using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Domain.Share;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IRaCIS.Core.Application.Service.Reading.Dto
{

	public class AddOrUpdateReadingClinicalDataDto
	{

		public Guid? Id { get; set; }

		/// <summary>
		/// 项目ID
		/// </summary>
		public Guid TrialId { get; set; }

		/// <summary>
		///  受试者ID
		/// </summary>
		public Guid SubjectId { get; set; }

		/// <summary>
		/// 阅片ID
		/// </summary>
		public Guid ReadingId { get; set; }

		/// <summary>
		/// 临床数据类型Id
		/// </summary>
		public Guid ClinicalDataTrialSetId { get; set; }

		/// <summary>
		/// 是否是访视
		/// </summary>
		public bool IsVisit { get; set; }


		///// <summary>
		///// 是否盲化
		///// </summary>
		//public bool IsBlind { get; set; }

		///// <summary>
		///// 是否完整
		///// </summary>
		//public bool IsComplete { get; set; }

		/// <summary>
		/// 要删除的对象
		/// </summary>

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


		public List<FileDto> AddFileList { get; set; } = new List<FileDto>();
	}

	public class GetCRCClinicalDataOutDto
	{

		public Guid Id { get; set; }

		/// <summary>
		/// 名称
		/// </summary>
		public Guid ClinicalDataTrialSetId { get; set; }

		/// <summary>
		/// 名称
		/// </summary>
		public string ClinicalDataSetName { get; set; }

		/// <summary>
		/// 英文名称
		/// </summary>
		public string ClinicalDataSetEnName { get; set; } = string.Empty;


		/// <summary>
		/// 上传方式
		/// </summary>
		public ClinicalUploadType ClinicalUploadType { get; set; }


		/// <summary>
		/// 上传角色
		/// </summary>
		public UploadRole UploadRole { get; set; }

		/// <summary>
		/// 模板文件名称
		/// </summary>
		public string FileName { get; set; }

		/// <summary>
		/// 文件路径
		/// </summary>
		public string Path { get; set; }

		/// <summary>
		/// 是否盲化
		/// </summary>
		public bool? IsBlind { get; set; }

		/// <summary>
		/// 是否完整
		/// </summary>
		public bool? IsComplete { get; set; }

        public List<ClinicalFromData> ClinicalFromList { get; set; }

        //public List<GetReadingClinicalDataListOutDto> ReadingClinicalDataList { get; set; }

        public List<GetFileDto> PDFFileList { get; set; } = new List<GetFileDto>();

		public ClinicalDataTable ClinicalTableData { get; set; }
	}


	public class ClinicalDataTable
	{
		public List<PreviousHistoryView> PreviousHistoryList { get; set; }

		public List<PreviousOtherView> PreviousOtherList { get; set; }

		public List<PreviousSurgeryView> PreviousSurgeryList { get; set; }


	}



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

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

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

		public bool IsBaseline { get; set; }
	}

	/// <summary>
	/// 是否盲化
	/// </summary>
	public class SetReadingClinicalDataIsBlind
	{
		public Guid Id { get; set; }

		public bool IsBlind { get; set; }
	}

	public class FileDto
	{
		/// <summary>
		/// 文件名称
		/// </summary>
		public string FileName { get; set; }

		/// <summary>
		/// 路径
		/// </summary>
		public string Path { get; set; }
	}


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

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

		public Guid? ReadingId { get; set; }

        /// <summary>
        /// 临床数据类型Id
        /// </summary>
        public Guid? ClinicalDataTrialSetId { get; set; }

        public Guid? VisitTaskId { get; set; }

        /// <summary>
        /// 1 PM上传的所有的  2CRC上传的所有已确认的    3 所有已经签名的
        /// </summary>
        public GetClinicalType? GetClinicalType { get; set; }

        public Guid? ReadingClinicalDataId { get; set; }

		/// <summary>
		/// 只获取CRC上传的阅片模块结构化录入
		/// </summary>
		public bool IsOnlyGetCRCReadModule { get; set; } = false;

        /// <summary>
        /// 只查询已经签名的临床数据
        /// </summary>
        public bool SelectIsSign { get; set; } = true;
	}

	/// <summary>
	/// 获取访视列表
	/// </summary>
	public class GetReadingClinicalDataListIndto
	{
		[NotDefault]
		public Guid SubjectId { get; set; }
		[NotDefault]
		public Guid ReadingId { get; set; }

        /// <summary>
        /// 临床数据类型Id
        /// </summary>
        public Guid? ClinicalDataTrialSetId { get; set; }

        /// <summary>
        /// 1 PM上传的所有的  2CRC上传的所有已确认的    3 所有已经签名的
        /// </summary>
        public GetClinicalType? GetClinicalType { get; set; }

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

		public Guid TrialId { get; set; }

		/// <summary>
		/// 是否是访视
		/// </summary>
		public bool IsVisit { get; set; }

		/// <summary>
		/// 是否是基线
		/// </summary>
		public bool IsBaseLine { get; set; }
	}

	public class GetReadingClinicalDataPDFListIndto : PageInput
	{
		public Guid ReadingClinicalDataId { get; set; }
	}

	public class GetReadingClinicalDataPDFListOutDto
	{
		public Guid? Id { get; set; }


		/// <summary>
		/// 阅片临床数据ID
		/// </summary>
		public Guid ReadingClinicalDataId { get; set; }

		/// <summary>
		/// Path
		/// </summary>
		public string Path { get; set; }

		/// <summary>
		/// FileName
		/// </summary>
		public string FileName { get; set; }

		/// <summary>
		/// 是否为访视
		/// </summary>
		public bool IsVisit { get; set; }


	}

	public class AddOrUpdateReadingClinicalDataPDFDto
	{

		public Guid? Id { get; set; }



		/// <summary>
		/// 阅片临床数据ID
		/// </summary>
		public Guid ReadingClinicalDataId { get; set; }

		/// <summary>
		/// Path
		/// </summary>
		public string Path { get; set; }

		/// <summary>
		/// FileName
		/// </summary>
		public string FileName { get; set; }

		/// <summary>
		/// 是否为访视
		/// </summary>
		public bool IsVisit { get; set; }
	}


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

		/// <summary>
		/// 是否盲化
		/// </summary>
		public bool? IsBlind { get; set; }

		/// <summary>
		/// 是否完整
		/// </summary>
		public bool? IsComplete { get; set; }

	}


	public class GetReadingClinicalDataListOutDto
	{

		public Guid Id { get; set; }


		/// <summary>
		/// 访视Id  或者模块Id
		/// </summary>
		public Guid ReadingId { get; set; }

        /// <summary>
        /// CRC是否正在申请撤回
        /// </summary>
        public bool IsCRCApplicationRevoke { get; set; } = false;
        public bool IsCRCConfirm { get; set; } = false;

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

        /// <summary>
        /// 项目配置临床类型Name
        /// </summary>
        public string ClinicalDataSetName { get; set; }

		/// <summary>
		/// 英文名称
		/// </summary>
		public string ClinicalDataSetEnName { get; set; } = string.Empty;

		/// <summary>
		/// 下拉ID
		/// </summary>
		public Guid ClinicalDataTrialSetId { get; set; }

		/// <summary>
		/// 临床级别
		/// </summary>
		public ClinicalLevel ClinicalDataLevel { get; set; }

		/// <summary>
		/// 上传角色
		/// </summary>
		public UploadRole UploadRole { get; set; }

		public Guid SubjectId { get; set; }

		/// <summary>
		/// 上传方式
		/// </summary>
		public ClinicalUploadType ClinicalUploadType { get; set; }

		/// <summary>
		/// 标准枚举
		/// </summary>
		public List<int> CriterionEnumList { get; set; }

		/// <summary>
		/// 临床级别名称
		/// </summary>
		public string ClinicalDataLevelName { get; set; }

		/// <summary>
		/// 上传方式名称
		/// </summary>
		public string ClinicalUploadTypeName { get; set; }

		/// <summary>
		/// 是否为CRC上传
		/// </summary>
		public bool IsCRCUpload { get; set; }

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

		public Guid ReadModuleId { get; set; }


		/// <summary>
		/// 是否签名
		/// </summary>
		public bool IsSign { get; set; }


		/// <summary>
		/// 是否盲化
		/// </summary>
		public bool? IsBlind { get; set; }

		/// <summary>
		/// 是否完整
		/// </summary>
		public bool? IsComplete { get; set; }


		//临床数据状态
		public ReadingClinicalDataStatus ReadingClinicalDataState { get; set; }

		/// <summary>
		/// 文件数量
		/// </summary>
		public int FileCount { get; set; }
		//{ 
		//	get 
		//	{
		//		return this.FileList.Count();
		//	} 
		//} 

		public List<ClinicalFromData> ClinicalFromList { get; set; }

		public List<GetFileDto> FileList { get; set; } = new List<GetFileDto>();


		public ClinicalDataTable ClinicalTableData { get; set; }

		public List<TrialClinicalDataSetCriterion> TrialClinicalDataSetCriteriaList { get; set; }
	}


	public class ClinicalFromData
	{
		/// <summary>
		/// 表单Id
		/// </summary>
		public Guid ClinicalFormId { get; set; }

		/// <summary>
		/// 检查日期
		/// </summary>
		public DateTime? CheckDate { get; set; }
	}

	public class GetFileDto
	{

		/// <summary>
		/// Id
		/// </summary>

		public Guid Id { get; set; }

		/// <summary>
		/// Path
		/// </summary>

		public string Path { get; set; }

		/// <summary>
		/// FileName
		/// </summary>
	
		public string FileName { get; set; }

		/// <summary>
		/// 上传时间
		/// </summary>
		public DateTime CreateTime { get; set; }
	}


	public class GetTrialClinicalDataSelectIndto
	{
		/// <summary>
		/// 项目ID
		/// </summary>
		[NotDefault]
		public Guid TrialId { get; set; }

		/// <summary>
		/// 阅片期临床数据ID
		/// </summary>
		public Guid? ReadingClinicalDataId { get; set; }

		/// <summary>
		/// 对象ID
		/// </summary>
		public Guid? ReadingId { get; set; }

		public Guid? SubjectId { get; set; }

		/// <summary>
		/// 是否是访视
		/// </summary>
		public bool IsVisit { get; set; }

		/// <summary>
		/// 是否是基线
		/// </summary>
		public bool IsBaseLine { get; set; }


		/// <summary>
		/// 上传角色
		/// </summary>
		public UploadRole? UploadRole { get; set; }


		public Guid? TrialReadingCriterionId { get; set; }
	}

	public class GetTrialClinicalDataSelectOutDto
	{

		public Guid Id { get; set; }

		/// <summary>
		/// 名称
		/// </summary>
		public string ClinicalDataSetName { get; set; }

		/// <summary>
		/// 英文名称
		/// </summary>
		public string ClinicalDataSetEnName { get; set; } = string.Empty;

		/// <summary>
		/// 临床级别
		/// </summary>
		public ClinicalLevel ClinicalDataLevel { get; set; }


		/// <summary>
		/// 上传方式
		/// </summary>
		public ClinicalUploadType ClinicalUploadType { get; set; }

		/// <summary>
		/// 临床级别名称
		/// </summary>
		public string ClinicalDataLevelName { get; set; }

		/// <summary>
		/// 上传方式名称
		/// </summary>
		public string ClinicalUploadTypeName { get; set; }


		/// <summary>
		/// 模板文件名称
		/// </summary>
		public string FileName { get; set; }

		/// <summary>
		/// 文件路径
		/// </summary>
		public string Path { get; set; }

		public List<int> CriterionEnumList { get; set; }


	}

}
