using System;
using System.Collections.Generic;
using System.Text;

namespace IRaCIS.Core.Application.Contracts
{
    public class LesionInformation
    {
        public Guid TUId { get; set; }
        public int LesionType { get; set; } //病灶类型
        public string STUDYID { get; set; } = string.Empty; // 项目ID
        public string USUBJID { get; set; } = string.Empty;// 患者ID
        public int TUSEQ { get; set; }  // 病灶序号

        // 病灶分组，主要是用于将分裂或者结合在一起的已经被标识的肿瘤分类
        public string TUGRPID { get; set; } = string.Empty;

        //内部或外部的肿瘤/病灶标识。 例如：医学影像 ID 
        public string TUREFID { get; set; } = string.Empty;

        public string TUSPID { get; set; } = string.Empty;// 申办方标识

        // 关联测量结果，及TUGRPID一起，标识分裂及合并
        public string TULNKID { get; set; } = string.Empty;

        /// <summary>
        /// 检查项目 
        /// TUMIDENT （Tumor Identification ）
        /// TUSPLIT （Tumor Split ）
        /// TUMERGE （Tumor Merged）
        /// </summary>
        public string TUTESTCD { get; set; } = string.Empty;
        public string TUTEST { get; set; } = string.Empty;

        public string TUORRES { get; set; } = string.Empty;//TARGET, NON-TARGET, NEW

        public string TUSTRESC { get; set; } = string.Empty;//包含从 TUORRES拷贝的所有发现的结果
        public string TUNAM { get; set; } = string.Empty;//完成肿瘤标识的供应商名称或标识

        public string LocDescription { get; set; } = string.Empty;// 部位描述
        public string TULOC { get; set; } = string.Empty; // 解剖学部位
        public string TULAT { get; set; } = string.Empty;//解剖学部位或者样本更详细的偏侧性修饰语，比如，左侧， 右侧，双侧。
        public string TUDIR { get; set; } = string.Empty;//解剖学部位或者样本更详细的方向性修饰语，比如，上边的 ，里面的。
        public string TUPORTOT { get; set; } = string.Empty;//解剖学部位或者样本更详细的分布，安排，分配的修饰语， 比如，全部的，单一的，部分的，多数的。 

        public string TUMETHOD { get; set; } = string.Empty; //用来标识肿瘤的办法。 例如，核磁共振,CT扫描。

        public string TUEVAL { get; set; } = string.Empty; //评估者的角色。 例如：研究者，独立评估者。
        public string TUEVALID { get; set; } = string.Empty;//这个特定的评估者变量是与 TUEVAL一起使用来提供更详 细的信息
        public string TUACPTFL { get; set; } = string.Empty;

        // 检查批次信息
        public decimal VISITNUM { get; set; } = 0;
        public string VISIT { get; set; } = string.Empty;
        public int VISITDY { get; set; }
        public string EPOCH { get; set; } = string.Empty;
        public string TUDTC { get; set; } = string.Empty;
        public int TUDY { get; set; } = 0;

        //TR

        public string TRTESTCD { get; set; } = string.Empty;
        public string TRTEST { get; set; } = string.Empty;
        public string TRORRES { get; set; } = string.Empty;//原始收到或采集的肿瘤测量/评估结
        public string TRORRESU { get; set; } = string.Empty;//原始单位
        public string TRSTRESC { get; set; } = string.Empty;//标准化结 果 
        public double TRSTRESN { get; set; }//标准化结 果(N)
        public string TRSTRESU { get; set; } = string.Empty;// 标准化单位
        public string TRSTAT { get; set; } = string.Empty; // 未做状态
        public string TRREASND { get; set; } = string.Empty; // 未做原因
        public string Note { get; set; } = string.Empty;
        public string TRGRPID { get; set; } = string.Empty;
        public string TRDTC { get; set; } = string.Empty;
        public int TRDY { get; set; } = 0;
        ////RS 
        //public string RSCAT { get; set; } // 类别，用来识别对反应评估中使用的标准，以及适当时提供版本号
        //public string RSORRES { get; set; } //原始接收、采集或者计算的肿瘤反应评估的结果。 
        //public string RSSTRESC { get; set; } //标准化结果

        public bool CoveredLesion { get; set; }
    }
    public class VisitLesion : LesionInformation
    {
        public LesionInformation CurrentLesion { get; set; } = new LesionInformation();
    }

    public class EfficacyAssessment
    {
        public string TargetLesion { get; set; } = string.Empty;
        public string Non_targetLesion { get; set; } = string.Empty;
        public string OverallAssessment { get; set; } = string.Empty;

