using IRaCIS.Core.Domain.Share;
using System.Linq;

namespace IRaCIS.Core.Domain.Models;

[Comment("系统临床表格问题")]
[Table("SystemClinicalTableQuestion")]
public class SystemClinicalTableQuestion : BaseAddAuditEntity
{
    #region 导航属性
    [NotMapped]
    public List<string> RelevanceValueList
    {
        get
        {
            try
            {
                return this.RelevanceValue.Split(',').ToList();
            }
            catch (Exception)
            {

                return new List<string>();
            }
        }

    }
    #endregion
    [Comment("系统临床数据Id")]
    public Guid SystemClinicalId { get; set; }

    [Comment("问题名称")]
    public string QuestionName { get; set; } = string.Empty;

    [Comment("问题英文名称")]
    public string QuestionEnName { get; set; } = string.Empty;

    [Comment("临床问题类型(分组,单选。)")]
    public string ClinicalTableQuestionType { get; set; } = string.Empty;

    [Comment("问题标识")]
    public ClinicalTableQuestionMark? ClinicalTableQuestionMarkEnum { get; set; }

    [Comment("最大长度")]
    public int? MaxAnswerLength { get; set; }

    [Comment("临床数据选项类型(无,自定义)")]
    public ClinicalOptionType ClinicalOptionTypeEnum { get; set; }

    [Comment("自定义选项")]
    public string TypeValue { get; set; } = string.Empty;

    [Comment("字典Code")]
    public string DictionaryCode { get; set; } = string.Empty;

    [Comment("排序")]
    public int ShowOrder { get; set; }

    [Comment("是否必填")]
    public IsRequired IsRequired { get; set; }
    [Comment("外层问题Id")]
    public Guid QuestionId { get; set; }

    [Comment("小数点位数")]
    public int? DigitPlaces { get; set; }

    [Comment("单位")]
    public string Unit { get; set; } = string.Empty;

    [Comment("关联ID")]
    public Guid? RelevanceId { get; set; }

    [Comment("关联Value")]
    public string RelevanceValue { get; set; } = string.Empty;
}