|
@@ -473,8 +473,10 @@ public class ExportFacade {
|
|
|
);
|
|
|
Map<String, KlConcept> map
|
|
|
= EntityUtil.makeEntityMapByKeys(klConcepts, "_", "libName", "libType");
|
|
|
+ //开单合理性(除输血外)
|
|
|
+ allOrder(mapPath, map);
|
|
|
//开单合理性_输血
|
|
|
- transfusionOrder(mapPath, map);
|
|
|
+ //transfusionOrder(mapPath, map);
|
|
|
//高危药品
|
|
|
//drugHighRisk(mapPath, map);
|
|
|
//高危手术
|
|
@@ -492,6 +494,358 @@ public class ExportFacade {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ private void allOrder(Map<String, String> mapPath, Map<String, KlConcept> map) {
|
|
|
+ MultipartFile file = null;
|
|
|
+ file = testFacade.getMulFileByPath(mapPath.get("【开单合理性】"));
|
|
|
+ List<ImportDataVO> data = ExcelUtils.importExcel(file, 0, 1, ImportDataVO.class);
|
|
|
+ Integer cnt = 0;
|
|
|
+ String debug = "";
|
|
|
+ for (ImportDataVO importDataVO : data) {
|
|
|
+ if (StringUtil.isNotBlank(importDataVO.getStandName())
|
|
|
+ && StringUtil.isNotBlank(importDataVO.getOrderType())
|
|
|
+ && StringUtil.isNotBlank(importDataVO.getNeoName())
|
|
|
+ && StringUtil.isNotBlank(importDataVO.getNeoType())
|
|
|
+ && StringUtil.isNotBlank(importDataVO.getOrderType())
|
|
|
+ && !importDataVO.getOrderType().equals("联合项目")
|
|
|
+ && StringUtil.isBlank(importDataVO.getStatus())) {
|
|
|
+// if (!importDataVO.getNeoType().equals("7")) {
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+ if (importDataVO.getNeoType().equals("7")) {
|
|
|
+ if (importDataVO.getNeoName().trim().equals("本品成份")
|
|
|
+ || importDataVO.getNeoName().trim().equals("本品的成分")
|
|
|
+ || importDataVO.getNeoName().trim().equals("本品任何成分")
|
|
|
+ || importDataVO.getNeoName().trim().equals("本品中任何成分")
|
|
|
+ || importDataVO.getNeoName().trim().equals("本品中任何成份过敏")) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ KlRule klRule = new KlRule();
|
|
|
+ Boolean canInsert = false;
|
|
|
+ switch (importDataVO.getOrderType()) {
|
|
|
+ case "辅助检查名称":
|
|
|
+ case "辅助检查子项目名称":
|
|
|
+ case "辅助子项目检查名称":
|
|
|
+ if (null != map.get(importDataVO.getStandName().trim() + "_109")) {
|
|
|
+ klRule.setConceptId(map.get(importDataVO.getStandName().trim() + "_109").getId());
|
|
|
+ klRule.setDescription("开单合理性_辅助检查项目_" + importDataVO.getStandName().trim());
|
|
|
+ canInsert = true;
|
|
|
+ } else {
|
|
|
+ if (null != map.get(importDataVO.getStandName().trim() + "_110")) {
|
|
|
+ klRule.setConceptId(map.get(importDataVO.getStandName().trim() + "_110").getId());
|
|
|
+ klRule.setDescription("开单合理性_辅助检查子项目_" + importDataVO.getStandName().trim());
|
|
|
+ canInsert = true;
|
|
|
+ } else {
|
|
|
+ debug += importDataVO.getStandName().trim() + "," + importDataVO.getOrderType() + ";";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "实验室检查套餐":
|
|
|
+ case "实验室检查套餐名":
|
|
|
+ if (null != map.get(importDataVO.getStandName().trim() + "_107")) {
|
|
|
+ klRule.setConceptId(map.get(importDataVO.getStandName().trim() + "_107").getId());
|
|
|
+ klRule.setDescription("开单合理性_实验室检查套餐_" + importDataVO.getStandName().trim());
|
|
|
+ canInsert = true;
|
|
|
+ } else {
|
|
|
+ debug += importDataVO.getStandName().trim() + "," + importDataVO.getOrderType() + ";";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "药品通用名称":
|
|
|
+ if (null != map.get(importDataVO.getStandName().trim() + "_101")) {
|
|
|
+ klRule.setConceptId(map.get(importDataVO.getStandName().trim() + "_101").getId());
|
|
|
+ klRule.setDescription("开单合理性_实验室检查套餐_" + importDataVO.getStandName().trim());
|
|
|
+ canInsert = true;
|
|
|
+ } else {
|
|
|
+ debug += importDataVO.getStandName().trim() + "," + importDataVO.getOrderType() + ";";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "医保手术和操作名称":
|
|
|
+ if (null != map.get(importDataVO.getStandName().trim() + "_106")) {
|
|
|
+ klRule.setConceptId(map.get(importDataVO.getStandName().trim() + "_106").getId());
|
|
|
+ klRule.setDescription("开单合理性_手术药品_" + importDataVO.getStandName().trim());
|
|
|
+ canInsert = true;
|
|
|
+ } else {
|
|
|
+ debug += importDataVO.getStandName().trim() + "," + importDataVO.getOrderType() + ";";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (canInsert) {
|
|
|
+ klRule.setRuleType(1);
|
|
|
+ klRule.setHasSubCond(1);
|
|
|
+ klRuleService.save(klRule);
|
|
|
+ cnt++;
|
|
|
+ Boolean baseCanInsert = false;
|
|
|
+ KlRuleBase klRuleBase = new KlRuleBase();
|
|
|
+ //1性别,2实验室检查,3临床表现,4辅助检查名称描述,5疾病,6服用药品,
|
|
|
+ //7药物过敏原,8食物过敏原,9手术,10禁忌人群,11过敏原,12体征,
|
|
|
+ //13禁忌医疗器械及物品,14年龄,15给药途径,16开单项互斥
|
|
|
+ switch (importDataVO.getNeoType().trim()) {
|
|
|
+ case "1":
|
|
|
+ //1性别
|
|
|
+ if (null != map.get(importDataVO.getNeoName().trim() + "_116")) {
|
|
|
+ klRuleBase.setConceptId(map.get(importDataVO.getNeoName().trim() + "_116").getId());
|
|
|
+ klRuleBase.setDescription("性别_" + importDataVO.getNeoName().trim());
|
|
|
+ klRuleBase.setType(1);
|
|
|
+ baseCanInsert = true;
|
|
|
+ } else {
|
|
|
+ debug += importDataVO.getNeoName().trim() + ",1性别;";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "2":
|
|
|
+ //2实验室检查
|
|
|
+ baseCanInsert = strDeal(importDataVO, klRuleBase, map, debug, 108, ",2实验室检查;");
|
|
|
+ break;
|
|
|
+ case "3":
|
|
|
+ //3临床表现
|
|
|
+ if (null != map.get(importDataVO.getNeoName().trim() + "_103")) {
|
|
|
+ klRuleBase.setConceptId(map.get(importDataVO.getNeoName().trim() + "_103").getId());
|
|
|
+ klRuleBase.setDescription("临床表现_" + importDataVO.getNeoName().trim());
|
|
|
+ klRuleBase.setType(1);
|
|
|
+ baseCanInsert = true;
|
|
|
+ } else {
|
|
|
+ debug += importDataVO.getNeoName().trim() + ",3临床表现;";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "4":
|
|
|
+ //4辅助检查名称描述
|
|
|
+ if (null != map.get(importDataVO.getNeoName().trim() + "_112")) {
|
|
|
+ klRuleBase.setConceptId(map.get(importDataVO.getNeoName().trim() + "_112").getId());
|
|
|
+ klRuleBase.setDescription("辅助检查名称描述_" + importDataVO.getNeoName().trim());
|
|
|
+ klRuleBase.setType(1);
|
|
|
+ baseCanInsert = true;
|
|
|
+ } else {
|
|
|
+ debug += importDataVO.getNeoName().trim() + ",4辅助检查名称描述;";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "5":
|
|
|
+ //5疾病
|
|
|
+ if (null != map.get(importDataVO.getNeoName().trim() + "_100")) {
|
|
|
+ klRuleBase.setConceptId(map.get(importDataVO.getNeoName().trim() + "_100").getId());
|
|
|
+ klRuleBase.setDescription("疾病_" + importDataVO.getNeoName().trim());
|
|
|
+ klRuleBase.setType(1);
|
|
|
+ baseCanInsert = true;
|
|
|
+ } else {
|
|
|
+ debug += importDataVO.getNeoName().trim() + ",5疾病;";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "6":
|
|
|
+ //6服用药品
|
|
|
+ if (null != map.get(importDataVO.getNeoName().trim() + "_101")) {
|
|
|
+ klRuleBase.setConceptId(map.get(importDataVO.getNeoName().trim() + "_101").getId());
|
|
|
+ klRuleBase.setDescription("服用药品_" + importDataVO.getNeoName().trim());
|
|
|
+ klRuleBase.setType(1);
|
|
|
+ baseCanInsert = true;
|
|
|
+ } else {
|
|
|
+ debug += importDataVO.getNeoName().trim() + ",6服用药品;";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "7":
|
|
|
+ //7药物过敏原
|
|
|
+ if (importDataVO.getDrugType().trim().equals("药品类别")) {
|
|
|
+ if (null != map.get(importDataVO.getNeoName().trim() + "_301")
|
|
|
+ || null != map.get(importDataVO.getNeoName().trim() + "_302")
|
|
|
+ || null != map.get(importDataVO.getNeoName().trim() + "_303")
|
|
|
+ || null != map.get(importDataVO.getNeoName().trim() + "_304")) {
|
|
|
+ if (null != map.get(importDataVO.getNeoName().trim() + "_301")) {
|
|
|
+ klRuleBase.setConceptId(map.get(importDataVO.getNeoName().trim() + "_301").getId());
|
|
|
+ } else if (null != map.get(importDataVO.getNeoName().trim() + "_302")) {
|
|
|
+ klRuleBase.setConceptId(map.get(importDataVO.getNeoName().trim() + "_302").getId());
|
|
|
+ } else if (null != map.get(importDataVO.getNeoName().trim() + "_303")) {
|
|
|
+ klRuleBase.setConceptId(map.get(importDataVO.getNeoName().trim() + "_303").getId());
|
|
|
+ } else {
|
|
|
+ klRuleBase.setConceptId(map.get(importDataVO.getNeoName().trim() + "_304").getId());
|
|
|
+ }
|
|
|
+ klRuleBase.setDescription("药物过敏原_" + importDataVO.getDrugType() + "_" + importDataVO.getNeoName().trim());
|
|
|
+ klRuleBase.setType(4);
|
|
|
+ baseCanInsert = true;
|
|
|
+ } else {
|
|
|
+ debug += importDataVO.getNeoName().trim() + ",7药物过敏原(" + importDataVO.getDrugType() + ");";
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ if (null != map.get(importDataVO.getNeoName().trim() + "_101")) {
|
|
|
+ klRuleBase.setConceptId(map.get(importDataVO.getNeoName().trim() + "_101").getId());
|
|
|
+ klRuleBase.setDescription("药物过敏原_" + importDataVO.getDrugType() + "_" + importDataVO.getNeoName().trim());
|
|
|
+ klRuleBase.setType(4);
|
|
|
+ baseCanInsert = true;
|
|
|
+ } else {
|
|
|
+ debug += importDataVO.getNeoName().trim() + ",7药物过敏原(" + importDataVO.getDrugType() + ");";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "8":
|
|
|
+ //8食物过敏原
|
|
|
+ if (null != map.get(importDataVO.getNeoName().trim() + "_118")) {
|
|
|
+ klRuleBase.setConceptId(map.get(importDataVO.getNeoName().trim() + "_118").getId());
|
|
|
+ klRuleBase.setDescription("食物过敏原_" + importDataVO.getNeoName().trim());
|
|
|
+ klRuleBase.setType(4);
|
|
|
+ baseCanInsert = true;
|
|
|
+ } else {
|
|
|
+ debug += importDataVO.getNeoName().trim() + ",8食物过敏原;";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "9":
|
|
|
+ //9手术
|
|
|
+ if (null != map.get(importDataVO.getNeoName().trim() + "_106")) {
|
|
|
+ klRuleBase.setConceptId(map.get(importDataVO.getNeoName().trim() + "_106").getId());
|
|
|
+ klRuleBase.setDescription("手术_" + importDataVO.getNeoName().trim());
|
|
|
+ klRuleBase.setType(1);
|
|
|
+ baseCanInsert = true;
|
|
|
+ } else {
|
|
|
+ debug += importDataVO.getNeoName().trim() + ",9手术;";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "10":
|
|
|
+ //10禁忌人群
|
|
|
+ if (null != map.get(importDataVO.getNeoName().trim().replace(",", "") + "_117")) {
|
|
|
+ klRuleBase.setConceptId(map.get(importDataVO.getNeoName().trim().replace(",", "") + "_117").getId());
|
|
|
+ klRuleBase.setDescription("禁忌人群_" + importDataVO.getNeoName().trim().replace(",", ""));
|
|
|
+ klRuleBase.setType(1);
|
|
|
+ baseCanInsert = true;
|
|
|
+ } else {
|
|
|
+ debug += importDataVO.getNeoName().trim() + ",10禁忌人群;";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "11":
|
|
|
+ //11过敏原
|
|
|
+ if (null != map.get(importDataVO.getNeoName().trim() + "_119")) {
|
|
|
+ klRuleBase.setConceptId(map.get(importDataVO.getNeoName().trim() + "_119").getId());
|
|
|
+ klRuleBase.setDescription("过敏原_" + importDataVO.getNeoName().trim());
|
|
|
+ klRuleBase.setType(1);
|
|
|
+ baseCanInsert = true;
|
|
|
+ } else {
|
|
|
+ debug += importDataVO.getNeoName().trim() + ",11过敏原;";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "12":
|
|
|
+ //12体征
|
|
|
+ if (null != map.get(importDataVO.getNeoName().trim() + "_105")) {
|
|
|
+ klRuleBase.setConceptId(map.get(importDataVO.getNeoName().trim() + "_105").getId());
|
|
|
+ klRuleBase.setDescription("体征_" + importDataVO.getNeoName().trim());
|
|
|
+ klRuleBase.setType(1);
|
|
|
+ baseCanInsert = true;
|
|
|
+ } else {
|
|
|
+ baseCanInsert = strDeal(importDataVO, klRuleBase, map, debug, 104, ",12体征;");
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "13":
|
|
|
+ //13禁忌医疗器械及物品
|
|
|
+ if (null != map.get(importDataVO.getNeoName().trim() + "_120")) {
|
|
|
+ klRuleBase.setConceptId(map.get(importDataVO.getNeoName().trim() + "_120").getId());
|
|
|
+ klRuleBase.setDescription("禁忌医疗器械及物品_" + importDataVO.getNeoName().trim());
|
|
|
+ klRuleBase.setType(1);
|
|
|
+ baseCanInsert = true;
|
|
|
+ } else {
|
|
|
+ debug += importDataVO.getNeoName().trim() + ",13禁忌医疗器械及物品;";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "14":
|
|
|
+ //14年龄
|
|
|
+ baseCanInsert = strDeal(importDataVO, klRuleBase, map, debug, 410, ",14年龄;");
|
|
|
+ break;
|
|
|
+ case "15":
|
|
|
+ //15给药途径
|
|
|
+ //数据暂时不导入
|
|
|
+ break;
|
|
|
+ case "16":
|
|
|
+ //16开单项互斥
|
|
|
+ if (null != map.get(importDataVO.getNeoName().trim() + "_109")) {
|
|
|
+ klRuleBase.setConceptId(map.get(importDataVO.getNeoName().trim() + "_109").getId());
|
|
|
+ klRuleBase.setDescription("开单项互斥_" + importDataVO.getNeoName().trim());
|
|
|
+ klRuleBase.setType(5);
|
|
|
+ baseCanInsert = true;
|
|
|
+ } else {
|
|
|
+ debug += importDataVO.getNeoName().trim() + ",16开单项互斥;";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (baseCanInsert) {
|
|
|
+ klRuleBaseService.save(klRuleBase);
|
|
|
+ KlRuleCondition klRuleCondition = new KlRuleCondition();
|
|
|
+ klRuleCondition.setGroupType(1);
|
|
|
+ klRuleCondition.setRuleId(klRule.getId());
|
|
|
+ klRuleCondition.setRuleBaseId(klRuleBase.getId());
|
|
|
+ klRuleConditionService.save(klRuleCondition);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ log.info("总条数:" + cnt);
|
|
|
+ log.info(debug);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Boolean strDeal(ImportDataVO importDataVO, KlRuleBase klRuleBase, Map<String, KlConcept> map,
|
|
|
+ String debug, Integer type, String debugStr) {
|
|
|
+ Boolean baseCanInsert = false;
|
|
|
+ List<String> slist = Arrays.asList(importDataVO.getNeoName().split(","));
|
|
|
+ KlRuleConditionVO klRuleConditionVO = new KlRuleConditionVO();
|
|
|
+ if (slist.size() == 0) {
|
|
|
+ klRuleBase.setType(1);
|
|
|
+ if (null != map.get(importDataVO.getNeoName().trim() + "_" + type)) {
|
|
|
+ klRuleBase.setConceptId(map.get(importDataVO.getNeoName().trim() + "_" + type).getId());
|
|
|
+ klRuleBase.setDescription(importDataVO.getNeoName().trim());
|
|
|
+ klRuleBase.setType(1);
|
|
|
+ baseCanInsert = true;
|
|
|
+ } else {
|
|
|
+ debug += importDataVO.getNeoName().trim() + debugStr;
|
|
|
+ }
|
|
|
+ return baseCanInsert;
|
|
|
+ }
|
|
|
+ if (slist.size() == 4) {
|
|
|
+ klRuleConditionVO.setName(slist.get(0));
|
|
|
+ klRuleConditionVO.setOperator(slist.get(1));
|
|
|
+ klRuleConditionVO.setValue(slist.get(2));
|
|
|
+ klRuleConditionVO.setUnit(slist.get(3));
|
|
|
+ } else if (slist.size() == 3) {
|
|
|
+ klRuleConditionVO.setName(slist.get(0));
|
|
|
+ klRuleConditionVO.setOperator(slist.get(1));
|
|
|
+ klRuleConditionVO.setValue(slist.get(2));
|
|
|
+ klRuleConditionVO.setUnit("");
|
|
|
+ } else if (slist.size() == 2) {
|
|
|
+ klRuleConditionVO.setName(slist.get(0));
|
|
|
+ klRuleConditionVO.setOperator("=");
|
|
|
+ klRuleConditionVO.setValue(slist.get(1));
|
|
|
+ klRuleConditionVO.setUnit("");
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+ klRuleBase.setType(2);
|
|
|
+ if (null != map.get(klRuleConditionVO.getName() + "_" + type)) {
|
|
|
+ klRuleBase.setConceptId(map.get(klRuleConditionVO.getName().trim() + "_" + type).getId());
|
|
|
+ klRuleBase.setDescription(klRuleConditionVO.getName()
|
|
|
+ + klRuleConditionVO.getOperator()
|
|
|
+ + klRuleConditionVO.getValue()
|
|
|
+ + klRuleConditionVO.getUnit());
|
|
|
+ if (operator_eq.contains(klRuleConditionVO.getOperator())) {
|
|
|
+ klRuleBase.setEqOperator("=");
|
|
|
+ klRuleBase.setEqValue(klRuleConditionVO.getValue());
|
|
|
+ klRuleBase.setEqUnit(klRuleConditionVO.getUnit());
|
|
|
+ } else if (operator_gt.contains(klRuleConditionVO.getOperator())) {
|
|
|
+ klRuleBase.setMaxOperator(">");
|
|
|
+ klRuleBase.setMaxValue(klRuleConditionVO.getValue());
|
|
|
+ klRuleBase.setMaxUnit(klRuleConditionVO.getUnit());
|
|
|
+ } else if (operator_ge.contains(klRuleConditionVO.getOperator())) {
|
|
|
+ klRuleBase.setMaxOperator(">=");
|
|
|
+ klRuleBase.setMaxValue(klRuleConditionVO.getValue());
|
|
|
+ klRuleBase.setMaxUnit(klRuleConditionVO.getUnit());
|
|
|
+ } else if (operator_lt.contains(klRuleConditionVO.getOperator())) {
|
|
|
+ klRuleBase.setMinOperator("<");
|
|
|
+ klRuleBase.setMinValue(klRuleConditionVO.getValue());
|
|
|
+ klRuleBase.setMinUnit(klRuleConditionVO.getUnit());
|
|
|
+ } else if (operator_le.contains(klRuleConditionVO.getOperator())) {
|
|
|
+ klRuleBase.setMinOperator("<=");
|
|
|
+ klRuleBase.setMinValue(klRuleConditionVO.getValue());
|
|
|
+ klRuleBase.setMinUnit(klRuleConditionVO.getUnit());
|
|
|
+ } else {
|
|
|
+ /*DO Nothing*/
|
|
|
+ }
|
|
|
+ baseCanInsert = true;
|
|
|
+ } else {
|
|
|
+ debug += klRuleConditionVO.getName() + debugStr;
|
|
|
+ }
|
|
|
+ return baseCanInsert;
|
|
|
+ }
|
|
|
+
|
|
|
private void transfusionOrder(Map<String, String> mapPath, Map<String, KlConcept> map) {
|
|
|
MultipartFile file = null;
|
|
|
file = testFacade.getMulFileByPath(mapPath.get("【开单合理性_输血】"));
|