|
@@ -9,6 +9,7 @@ import com.diagbot.dto.StandConvertCrfBatchDTO;
|
|
|
import com.diagbot.dto.StandConvertCrfDTO;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
+import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.ExcelUtils;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.RedisUtil;
|
|
@@ -17,8 +18,10 @@ import com.diagbot.vo.Drug;
|
|
|
import com.diagbot.vo.IndicationPushVO;
|
|
|
import com.diagbot.vo.ItemExt;
|
|
|
import com.diagbot.vo.StandConvertCrfVO;
|
|
|
+import com.diagbot.vo.TestAllVO;
|
|
|
import com.diagbot.vo.TestIndicationVO;
|
|
|
import com.diagbot.vo.TestLineVO;
|
|
|
+import io.github.lvyahui8.spring.facade.DataFacade;
|
|
|
import org.apache.commons.fileupload.FileItem;
|
|
|
import org.apache.commons.fileupload.FileItemFactory;
|
|
|
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
|
@@ -102,6 +105,14 @@ public class TestFacade {
|
|
|
operationOrder.add(operationItem);
|
|
|
indicationPushVO.setOperationOrder(operationOrder);
|
|
|
break;
|
|
|
+ case "药品通用名称":
|
|
|
+ List<Drug> drugOrder = new ArrayList<>();
|
|
|
+ Drug drug = new Drug();
|
|
|
+ drug.setName(bean.getStandName());
|
|
|
+ drug.setUniqueName(bean.getStandName());
|
|
|
+ drugOrder.add(drug);
|
|
|
+ indicationPushVO.setDrugOrder(drugOrder);
|
|
|
+ break;
|
|
|
default:
|
|
|
continue;
|
|
|
}
|
|
@@ -109,92 +120,107 @@ public class TestFacade {
|
|
|
|
|
|
if (StringUtil.isNotEmpty(bean.getNeoType())) {
|
|
|
switch (bean.getNeoType()) {
|
|
|
- // case "1": // 性别
|
|
|
- // if ("男性".equals(bean.getNeoName())) {
|
|
|
- // indicationPushVO.setSex(1);
|
|
|
- // } else if ("女性".equals(bean.getNeoName())) {
|
|
|
- // indicationPushVO.setSex(2);
|
|
|
- // }
|
|
|
- // break;
|
|
|
- // case "2": // 化验, 示例:血小板计数,<,50,10^9/L
|
|
|
- // String lisStr = bean.getNeoName();
|
|
|
- // String[] lisArr = lisStr.split(",");
|
|
|
- //
|
|
|
- // List<Lis> lisList = new ArrayList<>();
|
|
|
- // Lis lisBean = new Lis();
|
|
|
- // lisBean.setUniqueName(lisArr[0]);
|
|
|
- // lisBean.setName(lisArr[0]);
|
|
|
- // lisBean.setDetailName(lisArr[0]);
|
|
|
- // lisBean.setValue(getValue(lisArr));
|
|
|
- // lisList.add(lisBean);
|
|
|
- // indicationPushVO.setLis(lisList);
|
|
|
- // break;
|
|
|
- // case "3": // 临床表现
|
|
|
- // indicationPushVO.setChief(bean.getNeoName());
|
|
|
- // break;
|
|
|
+ case "1": // 性别
|
|
|
+ if ("男性".equals(bean.getNeoName())) {
|
|
|
+ indicationPushVO.setSex(1);
|
|
|
+ } else if ("女性".equals(bean.getNeoName())) {
|
|
|
+ indicationPushVO.setSex(2);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "2": // 化验, 示例:血小板计数,<,50,10^9/L
|
|
|
+ String lisStr = bean.getNeoName();
|
|
|
+ String[] lisArr = lisStr.split(",");
|
|
|
+
|
|
|
+ List<Lis> lisList = new ArrayList<>();
|
|
|
+ Lis lisBean = new Lis();
|
|
|
+ lisBean.setUniqueName(lisArr[0]);
|
|
|
+ lisBean.setName(lisArr[0]);
|
|
|
+ lisBean.setDetailName(lisArr[0]);
|
|
|
+ lisBean.setValue(getValue(lisArr));
|
|
|
+ lisList.add(lisBean);
|
|
|
+ indicationPushVO.setLis(lisList);
|
|
|
+ break;
|
|
|
+ case "3": // 临床表现
|
|
|
+ indicationPushVO.setChief(bean.getNeoName());
|
|
|
+ break;
|
|
|
case "4": //辅助检查描述
|
|
|
indicationPushVO.setSymptom("B超:提示" + bean.getNeoName());
|
|
|
break;
|
|
|
- // case "5": // 诊断
|
|
|
- // List<Item> diag = new ArrayList<>();
|
|
|
- // Item diagItem = new Item();
|
|
|
- // diagItem.setName(bean.getNeoName());
|
|
|
- // diagItem.setUniqueName(bean.getNeoName());
|
|
|
- // diag.add(diagItem);
|
|
|
- // indicationPushVO.setDiag(diag);
|
|
|
- // break;
|
|
|
- // case "6": // 服用药品
|
|
|
- // StringBuffer symptom = new StringBuffer("发病来,神志清,精神可,胃纳一般,睡眠可,二便无殊。一直服用");
|
|
|
- // symptom.append(bean.getNeoName()).append("。");
|
|
|
- // indicationPushVO.setSymptom(symptom.toString());
|
|
|
- // break;
|
|
|
- // case "7" : // 药品过敏原
|
|
|
- // StringBuffer pastStr = new StringBuffer("");
|
|
|
- // if ("药品通用名称".equals(bean.getDrugType())) {
|
|
|
- // pastStr.append("有“").append(bean.getNeoName()).append("”过敏。");
|
|
|
- // indicationPushVO.setPasts(pastStr.toString());
|
|
|
- // } else if ("药品类别".equals(bean.getDrugType())) {
|
|
|
- // List<String> drugList = (List<String>)redisUtil.get("药品分类_" + bean.getNeoName());
|
|
|
- // if (ListUtil.isNotEmpty(drugList)) {
|
|
|
- // for (String s : drugList) {
|
|
|
- // pastStr = new StringBuffer("");
|
|
|
- // IndicationPushVO indicationPushCopy = new IndicationPushVO();
|
|
|
- // BeanUtil.copyProperties(indicationPushVO, indicationPushCopy);
|
|
|
- // pastStr.append("有“").append(s).append("”过敏。");
|
|
|
- // indicationPushCopy.setPasts(pastStr.toString());
|
|
|
- // indicationPushCopy.setMsg("过敏药品【" + s + "】");
|
|
|
- // indicationPushVOList.add(indicationPushCopy);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // continue;
|
|
|
- // }
|
|
|
- // break;
|
|
|
- // case "12": // 体征
|
|
|
- // StringBuffer sbVital = new StringBuffer();
|
|
|
- // String[] vitalArr = bean.getNeoName().split(",");
|
|
|
- // if (vitalArr.length > 1) {
|
|
|
- // if ("收缩压".equals(vitalArr[0]) || "舒张压".equals(vitalArr[0])) {
|
|
|
- // if ("收缩压".equals(vitalArr[0])) {
|
|
|
- // sbVital.append("血压");
|
|
|
- // sbVital.append(getValue(vitalArr) + "/100mmHg");
|
|
|
- // indicationPushVO.setVital(sbVital.toString());
|
|
|
- // } else if ("舒张压".equals(vitalArr[0])) {
|
|
|
- // sbVital.append("血压");
|
|
|
- // sbVital.append("100/" + getValue(vitalArr) + "mmHg");
|
|
|
- // indicationPushVO.setVital(sbVital.toString());
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // // 其他数值类型
|
|
|
- // sbVital.append(vitalArr[0]);
|
|
|
- // sbVital.append(getValue(vitalArr));
|
|
|
- // sbVital.append(vitalArr[3]);
|
|
|
- // indicationPushVO.setVital(sbVital.toString());
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // sbVital.append(vitalArr[0]);
|
|
|
- // indicationPushVO.setVital(sbVital.toString());
|
|
|
- // }
|
|
|
- // break;
|
|
|
+ case "5": // 诊断
|
|
|
+ List<Item> diag = new ArrayList<>();
|
|
|
+ Item diagItem = new Item();
|
|
|
+ diagItem.setName(bean.getNeoName());
|
|
|
+ diagItem.setUniqueName(bean.getNeoName());
|
|
|
+ diag.add(diagItem);
|
|
|
+ indicationPushVO.setDiag(diag);
|
|
|
+ break;
|
|
|
+ case "6": // 服用药品
|
|
|
+ StringBuffer symptom = new StringBuffer("发病来,神志清,精神可,胃纳一般,睡眠可,二便无殊。一直服用");
|
|
|
+ symptom.append(bean.getNeoName()).append("。");
|
|
|
+ indicationPushVO.setSymptom(symptom.toString());
|
|
|
+ break;
|
|
|
+ case "10": // 禁忌人群
|
|
|
+ if ("妊娠".equals(bean.getNeoName())) {
|
|
|
+ List<Item> groupList = new ArrayList<>();
|
|
|
+ Item group = new Item();
|
|
|
+ group.setName(bean.getNeoName());
|
|
|
+ group.setUniqueName(bean.getNeoName());
|
|
|
+ groupList.add(group);
|
|
|
+ indicationPushVO.setDiag(groupList);
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ case "7" : // 药品过敏原
|
|
|
+ StringBuffer pastStr = new StringBuffer("");
|
|
|
+ if ("药品通用名称".equals(bean.getDrugType())) {
|
|
|
+ pastStr.append("有“").append(bean.getNeoName()).append("”过敏。");
|
|
|
+ indicationPushVO.setPasts(pastStr.toString());
|
|
|
+ } else if ("药品类别".equals(bean.getDrugType())) {
|
|
|
+ List<String> drugList = (List<String>)redisUtil.get("药品分类_" + bean.getNeoName());
|
|
|
+ if (ListUtil.isNotEmpty(drugList)) {
|
|
|
+ for (String s : drugList) {
|
|
|
+ pastStr = new StringBuffer("");
|
|
|
+ IndicationPushVO indicationPushCopy = new IndicationPushVO();
|
|
|
+ BeanUtil.copyProperties(indicationPushVO, indicationPushCopy);
|
|
|
+ pastStr.append("有“").append(s).append("”过敏。");
|
|
|
+ indicationPushCopy.setPasts(pastStr.toString());
|
|
|
+ indicationPushCopy.setMsg("过敏药品【" + s + "】");
|
|
|
+ indicationPushVOList.add(indicationPushCopy);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "12": // 体征
|
|
|
+ StringBuffer sbVital = new StringBuffer();
|
|
|
+ String[] vitalArr = bean.getNeoName().split(",");
|
|
|
+ if (vitalArr.length > 1) {
|
|
|
+ if ("收缩压".equals(vitalArr[0]) || "舒张压".equals(vitalArr[0])) {
|
|
|
+ if ("收缩压".equals(vitalArr[0])) {
|
|
|
+ sbVital.append("血压");
|
|
|
+ sbVital.append(getValue(vitalArr) + "/100mmHg");
|
|
|
+ indicationPushVO.setVital(sbVital.toString());
|
|
|
+ } else if ("舒张压".equals(vitalArr[0])) {
|
|
|
+ sbVital.append("血压");
|
|
|
+ sbVital.append("100/" + getValue(vitalArr) + "mmHg");
|
|
|
+ indicationPushVO.setVital(sbVital.toString());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 其他数值类型
|
|
|
+ sbVital.append(vitalArr[0]);
|
|
|
+ sbVital.append(getValue(vitalArr));
|
|
|
+ sbVital.append(vitalArr[3]);
|
|
|
+ indicationPushVO.setVital(sbVital.toString());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ sbVital.append(vitalArr[0]);
|
|
|
+ indicationPushVO.setVital(sbVital.toString());
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "14": // 年龄
|
|
|
+ String[] splitAge = bean.getNeoName().split(",");
|
|
|
+ indicationPushVO.setAge((int) getValueNum(splitAge));
|
|
|
+ break;
|
|
|
default:
|
|
|
continue;
|
|
|
}
|
|
@@ -490,13 +516,13 @@ public class TestFacade {
|
|
|
IndicationPushVO indicationPushVO = new IndicationPushVO();
|
|
|
indicationPushVO.setRuleType("3");
|
|
|
indicationPushVO.setIdNum(bean.getIdNum());
|
|
|
- List<Drug> drug = new ArrayList<>();
|
|
|
+ List<Drug> drugOrder = new ArrayList<>();
|
|
|
Drug item = new Drug();
|
|
|
item.setUniqueName(bean.getDrugHighRisk());
|
|
|
item.setName(bean.getDrugHighRisk());
|
|
|
item.setForm(bean.getDrugForm());
|
|
|
- drug.add(item);
|
|
|
- indicationPushVO.setDrug(drug);
|
|
|
+ drugOrder.add(item);
|
|
|
+ indicationPushVO.setDrugOrder(drugOrder);
|
|
|
indicationPushVOList.add(indicationPushVO);
|
|
|
}
|
|
|
|
|
@@ -608,9 +634,9 @@ public class TestFacade {
|
|
|
* @return
|
|
|
*/
|
|
|
public double getValueNum(String[] arr) {
|
|
|
- if ("<".equals(arr[1]) || "≤".equals(arr[1])) {
|
|
|
+ if ("<".equals(arr[1]) || "<".equals(arr[1]) || "≤".equals(arr[1])) {
|
|
|
return Double.parseDouble(arr[2]) - 1;
|
|
|
- } else if (">".equals(arr[1]) || "≥".equals(arr[1])) {
|
|
|
+ } else if (">".equals(arr[1]) || "≥".equals(arr[1]) || ">".equals(arr[1])) {
|
|
|
return Double.parseDouble(arr[2]) + 1;
|
|
|
}
|
|
|
return 0.0;
|
|
@@ -896,29 +922,44 @@ public class TestFacade {
|
|
|
indicationPushVO.setOperationOrder(operationOrder);
|
|
|
}
|
|
|
|
|
|
- public Map testAll() {
|
|
|
+ public Map testAll(TestAllVO testAllVO) {
|
|
|
+ if (StringUtil.isBlank(testAllVO.getPath())) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "参数为空,未填写【文件所在路径】");
|
|
|
+ }
|
|
|
+ long start = System.currentTimeMillis();
|
|
|
+ String path = testAllVO.getPath();
|
|
|
Map<String, Object> map = new LinkedHashMap<>();
|
|
|
- String picPathLis ="D:\\newSVN\\2020新版CDSS\\05.其他资料\\数据\\【危急值_化验】.xlsx";
|
|
|
- String picPathPacs ="D:\\newSVN\\2020新版CDSS\\05.其他资料\\数据\\【危急值_辅检】.xls";
|
|
|
- MultipartFile file = null;
|
|
|
-
|
|
|
- file = getMulFileByPath(picPathLis);
|
|
|
- Map<String, Object> criticalMapLis = importCriticalLisExcel(file, new TestLineVO());
|
|
|
- map.put("【危急值_化验】",criticalMapLis);
|
|
|
+ Map<String, Object> paramMap = new LinkedHashMap<>();
|
|
|
+ Map<String, String> mapPath = new LinkedHashMap<>();
|
|
|
+ mapPath.put("【危急值_化验】", path + File.separator + "【危急值_化验】.xlsx");
|
|
|
+ mapPath.put("【危急值_辅检】", path + File.separator + "【危急值_辅检】.xls");
|
|
|
+ mapPath.put("【其他值提醒_化验】", path + File.separator + "【其他值提醒_化验】.xlsx");
|
|
|
+ mapPath.put("【其他值提醒_辅检】", path + File.separator + "【其他值提醒_辅检】.xlsx");
|
|
|
+ mapPath.put("【其他值提醒_输血】", path + File.separator + "【其他值提醒_输血】.xlsx");
|
|
|
+ mapPath.put("【高危药品】", path + File.separator + "【高危药品】.xlsx");
|
|
|
+ mapPath.put("【高危手术】", path + File.separator + "【高危手术】.xlsx");
|
|
|
+ mapPath.put("【开单合理性】", path + File.separator + "【开单合理性】.xlsx");
|
|
|
+ mapPath.put("【开单合理性_输血】", path + File.separator + "【开单合理性_输血】.xlsx");
|
|
|
+ paramMap.put("mapPath", mapPath);
|
|
|
+
|
|
|
+ try {
|
|
|
+ map = DataFacade.get("testAll", paramMap, Map.class);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "提醒类服务出错" + e.getMessage());
|
|
|
+ }
|
|
|
|
|
|
- file = getMulFileByPath(picPathPacs);
|
|
|
- Map<String, Object> criticalMapPacs = importCriticalPacsExcel(file, new TestLineVO());
|
|
|
- map.put("【危急值_辅检】",criticalMapPacs);
|
|
|
+ map.put("总耗时", (System.currentTimeMillis() - start) / 1000.0 + "秒");
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
- private MultipartFile getMulFileByPath(String picPath) {
|
|
|
+ public MultipartFile getMulFileByPath(String picPath) {
|
|
|
FileItem fileItem = createFileItem(picPath);
|
|
|
MultipartFile mfile = new CommonsMultipartFile(fileItem);
|
|
|
return mfile;
|
|
|
}
|
|
|
|
|
|
- private FileItem createFileItem(String filePath) {
|
|
|
+ public FileItem createFileItem(String filePath) {
|
|
|
FileItemFactory factory = new DiskFileItemFactory(16, null);
|
|
|
String textFieldName = "textField";
|
|
|
int num = filePath.lastIndexOf(".");
|
|
@@ -946,4 +987,13 @@ public class TestFacade {
|
|
|
}
|
|
|
return item;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 随机获取0—size之间的一个数值
|
|
|
+ * @param size
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public int getRandomNum(int size) {
|
|
|
+ return (int)(Math.random() * size);
|
|
|
+ }
|
|
|
}
|