using System;
using IRaCIS.Core.Domain.Share;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Collections.Generic;
using System.Linq;
using IRaCIS.Core.Domain.Share.Reading;
namespace IRaCIS.Core.Domain.Models
{
///
/// 项目阅片问题
///
[Table("ReadingQuestionTrial")]
public class ReadingQuestionTrial : Entity, IAuditAdd
{
public bool IsAdditional { get; set; }
///
/// 项目标准Id
///
public Guid ReadingQuestionCriterionTrialId { get; set; }
///
/// 项目Id
///
public Guid TrialId { get; set; }
///
/// 类型
///
public string Type { get; set; } = string.Empty;
///
/// 父问题触发
///
public string ParentTriggerValue { get; set; } = string.Empty;
///
/// 问题名称
///
public string QuestionName { get; set; } = string.Empty;
///
/// 是否是必须
///
public IsRequired IsRequired { get; set; }
///
/// 排序
///
public int ShowOrder { get; set; }
///
/// 父问题ID
///
public Guid? ParentId { get; set; }
///
/// 类型值
///
public string TypeValue { get; set; } = string.Empty;
public bool IsEnable { get; set; }
///
/// 是否是裁判问题
///
public bool IsJudgeQuestion { get; set; }
///
/// 病灶类型
///
public LesionType? LesionType { get; set; }
///
/// 问题类型
///
public QuestionType? QuestionType { get; set; }
///
/// 全局阅片显示类型
///
public GlobalReadingShowType GlobalReadingShowType { get; set; } = GlobalReadingShowType.NotShow;
///
/// 备注
///
public string Remark { get; set; } = string.Empty;
///
/// 分组
///
public string GroupName { get; set; } = string.Empty;
///
/// 创建时间
///
public DateTime CreateTime { get; set; }
///
/// 系统问题ID
///
public Guid? ReadingQuestionSystemId { get; set; }
///
/// 系统标准的ParentId
///
public Guid? SystemParentId { get; set; }
///
/// 答案分组
///
public string AnswerGroup { get; set; } = string.Empty;
///
/// 答案组合
///
public string AnswerCombination { get; set; } = string.Empty;
///
/// 裁判类型
///
public JudgeTypeEnum JudgeType { get; set; } = JudgeTypeEnum.AnswerDisaffinity;
///
/// 创建人
///
public Guid CreateUserId { get; set; }
///
/// 标准分页Id
///
public Guid? ReadingCriterionPageId { get; set; }
///
/// 关联ID
///
public Guid? RelevanceId { get; set; }
///
/// 关联Value
///
public string RelevanceValue { get; set; }=string.Empty;
///
/// 图片数量
///
public int ImageCount { get; set; } = 1;
///
/// 是否显示
///
public ShowQuestion ShowQuestion { get; set; } = ShowQuestion.Show;
///
/// 默认值
///
public string DefaultValue { get; set; } =string.Empty;
///
/// 最大问题数
///
public int? MaxQuestionCount { get; set; }
///
/// 最大答案长度
///
public int? MaxAnswerLength { get; set; }
///
/// 文件类型
///
public string? FileType { get; set; }
///
/// 是否显示在Dicom阅片中
///
public bool IsShowInDicom { get; set; } = false;
///
/// 序号标记
///
public string OrderMark { get; set; } = string.Empty;
///
/// 字典code
///
public string DictionaryCode { get; set; } = string.Empty;
///
/// 问题类型
///
public TableQuestionType? QuestionGenre { get; set; }
///
/// 数值类型
///
public ValueOfType? ValueType { get; set; }
///
/// 单位
///
public ValueUnit? Unit { get; set; }
///
/// 自定义单位
///
public string CustomUnit { get; set; } = string.Empty;
///
/// 自定义计算标记
///
public CustomCalculateMark? CustomCalculateMark { get; set; }
///
/// 限制编辑
///
public LimitEdit LimitEdit { get; set; } = LimitEdit.None;
///
/// 自定义计算标记
///
public string CalculateQuestions { get; set; } = "[]";
///
/// 数据来源
///
public DataSources DataSource { get; set; } = DataSources.ManualEntry;
///
/// 问题英文名称
///
public string QuestionEnName { get; set; } = string.Empty;
///
/// 问题英文分组
///
public string GroupEnName { get; set; } = string.Empty;
///
/// 是否复制病灶
///
public bool IsCopyLesions { get; set; } = false;
///
/// 分组ID
///
public Guid? GroupId { get; set; }
[JsonIgnore]
[ForeignKey("GroupId")]
public ReadingQuestionTrial GroupInfo { get; set; }
///
/// 分页标准
///
[ForeignKey("ReadingCriterionPageId")]
[JsonIgnore]
public ReadingCriterionPage ReadingCriterionPage { get; set; }
[JsonIgnore]
[ForeignKey("ParentId")]
public ReadingQuestionTrial ParentReadingQuestionTrial { get; set; }
[JsonIgnore]
[ForeignKey("RelevanceId")]
public ReadingQuestionTrial RelevanceReadingQuestionTrial { get; set; }
[JsonIgnore]
[ForeignKey("ReadingQuestionCriterionTrialId")]
public ReadingQuestionCriterionTrial ReadingQuestionCriterionTrial { get; set; }
[JsonIgnore]
public List ReadingTableQuestionTrialList { get; set; }
[NotMapped]
public List ParentTriggerValueList
{
get
{
try
{
return this.ParentTriggerValue.Split(',').ToList();
}
catch (Exception)
{
return new List();
}
}
}
[NotMapped]
public List RelevanceValueList
{
get
{
try
{
return this.RelevanceValue.Split(',').ToList();
}
catch (Exception)
{
return new List();
}
}
}
[NotMapped]
public List CalculateQuestionList
{
get
{
try
{
var result = JsonConvert.DeserializeObject>(this.CalculateQuestions);
return result == null ? new List() : result;
}
catch (Exception)
{
return new List();
}
}
}
}
public class CalculateInfo
{
public bool IsTable { get; set; }
public Guid? QuestionId { get; set; }
public Guid? TableQuestionId { get; set; }
}
}