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

namespace IRaCIS.Core.Domain.Models
{
    ///<summary>
    ///VisitTask
    ///</summary>
    [Table("VisitTask")]
    public class VisitTask : Entity, IAuditUpdate, IAuditAdd
    {

        public Guid TrialId { get; set; }

        /// <summary>
        /// CreateUserId
        /// </summary>
        [Required]
        public Guid CreateUserId { get; set; }

        /// <summary>
        /// CreateTime
        /// </summary>
        [Required]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// UpdateTime
        /// </summary>
        [Required]
        public DateTime UpdateTime { get; set; }

        /// <summary>
        /// UpdateUserId
        /// </summary>
        [Required]
        public Guid UpdateUserId { get; set; }

        /// <summary>
        /// TaskName
        /// </summary>
        [Required]
        public string TaskName { get; set; } = string.Empty;

        /// <summary>
        /// TaskBlindName
        /// </summary>
        [Required]
        public string TaskBlindName { get; set; } = string.Empty;


        //任务来源访视Id  方便回更访视读片状态
        public Guid? SourceSubjectVisitId { get; set; }

        [ForeignKey("SourceSubjectVisitId")]
        public SubjectVisit SubjectVisit { get; set; }


        public Guid? SouceReadModuleId { get; set; }

        [ForeignKey("SouceReadModuleId")]
        public ReadModule ReadModule { get; set; }



        /// <summary>
        /// 任务类别
        /// </summary>
        [Required]
        public ReadingCategory ReadingCategory { get; set; }

        ///// <summary>
        ///// 一致性核查通过时间
        ///// </summary>
        //public DateTime? CheckPassedTime { get; set; }

        /// <summary>
        /// 分配时间
        /// </summary>
        public DateTime? AllocateTime { get; set; }

        /// <summary>
        /// SubjectId
        /// </summary>
        [Required]
        public Guid SubjectId { get; set; }

        public Subject Subject { get; set; }

        /// <summary>
        /// Code
        /// </summary>
        [Required]
        public int Code { get; set; }

        /// <summary>
        /// TaskCode
        /// </summary>
        [Required]
        public string TaskCode { get; set; } = string.Empty;

        /// <summary>
        /// IsUrgent
        /// </summary>
        [Required]
        public bool IsUrgent { get; set; }

        /// <summary>
        /// 0 代表 单重阅片 产生的任务    否则就是双重  任务 1 任务  2 
        /// </summary>
        [Required]
        public Arm ArmEnum { get; set; }


        //分配状态
        public TaskAllocationState TaskAllocationState { get; set; }


        public TaskState TaskState { get; set; }


        public ReReadingApplyState ReReadingApplyState { get; set; }





        ////是否 重阅
        //public bool IsReReading { get; set; }

        /// <summary>
        /// DoctorUserId
        /// </summary>
        public Guid? DoctorUserId { get; set; }
        [ForeignKey("DoctorUserId")]

        public User DoctorUser { get; set; }

        public TaskAllocationRule DoctorTaskAllocationRule { get; set; }

        public TaskMedicalReviewRule DoctorTaskMedicalReviewRule { get; set; }




        //裁判任务的Id
        public Guid? JudgeVisitTaskId { get; set; }

        [ForeignKey("JudgeVisitTaskId")]
        public VisitTask JudgeVisitTask { get; set; }

        //对于裁判项而言，触发裁判的列表
        public List<VisitTask> JudgeVisitList { get; set; }


        //任务阅片状态
        public ReadingTaskState ReadingTaskState { get; set; }

        //签名时间
        public DateTime? SignTime { get; set; }



        public DateTime? SuggesteFinishedTime { get; set; }


        public SubjectUser SujectArm { get; set; }

        //是否是重阅产生的，方便过滤数据

        public bool IsReReadingCreate { get; set; }

        //是否是一致性分析产生
        public bool IsAnalysisCreate { get; set; }


        /// <summary>
        /// 裁判结果的任务ID
        /// </summary>
        public Guid? JudgeResultTaskId { get; set; }

        /// <summary>
        /// 裁判结果的备注
        /// </summary>
        public string JudgeResultRemark { get; set; } = string.Empty;


    }

}
