diff --git a/src/Shentun.Peis.Domain/LisRequests/LisRequestManager.cs b/src/Shentun.Peis.Domain/LisRequests/LisRequestManager.cs index 3ed87fb..943a481 100644 --- a/src/Shentun.Peis.Domain/LisRequests/LisRequestManager.cs +++ b/src/Shentun.Peis.Domain/LisRequests/LisRequestManager.cs @@ -86,8 +86,10 @@ namespace Shentun.Peis.LisRequests on registerCheckAsbitem.AsbitemId equals asbitem.Id join itemType in await _itemTypeRepository.GetQueryableAsync() on asbitem.ItemTypeId equals itemType.Id - where patientRegister.Id == patientRegisterId + where patientRegister.Id == patientRegisterId + && patientRegister.CompleteFlag != PatientRegisterCompleteFlag.PreRegistration && patientRegister.CompleteFlag != PatientRegisterCompleteFlag.SumCheck + && patientRegister.CompleteFlag != PatientRegisterCompleteFlag.Audit && itemType.CheckTypeFlag == CheckTypeFlag.Laboratory && registerCheck.CompleteFlag == RegisterCheckCompleteFlag.UnChecked select new diff --git a/test/Shentun.Peis.Application.Tests/DiagnosisFunctionAppServiceTest.cs b/test/Shentun.Peis.Application.Tests/DiagnosisFunctionAppServiceTest.cs index 6d47dbd..e7ba3da 100644 --- a/test/Shentun.Peis.Application.Tests/DiagnosisFunctionAppServiceTest.cs +++ b/test/Shentun.Peis.Application.Tests/DiagnosisFunctionAppServiceTest.cs @@ -481,21 +481,21 @@ namespace Shentun.Peis { string result = ""; decimal tzzsDecimal = 0; - + var itemResult = patient.Item.Result; if (string.IsNullOrWhiteSpace(itemResult)) { return null; } - - + + if (!decimal.TryParse(itemResult, out tzzsDecimal)) { return null; } - - if (tzzsDecimal > 24 ) + + if (tzzsDecimal > 24) { return "超重"; } @@ -745,5 +745,229 @@ namespace Shentun.Peis } return msg; } + + [Fact] + public void GetAsbitemDiagnosisResultTzzsTest() + { + var patient = new PatientAsbitemDiagnosisInput(); + patient.SexName = "男"; + patient.Age = 30; + patient.Items = new List() + { + new ItemResultInput() + { + ItemId = Guid.NewGuid(), + ItemName = "体重指数", + Result = "18" + } + }; + var result = GetAsbitemDiagnosisResultTzzs(patient); + _output.WriteLine("结果:" + result); + return; + string code = @" + string msg = null; + string result1 = """"; + string result2= """"; + string result3 = """"; + string result4 = """"; + string result5 = """"; + foreach (var item in patient.Items) + { + if(item.ItemName == ""乙肝表面抗原(HBsAg)"") + { + result1 = item.Result; + } + if (item.ItemName == ""乙肝表面抗体(抗-HBs)"") + { + result2 = item.Result; + } + if (item.ItemName == ""乙肝e抗原(HBeAg)"") + { + result3 = item.Result; + } + if (item.ItemName == ""乙肝e抗体(抗-HBe)"") + { + result4 = item.Result; + } + if (item.ItemName == ""乙肝核心抗体(抗-HBc)"") + { + result5 = item.Result; + } + + } + switch (result1 + "","" + result2 + "","" + result3 + "","" + result4 + "","" + result5) + { + case ""阳性,阴性,阳性,阴性,阳性"": + msg = ""乙肝五项检查大三阳""; + break; + case ""阳性,阴性,阴性,阳性,阳性"": + msg = ""乙肝五项检查小三阳""; + break; + case ""阳性,阴性,阳性,阴性,阴性"": + msg = ""乙肝五项检查第一项,第三项阳性""; + break; + case ""阴性,阴性,阳性,阳性,阳性"": + msg = ""乙肝两对半三,四,五阳性""; + break; + case ""阳性,阴性,阴性,阴性,阳性"": + msg = ""乙肝五项检查第一项,第五项阳性""; + break; + case ""阴性,阴性,阴性,阳性,阳性"": + msg = ""乙肝五项检查第四项,第五项阳性""; + break; + case ""阳性,阴性,阳性,阳性,阴性"": + msg = ""乙肝两对半一,三,四阳性""; + break; + case ""阴性,阴性,阳性,阴性,阳性"": + msg = ""乙肝五项检查第三项,第五项阳性""; + break; + case ""阴性,阴性,阴性,阴性,阴性"": + msg = ""乙肝五项全阴""; + break; + case ""阴性,阳性,阴性,阴性,阴性"": + msg = ""乙肝表面抗体阳性""; + break; + case ""阳性,阴性,阴性,阴性,阴性"": + msg = ""乙肝表面抗原阳性""; + break; + case ""阴性,阳性,阴性,阳性,阳性"": + msg = ""乙肝五项检查第二,第四,第五项阳性""; + break; + case ""阴性,阴性,阴性,阳性,阴性"": + msg = ""乙肝e抗体阳性""; + break; + case ""阳性,阴性,阴性,阳性,阴性"": + msg = ""乙肝五项检查第一项,第四项阳性""; + break; + case ""阴性,阳性,阴性,阴性,阳性"": + msg = ""乙肝五项检查第二项,第五项阳性""; + break; + case ""阴性,阴性,阴性,阴性,阳性"": + msg = ""乙肝核心抗体阳性""; + break; + case ""阴性,弱阳性,阴性,阴性,阴性"": + msg = ""乙肝表面抗体弱阳性""; + break; + case ""阴性,弱阳性,阴性,阴性,阳性"": + msg = ""乙肝五项检查第二项弱阳性,第五项阳性""; + break; + default: + msg = """"; + break; + } + return msg; + "; + + + DiagnosisBuilder diagnosisBuilder = new DiagnosisBuilder(); + result = diagnosisBuilder.GetAsbitemDiagnosisResult(patient, code); + _output.WriteLine("动态结果:" + result); + + + } + public string GetAsbitemDiagnosisResultTzzs(PatientAsbitemDiagnosisInput patient) + { + string msg = null; + string result1 = ""; + string result2 = ""; + string result3 = ""; + string result4 = ""; + string result5 = ""; + foreach (var item in patient.Items) + { + if (item.ItemName == "体重指数") + { + result1 = item.Result; + } + + } + var tzzsPre = "体重指数:"; + if (double.TryParse(result1, out var tzzsResult)) + { + if (tzzsResult < 18.5) + { + msg = tzzsPre + tzzsResult.ToString() + "诊断为:体重过低"; + } + else if (tzzsResult >= 24.9 && tzzsResult < 28) + { + msg = tzzsPre + tzzsResult.ToString() + "诊断为:超重"; + } + else if (tzzsResult >= 28 && tzzsResult < 29.9) + { + msg = tzzsPre + tzzsResult.ToString() + "诊断为:肥胖症(轻度)"; + } + else if (tzzsResult >= 29.9 && tzzsResult < 34.9) + { + msg = tzzsPre + tzzsResult.ToString() + "诊断为:肥胖症(中度)"; + } + else if (tzzsResult >= 34.9) + { + msg = tzzsPre + tzzsResult.ToString() + "诊断为:肥胖症(重度)"; + } + else + { + msg = tzzsPre + tzzsResult.ToString() + "诊断为:正常"; + } + } + return msg; + } + + public string GetAsbitemDiagnosisResultTzzs2(PatientAsbitemDiagnosisInput patient) + { + string msg = null; + decimal sg = 0; + decimal tz = 0; + string tzStr = ""; + string sgStr = ""; + foreach (var item in patient.Items) + { + if (item.ItemName == "身高") + { + sgStr = item.Result; + } + if (item.ItemName == "体重") + { + tzStr = item.Result; + } + + } + if (!decimal.TryParse(sgStr, out sg)) + { + return ""; + } + if (!decimal.TryParse(tzStr, out tz)) + { + return ""; + } + var tzzsResult = (double)(tz / ((sg / 100) * (sg / 100))); + var tzzsPre = "体重指数:"; + + if (tzzsResult < 18.5) + { + msg = tzzsPre + tzzsResult.ToString("0.00") + "诊断为:体重过低"; + } + else if (tzzsResult >= 24.9 && tzzsResult < 28) + { + msg = tzzsPre + tzzsResult.ToString("0.00") + "诊断为:超重"; + } + else if (tzzsResult >= 28 && tzzsResult < 29.9) + { + msg = tzzsPre + tzzsResult.ToString("0.00") + "诊断为:肥胖症(轻度)"; + } + else if (tzzsResult >= 29.9 && tzzsResult < 34.9) + { + msg = tzzsPre + tzzsResult.ToString() + "诊断为:肥胖症(中度)"; + } + else if (tzzsResult >= 34.9) + { + msg = tzzsPre + tzzsResult.ToString("0.00") + "诊断为:肥胖症(重度)"; + } + else + { + msg = tzzsPre + tzzsResult.ToString("0.00") + "诊断为:正常"; + } + + return msg; + } } }