        public string TargetLesionNote { get; set; } = string.Empty;
        public string Non_targetLesionNote { get; set; } = string.Empty;
        public string OverallAssessmentNote { get; set; } = string.Empty;
    }

    public class PreviousOverallAssessment
    {
        public string VisitName { get; set; } = string.Empty;
        public string OverallAssessment { get; set; } = string.Empty;
    }
    public class VisitLesionInfo
    {
        //基线病灶信息及本次检查批次测量信息
        public IList<VisitLesion> BLLesionList { get; set; } = new List<VisitLesion>();
        // public IList<LesionInformation> BLVisitLesionList { get; set; } = new List<LesionInformation>();
        //public IList<LesionInformation> CurrentVisitLesionList { get; set; } = new List<LesionInformation>();

        // 以往病灶信息
        public IList<VisitLesion> PreviousNewLesionList { get; set; } = new List<VisitLesion>();
        //本次疑似新病灶
        public IList<LesionInformation> EquivocalNewLesionList { get; set; } = new List<LesionInformation>();
        public IList<LesionInformation> UnequivocalNewLesionList { get; set; } = new List<LesionInformation>();
        public ReportDTO ReportResult { get; set; } = new ReportDTO();
        public EfficacyAssessment Efficacy { get; set; } = new EfficacyAssessment();
        public List<PreviousOverallAssessment> PreviousOverallAssessment { get; set; } = new List<PreviousOverallAssessment>();

        public MinVisit MinVisitInfo { get; set; } = new MinVisit();
    }

    public class MinVisit
    {
        public double MinSum { get; set; } = 0.0;
        public string MinVistName { get; set; } = string.Empty;
    }
    public class ReportCommand
    {
        public List<LesionInformation> LesionInformationList { get; set; } = new List<LesionInformation>();

        //RS 
        public string RSCAT { get; set; } = string.Empty;// 类别，用来识别对反应评估中使用的标准，以及适当时提供版本号
        public string RSORRES { get; set; } = string.Empty; //原始接收、采集或者计算的肿瘤反应评估的结果。 
        public string RSSTRESC { get; set; } = string.Empty; //标准化结果
    }
    public class TUDTO
    {
        public int LesionType { get; set; }
        public string STUDYID { get; set; } = string.Empty;
        public string USUBJID { get; set; } = string.Empty;
        public int TUSEQ { get; set; }
        public string TUGRPID { get; set; } = string.Empty;
        public string TUREFID { get; set; } = string.Empty;//内部或外部的肿瘤/病灶标识。 例如：医学影像 ID 
        public string TUSPID { get; set; } = string.Empty;
        public string TULNKID { get; set; } = string.Empty;
        public string TUTESTCD { get; set; } = string.Empty;
        public string TUTEST { get; set; } = string.Empty;

        public double TUORRES { get; set; } = 0;
        public string TUSTRESC { get; set; } = string.Empty;
        public string TUNAM { get; set; } = string.Empty;
        public string TULOC { get; set; } = string.Empty;
        public string TULAT { get; set; } = string.Empty;
        public string TUDIR { get; set; } = string.Empty;
        public string TUPORTOT { get; set; } = string.Empty;
        public string TUMETHOD { get; set; } = string.Empty;
        public string TUEVAL { get; set; } = string.Empty;
        public string TUEVALID { get; set; } = string.Empty;
        public string TUACPTFL { get; set; } = string.Empty;
        public double VISITNUM { get; set; } = 0;
        public string VISIT { get; set; } = string.Empty;
        public string VISITDY { get; set; } = string.Empty;
        public string EPOCH { get; set; } = string.Empty;
        public string TUDTC { get; set; } = string.Empty;
        public int TUDY { get; set; } = 0;
    }
    public class TRDTO
    {
        public string STUDYID { get; set; } = string.Empty;
        public string DOMAIN { get; set; } = string.Empty;
        public string USUBJID { get; set; } = string.Empty;
        public int TRSEQ { get; set; }
        public string TRGRPID { get; set; } = string.Empty;
        public string TRREFID { get; set; } = string.Empty;
        public string TRSPID { get; set; } = string.Empty;
        public string TRLNKID { get; set; } = string.Empty;
        public string TRLNKGRP { get; set; } = string.Empty;
        public string TRTESTCD { get; set; } = string.Empty;
        public string TRTEST { get; set; } = string.Empty;
        public string TRORRES { get; set; } = string.Empty;
        public string TRORRESU { get; set; } = string.Empty;
        public string TRSTRESC { get; set; } = string.Empty;
        public double TRSTRESN { get; set; } = 0;
        public string TRSTRESU { get; set; } = string.Empty;
        public string TRSTAT { get; set; } = string.Empty;
        public string TRREASND { get; set; } = string.Empty;
        public string TRNAM { get; set; } = string.Empty;
        public string TRMETHOD { get; set; } = string.Empty;
        public string TREVAL { get; set; } = string.Empty;
        public string TREVALID { get; set; } = string.Empty;
        public string TRACPTFL { get; set; } = string.Empty;
        public decimal VISITNUM { get; set; } = 0;
        public string VISIT { get; set; } = string.Empty;
        public int VISITDY { get; set; } = 0;
        public string EPOCH { get; set; } = string.Empty;
        public string TRDTC { get; set; } = string.Empty;
        public int TRDY { get; set; } = 0;
        public string Note { get; set; } = string.Empty;
        public bool CoveredLesion { get; set; } = true;
    }

