using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Share;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;

namespace IRaCIS.Application.Contracts
{
    public class SystemHospitalOption
    {
        public string HospitalName { get; set; }
        public string HospitalAliasName { get; set; }
        public string Country { get; set; }
        public string City { get; set; }
        public string Province { get; set; }
        public string Address { get; set; }
        public string Phone { get; set; }

        public bool IsCanConnectInternet { get; set; }

        public string HospitalCode { get; set; }
        public string HospitalLogoPath { get; set; }
        public int TrialKeepCount { get; set; }

    }


    public class NewTrialView : PatientJoinTrialInitView
    {
        public Guid Id { get; set; }
        //授权年限
        public int AuthorizationDuration { get; set; }

        public DateTime? AuthorizationDate { get; set; }

        public string AuthorizationEncrypt { get; set; }

        public string CriterionTypes { get; set; }
        public List<CriterionType> CriterionTypeList => CriterionTypes.Split('|', StringSplitOptions.RemoveEmptyEntries)
          .Select(s => Enum.Parse(typeof(CriterionType), s)).Cast<CriterionType>().ToList();

        public int? UnSubmitCount { get; set; }

        public int? UnReadCount { get; set; }
    }

    public class NewTrialQuery : PageInput
    {
        public string? ExperimentName { get; set; }
        public string? ResearchProgramNo { get; set; }
        public TrialType? TrialType { get; set; }

        public string? SponsorName { get; set; }

        public string? TrialCode { get; set; }
    }

    public class TrialInfoDTO : AddOrUpdateTrialCommand
    {
        [JsonIgnore]
        public List<DicView> DictionaryList { get; set; } = new List<DicView>();

        public new List<Guid> ModalityIds => DictionaryList.Where(t => t.ParentCode == StaticData.Modality).OrderBy(t => t.ShowOrder).Select(t => t.Id).ToList();

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


        public new List<CriterionType> CriterionTypeList => CriterionTypes.Split('|', StringSplitOptions.RemoveEmptyEntries)
          .Select(s => Enum.Parse(typeof(CriterionType), s)).Cast<CriterionType>().ToList();

        public string AuthorizationEncrypt { get; set; }

        public TrialAuthorizationInfo AuthorizationInfo { get; set; }

        public string TrialStatusStr { get; set; }

        public DateTime CreateTime { get; set; }
    }

    public class AddOrUpdateTrialCommand
    {

        public Guid? Id { get; set; }
        public string TrialCode { get; set; } = string.Empty;

        public TrialType TrialType { get; set; }


        //研究方案号
        public string ResearchProgramNo { get; set; } = string.Empty;

        //实验名称
        public string ExperimentName { get; set; } = string.Empty;

        // 负责人PI
        public string HeadPI { get; set; } = string.Empty;

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

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

        //药物名称
        public string MedicineName { get; set; } = string.Empty;


        //临床分期
        public Guid? PhaseId { get; set; }

        //适应症
        public string Indication { get; set; } = string.Empty;

        //检查技术
        public List<Guid> ModalityIds { get; set; } = new List<Guid>();

        //阅片标准
        public List<CriterionType> CriterionTypeList { get; set; }

        //联系人  
        public string ContactUser { get; set; } = string.Empty;
        //联系电话
        public string ContactPhone { get; set; } = string.Empty;

        //授权年限
        public int AuthorizationDuration { get; set; }

        public DateTime? AuthorizationDate { get; set; }

    }

    public class PatientJoinTrialInitQuery : PageInput
    {
        [NotDefault]
        public Guid PatientId { get; set; }

        public string? Filter { get; set; }

    }

    public class PatientJoinedTrialQuery
    {
        [NotDefault]
        public Guid PatientId { get; set; }
    }

    public class PatientJoinedTrialView : PatientJoinTrialInitView
    {
        public Guid SubjectId { get; set; }
        public string Code { get; set; }

        public string ShortName { get; set; }

        public string Sex { get; set; }

        public int? Age { get; set; }
    }

    public class PatientJoinTrialSelectView
    {
        public Guid TrialId { get; set; }
        public string ExperimentName { get; set; }
        public string ResearchProgramNo { get; set; }
        public string Sponsor { get; set; }
    }


