public JsonResult CDSSdiagnosis() { string strResult = null; try{ string jsonStr = Request.Params["postjson"]; VisitData obj = JsonConvert.DeserializeObject<VisitData>(jsonStr);//jsonStr.FromJsonTo<VisitData>(); HeadachePlace h1=new HeadachePlace(); h1.Position = "左侧为主"; obj.PHeadacheOverview.HeadachePlace.Add(h1);//629演示 HeadacheDiagnosis HDiagnosis = new HeadacheDiagnosis(); strResult= HDiagnosis.GetDiagnosis(obj); } catch (Exception e) { return this.Json(new { OK = false, Message = e.Message + "推理出错" }); } //strResult = "123"; if(!strResult.Contains("必填项")){ if (strResult.Length < 20) strResult = "\n" + " " + strResult; return this.Json(new { OK = true, Message = strResult}); } else{ return this.Json(new { OK = false, Message = strResult }); } }
public VisitData DataPreprocess(VisitData VData) { try { int num1 = VData.HFamilyMember.Count - 1; //对于空字符串进行处理 for (int i = num1; i >= 0; i--) { if (VData.HFamilyMember[i].Person == "") { VData.HFamilyMember.RemoveAt(i); } } int num2 = VData.OFamilyDisease.Count - 1; for (int j = num2; j >= 0; j--) { if (VData.OFamilyDisease[j].DiseaseName == "") { VData.OFamilyDisease.RemoveAt(j); } } int num3 = VData.PDrug.Count - 1; for (int m = num3; m >= 0; m--) { if (VData.PDrug[m].DrugCategory == "") { VData.PDrug.RemoveAt(m); } } int num4 = VData.PExam.Count - 1; for (int n = num4; n >= 0; n--) { if (VData.PExam[n].ExamName == "") { VData.PExam.RemoveAt(n); } } int num5 = VData.MAdvice.Count - 1; for (int n = num5; n >= 0; n--) { if (VData.MAdvice[n].DrugName == "") { VData.MAdvice.RemoveAt(n); } } int count1 = VData.PHeadacheOverview.HeadacheAccompany.Count - 1; for (int n = count1; n >= 0; n--) { HeadacheAccompany ha = VData.PHeadacheOverview.HeadacheAccompany.ElementAt(n); if (ha.Symptom == "") { VData.PHeadacheOverview.HeadacheAccompany.Remove(ha); } } int count2 = VData.PHeadacheOverview.HeadacheProdrome.Count - 1; for (int n = count2; n >= 0; n--) { HeadacheProdrome ha = VData.PHeadacheOverview.HeadacheProdrome.ElementAt(n); if (ha.Prodrome == "") { VData.PHeadacheOverview.HeadacheProdrome.Remove(ha); } } int count3 = VData.PHeadacheOverview.HeadachePlace.Count - 1; for (int n = count3; n >= 0; n--) { HeadachePlace ha = VData.PHeadacheOverview.HeadachePlace.ElementAt(n); if (ha.SpecificPlace == "") { VData.PHeadacheOverview.HeadachePlace.Remove(ha); } } int count4 = VData.PHeadacheOverview.MitigatingFactors.Count - 1; for (int n = count4; n >= 0; n--) { MitigatingFactors ha = VData.PHeadacheOverview.MitigatingFactors.ElementAt(n); if (ha.FactorName == "") { VData.PHeadacheOverview.MitigatingFactors.Remove(ha); } } int count5 = VData.PHeadacheOverview.PrecipitatingFactor.Count - 1; for (int n = count5; n >= 0; n--) { PrecipitatingFactor ha = VData.PHeadacheOverview.PrecipitatingFactor.ElementAt(n); if (ha.FactorName == "") { VData.PHeadacheOverview.PrecipitatingFactor.Remove(ha); } } int count6 = VData.visitrecord.SecondaryHeadacheSymptom.Count - 1; for (int n = count6; n >= 0; n--) { SecondaryHeadacheSymptom ha = VData.visitrecord.SecondaryHeadacheSymptom.ElementAt(n); if (ha.Symptom == "") { VData.visitrecord.SecondaryHeadacheSymptom.Remove(ha); } } int count7 = VData.PHeadacheOverview.PremonitorySymptom.Count - 1; for (int n = count7; n >= 0; n--) { PremonitorySymptom ha = VData.PHeadacheOverview.PremonitorySymptom.ElementAt(n); if (ha.Symptom == "") { VData.PHeadacheOverview.PremonitorySymptom.Remove(ha); } } return(VData); } catch (Exception e) { return(null); } }