|
@@ -9,8 +9,8 @@ import com.lantone.qc.pub.model.doc.LisDoc;
|
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
@@ -27,24 +27,29 @@ import java.util.stream.Collectors;
|
|
|
@Component
|
|
|
public class THR03044 extends QCCatalogue {
|
|
|
public static Map<String, String> lisData = ImmutableMap.<String, String>builder()
|
|
|
- .put("C—反应蛋白(CRP)", "大于10mg/L")
|
|
|
- .put("降钙素原检测", "大于0.25ng/mL")
|
|
|
- .put("白细胞计数(WBC)", "小于0.4*11⁹/L")
|
|
|
- .put("血培养及鉴定", "细菌生长")
|
|
|
- .put("痰培养及鉴定", "细菌生长")
|
|
|
- .put("尿培养加菌落计数", "细菌生长")
|
|
|
+ .put("超敏C反应蛋白", ">10")
|
|
|
+ .put("降钙素CT(免疫)", ">0.25")
|
|
|
+ .put("尿=白细胞", ">13.2")
|
|
|
+ .put("白细胞计数[电阻抗法]", "<0.4")
|
|
|
+ .put("中性粒细胞绝对值", ">12")
|
|
|
+ .put("中性粒细胞百分率", ">70%")
|
|
|
+ .put("血培养报阳时间", "")
|
|
|
+ // .put("尿培养加菌落计数", "细菌生长")
|
|
|
.put("一般细菌涂片检查", "细菌生长")
|
|
|
- .put("内毒素鲎定性试验", "阳性")
|
|
|
- .put("常规药敏定性试验", "阳性")
|
|
|
- .put("细菌抗体测定", "阳性")
|
|
|
- .put("碱性磷酸酶染色", "大于80分")
|
|
|
- .put("红细胞沉降率测定(ESR)", "大于25mm/h")
|
|
|
- .put("肥达氏反应", "大于等于1:160")
|
|
|
- .put("外斐氏反应", "大于等于:160")
|
|
|
- .put("尿白细胞计数", "大于5个/高位视野")
|
|
|
- .put("粪便白细胞", "大于2个/高位视野")
|
|
|
- .put("前列腺液白细胞", "大于1个/高位视野")
|
|
|
- .put("胸腹水细胞分类", "白细胞计数大于500*10^6/L")
|
|
|
+ // .put("内毒素鲎定性试验", "阳性")
|
|
|
+ // .put("常规药敏定性试验", "阳性")
|
|
|
+ // .put("细菌抗体测定", "阳性")
|
|
|
+ .put("碱性磷酸酶[速率法]", ">80")
|
|
|
+ .put("血沉", ">25")
|
|
|
+ // .put("肥达氏反应", "大于等于1:160")
|
|
|
+ // .put("外斐氏反应", "大于等于:160")
|
|
|
+ .put("粪=白细胞", ">2")
|
|
|
+ // .put("前列腺液白细胞", "大于1个/高位视野")
|
|
|
+ .put("胸水常规=白细胞", ">500")
|
|
|
+ .put("G+球菌:痰夜", "少,中等,多,偶见")
|
|
|
+ .put("G-球菌:痰夜", "少,中等,多,偶见")
|
|
|
+ .put("G+杆菌:痰夜", "少,中等,多,偶见")
|
|
|
+ .put("G-杆菌:痰夜", "少,中等,多,偶见")
|
|
|
.build();
|
|
|
|
|
|
public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
@@ -52,13 +57,10 @@ public class THR03044 extends QCCatalogue {
|
|
|
List<DoctorAdviceDoc> doctorAdviceDocs = inputInfo.getDoctorAdviceDocs();
|
|
|
List<LisDoc> lisDocs = inputInfo.getLisDocs();
|
|
|
|
|
|
- /*
|
|
|
if (doctorAdviceDocs.size() == 0 || lisDocs.size() == 0) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- */
|
|
|
-
|
|
|
Set<String> antibiotics = doctorAdviceDocs
|
|
|
.stream()
|
|
|
.map(x -> x.getStructureMap().get("药品类型"))
|
|
@@ -69,7 +71,7 @@ public class THR03044 extends QCCatalogue {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- List<String> lises = new ArrayList<>();
|
|
|
+ Set<String> lises = new HashSet<>();
|
|
|
Map<String, String> lisReportMap = new HashMap<>();
|
|
|
|
|
|
for (LisDoc lisDoc : lisDocs) {
|
|
@@ -77,56 +79,99 @@ public class THR03044 extends QCCatalogue {
|
|
|
String lisName = lisDocStructureMap.get("报告名称").trim();
|
|
|
String result = lisDocStructureMap.get("检验结果");
|
|
|
lisReportMap.put(lisName, result);
|
|
|
- if (!lises.contains(lisName)) {
|
|
|
+ if (lisName.contains("=")) {
|
|
|
+ lises.add(lisName.split("=")[1]);
|
|
|
+ } else {
|
|
|
lises.add(lisName);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
//如果这个病例的化验项目不在lisData,不报
|
|
|
Set<String> dataLises = lisData.keySet();
|
|
|
- List<String> collect = new ArrayList<>(dataLises);
|
|
|
+ Set<String> collect = new HashSet<>();
|
|
|
+ for (String dataLis : dataLises) {
|
|
|
+ if (dataLis.contains("=")) {
|
|
|
+ collect.add(dataLis.split("=")[1]);
|
|
|
+ } else {
|
|
|
+ collect.add(dataLis);
|
|
|
+ }
|
|
|
+ }
|
|
|
collect.retainAll(lises);
|
|
|
if (collect.size() == 0) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- for (Map.Entry<String, String> lis : lisReportMap.entrySet()) {
|
|
|
- String lisname = lis.getKey();
|
|
|
- String result = lis.getValue();
|
|
|
- if (collect.contains(lisname)) {
|
|
|
- String value = lisData.get(lisname);
|
|
|
- String s = num_method(value);
|
|
|
- System.out.println(s);
|
|
|
- if (num_contain(result) && num_contain(s)) {
|
|
|
- if (Float.parseFloat(result) > Float.parseFloat(s) && !value.contains("大于")) {
|
|
|
- status.set("-1");
|
|
|
- return;
|
|
|
- }
|
|
|
- if (Float.parseFloat(result) < Float.parseFloat(s) && !value.contains("小于")) {
|
|
|
+ String[] lisNameMapSub = null;
|
|
|
+ String[] lisNameSub = null;
|
|
|
+ String lisMapKey = null, lisMapValue = null, lisKey = null, lisValue = null;
|
|
|
+ for (Map.Entry<String, String> lisDataMap : lisData.entrySet()) {
|
|
|
+ String lisName = lisDataMap.getKey();
|
|
|
+ String lisResult = lisDataMap.getValue();
|
|
|
+ if (lisName.contains("=")) {
|
|
|
+ lisNameMapSub = lisName.split("=");
|
|
|
+ }
|
|
|
+ if (lisNameMapSub != null) {
|
|
|
+ lisMapKey = lisNameMapSub[0]; //静态map(lisData)的key根据=分隔,得到的key,如尿=白细胞,lisMapKey=尿
|
|
|
+ lisMapValue = lisNameMapSub[1];//静态map(lisData)的key根据=分隔,得到的value,如尿=白细胞,lisMapValue=白细胞
|
|
|
+ } else {
|
|
|
+ lisMapValue = lisName;//若静态map(lisData)的key没有=,直接用key作为分隔后的value,如超敏C反应蛋白,lisMapValue=超敏C反应蛋白
|
|
|
+ }
|
|
|
+ for (Map.Entry<String, String> lis : lisReportMap.entrySet()) {
|
|
|
+ String lisname = lis.getKey();
|
|
|
+ String result = lis.getValue();
|
|
|
+ lisNameSub = lisname.split("=");
|
|
|
+ lisKey = lisNameSub[0];//库中化验表map的key根据=分隔,得到的key,如尿=白细胞,lisMapKey=尿
|
|
|
+ lisValue = lisNameSub[1];
|
|
|
+ if (StringUtil.isBlank(lisMapKey) && lisMapValue.equals(lisValue)) {
|
|
|
+ if (compare(result, lisResult)) {
|
|
|
status.set("-1");
|
|
|
return;
|
|
|
}
|
|
|
- } else {
|
|
|
- if (!result.equals(s)) {
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(lisMapKey) && lisMapKey.contains(lisKey) && lisMapValue.equals(lisValue)) {
|
|
|
+ if (compare(result, lisResult)) {
|
|
|
status.set("-1");
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 比对化验表数据与lisData中数据大小,若符合则返回true
|
|
|
+ *
|
|
|
+ * @param result
|
|
|
+ * @param value
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private boolean compare(String result, String value) {
|
|
|
+ boolean flag = false;
|
|
|
+ String s = num_method(value);
|
|
|
+ if (num_contain(result) && num_contain(s)) {
|
|
|
+ if (Float.parseFloat(result) > Float.parseFloat(s) && value.contains(">")) {
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+ if (Float.parseFloat(result) < Float.parseFloat(s) && value.contains("<")) {
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (result.equals(s)) {
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return flag;
|
|
|
}
|
|
|
|
|
|
public String num_method(String content) {
|
|
|
// String compile = "(\\d+\\.\\d+)|(\\d+)";
|
|
|
- String compile = "(\\d+\\.\\d+)";
|
|
|
+ String group = "";
|
|
|
+ String compile = "([1-9]\\d*\\.?\\d*)|(0\\.\\d*[1-9])";
|
|
|
Pattern p = Pattern.compile(compile);
|
|
|
Matcher matcher = p.matcher(content);
|
|
|
- String group = matcher.group(1);
|
|
|
- group = group == null ? "" : group;
|
|
|
+ if (matcher.find()) {
|
|
|
+ group = matcher.group(0);
|
|
|
+ }
|
|
|
return group;
|
|
|
}
|
|
|
|