|
@@ -1,50 +1,98 @@
|
|
package com.lantone.qc.kernel.catalogue.behospitalized;
|
|
package com.lantone.qc.kernel.catalogue.behospitalized;
|
|
|
|
+
|
|
import com.lantone.qc.kernel.catalogue.QCCatalogue;
|
|
import com.lantone.qc.kernel.catalogue.QCCatalogue;
|
|
-import com.lantone.qc.kernel.util.CatalogueUtil;
|
|
|
|
-import com.lantone.qc.dbanaly.util.KernelConstants;
|
|
|
|
-import com.lantone.qc.dbanaly.util.SpecialStorageUtil;
|
|
|
|
import com.lantone.qc.pub.model.InputInfo;
|
|
import com.lantone.qc.pub.model.InputInfo;
|
|
import com.lantone.qc.pub.model.OutputInfo;
|
|
import com.lantone.qc.pub.model.OutputInfo;
|
|
import com.lantone.qc.pub.model.entity.Diag;
|
|
import com.lantone.qc.pub.model.entity.Diag;
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
+import com.lantone.qc.pub.model.entity.GeneralDesc;
|
|
|
|
+import com.lantone.qc.pub.model.label.DiagLabel;
|
|
|
|
+import com.lantone.qc.pub.model.label.PastLabel;
|
|
|
|
+import com.lantone.qc.pub.model.label.PresentLabel;
|
|
|
|
+import com.lantone.qc.pub.util.StringUtil;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
-import java.util.Map;
|
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* @ClassName : BEH0011
|
|
* @ClassName : BEH0011
|
|
- * @Description : 入院诊断不完整
|
|
|
|
- * 初步诊断没有既往史里的慢性疾病
|
|
|
|
|
|
+ * @Description : 初步诊断不完整
|
|
|
|
+ * 原逻辑 --初步诊断没有既往史里的慢性疾病
|
|
|
|
+ * 现逻辑 --检查现病史中一般情况之后的疾病名称,既往史中的疾病名称是否都在初步诊断里
|
|
* @Author : 楼辉荣
|
|
* @Author : 楼辉荣
|
|
* @Date: 2020-03-06 17:28
|
|
* @Date: 2020-03-06 17:28
|
|
*/
|
|
*/
|
|
@Component
|
|
@Component
|
|
public class BEH0011 extends QCCatalogue {
|
|
public class BEH0011 extends QCCatalogue {
|
|
- @Autowired
|
|
|
|
- private SpecialStorageUtil specialStorageUtil;
|
|
|
|
|
|
+// @Autowired
|
|
|
|
+// private SpecialStorageUtil specialStorageUtil;
|
|
|
|
+
|
|
public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
- if(inputInfo.getBeHospitalizedDoc() == null){
|
|
|
|
|
|
+ if (inputInfo.getBeHospitalizedDoc() == null) {
|
|
|
|
+ status.set("0");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ PresentLabel presentLabel = inputInfo.getBeHospitalizedDoc().getPresentLabel();
|
|
|
|
+ DiagLabel initialDiagLabel = inputInfo.getBeHospitalizedDoc().getInitialDiagLabel();
|
|
|
|
+ PastLabel pastLabel = inputInfo.getBeHospitalizedDoc().getPastLabel();
|
|
|
|
+ if (initialDiagLabel == null || pastLabel == null || presentLabel == null) {
|
|
status.set("0");
|
|
status.set("0");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- Map<String, Map<String, Object>> diagMap = specialStorageUtil.getJsonStringValue(KernelConstants.CONCEPT_DIAG_PROPERTY_MAP);
|
|
|
|
- String initDiagText = CatalogueUtil.removeSpecialChar(inputInfo.getBeHospitalizedDoc().getInitialDiagLabel().getText());
|
|
|
|
- List<Diag> diags = inputInfo.getBeHospitalizedDoc().getPastLabel().getDiags().stream().filter(diag -> diag.getNegative() == null).collect(Collectors.toList());
|
|
|
|
- if(StringUtils.isNotEmpty(initDiagText)){
|
|
|
|
|
|
+ String presentText = presentLabel.getText();
|
|
|
|
+ List<Diag> presentDiags = presentLabel.getDiags();
|
|
|
|
+ List<String> presentPastDiag = new ArrayList<>();
|
|
|
|
+ /* 取现病史中一般情况之后的疾病名称 */
|
|
|
|
+ if (StringUtil.isNotBlank(presentText) && presentDiags.size() > 0) {
|
|
|
|
+ List<GeneralDesc> generals = presentLabel.getGenerals();
|
|
|
|
+ String lastGeneral = generals.get(generals.size() - 1).getName();
|
|
|
|
+ int lastGeneralIndex = presentText.indexOf(lastGeneral);
|
|
|
|
+ for (Diag presentDiag : presentDiags) {
|
|
|
|
+ if (presentDiag.getNegative() != null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ /* 现病史中一般情况之后的疾病名称 */
|
|
|
|
+ if (presentText.indexOf(presentDiag.getHospitalDiagName()) > lastGeneralIndex) {
|
|
|
|
+ presentPastDiag.add(presentDiag.getHospitalDiagName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ /* 取既往史中疾病名称 */
|
|
|
|
+ List<Diag> pastDiags = pastLabel.getDiags();
|
|
|
|
+ addDiagHospitalName(presentPastDiag, pastDiags);
|
|
|
|
+ /* 取初步诊断中疾病名称 */
|
|
|
|
+ List<String> initDiag = new ArrayList<>();
|
|
|
|
+ List<Diag> initialDiagDiags = initialDiagLabel.getDiags();
|
|
|
|
+ addDiagHospitalName(initDiag, initialDiagDiags);
|
|
|
|
+
|
|
|
|
+ if (initDiag.containsAll(presentPastDiag)){
|
|
|
|
+ status.set("0");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void addDiagHospitalName(List<String> presentPastDiag, List<Diag> pastDiags) {
|
|
|
|
+ for (Diag pastDiag : pastDiags) {
|
|
|
|
+ if (pastDiag.getNegative() != null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ presentPastDiag.add(pastDiag.getHospitalDiagName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ /* 原逻辑
|
|
|
|
+ Map<String, Map<String, Object>> diagMap = specialStorageUtil.getJsonStringValue(KernelConstants.CONCEPT_DIAG_PROPERTY_MAP);
|
|
|
|
+ String initDiagText = CatalogueUtil.removeSpecialChar(initialDiagLabel.getText());
|
|
|
|
+ if (pastLabel.getDiags() != null) {
|
|
|
|
+ List<Diag> diags = pastLabel.getDiags().stream().filter(diag -> diag.getNegative() == null).collect(Collectors.toList());
|
|
List<String> initDiags = Arrays.asList(initDiagText.split(","));
|
|
List<String> initDiags = Arrays.asList(initDiagText.split(","));
|
|
- if(diags.size()>0){
|
|
|
|
- for (Diag diag:diags) {
|
|
|
|
|
|
+ if (diags.size() > 0) {
|
|
|
|
+ for (Diag diag : diags) {
|
|
Map<String, Object> map = (Map<String, Object>) diagMap.get(diag.getName());
|
|
Map<String, Object> map = (Map<String, Object>) diagMap.get(diag.getName());
|
|
- if(map != null && map.size() >0){
|
|
|
|
|
|
+ if (map != null && map.size() > 0) {
|
|
String chronic = (String) map.get("chronic");//1是慢病
|
|
String chronic = (String) map.get("chronic");//1是慢病
|
|
- if("1".equals(chronic) && !initDiags.contains(diag.getName())){
|
|
|
|
- if(StringUtils.isEmpty(info.get())){
|
|
|
|
|
|
+ if ("1".equals(chronic) && !initDiags.contains(diag.getName())) {
|
|
|
|
+ if (StringUtils.isEmpty(info.get())) {
|
|
info.set(diag.getName());
|
|
info.set(diag.getName());
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
info.set(info.get() + "," + diag.getName());
|
|
info.set(info.get() + "," + diag.getName());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -52,10 +100,8 @@ public class BEH0011 extends QCCatalogue {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(StringUtils.isEmpty(info.get())){
|
|
|
|
|
|
+ if (StringUtils.isEmpty(info.get())) {
|
|
status.set("0");
|
|
status.set("0");
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ */
|
|
}
|
|
}
|