    public class TrialCacheInfo
    {
        public Guid TrialId { get; set; }
        public Guid CreateUserId { get; set; }
        public string TrialCode { get; set; }

        public DateTime? AuthorizationDate { get; set; }
        public string TrialStatusStr { get; set; }

        public string AuthorizationEncrypt { get; set; }

        public string CriterionTypes { get; set; }
        public List<CriterionType> CriterionTypeList => CriterionTypes.Split('|', StringSplitOptions.RemoveEmptyEntries)
          .Select(s => Enum.Parse(typeof(CriterionType), s)).Cast<CriterionType>().ToList();
    }
    public class TrialAuthorizationInfo
    {
        public Guid TrialId { get; set; }
        public Guid CreateUserId { get; set; }
        public string TrialCode { get; set; }

        public string HospitalName { get; set; }

        public string HospitalCode { get; set; }

        public int PurchaseDuration { get; set; }



        public List<CriterionType> CriterionTypeList { get; set; }

        public DateTime? AuthorizationDeadLineDate { get; set; }

        public DateTime? ActiveDeadLineDate { get; set; }

        public DateTime? ActiveTime { get; set; }

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

        public string TrialCode { get; set; }
        public string ExperimentName { get; set; }
        public string ResearchProgramNo { get; set; }
        public TrialType TrialType { get; set; }

        public string Sponsor { get; set; }

        public string TrialStatusStr { get; set; }

        public DateTime CreateTime { get; set; }
    }


    public class PatientTrialQuery : PageInput
    {
        [NotDefault]
        public Guid TrialId { get; set; }

        public string? PatientIdStr { get; set; }
        public string? PatientName { get; set; }
        //public List<string> CalledAEList { get; set; } = new List<string>();

        public string? CallingAE { get; set; }
        public string? CalledAE { get; set; }

        public DateTime? BeginPushTime { get; set; }
        public DateTime? EndPushTime { get; set; }

        public string SubejctCode { get; set; }

        public string TrialSiteKeyInfo { get; set; }

    }

    public class PatientSubjectView : PatientQueryView
    {

        public int? StudyCount { get; set; }



        public Guid? SubejctId { get; set; }

        public Guid TrialId { get; set; }

        public string? SubjectCode { get; set; }

        public string? TrialSiteCode { get; set; }

        public string? TrialSiteName { get; set; }

        public string? TrialSiteAliasName { get; set; }



    }


    public class SCPPatientSubjectExportDTO
    {
        public int? StudyCount { get; set; }

        public string? SubjectCode { get; set; }

        public string? TrialSiteCode { get; set; }

        public string? TrialSiteName { get; set; }

        public string? TrialSiteAliasName { get; set; }

        public string PatientIdStr { get; set; } = string.Empty;
        public string PatientName { get; set; } = string.Empty;
        public string PatientAge { get; set; } = string.Empty;
        public string PatientSex { get; set; } = string.Empty;
        public string PatientBirthDate { get; set; } = string.Empty;

        public DateTime? EarliestStudyTime { get; set; }

        public DateTime? LatestStudyTime { get; set; }

        public DateTime LatestPushTime { get; set; }

        public List<string> CallingAEList { get; set; } = new List<string>();

        public List<string> CalledAEList { get; set; } = new List<string>();

        public string CallingAEListStr => string.Join(",", CallingAEList);

        public string CalledAEListStr => string.Join(",", CalledAEList);
    }


    public class PatientQuery : PageInput
    {
        [NotDefault]
        public Guid TrialId { get; set; }
        public Guid? SubjectId { get; set; }
        public string? PatientIdStr { get; set; }
        public string? PatientName { get; set; }
        public List<string> CalledAEList { get; set; } = new List<string>();

        public string? CallingAE { get; set; }

        public DateTime? EarliestStudyTime { get; set; }

        public DateTime? LatestStudyTime { get; set; }

    }

