|
@@ -9,6 +9,7 @@ import com.diagbot.dto.RuleBaseDTO;
|
|
|
import com.diagbot.dto.RuleSimpleDTO;
|
|
|
import com.diagbot.dto.WordCrfDTO;
|
|
|
import com.diagbot.enums.BaseDiagnoseTypeEnum;
|
|
|
+import com.diagbot.enums.CommonEnum;
|
|
|
import com.diagbot.enums.ConEnum;
|
|
|
import com.diagbot.enums.LexiconEnum;
|
|
|
import com.diagbot.enums.RedisEnum;
|
|
@@ -28,6 +29,7 @@ import com.diagbot.util.RedisUtil;
|
|
|
import com.diagbot.util.ReflectUtil;
|
|
|
import com.diagbot.util.RegexUtil;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -345,11 +347,16 @@ public class CommonRule {
|
|
|
* @param billMsgList
|
|
|
*/
|
|
|
public void repeat24Bill(WordCrfDTO wordCrfDTO, List<BillMsg> billMsgList) {
|
|
|
- repeat24BillWithType(billMsgList, wordCrfDTO.getLisOrder(), TypeEnum.lis.getName(), ConEnum.repeat24.getName()); // 化验重复开单
|
|
|
- repeat24BillWithType(billMsgList, wordCrfDTO.getPacsOrder(), TypeEnum.pacs.getName(), ConEnum.repeat24.getName()); // 辅检重复开单
|
|
|
+ // 当前开单项与当前开单项重复开立
|
|
|
+ repeat24BillWithOrder(billMsgList, wordCrfDTO.getLisOrder(), TypeEnum.lis.getName(), ConEnum.repeat24.getName()); // 化验重复开单
|
|
|
+ repeat24BillWithOrder(billMsgList, wordCrfDTO.getPacsOrder(), TypeEnum.pacs.getName(), ConEnum.repeat24.getName()); // 辅检重复开单
|
|
|
// repeat24BillWithType(billMsgList, wordCrfDTO.getDrugOrder(), TypeEnum.drug.getName(), ConEnum.repeat24.getName()); // 药品重复开单
|
|
|
// repeat24BillWithType(billMsgList, wordCrfDTO.getOperationOrder(), TypeEnum.operation.getName(), ConEnum.repeat24.getName()); // 手术重复开单
|
|
|
// repeat24BillWithType(billMsgList, wordCrfDTO.getTransfusionOrder(), TypeEnum.transfusion.getName(), ConEnum.repeat24.getName()); // 输血重复开单
|
|
|
+
|
|
|
+ // 当前开单项和结构化开单项重复开立
|
|
|
+ repeat24BillWithStruct(billMsgList, wordCrfDTO.getLisOrder(), wordCrfDTO.getLis(), TypeEnum.lis.getName(), ConEnum.repeat24.getName()); // 化验重复开单
|
|
|
+ repeat24BillWithStruct(billMsgList, wordCrfDTO.getPacsOrder(), wordCrfDTO.getPacs(), TypeEnum.pacs.getName(), ConEnum.repeat24.getName()); // 辅检重复开单
|
|
|
}
|
|
|
|
|
|
// /**
|
|
@@ -430,56 +437,20 @@ public class CommonRule {
|
|
|
* @param ruleSimpleDTO
|
|
|
* @param set 用于记录:A与B不宜同时进行, B与A不宜同时进行 只能提示一个
|
|
|
*/
|
|
|
- public <T> void exclusionBillLis(List<T> orderList, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO, Set<String> set) {
|
|
|
+ public <T> void exclusionBillStruct(List<T> orderList, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO, Set<String> set) {
|
|
|
if (ListUtil.isNotEmpty(orderList)) {
|
|
|
// 不同的项目可能对应同一个uniqueName,提示显示多条
|
|
|
Map<String, List<T>> map = EntityUtil.makeEntityListMap(orderList, "uniqueName");
|
|
|
List<T> orginNameList = map.get(ruleBaseDTO.getBaseLibName());
|
|
|
if (map.get(ruleBaseDTO.getBaseLibName()) != null) {
|
|
|
for (T bean : orginNameList) {
|
|
|
- String detailName = ReflectUtil.getProperty(bean, "detailName");
|
|
|
- if (StringUtil.isBlank(detailName)) { // 获取开单项信息,detail为空,说明是开单项
|
|
|
- String finishDateValue = ReflectUtil.getProperty(bean, "finishDateValue");
|
|
|
- // 报告时间不为空,说明已出报告,可以再次开单
|
|
|
- if (StringUtil.isBlank(finishDateValue)) {
|
|
|
- String orderDateValue = ReflectUtil.getProperty(ruleSimpleDTO, "dateValue");
|
|
|
- String beanDateValue = ReflectUtil.getProperty(bean, "dateValue");
|
|
|
- int dateFlag = CoreUtil.compareTime(beanDateValue, orderDateValue, 24 * 60L, false, false);
|
|
|
- if (dateFlag == 1) {
|
|
|
- String orginName = ReflectUtil.getProperty(bean, "name");
|
|
|
- // A与B不宜同时进行, B与A不宜同时进行 只能提示一个
|
|
|
- // if (!set.contains(ruleSimpleDTO.getLibName() + "******" + orginName)) {
|
|
|
- // set.add(ruleSimpleDTO.getLibName() + "******" + orginName);
|
|
|
- // set.add(orginName + "******" + ruleSimpleDTO.getLibName());
|
|
|
- ruleSimpleDTO.setContent(orginName);
|
|
|
- ruleSimpleDTO.setConType(conType);
|
|
|
- BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
|
|
|
- CoreUtil.addBeanToList(billMsgList, billMsg);
|
|
|
- // }
|
|
|
- }
|
|
|
+ // 化验明细项不为空的数据,说明是细项,舍弃
|
|
|
+ if (TypeEnum.lis.getName().equals(ruleSimpleDTO.getLibTypeName())) {
|
|
|
+ String detailName = ReflectUtil.getProperty(bean, "detailName");
|
|
|
+ if (StringUtil.isNotBlank(detailName)) {
|
|
|
+ continue;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 互斥开单项(结构化辅检)
|
|
|
- *
|
|
|
- * @param orderList 开单列表
|
|
|
- * @param ruleBaseDTO
|
|
|
- * @param billMsgList
|
|
|
- * @param ruleSimpleDTO
|
|
|
- * @param set 用于记录:A与B不宜同时进行, B与A不宜同时进行 只能提示一个
|
|
|
- */
|
|
|
- public <T> void exclusionBillPacs(List<T> orderList, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO, Set<String> set) {
|
|
|
- if (ListUtil.isNotEmpty(orderList)) {
|
|
|
- // 不同的项目可能对应同一个uniqueName,提示显示多条
|
|
|
- Map<String, List<T>> map = EntityUtil.makeEntityListMap(orderList, "uniqueName");
|
|
|
- List<T> orginNameList = map.get(ruleBaseDTO.getBaseLibName());
|
|
|
- if (map.get(ruleBaseDTO.getBaseLibName()) != null) {
|
|
|
- for (T bean : orginNameList) {
|
|
|
String finishDateValue = ReflectUtil.getProperty(bean, "finishDateValue");
|
|
|
// 报告时间不为空,说明已出报告,可以再次开单
|
|
|
if (StringUtil.isBlank(finishDateValue)) {
|
|
@@ -524,7 +495,7 @@ public class CommonRule {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 24小时重复开单入口
|
|
|
+ * 24小时重复开单入口——与开单项比较
|
|
|
*
|
|
|
* @param billMsgList
|
|
|
* @param itemList
|
|
@@ -532,10 +503,11 @@ public class CommonRule {
|
|
|
* @param conType 禁忌条件
|
|
|
* @param <T>
|
|
|
*/
|
|
|
- public <T> void repeat24BillWithType(List<BillMsg> billMsgList, List<T> itemList, String type, String conType) {
|
|
|
+ public <T> void repeat24BillWithOrder(List<BillMsg> billMsgList, List<T> itemList, String type, String conType) {
|
|
|
if (ListUtil.isEmpty(itemList)) {
|
|
|
return;
|
|
|
}
|
|
|
+ // name+uniqueName 作为key(备注:标准名称相同,医院名称不同,认为是不同的开单项)
|
|
|
Map<String, List<T>> map = CoreUtil.makeEntityListMap(itemList, "name", "uniqueName");
|
|
|
for (String key : map.keySet()) {
|
|
|
List<T> items = map.get(key);
|
|
@@ -556,12 +528,7 @@ public class CommonRule {
|
|
|
.equals(getFrquenceType(ReflectUtil.getProperty(itNext, "frequency")))) {
|
|
|
String name = (String) CoreUtil.getFieldValue(it, "name");
|
|
|
String uniqueName = (String) CoreUtil.getFieldValue(it, "uniqueName");
|
|
|
- RuleSimpleDTO ruleSimpleDTO = new RuleSimpleDTO();
|
|
|
- ruleSimpleDTO.setInputName(name);
|
|
|
- ruleSimpleDTO.setLibName(uniqueName);
|
|
|
- ruleSimpleDTO.setLibTypeName(type);
|
|
|
- ruleSimpleDTO.setContent(name);
|
|
|
- ruleSimpleDTO.setConType(ConEnum.repeat24.getName());
|
|
|
+ RuleSimpleDTO ruleSimpleDTO = new RuleSimpleDTO(name, uniqueName, type, name, conType);
|
|
|
BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
|
|
|
CoreUtil.addBeanToList(billMsgList, billMsg);
|
|
|
break;
|
|
@@ -574,6 +541,56 @@ public class CommonRule {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 24小时重复开单——与结构化比较
|
|
|
+ *
|
|
|
+ * @param billMsgList
|
|
|
+ * @param orderList
|
|
|
+ * @param itemList
|
|
|
+ * @param type
|
|
|
+ * @param conType
|
|
|
+ * @param <T>
|
|
|
+ */
|
|
|
+ public <T> void repeat24BillWithStruct(List<BillMsg> billMsgList, List<T> orderList, List<T> itemList, String type, String conType) {
|
|
|
+ if (ListUtil.isEmpty(itemList) || ListUtil.isEmpty(orderList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // name+uniqueName 作为key(备注:标准名称相同,医院名称不同,认为是不同的开单项)
|
|
|
+ Map<String, List<T>> map = CoreUtil.makeEntityListMap(itemList, "name", "uniqueName");
|
|
|
+ for (T order : orderList) {
|
|
|
+ String orderName = ReflectUtil.getProperty(order, "name");
|
|
|
+ String orderUniqueName = ReflectUtil.getProperty(order, "uniqueName");
|
|
|
+ List<T> items = map.get(orderName + CommonEnum.splitSymbol.getName() + orderUniqueName);
|
|
|
+ if (ListUtil.isNotEmpty(items)) {
|
|
|
+ for (T it : items) {
|
|
|
+ // 化验明细项不为空的数据,说明是细项,舍弃
|
|
|
+ if (TypeEnum.lis.getName().equals(type)) {
|
|
|
+ String detailName = ReflectUtil.getProperty(order, "detailName");
|
|
|
+ if (StringUtil.isNotBlank(detailName)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String finishDateValue = ReflectUtil.getProperty(it, "finishDateValue");
|
|
|
+ // 报告时间不为空,说明已出报告,可以再次开单
|
|
|
+ if (StringUtil.isBlank(finishDateValue)) {
|
|
|
+ String curDateValue = ReflectUtil.getProperty(order, "dateValue"); // 当前开单时间
|
|
|
+ String pastDateValue = ReflectUtil.getProperty(it, "dateValue"); // 历史开单时间
|
|
|
+ int dateFlag = CoreUtil.compareTime(pastDateValue, curDateValue, 24 * 60L, false, false);
|
|
|
+ // 规定时间内,并且频次相同
|
|
|
+ if (dateFlag == 1 &&
|
|
|
+ getFrquenceType(ReflectUtil.getProperty(it, "frequency"))
|
|
|
+ .equals(getFrquenceType(ReflectUtil.getProperty(it, "frequency")))) {
|
|
|
+ RuleSimpleDTO ruleSimpleDTO = new RuleSimpleDTO(orderName, orderUniqueName, type, orderName, conType);
|
|
|
+ BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
|
|
|
+ CoreUtil.addBeanToList(billMsgList, billMsg);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 高风险药品、手术
|
|
|
*
|
|
@@ -664,7 +681,14 @@ public class CommonRule {
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
- CommonRule commonRule = new CommonRule();
|
|
|
- System.out.println(commonRule.getFrquenceType(null));
|
|
|
+ List<Lis> lisList = Lists.newArrayList();
|
|
|
+ Lis lis = new Lis();
|
|
|
+ lis.setName("血常规");
|
|
|
+ lis.setUniqueName(null);
|
|
|
+ lisList.add(lis);
|
|
|
+ Map<String, List<Lis>> map = lisList.stream().collect(Collectors.groupingBy(r -> {
|
|
|
+ return "333";
|
|
|
+ }));
|
|
|
+ System.out.println(map);
|
|
|
}
|
|
|
}
|