|
@@ -0,0 +1,79 @@
|
|
|
|
+package com.lantone.qc.kernel.catalogue.behospitalized;
|
|
|
|
+
|
|
|
|
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
|
|
|
|
+import com.lantone.qc.pub.model.InputInfo;
|
|
|
|
+import com.lantone.qc.pub.model.OutputInfo;
|
|
|
|
+import com.lantone.qc.pub.model.entity.Medicine;
|
|
|
|
+import com.lantone.qc.pub.model.label.PresentLabel;
|
|
|
|
+import com.lantone.qc.pub.util.ListUtil;
|
|
|
|
+import com.lantone.qc.pub.util.StringUtil;
|
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
|
+
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * @ClassName : BEH02909
|
|
|
|
+ * @Description : 目前使用药物情况与现病史描述不一致
|
|
|
|
+ * @Author : 胡敬
|
|
|
|
+ * @Date: 2020-06-11 16:10
|
|
|
|
+ */
|
|
|
|
+@Component
|
|
|
|
+public class BEH02909 extends QCCatalogue {
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
|
|
+ if (inputInfo.getBeHospitalizedDoc() == null) {
|
|
|
|
+ status.set("0");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ String drugsCurrentlyInUse = inputInfo.getBeHospitalizedDoc().getStructureMap().get("目前使用的药物");
|
|
|
|
+ drugsCurrentlyInUse = StringUtil.isBlank(drugsCurrentlyInUse) ? "" : drugsCurrentlyInUse;
|
|
|
|
+ List<String> drug = getDrug(drugsCurrentlyInUse);
|
|
|
|
+ PresentLabel presentLabel = inputInfo.getBeHospitalizedDoc().getPresentLabel();
|
|
|
|
+ if (presentLabel == null) {
|
|
|
|
+ status.set("0");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ List<Medicine> medicines = presentLabel.getMedicines();
|
|
|
|
+ if (medicines != null && medicines.size() > 0) {
|
|
|
|
+ List<String> drugFromPresent = getDrugFromPresent(medicines);
|
|
|
|
+ if (ListUtil.equals(drug, drugFromPresent)) {
|
|
|
|
+ status.set("0");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private List<String> getDrug(String drugsCurrentlyInUse) {
|
|
|
|
+ List<String> drugs = new ArrayList<>();
|
|
|
|
+ String medicine = "药物名称", usage = "用法", continueUse = "本次住院是否继续使用";
|
|
|
|
+ while (drugsCurrentlyInUse.length() > 0) {
|
|
|
|
+ if (drugsCurrentlyInUse.contains(medicine) && drugsCurrentlyInUse.contains(usage) && drugsCurrentlyInUse.contains(continueUse)) {
|
|
|
|
+ int medicineIndex = drugsCurrentlyInUse.indexOf(medicine);
|
|
|
|
+ int usageIndex = drugsCurrentlyInUse.indexOf(usage);
|
|
|
|
+ int continueUseIndex = drugsCurrentlyInUse.indexOf(continueUse);
|
|
|
|
+ String drug = drugsCurrentlyInUse.substring(medicineIndex + medicine.length() + 1, usageIndex);
|
|
|
|
+ if (StringUtil.isNotBlank(drug)) {
|
|
|
|
+ drug = StringUtil.removeBlank(drug);
|
|
|
|
+ drugs.add(drug);
|
|
|
|
+ }
|
|
|
|
+ drugsCurrentlyInUse = drugsCurrentlyInUse.substring(continueUseIndex + continueUse.length() + 1);
|
|
|
|
+ } else {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return drugs;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private List<String> getDrugFromPresent(List<Medicine> medicines) {
|
|
|
|
+ List<String> drugs = new ArrayList<>();
|
|
|
|
+ String name;
|
|
|
|
+ for (Medicine medicine : medicines) {
|
|
|
|
+ name = medicine.getName();
|
|
|
|
+ if (StringUtil.isNotBlank(name)) {
|
|
|
|
+ drugs.add(name.replaceAll("[“”\"]",""));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return drugs;
|
|
|
|
+ }
|
|
|
|
+}
|