    public class PatientQueryView
    {
        public Guid PatientId { get; set; }
        public string PatientIdStr { get; set; } = string.Empty;
        public string PatientName { get; set; } = string.Empty;
        public string PatientAge { get; set; } = string.Empty;
        public string PatientSex { get; set; } = string.Empty;
        public string PatientBirthDate { get; set; } = string.Empty;

        public DateTime? EarliestStudyTime { get; set; }

        public DateTime? LatestStudyTime { get; set; }

        public DateTime LatestPushTime { get; set; }

        public List<string> CallingAEList { get; set; } = new List<string>();

        public List<string> CalledAEList { get; set; } = new List<string>();

        public Guid UpdateUserId { get; set; }
        public DateTime UpdateTime { get; set; } = DateTime.Now;
        public Guid CreateUserId { get; set; }
        public DateTime CreateTime { get; set; } = DateTime.Now;
    }

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

        [NotDefault]
        public Guid SubjectId { get; set; }
        [NotDefault]
        public Guid SCPStudyId { get; set; }

        [NotDefault]
        public Guid SubjectVisitId { get; set; }

        public bool IsAdd { get; set; }


    }

    public class DeleteSubejctPatientCommand
    {
        [NotDefault]
        public Guid SubjectId { get; set; }
        [NotDefault]
        public Guid PatientId { get; set; }

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


    public class VisitStudyVerifyTimeQuery
    {
        public Guid SCPStudyId { get; set; }

        public Guid SubjectId { get; set; }
        public Guid TrialId { get; set; }
    }

    public class VerifyTrialSubjectCommand
    {
        [NotDefault]
        public Guid TrialId { get; set; }
        public string SubjectCode { get; set; } = string.Empty;
    }
    public class AddSubjectPatientCommand
    {
        [NotDefault]
        public Guid TrialId { get; set; }
        public string SubjectCode { get; set; } = string.Empty;

        public Guid? SubjectId { get; set; }

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

    public class VerifyVisitStudyDTO
    {
        public Guid SubjectVisitId { get; set; }
        public decimal VisitNum { get; set; }
        public DateTime? StudyTime { get; set; }
        public Guid SCPStudyId { get; set; }
    }
    public class AddSubjectPatientStudyVisitCommand
    {
        [NotDefault]
        public Guid TrialId { get; set; }
        [NotDefault]
        public Guid SubjectId { get; set; }
        [NotDefault]
        public Guid SubjectVisitId { get; set; }
        [NotDefault]
        public Guid SCPStudyId { get; set; }

        //public string VisitName { get; set; }

    }



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

        [NotDefault]
        public Guid SubjectId { get; set; }

        [NotDefault]
        public Guid SubjectVisitId { get; set; }

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

    public class SubmitVisitStudyBindingCommand : VerifyPacsImageCommand
    {


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

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

        public Guid? SCPStudyId { get; set; }
    }

    public class SubjectVisitSelectDto
    {
        public Guid Id { get; set; }

        public Guid TrialId { get; set; }
        public Guid SubjectId { get; set; }

        public string VisitNum { get; set; }

        public string VisitName { get; set; }

        public SubmitStateEnum SubmitState { get; set; }

        public DateTime? VisitMaxStudyTime { get; set; }

        public DateTime? VisitMinStudyTime { get; set; }
    }
    public class AddOrUpdateSubjectVisitCommand
    {
        public Guid? Id { get; set; }
        public Guid TrialId { get; set; }
        public Guid SubjectId { get; set; }

        public decimal VisitNum { get; set; }

        public string VisitName { get; set; }
    }
    public class SubjectSelectQuery
    {
        public string? SubjectCode { get; set; }


        public Guid? SubjectId { get; set; }

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

    public class SubjectPatientSelectQuery
    {
        public string? SubjectCode { get; set; }
        public string? PatientIdStr { get; set; }

        public Guid? SubjectId { get; set; }

        public Guid? PatientId { get; set; }
        [NotDefault]
        public Guid TrialId { get; set; }
    }
    public class SubjectSelectDto
    {
        public Guid SubejctId { get; set; }

        public string SubjectCode { get; set; }

        public string ShortName { get; set; }

        public string Sex { get; set; }

        public int? Age { get; set; }

        public DateTime? BirthDate { get; set; }

        public SubjectStatus Status { get; set; }

        public List<PatienBasicInfo> PatientList { get; set; }
    }

    public class PatienBasicInfo
    {
        public Guid PatientId { get; set; }
        public string PatientIdStr { get; set; }
    }

    public class SubjectPatientSelectDto
    {
        public Guid Id { get; set; }
        public Guid PatientId { get; set; }
        public Guid TrialId { get; set; }
        public Guid SubejctId { get; set; }
        public string? PatientIdStr { get; set; }
        public string SubjectCode { get; set; }
    }

    public class PatientStudyInfoQuery : PageInput
    {
        [NotDefault]
        public Guid PatientId { get; set; }

        public DateTime? EarliestStudyTime { get; set; }

        public DateTime? LatestStudyTime { get; set; }
        public string? Modalities { get; set; }
    }

    public class PatientStudyQuery : PageInput
    {
        [NotDefault]
        public Guid TrialId { get; set; }

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



        public DateTime? EarliestStudyTime { get; set; }

        public DateTime? LatestStudyTime { get; set; }
    }


    public class PatientVisitTaskQuery : PageInput
    {
        [NotDefault]
        public Guid TrialId { get; set; }


        public Guid? SubjectId { get; set; }

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

        public string? SubjectShortName { get; set; }

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

        public Guid? DoctorUserId { get; set; }

        public ReadingCategory? ReadingCategory { get; set; }

        public ReadingTaskState? ReadingTaskState { get; set; }

        public TaskState? TaskState { get; set; }


        public string? TaskCode { get; set; }

        public Arm? ArmEnum { get; set; }

        public Guid? TrialReadingCriterionId { get; set; }


        public DateTime? BeginSignTime { get; set; }
        public DateTime? EndSignTime { get; set; }

        public DateTime? BeginTaskCreateTime { get; set; }
        public DateTime? EndTaskCreateTime { get; set; }


        public string? PatientName { get; set; }
        public string? PatientIdStr { get; set; }

        public string? PatientSex { get; set; }

    }

    public class PatientVisitTaskDTO
    {
        public List<PatientBasicInfo> PatientList { get; set; }

        public Guid Id { get; set; }
        public Guid TrialId { get; set; }

        public string TaskCode { get; set; }

        public string TaskName { get; set; }
        public string TaskBlindName { get; set; }

        public decimal VisitTaskNum { get; set; }

        public Guid? SourceSubjectVisitId { get; set; }

        public ReadingCategory ReadingCategory { get; set; }


        public TaskState TaskState { get; set; }

        public DateTime? SignTime { get; set; }

        public DateTime? AllocateTime { get; set; }
        public Guid SubjectId { get; set; }

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

        public string SubjectShortName { get; set; }

        public string VisitImageZipPath { get; set; }

        public PackState PackState { get; set; }

        public Arm ArmEnum { get; set; }
        public Guid? DoctorUserId { get; set; }


        public Guid TrialReadingCriterionId { get; set; }

        public string TrialReadingCriterionName { get; set; }

        public CriterionType CriterionType { get; set; }

        public DateTime CreateTime { get; set; }

        public UserSimpleInfo DoctorUser { get; set; }

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

        //public bool IsUrgent { get; set; }

        ///// <summary>
        ///// 加急类型
        ///// </summary>
        //public TaskUrgentType? TaskUrgentType { get; set; }


        //public string TaskUrgentRemake { get; set; } = string.Empty;


        //public TaskAllocationState TaskAllocationState { get; set; }
        //public bool IsNeedClinicalDataSign { get; set; }

        //public bool IsClinicalDataSign { get; set; }

    }

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


    }
    public class TrialPatientStudyQuery : PageInput
    {
        [NotDefault]
        public Guid TrialId { get; set; }

        public string? SubjectCode { get; set; }


        public Guid? PatientId { get; set; }

        public string? PatientIdStr { get; set; }

        public string? PatientSex { get; set; }

        public string? SubjectShortName { get; set; }

        public int? SubjectAge { get; set; }
        public string? SubjectSex { get; set; }

        public DateTime? BeginStudyTime { get; set; }

        public DateTime? EndStudyTime { get; set; }

        public string? VisitName { get; set; }

        public bool? IsBindedVisit { get; set; }
    }

    public class AddOrUpdateSubjectCommand
    {

        public Guid? Id { get; set; }

        [NotDefault]
        public Guid TrialId { get; set; }
        public string Code { get; set; } = String.Empty;

        public int? Age { get; set; }
        public string Sex { get; set; } = string.Empty;

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


        public DateTime? BirthDate { get; set; }


    }
    public class PatientSubjectQuery : PageInput
    {
        [NotDefault]
        public Guid TrialId { get; set; }

        public string? Code { get; set; }

        public string? ShortName { get; set; }

        public string? Sex { get; set; }

        public SubjectStatus? Status { get; set; }

        public string? PatientName { get; set; }
        public string? PatientIdStr { get; set; }

        public string? PatientSex { get; set; }

    }

    public class PatienSubejctView
    {
        public List<PatientBasicInfo> PatientList { get; set; }

        public Guid TrialId { get; set; }
        public Guid Id { get; set; }
        public string Code { get; set; }


        public string ShortName { get; set; }

        public string Sex { get; set; }

        public int? Age { get; set; }

        public SubjectStatus Status { get; set; }

        public DateTime? BirthDate { get; set; }

        public int? VisitCount { get; set; }

        public DateTime CreateTime { get; set; }

        public string LatestVisitName { get; set; }

        public DateTime? VisitOverTime { get; set; }

        public Guid? FinalSubjectVisitId { get; set; }

        public string Reason { get; set; }
    }

    public class PatientSubejctVisitQuery : PageInput
    {
        [NotDefault]
        public Guid TrialId { get; set; }
        public string? SubjectCode { get; set; }


        public string? SubjectShortName { get; set; }

        public string? SubjectSex { get; set; }

        public string? PatientName { get; set; }
        public string? PatientIdStr { get; set; }

        public string? PatientSex { get; set; }

        public string? VisitName { get; set; }

        public SubmitStateEnum? SubmitState { get; set; }

        public DateTime? BeginStudyTime { get; set; }

        public DateTime? EndStudyTime { get; set; }
    }

    public class PatientStudyBeforeConfirmView : PatientStudyView
    {
        public Guid PatientId { get; set; }
        public string CalledAE { get; set; } = string.Empty;

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

    public class PatientStudyView
    {

        public string PatientName { get; set; }
        public string PatientIdStr { get; set; }

        public string PatientSex { get; set; }

        public string PatientAge { get; set; } = string.Empty;
        public string PatientBirthDate { get; set; } = string.Empty;


        public Guid StudyId { get; set; }
        public string Modalities { get; set; }

        public string ModalityForEdit { get; set; }

        public DateTime? StudyTime { get; set; }

        public string Description { get; set; } = string.Empty;
        public int SeriesCount { get; set; } = 0;
        public int InstanceCount { get; set; } = 0;



        public Guid SubjectId { get; set; }

        public string SubjectCode { get; set; }


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

        public int? SubjectAge { get; set; }
        public string SubjectSex { get; set; } = string.Empty;

        public Guid? SubjectVisitId { get; set; }
        public string? VisitName { get; set; }

        public decimal? VisitNum { get; set; }

        public DateTime? VisitEarliestStudyTime { get; set; }

        public DateTime? VisitLatestStudyTime { get; set; }

        public DateTime? SubmitTime { get; set; }

        public SubmitStateEnum? SubmitState { get; set; }

    }

    public class PatientBasicInfo
    {
        public Guid PatientId { get; set; }

        public string PatientIdStr { get; set; }

        public string PatientSex { get; set; }

        public string PatientName { get; set; }

        public string PatientAge { get; set; } = string.Empty;
        public string PatientBirthDate { get; set; } = string.Empty;
    }


    public class PatientSubjectVisitView
    {
        public Guid TrialId { get; set; }
        public Guid SubjectId { get; set; }

        public string SubjectCode { get; set; }

        public List<PatientBasicInfo> PatientList { get; set; }

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

        public int? SubjectAge { get; set; }
        public string SubjectSex { get; set; } = string.Empty;

        public Guid SubjectVisitId { get; set; }
        public string VisitName { get; set; }

        public decimal VisitNum { get; set; }

        public DateTime? VisitEarliestStudyTime { get; set; }

        public DateTime? VisitLatestStudyTime { get; set; }

        public DateTime? SubmitTime { get; set; }

        public SubmitStateEnum SubmitState { get; set; }

        public string VisitImageZipPath { get; set; }
        public PackState PackState { get; set; }
    }

    public class SubjectPatientStudyView : PatientStudySimpleView
    {
        public Guid SubjectId { get; set; }

        public string SubjectCode { get; set; }

        public List<PatientBasicInfo> PatientList { get; set; }

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

        public int? SubjectAge { get; set; }
        public string SubjectSex { get; set; } = string.Empty;

    }

    public class SubjectVisitStudyQuery : PageInput
    {
        [NotDefault]
        public Guid SujectVisitId { get; set; }

        public SubmitStateEnum? SubmitState { get; set; }
    }

    public class PatientStudyOtherQuery : PageInput
    {
        [NotDefault]
        public Guid TrialId { get; set; }
        public List<Guid> PatientIdList { get; set; }

        [NotDefault]
        public Guid SujectVisitId { get; set; }

        public DateTime? EarliestStudyTime { get; set; }

        public DateTime? LatestStudyTime { get; set; }

        public string? PatientIdStr { get; set; }

    }

    public class VisitImageDownloadQuery : PageInput
    {
        [NotDefault]
        public Guid TrialId { get; set; }

        public string? IP { get; set; }

        public string? SubjectCode { get; set; }

        public string? VisitName { get; set; }

        public string? Name { get; set; }

        public DateTime? BeginDownloadTime { get; set; }

        public DateTime? EndDownloadTime { get; set; }

        public UserTypeEnum? UserTypeEnum { get; set; }
    }

    public class VisitImageDownloadView
    {
        public string SubjectCode { get; set; }

        public string VisitName { get; set; }

        public DateTime DownloadTime { get; set; }

        public string DownloadUserName { get; set; }

        public string DownLoadUserFullName { get; set; }

        public string IP { get; set; }

        public long VisitImageZipSize { get; set; }

        //文件大小
        public int VisitImageFileCount { get; set; }

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

        public int? StudyCount { get; set; }

        public UserTypeEnum UserTypeEnum { get; set; }

    }


    public class SCPImageUploadQuery : PageInput
    {
        [NotDefault]
        public Guid TrialId { get; set; }
        public string TrialSiteKeyInfo { get; set; }

        public string? CallingAE { get; set; }

        public string? CalledAE { get; set; }

        public string? CallingAEIP { get; set; }

        public DateTime? StartTime { get; set; }

        public DateTime? EndTime { get; set; }
    }

    public class SCPImageUploadView
    {
        public string CallingAE { get; set; } = string.Empty;

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

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

        public DateTime StartTime { get; set; }

        public DateTime EndTime { get; set; }

        public int FileCount { get; set; }

        public long FileSize { get; set; }

        public int StudyCount { get; set; }


        public Guid TrialId { get; set; }
        public Guid TrialSiteId { get; set; }


        public string TrialSiteCode { get; set; }

        public string TrialSiteName { get; set; }

        public string TrialSiteAliasName { get; set; }

        public string UploadIntervalStr
        {
            get
            {
                var uploadTimeSpan = EndTime - StartTime;

                return $" {uploadTimeSpan.Hours}:{uploadTimeSpan.Minutes}:{uploadTimeSpan.Seconds}.{uploadTimeSpan.Milliseconds}";
            }
        }

    }
    public class VisitPatientStudyView : PatientStudySelectDto
    {

        public string VisitName { get; set; }
    }

    public class UnbindStudyView : VisitPatientStudyView
    {
        public Guid TrialId { get; set; }

        public Guid SubjectId { get; set; }
        public string SubjectCode { get; set; }

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

        public int? SubjectAge { get; set; }
        public string SubjectSex { get; set; } = string.Empty;

        public DateTime? SubjectBirthDate { get; set; }

    }

    public class VisitPatientStudyFilterQuery : PageInput
    {
        [NotDefault]
        public Guid SubjectId { get; set; }

        [NotDefault]
        public Guid SubjectVisitId { get; set; }

        public DateTime? EarliestStudyTime { get; set; }

        public DateTime? LatestStudyTime { get; set; }
        public string? Modalities { get; set; }

        public string? PatientInfo { get; set; }
    }
    public class VisitPatientStudyFilterView
    {
        public Guid SCPStudyId { get; set; }

        public Guid PatientId { get; set; }

        public DateTime? StudyTime { get; set; }
        public string Modalities { get; set; } = string.Empty;

        public string Description { get; set; } = string.Empty;
        public int SeriesCount { get; set; } = 0;
        public int InstanceCount { get; set; } = 0;

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

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

        public string BodyPartExamined { get; set; } = string.Empty;
        public string AccessionNumber { get; set; } = string.Empty;
        public string PatientIdStr { get; set; } = string.Empty;
        public string PatientName { get; set; } = string.Empty;
        public string PatientAge { get; set; } = string.Empty;
        public string PatientSex { get; set; } = string.Empty;

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

    public class PatientStudySimpleView
    {

        public Guid SCPStudyId { get; set; }

        public Guid PatientId { get; set; }

        public DateTime? StudyTime { get; set; }
        public string Modalities { get; set; } = string.Empty;

        public string Description { get; set; } = string.Empty;
        public int SeriesCount { get; set; } = 0;
        public int InstanceCount { get; set; } = 0;

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

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

        public Guid? SubjectVisitId { get; set; }
        public string? VisitName { get; set; }

        public string? BlindName { get; set; } = string.Empty;


        //public SubjectVisitInfo SubejectVisit { get; set; }

    }

    public class SubjectVisitInfo
    {
        public Guid Id { get; set; }

        public string VisitName { get; set; }

        public decimal VisitNum { get; set; }
        public string BlindName { get; set; } = string.Empty;
    }


    public class PatientSeriesDTO
    {

        public bool IsDicom { get; set; } = true;


        public Guid Id { get; set; }
        public Guid StudyId { get; set; }
        public string StudyInstanceUid { get; set; } = String.Empty;
        public string SeriesInstanceUid { get; set; } = String.Empty;
        public int SeriesNumber { get; set; }
        public DateTime? SeriesTime { get; set; }
        public string Modality { get; set; } = String.Empty;
        public string Description { get; set; } = String.Empty;
        public int InstanceCount { get; set; }
        public string SliceThickness { get; set; } = String.Empty;

        public DateTime CreateTime { get; set; }
        public DateTime UpdateTime { get; set; }

        public bool IsDeleted { get; set; }
        public bool IsReading { get; set; } = true;

        public List<Guid> InstanceList { get; set; } = new List<Guid>();

        public List<string> InstancePathList { get; set; } = new List<string>();

        public string ImageResizePath { get; set; }
    }

    public class PatientStudySelectDto
    {
        public Guid SCPStudyId { get; set; }

        public Guid PatientId { get; set; }
        public string PatientIdStr { get; set; } = string.Empty;
        public string PatientName { get; set; } = string.Empty;
        public string PatientAge { get; set; } = string.Empty;
        public string PatientSex { get; set; } = string.Empty;
        public string PatientBirthDate { get; set; } = string.Empty;

        public DateTime? StudyTime { get; set; }
        public string Modalities { get; set; } = string.Empty;

        public string Description { get; set; } = string.Empty;
        public int SeriesCount { get; set; } = 0;
        public int InstanceCount { get; set; } = 0;

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

        public string CallingAE { get; set; }
        public Guid? SubjectVisitId { get; set; }

        public SubmitStateEnum? SubmitState { get; set; }

        //public Guid? SubjectVisitId { get; set; }

        //public string CallingAE { get; set; } = string.Empty;

        //public string BodyPartExamined { get; set; } = string.Empty;

        //public string BodyPartForEdit { get; set; } = string.Empty;

        //public string ModalityForEdit { get; set; } = string.Empty;



    }

}
