Browse Source

血压

master
wxd 1 year ago
parent
commit
872bd5497e
  1. 83
      test/Shentun.Peis.Application.Tests/DiagnosisFunctionAppServiceTest.cs

83
test/Shentun.Peis.Application.Tests/DiagnosisFunctionAppServiceTest.cs

@ -969,5 +969,88 @@ namespace Shentun.Peis
return msg;
}
/// <summary>
/// 测试血压函数
/// </summary>
[Fact]
public void GetAsbitemDiagnosisResultXyTest()
{
var patient = new PatientAsbitemDiagnosisInput();
patient.SexName = "男";
patient.Age = 30;
patient.Items = new List<ItemResultInput>()
{
new ItemResultInput()
{
ItemId = Guid.NewGuid(),
ItemName = "血压",
Result = "140/86"
}
};
var result = GetAsbitemDiagnosisResultXy(patient);
_output.WriteLine("结果:" + result);
return;
}
/// <summary>
/// 血压函数
/// </summary>
/// <param name="patient"></param>
/// <returns></returns>
public string GetAsbitemDiagnosisResultXy(PatientAsbitemDiagnosisInput patient)
{
decimal sbp = 0;
string msg = null;
decimal dbp = 0;
var itemResult = "";
foreach (var item in patient.Items)
{
if (item.ItemName == "血压")
{
itemResult = item.Result;
}
}
if (string.IsNullOrWhiteSpace(itemResult))
{
return null;
}
int indexBefore = itemResult.IndexOf("/");
string before = itemResult.Substring(0, indexBefore);
int indexAfter = itemResult.IndexOf("/") + 1;
string after = itemResult.Substring(indexAfter);
if (!String.IsNullOrEmpty(before) && !String.IsNullOrEmpty(after))
{
if (!decimal.TryParse(before, out sbp))
{
return null;
}
if (!decimal.TryParse(after, out dbp))
{
return null;
}
if ((sbp >= 90 && sbp <= 139) && (dbp >= 60 && dbp <= 89))
{
msg = "血压正常";
}
else if (sbp > 139 || dbp > 89)
{
msg = "血压升高";
}
else if (sbp < 90 || dbp < 60)
{
msg = "血压降低";
}
return msg;
}
return itemResult;
}
}
}
Loading…
Cancel
Save