|
@@ -0,0 +1,134 @@
|
|
|
+package com.diagbot.rule;
|
|
|
+
|
|
|
+import com.diagbot.biz.push.entity.Item;
|
|
|
+import com.diagbot.biz.push.entity.Pacs;
|
|
|
+import com.diagbot.dto.BillMsg;
|
|
|
+import com.diagbot.dto.IndicationDTO;
|
|
|
+import com.diagbot.dto.RuleSimpleDTO;
|
|
|
+import com.diagbot.dto.WordCrfDTO;
|
|
|
+import com.diagbot.enums.ConEnum;
|
|
|
+import com.diagbot.enums.RedisEnum;
|
|
|
+import com.diagbot.enums.TypeEnum;
|
|
|
+import com.diagbot.model.entity.AllergyMedicine;
|
|
|
+import com.diagbot.model.entity.Negative;
|
|
|
+import com.diagbot.model.label.PastLabel;
|
|
|
+import com.diagbot.util.CoreUtil;
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
+import com.diagbot.util.MsgNewUtil;
|
|
|
+import com.diagbot.util.RedisUtil;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
+import com.diagbot.vo.Drug;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @description: 其他特殊规则
|
|
|
+ * @author: zhoutg
|
|
|
+ * @time: 2020/8/3 14:47
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class OtherRule {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ MsgNewUtil msgNewUtil;
|
|
|
+ @Autowired
|
|
|
+ RedisUtil redisUtil;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 过敏原自身过敏,如果规则已维护,就不再比较;如果没有维护,比较是否与自身过敏
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public void allergy(WordCrfDTO wordCrfDTO, IndicationDTO res) {
|
|
|
+ // 药物过敏源
|
|
|
+ PastLabel pastLabel = wordCrfDTO.getPastLabel();
|
|
|
+ List<AllergyMedicine> allergyMedicines = pastLabel.getAllergyMedicines();
|
|
|
+ if (ListUtil.isEmpty(wordCrfDTO.getDrugOrder()) || ListUtil.isEmpty(allergyMedicines)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 获取已维护的自身过敏规则,如果包含standName就不用再比较
|
|
|
+ Map<String, Integer> allergyMap = redisUtil.get(RedisEnum.drugAllergen.getName());
|
|
|
+ for (Drug drug : wordCrfDTO.getDrugOrder()) {
|
|
|
+ for (AllergyMedicine allergy : allergyMedicines) {
|
|
|
+ String name = allergy.getName();
|
|
|
+ String standName = allergy.getStandName();
|
|
|
+ Negative negative = allergy.getNegative(); // null表示阳性
|
|
|
+ if (allergyMap == null || !allergyMap.containsKey(standName)) {
|
|
|
+ // 执行到这里说明自身过敏的规则没有维护
|
|
|
+ if (negative == null && StringUtil.isNotBlank(drug.getUniqueName()) && drug.getUniqueName().equals(standName)) {
|
|
|
+ RuleSimpleDTO ruleSimpleDTO = new RuleSimpleDTO();
|
|
|
+ ruleSimpleDTO.setInputName(drug.getName());
|
|
|
+ ruleSimpleDTO.setLibName(drug.getUniqueName());
|
|
|
+ ruleSimpleDTO.setLibTypeName(TypeEnum.drug.getName());
|
|
|
+ ruleSimpleDTO.setContent(name);
|
|
|
+ ruleSimpleDTO.setConType(ConEnum.allergicmeds.getName());
|
|
|
+ BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
|
|
|
+ CoreUtil.addBeanToList(res.getBillMsgList(), billMsg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 七院需求:
|
|
|
+ * 非阻塞性睡眠呼吸暂停综合征和非混合性睡眠呼吸暂停综合征,不宜同时开立呼吸睡眠监测和眼电图(EOG)
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public void smhxjcAndYdteog(WordCrfDTO wordCrfDTO, IndicationDTO res) {
|
|
|
+ // 七院特有
|
|
|
+ if (6 != wordCrfDTO.getHospitalId()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 1、比较是否包含2种诊断
|
|
|
+ List<Item> diagAllList = wordCrfDTO.getDiag(); // 结构化诊断
|
|
|
+ List<String> zsxList = Lists.newArrayList();// 阻塞性睡眠呼吸暂停综合征医院名称
|
|
|
+ List<String> hhxList = Lists.newArrayList();// 混合性睡眠呼吸暂停综合征医院名称
|
|
|
+ for (Item item : diagAllList) {
|
|
|
+ if ("阻塞性睡眠呼吸暂停综合征".equals(item.getUniqueName())) {
|
|
|
+ zsxList.add(item.getName());
|
|
|
+ } else if ("混合性睡眠呼吸暂停综合征".equals(item.getUniqueName())) {
|
|
|
+ hhxList.add((item.getName()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 如果两种疾病有其一,就不提示
|
|
|
+ if (ListUtil.isNotEmpty(zsxList) || ListUtil.isNotEmpty(hhxList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2、比较是否包含2种辅检开单项
|
|
|
+ List<Pacs> pacsList = wordCrfDTO.getPacsOrder(); // 辅检开单项
|
|
|
+ List<String> hxsmjcList = Lists.newArrayList();// 呼吸睡眠监测医院名称
|
|
|
+ List<String> ydteogList = Lists.newArrayList();// 眼电图(EOG)医院名称
|
|
|
+ for (Pacs pacs : pacsList) {
|
|
|
+ if ("呼吸睡眠监测".equals(pacs.getUniqueName())) {
|
|
|
+ hxsmjcList.add(pacs.getName());
|
|
|
+ } else if ("眼电图(EOG)".equals(pacs.getUniqueName())) {
|
|
|
+ ydteogList.add(pacs.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 辅检开单项必须有两个,否则就不提示
|
|
|
+ if (ListUtil.isEmpty(hxsmjcList) || ListUtil.isEmpty(ydteogList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 3、提示语组合
|
|
|
+ List<BillMsg> billMsgList = res.getBillMsgList();
|
|
|
+ for (String hxsm : hxsmjcList) {
|
|
|
+ for (String ydt : ydteogList) {
|
|
|
+ BillMsg billMsg = new BillMsg();
|
|
|
+ billMsg.setType(TypeEnum.pacs.getName());
|
|
|
+ billMsg.setMsg(String.format("非阻塞性睡眠呼吸暂停综合征和非混合性睡眠呼吸暂停综合征患者,不宜同时开立%s和%s",
|
|
|
+ hxsm, ydt));
|
|
|
+ billMsgList.add(billMsg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|