|
@@ -1,14 +1,20 @@
|
|
package com.diagbot.rule;
|
|
package com.diagbot.rule;
|
|
|
|
|
|
import com.diagbot.biz.push.entity.Pacs;
|
|
import com.diagbot.biz.push.entity.Pacs;
|
|
|
|
+import com.diagbot.dto.BillMsg;
|
|
import com.diagbot.dto.IndicationDTO;
|
|
import com.diagbot.dto.IndicationDTO;
|
|
|
|
+import com.diagbot.dto.NodeNeoDTO;
|
|
import com.diagbot.dto.WordCrfDTO;
|
|
import com.diagbot.dto.WordCrfDTO;
|
|
|
|
+import com.diagbot.util.CoreUtil;
|
|
import com.diagbot.util.ListUtil;
|
|
import com.diagbot.util.ListUtil;
|
|
import com.diagbot.util.StringUtil;
|
|
import com.diagbot.util.StringUtil;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @description: 特殊规则
|
|
* @description: 特殊规则
|
|
@@ -19,25 +25,84 @@ import java.util.List;
|
|
public class OtherRule {
|
|
public class OtherRule {
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 70岁及以上开内镜检查时,需要做心电图检查
|
|
|
|
|
|
+ * 70岁及以上开【内镜检查】时,需要先做【心电图检查】
|
|
*
|
|
*
|
|
* @param wordCrfDTO
|
|
* @param wordCrfDTO
|
|
* @param res
|
|
* @param res
|
|
*/
|
|
*/
|
|
- public void otherRule(WordCrfDTO wordCrfDTO, IndicationDTO res) {
|
|
|
|
|
|
+ public void ecgRule(WordCrfDTO wordCrfDTO, IndicationDTO res) {
|
|
if (wordCrfDTO.getAgeNum() != null && wordCrfDTO.getAgeNum() >= 70) {
|
|
if (wordCrfDTO.getAgeNum() != null && wordCrfDTO.getAgeNum() >= 70) {
|
|
- List<Pacs> pacsOrder = wordCrfDTO.getPacsOrder();
|
|
|
|
- if (ListUtil.isNotEmpty(pacsOrder)) {
|
|
|
|
- List<String> orderNameList = Lists.newArrayList("胃镜"); // 内镜检查
|
|
|
|
- List<String> ecgList = Lists.newArrayList("心电图"); // 心电图检查
|
|
|
|
- for (Pacs pacs : pacsOrder) {
|
|
|
|
|
|
+ List<Pacs> pacsOrderList = wordCrfDTO.getPacsOrder();
|
|
|
|
+ if (ListUtil.isNotEmpty(pacsOrderList)) {
|
|
|
|
+ List<String> orderNameList = Lists.newArrayList("胃镜"); // 医院内镜检查列表
|
|
|
|
+ List<String> ecgList = Lists.newArrayList("心电图"); // 医院心电图检查列表
|
|
|
|
+ List<Pacs> pacsList = wordCrfDTO.getPacs();
|
|
|
|
+ for (Pacs pacs : pacsOrderList) {
|
|
String ordreName = pacs.getName();
|
|
String ordreName = pacs.getName();
|
|
if (StringUtil.isNotBlank(ordreName) && orderNameList.contains(ordreName)) {
|
|
if (StringUtil.isNotBlank(ordreName) && orderNameList.contains(ordreName)) {
|
|
- // TODO 检查时效内辅检
|
|
|
|
-
|
|
|
|
|
|
+ boolean flag = true; // 时效内做过心电图检查标识,false:是,true:否
|
|
|
|
+ for (Pacs pa : pacsList) {
|
|
|
|
+ if (StringUtil.isNotBlank(pa.getName()) && ecgList.contains(pa.getName())) {
|
|
|
|
+ Date ecgDate = StringUtil.parseDateTime(pa.getDateValue()); // 心电图检查时间
|
|
|
|
+ Date orderDate = StringUtil.parseDateTime(pacs.getDateValue()); // 开单时间
|
|
|
|
+ // 时间未传,数据无效
|
|
|
|
+ if (ecgDate != null && orderDate != null) {
|
|
|
|
+ // 超过时效需要再次做心电图检查
|
|
|
|
+ if (!CoreUtil.compareTime(ecgDate, orderDate, 60L * 24, true)) {
|
|
|
|
+ flag = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (flag) {
|
|
|
|
+ BillMsg billMsg = new BillMsg();
|
|
|
|
+ billMsg.setOrderName(ordreName);
|
|
|
|
+ billMsg.setMsg(String.format("该患者%s,开%s时,建议先做心电图检查",
|
|
|
|
+ CoreUtil.subZeroAndDot(String.valueOf(wordCrfDTO.getAgeNum())), ordreName));
|
|
|
|
+ res.getBillMsgList().add(billMsg);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 药品开单:【去甲肾上腺素】,收缩压大于140mmHg 或者舒张压大于90mmHg ,不宜开去甲肾上腺素
|
|
|
|
+ *
|
|
|
|
+ * @param wordCrfDTO
|
|
|
|
+ * @param res
|
|
|
|
+ */
|
|
|
|
+ public void qjssxsRule(WordCrfDTO wordCrfDTO, IndicationDTO res) {
|
|
|
|
+ // 特殊值处理
|
|
|
|
+ List<String> drugNameList = CoreUtil.getPropertyList(wordCrfDTO.getDrugOrder(), "name");
|
|
|
|
+ String drugOrderName = "去甲肾上腺素";
|
|
|
|
+ if (drugNameList.contains(drugOrderName)) {
|
|
|
|
+ // 体征数值比较(例如:体温,血压)
|
|
|
|
+ NodeNeoDTO ssyNode = new NodeNeoDTO();
|
|
|
|
+ ssyNode.setName("收缩压");
|
|
|
|
+ // ssyNode.setMax(new BigDecimal(100));
|
|
|
|
+ ssyNode.setMin(new BigDecimal(140));
|
|
|
|
+ Map<String, Object> objectMap = CoreUtil.compareVital(ssyNode, wordCrfDTO.getVitalLabel());
|
|
|
|
+ if (CoreUtil.getMapFlag(objectMap)) {
|
|
|
|
+ BillMsg billMsg = new BillMsg();
|
|
|
|
+ billMsg.setOrderName(drugOrderName);
|
|
|
|
+ billMsg.setMsg(String.format("该患者%s,不宜开%s", objectMap.get("msg"), drugOrderName));
|
|
|
|
+ res.getBillMsgList().add(billMsg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ NodeNeoDTO szyNode = new NodeNeoDTO();
|
|
|
|
+ szyNode.setName("舒张压");
|
|
|
|
+ // szyNode.setMax(new BigDecimal(100));
|
|
|
|
+ szyNode.setMin(new BigDecimal(90));
|
|
|
|
+ objectMap = CoreUtil.compareVital(szyNode, wordCrfDTO.getVitalLabel());
|
|
|
|
+ if (CoreUtil.getMapFlag(objectMap)) {
|
|
|
|
+ BillMsg billMsg = new BillMsg();
|
|
|
|
+ billMsg.setOrderName(drugOrderName);
|
|
|
|
+ billMsg.setMsg(String.format("该患者%s,不宜开%s", objectMap.get("msg"), drugOrderName));
|
|
|
|
+ res.getBillMsgList().add(billMsg);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|