コード例 #1
0
        /// <summary>
        /// 获取诊断列表
        /// </summary>
        /// <param name="one"></param>
        /// <param name="two"></param>
        /// <param name="three"></param>
        /// <returns></returns>
        private List <InpatientDiagnosisDto> GetDiagnosisList(string one, string two, string three)
        {
            var resultData = new List <InpatientDiagnosisDto>();
            var param      = new List <string>();

            if (!string.IsNullOrWhiteSpace(one))
            {
                param.Add(one);
            }
            if (!string.IsNullOrWhiteSpace(one))
            {
                param.Add(two);
            }
            if (!string.IsNullOrWhiteSpace(one))
            {
                param.Add(three);
            }
            //var queryIcd10Data = _hisSqlRepository.QueryICD10(new QueryICD10UiParam()
            //{ Page = 1, Limit = 10000000 });
            //var icd10Data = queryIcd10Data.Values.FirstOrDefault();

            var icd10Data = _hisSqlRepository.QueryICD10Detail(param);

            if (icd10Data == null)
            {
                throw new Exception("icd10为空请更新icd10!!!");
            }
            if (!string.IsNullOrWhiteSpace(one))
            {
                var strList = GetStrList(one);
                var oneData = icd10Data.Where(c => strList.Contains(c.DiseaseCoding)).ToList();
                if (strList.Count() != oneData.Count())
                {
                    throw new Exception("icd10与基层数量不匹配请更新icd10!!!");
                }
                resultData.AddRange(oneData.Select(c => new InpatientDiagnosisDto()
                {
                    IsMainDiagnosis = true,
                    DiseaseName     = c.DiseaseName,
                    DiseaseCoding   = c.DiseaseCoding,
                    ProjectCode     = c.ProjectCode != null? c.ProjectCode:c.DiseaseCoding
                }).ToList());
            }
            if (!string.IsNullOrWhiteSpace(two))
            {
                var strList = GetStrList(two);
                var data    = icd10Data.Where(c => strList.Contains(c.DiseaseCoding)).ToList();
                if (strList.Count() != data.Count())
                {
                    throw new Exception("icd10与基层数量不匹配请更新icd10!!!");
                }
                resultData.AddRange(data.Select(c => new InpatientDiagnosisDto()
                {
                    IsMainDiagnosis = false,
                    DiseaseName     = c.DiseaseName,
                    DiseaseCoding   = c.DiseaseCoding,
                    ProjectCode     = c.ProjectCode != null ? c.ProjectCode : c.DiseaseCoding
                }).ToList());
            }
            if (!string.IsNullOrWhiteSpace(three))
            {
                var strList = GetStrList(three);
                var data    = icd10Data.Where(c => strList.Contains(c.DiseaseCoding)).ToList();
                if (strList.Count() != data.Count())
                {
                    throw new Exception("icd10与基层数量不匹配请更新icd10!!!");
                }
                resultData.AddRange(data.Select(c => new InpatientDiagnosisDto()
                {
                    IsMainDiagnosis = false,
                    DiseaseName     = c.DiseaseName,
                    DiseaseCoding   = c.DiseaseCoding,
                    ProjectCode     = c.ProjectCode != null ? c.ProjectCode : c.DiseaseCoding
                }).ToList());
            }
            //获取诊断字符串集
            List <string> GetStrList(string diagnosis)
            {
                var returnData = new List <string>();

                string[] sArray = diagnosis.Split(',');
                foreach (var item in sArray)
                {
                    returnData.Add(item);
                }
                return(returnData);
            }

            return(resultData);
        }