|
@@ -1,10 +1,12 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.diagbot.dto.BillMsg;
|
|
|
import com.diagbot.entity.MappingShortEntity;
|
|
|
import com.diagbot.entity.ResultBill;
|
|
|
import com.diagbot.entity.ResultCritical;
|
|
|
import com.diagbot.entity.ResultHighriskDrug;
|
|
|
+import com.diagbot.entity.ResultHighriskOperation;
|
|
|
import com.diagbot.entity.node.BillItem;
|
|
|
import com.diagbot.entity.node.LisCritical;
|
|
|
import com.diagbot.entity.node.LisName;
|
|
@@ -12,6 +14,7 @@ import com.diagbot.entity.node.MedNameRegName;
|
|
|
import com.diagbot.entity.node.MedRegName;
|
|
|
import com.diagbot.entity.node.PacsCritical;
|
|
|
import com.diagbot.entity.node.TransfusionRemind;
|
|
|
+import com.diagbot.entity.node.YiBaoOperationName;
|
|
|
import com.diagbot.enums.GraphLabelEnum;
|
|
|
import com.diagbot.enums.StatusEnum;
|
|
|
import com.diagbot.enums.TypeEnum;
|
|
@@ -24,10 +27,12 @@ import com.diagbot.util.StringUtil;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -59,6 +64,7 @@ public class RuleConvertFacade {
|
|
|
|
|
|
/**
|
|
|
* 开单规则转换
|
|
|
+ *
|
|
|
* @param billItems
|
|
|
* @param hospitalId
|
|
|
* @return
|
|
@@ -291,11 +297,12 @@ public class RuleConvertFacade {
|
|
|
|
|
|
/**
|
|
|
* 开单规则转换-输血
|
|
|
+ *
|
|
|
* @param items
|
|
|
* @param hospitalId
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<ResultBill> billRuleConvert_transfusion(List<TransfusionRemind> items,Long hospitalId) {
|
|
|
+ public List<ResultBill> billRuleConvert_transfusion(List<TransfusionRemind> items, Long hospitalId) {
|
|
|
List<ResultBill> retList = Lists.newLinkedList();
|
|
|
List<ResultBill> resultBillList = Lists.newLinkedList();
|
|
|
List<ResultBill> retBillList = Lists.newArrayList();
|
|
@@ -403,11 +410,12 @@ public class RuleConvertFacade {
|
|
|
|
|
|
/**
|
|
|
* 危急值规则转换-检验
|
|
|
+ *
|
|
|
* @param items
|
|
|
* @param hospitalId
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<ResultCritical> criticalRuleConvert_lis(List<LisCritical> items,Long hospitalId) {
|
|
|
+ public List<ResultCritical> criticalRuleConvert_lis(List<LisCritical> items, Long hospitalId) {
|
|
|
List<ResultCritical> retList = Lists.newLinkedList();
|
|
|
List<ResultCritical> resultList = Lists.newLinkedList();
|
|
|
List<ResultCritical> resultMappingList = Lists.newArrayList();
|
|
@@ -489,11 +497,12 @@ public class RuleConvertFacade {
|
|
|
|
|
|
/**
|
|
|
* 危急值规则转换-检查
|
|
|
+ *
|
|
|
* @param items
|
|
|
* @param hospitalId
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<ResultCritical> criticalRuleConvert_pacs(List<PacsCritical> items,Long hospitalId) {
|
|
|
+ public List<ResultCritical> criticalRuleConvert_pacs(List<PacsCritical> items, Long hospitalId) {
|
|
|
List<ResultCritical> retList = Lists.newLinkedList();
|
|
|
List<ResultCritical> resultList = Lists.newLinkedList();
|
|
|
List<ResultCritical> resultMappingList = Lists.newArrayList();
|
|
@@ -538,11 +547,12 @@ public class RuleConvertFacade {
|
|
|
|
|
|
/**
|
|
|
* 高危药品转换
|
|
|
+ *
|
|
|
* @param items
|
|
|
* @param hospitalId
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<ResultHighriskDrug> highriskRuleConvert_drug(List<MedRegName> items,Long hospitalId) {
|
|
|
+ public List<ResultHighriskDrug> highriskRuleConvert_drug(List<MedRegName> items, Long hospitalId) {
|
|
|
List<ResultHighriskDrug> retList = Lists.newLinkedList();
|
|
|
List<ResultHighriskDrug> retMedList = Lists.newLinkedList();
|
|
|
List<ResultHighriskDrug> retMappingList = Lists.newLinkedList();
|
|
@@ -617,6 +627,324 @@ public class RuleConvertFacade {
|
|
|
return retList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 高危手术转换
|
|
|
+ *
|
|
|
+ * @param items
|
|
|
+ * @param hospitalId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<ResultHighriskOperation> highriskRuleConvert_operation(List<YiBaoOperationName> items, Long hospitalId) {
|
|
|
+ List<ResultHighriskOperation> retList = Lists.newLinkedList();
|
|
|
+ List<ResultHighriskOperation> retOptList = Lists.newLinkedList();
|
|
|
+ List<ResultHighriskOperation> retMappingList = Lists.newLinkedList();
|
|
|
+ List<ResultHighriskOperation> retFactorMappingList = Lists.newLinkedList();
|
|
|
+
|
|
|
+ Map<String, Map<String, Map<String, List<Long>>>> lisConfigMap = lisConfigFacade.getUniqueConfigMap(hospitalId, null, null);
|
|
|
+ Map<String, Map<String, List<Long>>> diseaseConfigMap = diseaseConfigFacade.getUniqueConfigMap(hospitalId, null, null);
|
|
|
+ Map<String, Map<String, List<Long>>> operationConfigMap = operationConfigFacade.getUniqueConfigMap(hospitalId, null, null);
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(items)) {
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> conds = items.stream().map(i -> i.getHighriskcond()).filter(i -> StringUtil.isNotBlank(i)).distinct().collect(Collectors.toList());
|
|
|
+ Map<Integer, Map<String, Object>> condMap = new LinkedHashMap<>();
|
|
|
+ if (ListUtil.isNotEmpty(conds)) {
|
|
|
+ for (String cond : conds) {
|
|
|
+ condMap.putAll(getHighriskCondMap(cond));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //转换高危手术记录
|
|
|
+ Integer condIndex = 0;
|
|
|
+ for (YiBaoOperationName item : items) {
|
|
|
+ //非高危手术
|
|
|
+ if (StringUtil.isBlank(item.getOpgrade()) || item.getOpgrade().equals("0") || item.getOpgrade().equals("1")) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ ResultHighriskOperation result = new ResultHighriskOperation();
|
|
|
+ result.setHighriskItemName(item.getName());
|
|
|
+ result.setLevel(item.getOpgrade());
|
|
|
+ //带条件高危手术
|
|
|
+ if (item.getOpgrade().equals("2")) {
|
|
|
+ if (condMap == null || condMap.size() == 0||StringUtil.isBlank(item.getHighriskcond())) {
|
|
|
+ result.setSuccess(0);
|
|
|
+ result.setMessage("缺少高危条件");
|
|
|
+ retOptList.add(result);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ result.setFactorItemCond(item.getHighriskcond());
|
|
|
+ Map<String, Object> subCondMap = condMap.get(condIndex++);
|
|
|
+ if (condIndex.equals(condMap.size())) {
|
|
|
+ condIndex = 0;
|
|
|
+ }
|
|
|
+ String type = subCondMap.get("type").toString();
|
|
|
+ if (type.equals(TypeEnum.age.getName())) {
|
|
|
+ ResultHighriskOperation ageResult = new ResultHighriskOperation();
|
|
|
+ BeanUtil.copyProperties(result, ageResult);
|
|
|
+ ageResult.setFactorItemType(TypeEnum.age.getName());
|
|
|
+ ageResult.setFactorItemName(subCondMap.get("name").toString());
|
|
|
+ if (subCondMap.containsKey("最大值")) {
|
|
|
+ ageResult.setFactorItemMaxValue((BigDecimal) subCondMap.get("最大值"));
|
|
|
+ }
|
|
|
+ if (subCondMap.containsKey("最小值")) {
|
|
|
+ ageResult.setFactorItemMinValue((BigDecimal) subCondMap.get("最小值"));
|
|
|
+ }
|
|
|
+ if (subCondMap.containsKey("单位")) {
|
|
|
+ ageResult.setFactorItemUnit(subCondMap.get("单位").toString());
|
|
|
+ }
|
|
|
+ if (subCondMap.containsKey("范围")) {
|
|
|
+ ageResult.setFactorItemRange((Integer) subCondMap.get("范围"));
|
|
|
+ }
|
|
|
+ retOptList.add(ageResult);
|
|
|
+ } else if (type.equals(TypeEnum.vital.getName())) {
|
|
|
+ ResultHighriskOperation vitalResult = new ResultHighriskOperation();
|
|
|
+ BeanUtil.copyProperties(result, vitalResult);
|
|
|
+ vitalResult.setFactorItemName(subCondMap.get("name").toString());
|
|
|
+ vitalResult.setFactorItemType(TypeEnum.vital.getName());
|
|
|
+ if (subCondMap.containsKey("最大值")) {
|
|
|
+ vitalResult.setFactorItemMaxValue((BigDecimal) subCondMap.get("最大值"));
|
|
|
+ }
|
|
|
+ if (subCondMap.containsKey("最小值")) {
|
|
|
+ vitalResult.setFactorItemMinValue((BigDecimal) subCondMap.get("最小值"));
|
|
|
+ }
|
|
|
+ if (subCondMap.containsKey("单位")) {
|
|
|
+ vitalResult.setFactorItemUnit((String) subCondMap.get("单位"));
|
|
|
+ }
|
|
|
+ if (subCondMap.containsKey("范围")) {
|
|
|
+ vitalResult.setFactorItemRange((Integer) subCondMap.get("范围"));
|
|
|
+ }
|
|
|
+ retOptList.add(vitalResult);
|
|
|
+ } else if (type.equals(TypeEnum.disease.getName())) {
|
|
|
+ ResultHighriskOperation diagResult = new ResultHighriskOperation();
|
|
|
+ BeanUtil.copyProperties(result, diagResult);
|
|
|
+ diagResult.setFactorItemType(TypeEnum.disease.getName());
|
|
|
+ diagResult.setFactorItemName(subCondMap.get("name").toString());
|
|
|
+ retOptList.add(diagResult);
|
|
|
+ } else if (type.equals(TypeEnum.lis.getName())) {
|
|
|
+ ResultHighriskOperation lisResult = new ResultHighriskOperation();
|
|
|
+ BeanUtil.copyProperties(result, lisResult);
|
|
|
+ lisResult.setFactorItemType(TypeEnum.lis.getName());
|
|
|
+ lisResult.setFactorItemName(subCondMap.get("name").toString());
|
|
|
+ if (subCondMap.containsKey("最大值")) {
|
|
|
+ lisResult.setFactorItemMaxValue((BigDecimal) subCondMap.get("最大值"));
|
|
|
+ }
|
|
|
+ if (subCondMap.containsKey("最小值")) {
|
|
|
+ lisResult.setFactorItemMinValue((BigDecimal) subCondMap.get("最小值"));
|
|
|
+ }
|
|
|
+ if (subCondMap.containsKey("单位")) {
|
|
|
+ lisResult.setFactorItemUnit((String) subCondMap.get("单位"));
|
|
|
+ }
|
|
|
+ if (subCondMap.containsKey("范围")) {
|
|
|
+ lisResult.setFactorItemRange((Integer) subCondMap.get("范围"));
|
|
|
+ }
|
|
|
+ if (subCondMap.containsKey("结果")) {
|
|
|
+ lisResult.setInputValue((String) subCondMap.get("结果"));
|
|
|
+ }
|
|
|
+ retOptList.add(lisResult);
|
|
|
+ } else if (type.equals(TypeEnum.pacsDecs.getName())) {
|
|
|
+ ResultHighriskOperation pacsDescResult = new ResultHighriskOperation();
|
|
|
+ BeanUtil.copyProperties(result, pacsDescResult);
|
|
|
+ pacsDescResult.setFactorItemType(TypeEnum.pacsDecs.getName());
|
|
|
+ pacsDescResult.setInputValue(subCondMap.get("name").toString());
|
|
|
+ retOptList.add(pacsDescResult);
|
|
|
+ }
|
|
|
+ /* String highriskcond = item.getHighriskcond();
|
|
|
+ JSONObject jobj = JSONObject.parseObject(highriskcond);
|
|
|
+ if (null != jobj) {
|
|
|
+ // 判断年龄
|
|
|
+ JSONObject ageobj = jobj.getJSONObject("年龄");
|
|
|
+ if (ageobj != null) {
|
|
|
+ ResultHighriskOperation ageResult = new ResultHighriskOperation();
|
|
|
+ BeanUtil.copyProperties(result, ageResult);
|
|
|
+ ageResult.setFactorItemType(TypeEnum.age.getName());
|
|
|
+ ageResult.setFactorItemName("年龄");
|
|
|
+ if (ageobj.containsKey("最大值")) {
|
|
|
+ ageResult.setFactorItemMaxValue(ageobj.getBigDecimal("最大值"));
|
|
|
+ }
|
|
|
+ if (ageobj.containsKey("最小值")) {
|
|
|
+ ageResult.setFactorItemMinValue(ageobj.getBigDecimal("最小值"));
|
|
|
+ }
|
|
|
+ if (ageobj.containsKey("单位")) {
|
|
|
+ ageResult.setFactorItemUnit(ageobj.getString("单位"));
|
|
|
+ }
|
|
|
+ if (ageobj.containsKey("范围")) {
|
|
|
+ ageResult.setFactorItemRange(ageobj.getInteger("范围"));
|
|
|
+ }
|
|
|
+ retOptList.add(ageResult);
|
|
|
+ }
|
|
|
+ // 判断生命体征和查体
|
|
|
+ JSONObject vitalObj = jobj.getJSONObject("生命体征及查体");
|
|
|
+ if (null != vitalObj) {
|
|
|
+ for (Map.Entry<String, Object> entry : vitalObj.entrySet()) {
|
|
|
+ ResultHighriskOperation vitalResult = new ResultHighriskOperation();
|
|
|
+ BeanUtil.copyProperties(result, vitalResult);
|
|
|
+ vitalResult.setFactorItemName(entry.getKey());
|
|
|
+ vitalResult.setFactorItemType(TypeEnum.vital.getName());
|
|
|
+ if (ObjectUtils.isEmpty(entry.getValue())) {
|
|
|
+ retOptList.add(vitalResult);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ JSONObject subVitalObj = (JSONObject) entry.getValue();
|
|
|
+ if (null != subVitalObj) {
|
|
|
+ if (subVitalObj.containsKey("最大值")) {
|
|
|
+ vitalResult.setFactorItemMaxValue(subVitalObj.getBigDecimal("最大值"));
|
|
|
+ }
|
|
|
+ if (subVitalObj.containsKey("最小值")) {
|
|
|
+ vitalResult.setFactorItemMinValue(subVitalObj.getBigDecimal("最小值"));
|
|
|
+ }
|
|
|
+ if (subVitalObj.containsKey("单位")) {
|
|
|
+ vitalResult.setFactorItemUnit(subVitalObj.getString("单位"));
|
|
|
+ }
|
|
|
+ if (subVitalObj.containsKey("范围")) {
|
|
|
+ vitalResult.setFactorItemRange(subVitalObj.getInteger("范围"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ retOptList.add(vitalResult);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 判断合并疾病
|
|
|
+ JSONObject diagobj = jobj.getJSONObject("合并疾病");
|
|
|
+ if (null != diagobj) {
|
|
|
+ for (Map.Entry<String, Object> entry : diagobj.entrySet()) {
|
|
|
+ ResultHighriskOperation diagResult = new ResultHighriskOperation();
|
|
|
+ BeanUtil.copyProperties(result, diagResult);
|
|
|
+ diagResult.setFactorItemType(TypeEnum.disease.getName());
|
|
|
+ diagResult.setFactorItemName(entry.getKey());
|
|
|
+ retOptList.add(diagResult);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 判断化验结果
|
|
|
+ JSONObject lisobj = jobj.getJSONObject("化验结果");
|
|
|
+ if (null != lisobj) {
|
|
|
+ for (Map.Entry<String, Object> entry : lisobj.entrySet()) {
|
|
|
+ ResultHighriskOperation lisResult = new ResultHighriskOperation();
|
|
|
+ BeanUtil.copyProperties(result, lisResult);
|
|
|
+ lisResult.setFactorItemType(TypeEnum.lis.getName());
|
|
|
+ lisResult.setFactorItemName(entry.getKey());
|
|
|
+ if (ObjectUtils.isEmpty(entry.getValue())) {
|
|
|
+ retOptList.add(lisResult);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ JSONObject subLisObj = (JSONObject) entry.getValue();
|
|
|
+ if (null != subLisObj) {
|
|
|
+ if (subLisObj.containsKey("最大值")) {
|
|
|
+ lisResult.setFactorItemMaxValue(subLisObj.getBigDecimal("最大值"));
|
|
|
+ }
|
|
|
+ if (subLisObj.containsKey("最小值")) {
|
|
|
+ lisResult.setFactorItemMinValue(subLisObj.getBigDecimal("最小值"));
|
|
|
+ }
|
|
|
+ if (subLisObj.containsKey("单位")) {
|
|
|
+ lisResult.setFactorItemUnit(subLisObj.getString("单位"));
|
|
|
+ }
|
|
|
+ if (subLisObj.containsKey("范围")) {
|
|
|
+ lisResult.setFactorItemRange(subLisObj.getInteger("范围"));
|
|
|
+ }
|
|
|
+ if (subLisObj.containsKey("结果")) {
|
|
|
+ lisResult.setInputValue(subLisObj.getString("结果"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ retOptList.add(lisResult);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 判断辅检结果,暂不处理
|
|
|
+ JSONObject pacsObj = jobj.getJSONObject("辅检结果");
|
|
|
+ // 判断辅检结果描述
|
|
|
+ JSONObject pacsDescObj = jobj.getJSONObject("辅检结果描述");
|
|
|
+ if (null != pacsDescObj) {
|
|
|
+ for (Map.Entry<String, Object> entry : pacsDescObj.entrySet()) {
|
|
|
+ ResultHighriskOperation pacsDescResult = new ResultHighriskOperation();
|
|
|
+ BeanUtil.copyProperties(result, pacsDescResult);
|
|
|
+ pacsDescResult.setFactorItemType(TypeEnum.pacsDecs.getName());
|
|
|
+ pacsDescResult.setFactorItemName("胸部CT");
|
|
|
+ pacsDescResult.setFactorItemHisName("胸部CT");
|
|
|
+ pacsDescResult.setInputValue(entry.getKey());
|
|
|
+ retOptList.add(pacsDescResult);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+ } else {
|
|
|
+ retOptList.add(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //手术名称映射
|
|
|
+ for (ResultHighriskOperation result : retOptList) {
|
|
|
+ Map<String, List<Long>> subMap = operationConfigMap.get(result.getHighriskItemName());
|
|
|
+ if (subMap != null && subMap.size() > 0) {
|
|
|
+ subMap.keySet().forEach(hisName -> {
|
|
|
+ ResultHighriskOperation resultExt = new ResultHighriskOperation();
|
|
|
+ BeanUtil.copyProperties(result, resultExt);
|
|
|
+ resultExt.setHighriskItemHisName(hisName);
|
|
|
+ retMappingList.add(resultExt);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ result.setSuccess(0);
|
|
|
+ result.setMessage((StringUtil.isNotBlank(result.getMessage()) ? result.getMessage() : "") +
|
|
|
+ "高危手术缺少医院端映射;");
|
|
|
+ retMappingList.add(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //高危条件映射
|
|
|
+ for (ResultHighriskOperation result : retMappingList) {
|
|
|
+ if (result.getFactorItemType() == null) {
|
|
|
+ retFactorMappingList.add(result);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (result.getFactorItemType().equals(TypeEnum.disease.getName())) {
|
|
|
+ Map<String, List<Long>> subMap = diseaseConfigMap.get(result.getFactorItemName());
|
|
|
+ if (subMap != null && subMap.size() > 0) {
|
|
|
+ subMap.keySet().forEach(hisName -> {
|
|
|
+ ResultHighriskOperation resultExt = new ResultHighriskOperation();
|
|
|
+ BeanUtil.copyProperties(result, resultExt);
|
|
|
+ resultExt.setFactorItemHisName(hisName);
|
|
|
+ retFactorMappingList.add(resultExt);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ result.setSuccess(0);
|
|
|
+ result.setMessage((StringUtil.isNotBlank(result.getMessage()) ? result.getMessage() : "") +
|
|
|
+ "高危手术条件缺少医院端映射;");
|
|
|
+ retFactorMappingList.add(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if (result.getFactorItemType().equals(TypeEnum.lis.getName())) {
|
|
|
+ Map<String, Map<String, List<Long>>> subMap = lisConfigMap.get(result.getFactorItemName());
|
|
|
+ if (subMap != null && subMap.size() > 0) {
|
|
|
+ subMap.entrySet().forEach(entry -> {
|
|
|
+ ResultHighriskOperation resultExt = new ResultHighriskOperation();
|
|
|
+ BeanUtil.copyProperties(result, resultExt);
|
|
|
+ resultExt.setFactorItemHisName(entry.getKey());
|
|
|
+ if (entry.getValue() != null && entry.getValue().size() > 0) {
|
|
|
+ entry.getValue().keySet().forEach(hisDetailName -> {
|
|
|
+ resultExt.setFactorItemHisDetailName(hisDetailName);
|
|
|
+ retFactorMappingList.add(resultExt);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ retFactorMappingList.add(resultExt);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ result.setSuccess(0);
|
|
|
+ result.setMessage((StringUtil.isNotBlank(result.getMessage()) ? result.getMessage() : "") +
|
|
|
+ "高危手术条件缺少医院端映射;");
|
|
|
+ retFactorMappingList.add(result);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ retFactorMappingList.add(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //模拟输入数据
|
|
|
+ retList = createHighriskOperationInputValue(retFactorMappingList);
|
|
|
+
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+
|
|
|
public MappingShortEntity setMappingShortEntity(String name, String hisName, String hisDetailName) {
|
|
|
MappingShortEntity item = new MappingShortEntity();
|
|
|
item.setName(name);
|
|
@@ -627,6 +955,7 @@ public class RuleConvertFacade {
|
|
|
|
|
|
/**
|
|
|
* 模拟输入数值
|
|
|
+ *
|
|
|
* @param resultList
|
|
|
* @return
|
|
|
*/
|
|
@@ -678,6 +1007,7 @@ public class RuleConvertFacade {
|
|
|
|
|
|
/**
|
|
|
* 模拟输入数值-危急值
|
|
|
+ *
|
|
|
* @param resultList
|
|
|
* @return
|
|
|
*/
|
|
@@ -727,6 +1057,70 @@ public class RuleConvertFacade {
|
|
|
return retList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 模拟输入数值-高危手术
|
|
|
+ *
|
|
|
+ * @param resultList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<ResultHighriskOperation> createHighriskOperationInputValue(List<ResultHighriskOperation> resultList) {
|
|
|
+ List<ResultHighriskOperation> retList = Lists.newLinkedList();
|
|
|
+ if (ListUtil.isEmpty(resultList)) {
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+ for (ResultHighriskOperation result : resultList) {
|
|
|
+ if (result.getSuccess() != null && result.getSuccess().equals(0)) {
|
|
|
+ retList.add(result);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (result.getFactorItemMaxValue() != null || result.getFactorItemMinValue() != null) {
|
|
|
+ if (result.getFactorItemRange() == null) {
|
|
|
+ result.setFactorItemRange(0);
|
|
|
+ }
|
|
|
+ if (result.getFactorItemRange().equals(1)) {
|
|
|
+ if (result.getFactorItemMinValue() != null) {
|
|
|
+ ResultHighriskOperation minResult = new ResultHighriskOperation();
|
|
|
+ BeanUtil.copyProperties(result, minResult);
|
|
|
+ if (result.getFactorItemType().equals(TypeEnum.lis.getName())) {
|
|
|
+ minResult.setInputValue(random(null, result.getFactorItemMinValue()).toString());
|
|
|
+ } else {
|
|
|
+ minResult.setInputValue(random_int(null, result.getFactorItemMinValue().intValue()).toString());
|
|
|
+ }
|
|
|
+ BillMsg billMsg = getHighriskOperationMsg(minResult);
|
|
|
+ minResult.setExpectedOutput(billMsg.getMsg());
|
|
|
+ retList.add(minResult);
|
|
|
+ }
|
|
|
+ if (result.getFactorItemMaxValue() != null) {
|
|
|
+ ResultHighriskOperation maxResult = new ResultHighriskOperation();
|
|
|
+ BeanUtil.copyProperties(result, maxResult);
|
|
|
+ if (result.getFactorItemType().equals(TypeEnum.lis.getName())) {
|
|
|
+ maxResult.setInputValue(random(result.getFactorItemMaxValue(), null).toString());
|
|
|
+ } else {
|
|
|
+ maxResult.setInputValue(random_int(result.getFactorItemMaxValue().intValue(), null).toString());
|
|
|
+ }
|
|
|
+ BillMsg billMsg = getHighriskOperationMsg(maxResult);
|
|
|
+ maxResult.setExpectedOutput(billMsg.getMsg());
|
|
|
+ retList.add(maxResult);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (result.getFactorItemType().equals(TypeEnum.lis.getName())) {
|
|
|
+ result.setInputValue(random(result.getFactorItemMinValue(), result.getFactorItemMaxValue()).toString());
|
|
|
+ } else {
|
|
|
+ result.setInputValue(random_int(result.getFactorItemMinValue().intValue(), result.getFactorItemMaxValue().intValue()).toString());
|
|
|
+ }
|
|
|
+ BillMsg billMsg = getHighriskOperationMsg(result);
|
|
|
+ result.setExpectedOutput(billMsg.getMsg());
|
|
|
+ retList.add(result);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ BillMsg billMsg = getHighriskOperationMsg(result);
|
|
|
+ result.setExpectedOutput(billMsg.getMsg());
|
|
|
+ retList.add(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 模拟提示信息
|
|
|
*
|
|
@@ -861,6 +1255,7 @@ public class RuleConvertFacade {
|
|
|
|
|
|
/**
|
|
|
* 模拟提示信息-危急值
|
|
|
+ *
|
|
|
* @param resultCritical
|
|
|
* @return
|
|
|
*/
|
|
@@ -885,6 +1280,60 @@ public class RuleConvertFacade {
|
|
|
return billMsg;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 模拟提示信息-高危手术
|
|
|
+ *
|
|
|
+ * @param result
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public BillMsg getHighriskOperationMsg(ResultHighriskOperation result) {
|
|
|
+ BillMsg billMsg = new BillMsg();
|
|
|
+ if (StringUtil.isNotBlank(result.getLevel()) && result.getLevel().equals("2")) {
|
|
|
+ if (result.getFactorItemType().equals(TypeEnum.lis.getName())) {
|
|
|
+ String content = "";
|
|
|
+ if (StringUtil.isNotBlank(result.getFactorItemHisName())) {
|
|
|
+ content += result.getFactorItemHisName();
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(result.getFactorItemHisDetailName())
|
|
|
+ && !result.getFactorItemHisDetailName().equals(result.getFactorItemHisName())) {
|
|
|
+ content += result.getFactorItemHisDetailName();
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(result.getInputValue())) {
|
|
|
+ content += trimZero(result.getInputValue());
|
|
|
+ }
|
|
|
+ billMsg = MsgUtil.getComplexOperationMsg(content, result.getHighriskItemHisName(), TypeEnum.operation.getName());
|
|
|
+ } else if (result.getFactorItemType().equals(TypeEnum.age.getName())) {
|
|
|
+ String content = result.getFactorItemName() + ":";
|
|
|
+ if (StringUtil.isNotBlank(result.getInputValue())) {
|
|
|
+ content += trimZero(result.getInputValue());
|
|
|
+ }
|
|
|
+ billMsg = MsgUtil.getComplexOperationMsg(content, result.getHighriskItemHisName(), TypeEnum.operation.getName());
|
|
|
+ } else if (result.getFactorItemType().equals(TypeEnum.vital.getName())) {
|
|
|
+ String content = "";
|
|
|
+ if (result.getFactorItemName().equals("收缩压")) {
|
|
|
+ content = "血压" + result.getInputValue() + "/80";
|
|
|
+ } else if (result.getFactorItemName().equals("舒张压")) {
|
|
|
+ content = "血压120/" + result.getInputValue();
|
|
|
+ } else {
|
|
|
+ content = result.getFactorItemName();
|
|
|
+ if (StringUtil.isNotBlank(result.getInputValue())) {
|
|
|
+ content += trimZero(result.getInputValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ billMsg = MsgUtil.getComplexOperationMsg(content, result.getHighriskItemHisName(), TypeEnum.operation.getName());
|
|
|
+ } else if (result.getFactorItemType().equals(TypeEnum.pacsDecs.getName())) {
|
|
|
+ billMsg = MsgUtil.getComplexOperationMsg(result.getInputValue(), result.getHighriskItemHisName(), TypeEnum.operation.getName());
|
|
|
+ } else if (result.getFactorItemType().equals(TypeEnum.disease.getName())) {
|
|
|
+ billMsg = MsgUtil.getComplexOperationMsg(result.getFactorItemHisName(), result.getHighriskItemHisName(), TypeEnum.operation.getName());
|
|
|
+ } else {
|
|
|
+ billMsg = MsgUtil.getComplexOperationMsg(result.getFactorItemName(), result.getHighriskItemHisName(), TypeEnum.operation.getName());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ billMsg = MsgUtil.getCommonHighRiskMsg(result.getHighriskItemHisName(), result.getLevel(), TypeEnum.operation.getName());
|
|
|
+ }
|
|
|
+ return billMsg;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 生成随机数
|
|
@@ -904,6 +1353,24 @@ public class RuleConvertFacade {
|
|
|
return randomVal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 生成随机-整数
|
|
|
+ *
|
|
|
+ * @param min
|
|
|
+ * @param max
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Integer random_int(Integer min, Integer max) {
|
|
|
+ if (min == null) {
|
|
|
+ min = 0;
|
|
|
+ }
|
|
|
+ if (max == null) {
|
|
|
+ max = min + 10;
|
|
|
+ }
|
|
|
+ Integer random_int = (int) (Math.random() * (max - min)) + min;
|
|
|
+ return random_int;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 开单类型转换
|
|
|
*
|
|
@@ -959,4 +1426,128 @@ public class RuleConvertFacade {
|
|
|
}
|
|
|
return s;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 手术高危条件
|
|
|
+ *
|
|
|
+ * @param highriskCond
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ Map<Integer, Map<String, Object>> getHighriskCondMap(String highriskCond) {
|
|
|
+ Map<Integer, Map<String, Object>> retMap = new LinkedHashMap<>();
|
|
|
+ if (StringUtil.isBlank(highriskCond)) {
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ JSONObject jobj = JSONObject.parseObject(highriskCond);
|
|
|
+ if (null != jobj) {
|
|
|
+ Integer index = 0;
|
|
|
+ // 判断年龄
|
|
|
+ JSONObject ageobj = jobj.getJSONObject("年龄");
|
|
|
+ if (ageobj != null) {
|
|
|
+ Map<String, Object> subMap = new HashMap<>();
|
|
|
+ subMap.put("type", TypeEnum.age.getName());
|
|
|
+ subMap.put("name", "年龄");
|
|
|
+ if (ageobj.containsKey("最大值")) {
|
|
|
+ subMap.put("最大值", ageobj.getBigDecimal("最大值"));
|
|
|
+ }
|
|
|
+ if (ageobj.containsKey("最小值")) {
|
|
|
+ subMap.put("最小值", ageobj.getBigDecimal("最小值"));
|
|
|
+ }
|
|
|
+ if (ageobj.containsKey("单位")) {
|
|
|
+ subMap.put("单位", ageobj.getString("单位"));
|
|
|
+ }
|
|
|
+ if (ageobj.containsKey("范围")) {
|
|
|
+ subMap.put("范围", ageobj.getInteger("范围"));
|
|
|
+ }
|
|
|
+ retMap.put(index++, subMap);
|
|
|
+ }
|
|
|
+ // 判断生命体征和查体
|
|
|
+ JSONObject vitalObj = jobj.getJSONObject("生命体征及查体");
|
|
|
+ if (null != vitalObj) {
|
|
|
+ for (Map.Entry<String, Object> entry : vitalObj.entrySet()) {
|
|
|
+ Map<String, Object> subMap = new HashMap<>();
|
|
|
+ subMap.put("type", TypeEnum.vital.getName());
|
|
|
+ subMap.put("name", entry.getKey());
|
|
|
+ if (ObjectUtils.isEmpty(entry.getValue())) {
|
|
|
+ retMap.put(index++, subMap);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ JSONObject subVitalObj = (JSONObject) entry.getValue();
|
|
|
+ if (null != subVitalObj) {
|
|
|
+ if (subVitalObj.containsKey("最大值")) {
|
|
|
+ subMap.put("最大值", subVitalObj.getBigDecimal("最大值"));
|
|
|
+ }
|
|
|
+ if (subVitalObj.containsKey("最小值")) {
|
|
|
+ subMap.put("最小值", subVitalObj.getBigDecimal("最小值"));
|
|
|
+ }
|
|
|
+ if (subVitalObj.containsKey("单位")) {
|
|
|
+ subMap.put("单位", subVitalObj.getString("单位"));
|
|
|
+ }
|
|
|
+ if (subVitalObj.containsKey("范围")) {
|
|
|
+ subMap.put("范围", subVitalObj.getInteger("范围"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ retMap.put(index++, subMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 判断合并疾病
|
|
|
+ JSONObject diagobj = jobj.getJSONObject("合并疾病");
|
|
|
+ if (null != diagobj) {
|
|
|
+ for (Map.Entry<String, Object> entry : diagobj.entrySet()) {
|
|
|
+ Map<String, Object> subMap = new HashMap<>();
|
|
|
+ subMap.put("type", TypeEnum.disease.getName());
|
|
|
+ subMap.put("name", entry.getKey());
|
|
|
+ retMap.put(index++, subMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 判断化验结果
|
|
|
+ JSONObject lisobj = jobj.getJSONObject("化验结果");
|
|
|
+ if (null != lisobj) {
|
|
|
+ for (Map.Entry<String, Object> entry : lisobj.entrySet()) {
|
|
|
+ Map<String, Object> subMap = new HashMap<>();
|
|
|
+ subMap.put("type", TypeEnum.lis.getName());
|
|
|
+ subMap.put("name", entry.getKey());
|
|
|
+ if (ObjectUtils.isEmpty(entry.getValue())) {
|
|
|
+ retMap.put(index++, subMap);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ JSONObject subLisObj = (JSONObject) entry.getValue();
|
|
|
+ if (null != subLisObj) {
|
|
|
+ if (subLisObj.containsKey("最大值")) {
|
|
|
+ subMap.put("最大值", subLisObj.getBigDecimal("最大值"));
|
|
|
+ }
|
|
|
+ if (subLisObj.containsKey("最小值")) {
|
|
|
+ subMap.put("最小值", subLisObj.getBigDecimal("最小值"));
|
|
|
+ }
|
|
|
+ if (subLisObj.containsKey("单位")) {
|
|
|
+ subMap.put("单位", subLisObj.getString("单位"));
|
|
|
+ }
|
|
|
+ if (subLisObj.containsKey("范围")) {
|
|
|
+ subMap.put("范围", subLisObj.getInteger("范围"));
|
|
|
+ }
|
|
|
+ if (subLisObj.containsKey("结果")) {
|
|
|
+ subMap.put("结果", subLisObj.getString("结果"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ retMap.put(index++, subMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 判断辅检结果,暂不处理
|
|
|
+ JSONObject pacsObj = jobj.getJSONObject("辅检结果");
|
|
|
+ // 判断辅检结果描述
|
|
|
+ JSONObject pacsDescObj = jobj.getJSONObject("辅检结果描述");
|
|
|
+ if (null != pacsDescObj) {
|
|
|
+ for (Map.Entry<String, Object> entry : pacsDescObj.entrySet()) {
|
|
|
+ Map<String, Object> subMap = new HashMap<>();
|
|
|
+ subMap.put("type", TypeEnum.pacsDecs.getName());
|
|
|
+ subMap.put("name", entry.getKey());
|
|
|
+ retMap.put(index++, subMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
}
|