    public class RSDTO
    {
        public string STUDYID { get; set; } = string.Empty;
        public string DOMAIN { get; set; } = string.Empty;
        public string USUBJID { get; set; } = string.Empty;
        public int RSSEQ { get; set; }
        public string RSGRPID { get; set; } = string.Empty;
        public string RSREFID { get; set; } = string.Empty;
        public string RSSPID { get; set; } = string.Empty;
        public string RSLNKID { get; set; } = string.Empty;
        public string RSLNKGRP { get; set; } = string.Empty;
        public string RSTESTCD { get; set; } = string.Empty;
        public string RSTEST { get; set; } = string.Empty;
        public string RSCAT { get; set; } = string.Empty;
        public string RSORRES { get; set; } = string.Empty;
        public string RSSTRESC { get; set; } = string.Empty;
        public string RSSTAT { get; set; } = string.Empty;
        public string RSREASND { get; set; } = string.Empty;
        public string RSNAM { get; set; } = string.Empty;

        public string RSEVAL { get; set; } = string.Empty;
        public string RSEVALID { get; set; } = string.Empty;
        public string RSACPTFL { get; set; } = string.Empty;
        public decimal VISITNUM { get; set; } = 0;
        public string VISIT { get; set; } = string.Empty;
        public int VISITDY { get; set; } = 0;
        public string EPOCH { get; set; } = string.Empty;
        public string RSDTC { get; set; } = string.Empty;
        public int RSDY { get; set; } = 0;
        public Guid StudyGuid { get; set; } = Guid.Empty;
        public Guid TrialGuid { get; set; } = Guid.Empty;
        public Guid SubjectGuid { get; set; } = Guid.Empty;

        public string Note { get; set; } = string.Empty;
    }
    public class ReportDTO
    {
        public bool Qualified { get; set; } = true;
        public string DiseaseProgression { get; set; } = string.Empty;
        public string NotEvaluable { get; set; } = string.Empty;
        public string Timepoint { get; set; } = string.Empty;
        public string TrialCode { get; set; } = string.Empty;
        public string SubjectCode { get; set; } = string.Empty;
        public decimal? VisitNum { get; set; }
        public string VisitName { get; set; } = string.Empty;
        public int? DiseaseSituation { get; set; }
        public string Comment { get; set; } = String.Empty;
        public Guid? TPId { get; set; }
        public Guid? DicomStudyId { get; set; }
        public string TpCode { get; set; } = string.Empty;

        public bool AffectRead { get; set; }//是否影响读片
        public string AffectReadNote { get; set; } = String.Empty;//备注说明
    }


    public class VisitReportCommand
    {
        public List<LesionInformation> LesionInformation { get; set; } = new List<LesionInformation>();
        public List<TRDTO> TRList { get; set; } = new List<TRDTO>();
        public List<RSDTO> RSList { get; set; } = new List<RSDTO>();
        public ReportDTO ReportResult { get; set; } = new ReportDTO();
    }

    public class BaseLineReportCommand
    {
        //public Guid TimepointId { get; set; }
        public string SumOfDiameter { get; set; } = String.Empty;
        public string SumDiameterOfNonLymphNode { get; set; } = String.Empty;
        public IList<LesionInformation> LesionInformation { get; set; } = new List<LesionInformation>();
        public ReportDTO ReportResult { get; set; } = new ReportDTO();
    }

    public class BaseLineReportDTO
    {
        public IList<LesionInformation> LesionInformation { get; set; } = new List<LesionInformation>();
        public ReportDTO ReportResult { get; set; } = new ReportDTO();
    }
}
