//--------------------------------------------------------------------
//     此代码由T4模板自动生成  byzhouhang 20210918
//	   生成时间 2022-06-29 10:59:50 
//     对此文件的更改可能会导致不正确的行为，并且如果重新生成代码，这些更改将会丢失。
//--------------------------------------------------------------------
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace IRaCIS.Core.Application.ViewModel
{
    /// <summary> TaskMedicalReviewView  列表视图模型 </summary>
    public class TaskMedicalReviewView : VisitTaskViewBasic
    {

        public Guid VisitTaskId { get; set; }
        public string MedicalNo { get; set; } = string.Empty;

        public int AuditState { get; set; }
        public DateTime? AuditSignTime { get; set; }
        public MedicalReviewDoctorUserIdea DoctorUserIdeaEnum { get; set; }
        public Guid? MedicalManagerUserId { get; set; }

        /// <summary>
        /// 审核建议
        /// </summary>
        public AuditAdvice AuditAdviceEnum { get; set; }


        public bool IsHaveQuestion { get; set; }



        public UserSimpleInfo DoctorUser { get; set; }

        public UserSimpleInfo MedicalManagerUser { get; set; }


        /// <summary>
        /// 医学审核对话关闭原因
        /// </summary>
        public MedicalDialogClose MedicalDialogCloseEnum { get; set; }


        /// <summary>
        /// 无效的 为True无效
        /// </summary>
        public bool IsInvalid { get; set; }
    }

    public class GenerateMedicalReviewTaskView : VisitTaskViewBasic
    {
        //开始读片时间
        public DateTime? FirstReadingTime { get; set; }

        public string MedicalNo { get; set; } = string.Empty;

        //读片时间差
        public TimeSpan? ReadingDurationTimeSpan { get; set; }

        /// <summary>
        /// 全局是否有更新
        /// </summary>
        public bool? IsGlobalHaveUpdate { get; set; } = false;

        //时间差 换成字符串
        public string ReadingDuration
        {
            get
            {
                if (!ReadingDurationTimeSpan.HasValue)
                    return "";
                else return string.Format("{0}d {1}h {2}min", (SignTime - FirstReadingTime)?.Days, (SignTime - FirstReadingTime)?.Hours, (SignTime - FirstReadingTime)?.Minutes)
                         /*string.Format("{0}分钟", (ReadingDurationTimeSpan)?.TotalMinutes)*/;
            }
        }

        //是否产生裁判
        public bool IsGeneratedJudge { get; set; }

        //审核次数
        public int? GeneratedMedicalReviewCount { get; set; }
        public UserSimpleInfo DoctorUser { get; set; }
    }

    public class GetNextMedicalReviewTaskInDto
    {
        [NotDefault]
        public Guid MedicalReviewId { get; set; }
    }


    ///<summary>TaskMedicalReviewQuery  列表查询参数模型</summary>
    public class TaskMedicalReviewQuery : PageInput
    {
        public Guid TrialId { get; set; }
        public Guid? SiteId { get; set; }

        /// <summary>
        /// 传了Id 就不查询这条数据
        /// </summary>
        public Guid? Id { get; set; }

        public Guid? SubjectId { get; set; }


        public bool IsGetBeRead { get; set; } = false;

        public string SubjectCode { get; set; } = String.Empty;

        public string TrialSiteCode { get; set; } = String.Empty;
        public string TaskName { get; set; } = String.Empty;

        public bool? IsUrgent { get; set; }
        public Guid? DoctorUserId { get; set; }


        public TaskState? TaskState { get; set; }

        public MedicalReviewAuditState? AuditState { get; set; }


        public ReadingCategory? ReadingCategory { get; set; }

        public ReadingTaskState? ReadingTaskState { get; set; }

        public Guid? TrialReadingCriterionId { get; set; }
    }


    public class SetMedicalReviewInvalidCommand
    {
        [NotDefault]
        public Guid TrialId { get; set; }

        public List<Guid> MedicalReviewIdList { get; set; }
    }

    public class GenerateMedicalReviewTaskQuery : TaskMedicalReviewQuery
    {
        public bool? IsGeneratedJudge { get; set; }

        public bool? IsGlobalHaveUpdate { get; set; }
    }



    public class GenerateMedicalReviewTaskCommand
    {
        public Guid TrialId { get; set; }


    }



    public class ManuallyGeneratedAndAssignedMedicalReviewCommand
    {
        [NotDefault]
        public Guid TrialId { get; set; }
        [NotDefault]
        public Guid MedicalManagerUserId { get; set; }


        public List<Guid> TaskIdList { get; set; }
    }

    public class AssignMedicalReviewTaskCommand
    {
        public List<Guid> IdList { get; set; }


        public Guid? MedicalManagerUserId { get; set; }

        public MedicalReviewTaskOptType TaskOptType { get; set; }
    }

    public enum MedicalReviewTaskOptType
    {
        Assign = 1,

        ReAssign = 2,


        CancelAssign = 3,
    }

}


