|
@@ -1,17 +1,25 @@
|
|
|
package com.lantone.qc.kernel.catalogue.threelevelward;
|
|
|
|
|
|
+import com.google.common.collect.ImmutableMap;
|
|
|
+import com.google.common.collect.ImmutableSet;
|
|
|
import com.lantone.qc.kernel.catalogue.QCCatalogue;
|
|
|
import com.lantone.qc.kernel.util.CatalogueUtil;
|
|
|
import com.lantone.qc.pub.model.InputInfo;
|
|
|
import com.lantone.qc.pub.model.OutputInfo;
|
|
|
+import com.lantone.qc.pub.model.doc.DoctorAdviceDoc;
|
|
|
+import com.lantone.qc.pub.model.doc.LisDoc;
|
|
|
import com.lantone.qc.pub.model.doc.ward.AttendingDoctorWardDoc;
|
|
|
+import com.lantone.qc.pub.model.entity.Lis;
|
|
|
import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
|
|
|
+import com.lantone.qc.pub.util.ListUtil;
|
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @ClassName : THR03044
|
|
@@ -21,44 +29,114 @@ import java.util.Map;
|
|
|
*/
|
|
|
@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("一般细菌涂片检查","细菌生长")
|
|
|
+ .put("内毒素鲎定性试验","阳性")
|
|
|
+ .put("常规药敏定性试验","阳性")
|
|
|
+ .put("细菌抗体测定","阳性")
|
|
|
+ .put("碱性磷酸酶染色","大于80分")
|
|
|
+ .put("红细胞沉降率测定(ESR)","大于25mm/h")
|
|
|
+ .put("肥达氏反应","≥1:160")
|
|
|
+ .put("外斐氏反应","≥1:160")
|
|
|
+ .put("尿白细胞计数","大于5个/高位视野")
|
|
|
+ .put("粪便白细胞","大于2个/高位视野")
|
|
|
+ .put("前列腺液白细胞","大于1个/高位视野")
|
|
|
+ .put("胸腹水细胞分类","白细胞计数大于500*10^6/L")
|
|
|
+ .build();
|
|
|
public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
|
- if (inputInfo.getThreeLevelWardDocs().size() == 0 || inputInfo.getBeHospitalizedDoc() == null) {
|
|
|
- status.set("0");
|
|
|
+ status.set("0");
|
|
|
+ List<DoctorAdviceDoc> doctorAdviceDocs = inputInfo.getDoctorAdviceDocs();
|
|
|
+ List<LisDoc> lisDocs = inputInfo.getLisDocs();
|
|
|
+ if(doctorAdviceDocs.size() == 0 || lisDocs.size() == 0){
|
|
|
return;
|
|
|
}
|
|
|
- List<AttendingDoctorWardDoc> attendDocs = inputInfo.getThreeLevelWardDocs().get(0).getAttendingDoctorWardDocs();
|
|
|
- if (attendDocs.size() == 0) {
|
|
|
- status.set("0");
|
|
|
- return;
|
|
|
- }
|
|
|
- AttendingDoctorWardDoc firstAttendDoc = attendDocs.get(0);
|
|
|
- //先取结构化数据判断
|
|
|
- Map<String, String> firstAttendStructureMap = firstAttendDoc.getStructureMap();
|
|
|
- String admisDateStr = inputInfo.getBeHospitalizedDoc().getStructureMap().get("入院日期");
|
|
|
- String recordDateStr = firstAttendStructureMap.get("查房日期");
|
|
|
- if (CatalogueUtil.isEmpty(admisDateStr) || CatalogueUtil.isEmpty(recordDateStr)) {
|
|
|
- status.set("0");
|
|
|
- return;
|
|
|
+
|
|
|
+ List<String> antibiotics = new ArrayList<>();
|
|
|
+ for (DoctorAdviceDoc doctorAdviceDoc:doctorAdviceDocs) {
|
|
|
+ Map<String, String> adviceDocStructureMap = doctorAdviceDoc.getStructureMap();
|
|
|
+ if(adviceDocStructureMap != null){
|
|
|
+ if(adviceDocStructureMap.get("医嘱项目名称").contains("抗生素")){
|
|
|
+ antibiotics.add(adviceDocStructureMap.get("医嘱项目名称"));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- //如果首次查房超过48小时则不判断该条规则
|
|
|
- if (CatalogueUtil.compareTime(StringUtil.parseDateTime(admisDateStr), StringUtil.parseDateTime(recordDateStr), 48 * 60L)) {
|
|
|
- status.set("0");
|
|
|
+ if(antibiotics.size() == 0){
|
|
|
return;
|
|
|
}
|
|
|
- if (StringUtil.isNotBlank(firstAttendStructureMap.get("病情记录"))) {
|
|
|
- status.set("0");
|
|
|
- return;
|
|
|
+
|
|
|
+ List<String> lises = new ArrayList<>();
|
|
|
+ Map<String,String> lisReportMap = new HashMap<>();
|
|
|
+
|
|
|
+ for (LisDoc lisDoc:lisDocs) {
|
|
|
+ Map<String, String> lisDocStructureMap = lisDoc.getStructureMap();
|
|
|
+ String lisName = lisDocStructureMap.get("报告名称").trim();
|
|
|
+ String result = lisDocStructureMap.get("检验结果");
|
|
|
+ lisReportMap.put(lisName,result);
|
|
|
+ if(!lises.contains(lisName)){
|
|
|
+ lises.add(lisName);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
- ThreeLevelWardLabel firstAttendLabel = firstAttendDoc.getThreeLevelWardLabel();
|
|
|
- if (firstAttendLabel == null) {
|
|
|
+ //如果这个病例的化验项目不在lisData,不报
|
|
|
+ Set<String> dataLises = lisData.keySet();
|
|
|
+ List<String> collect = dataLises.stream().collect(Collectors.toList());
|
|
|
+ collect.retainAll(lises);
|
|
|
+ if(collect.size() == 0){
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (firstAttendLabel.getDiags().size() > 0
|
|
|
- || StringUtil.isNotBlank(firstAttendLabel.getDiagBasisText())
|
|
|
- || (firstAttendLabel.getDiffDiag().size() > 0 || StringUtils.isNotEmpty(firstAttendLabel.getDiffDiagText()))
|
|
|
- || firstAttendLabel.getTreatmentPlans().size() > 0) {
|
|
|
- status.set("0");
|
|
|
+ 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("小于")){
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if(!result.equals(s)){
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ public String num_method(String content){
|
|
|
+// String compile = "(\\d+\\.\\d+)|(\\d+)";
|
|
|
+ String compile = "(\\d+\\.\\d+)";
|
|
|
+ Pattern p = Pattern.compile(compile);
|
|
|
+ Matcher matcher = p.matcher(content);
|
|
|
+ boolean b = matcher.find();
|
|
|
+ String group = matcher.group(1);
|
|
|
+ group = group == null? "":group;
|
|
|
+ return group;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Boolean num_contain(String content){
|
|
|
+// String compile = "(\\d+\\.\\d+)|(\\d+)";
|
|
|
+ String compile = "(\\d+)";
|
|
|
+ Pattern p = Pattern.compile(compile);
|
|
|
+ Matcher matcher = p.matcher(content);
|
|
|
+ boolean b = matcher.find();
|
|
|
+ return b;
|
|
|
}
|
|
|
}
|