|
@@ -11,6 +11,7 @@ import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.util.ExcelUtils;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
+import com.diagbot.util.RedisUtil;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
import com.diagbot.vo.Drug;
|
|
|
import com.diagbot.vo.IndicationPushVO;
|
|
@@ -24,6 +25,7 @@ import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
@@ -46,6 +48,8 @@ public class TestFacade {
|
|
|
IndicationFacade indicationFacade;
|
|
|
@Autowired
|
|
|
StandConvertServiceClient standConvertServiceClient;
|
|
|
+ @Autowired
|
|
|
+ RedisUtil redisUtil;
|
|
|
|
|
|
/**
|
|
|
* 开单项数据测试
|
|
@@ -53,6 +57,7 @@ public class TestFacade {
|
|
|
* @param file
|
|
|
*/
|
|
|
public Map<String, Object> importExcel(MultipartFile file, TestLineVO testLineVO) {
|
|
|
+ long start = System.currentTimeMillis();
|
|
|
List<IndicationPushVO> indicationPushVOList = new ArrayList<>();
|
|
|
List<TestIndicationVO> data = ExcelUtils.importExcelMultiSheets(file, 0, 1, testLineVO.getSheetIndex(), TestIndicationVO.class);
|
|
|
for (TestIndicationVO bean : data) {
|
|
@@ -127,9 +132,9 @@ public class TestFacade {
|
|
|
// case "3": // 临床表现
|
|
|
// indicationPushVO.setChief(bean.getNeoName());
|
|
|
// break;
|
|
|
- // case "4": //辅助检查描述
|
|
|
- // indicationPushVO.setSymptom("B超:提示" + bean.getNeoName());
|
|
|
- // break;
|
|
|
+ case "4": //辅助检查描述
|
|
|
+ indicationPushVO.setSymptom("B超:提示" + bean.getNeoName());
|
|
|
+ break;
|
|
|
// case "5": // 诊断
|
|
|
// List<Item> diag = new ArrayList<>();
|
|
|
// Item diagItem = new Item();
|
|
@@ -143,11 +148,27 @@ public class TestFacade {
|
|
|
// symptom.append(bean.getNeoName()).append("。");
|
|
|
// indicationPushVO.setSymptom(symptom.toString());
|
|
|
// break;
|
|
|
- case "7" : // 药品过敏原
|
|
|
- StringBuffer pastStr = new StringBuffer("");
|
|
|
- pastStr.append("有“").append(bean.getNeoName()).append("”过敏。");
|
|
|
- indicationPushVO.setPasts(pastStr.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(",");
|
|
@@ -181,7 +202,7 @@ public class TestFacade {
|
|
|
indicationPushVOList.add(indicationPushVO);
|
|
|
}
|
|
|
|
|
|
- Map<String, Object> map = getDebugMap(indicationPushVOList, "2");
|
|
|
+ Map<String, Object> map = getDebugMap(indicationPushVOList, "2", start);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -191,6 +212,7 @@ public class TestFacade {
|
|
|
* @param file
|
|
|
*/
|
|
|
public Map<String, Object> testIndicationTransfusion(MultipartFile file, TestLineVO testLineVO) {
|
|
|
+ long start = System.currentTimeMillis();
|
|
|
List<IndicationPushVO> indicationPushVOList = new ArrayList<>();
|
|
|
List<TestIndicationVO> data = ExcelUtils.importExcelMultiSheets(file, 0, 1, testLineVO.getSheetIndex(), TestIndicationVO.class);
|
|
|
for (TestIndicationVO bean : data) {
|
|
@@ -247,7 +269,7 @@ public class TestFacade {
|
|
|
indicationPushVOList.add(indicationPushVO);
|
|
|
}
|
|
|
|
|
|
- Map<String, Object> map = getDebugMap(indicationPushVOList, "2");
|
|
|
+ Map<String, Object> map = getDebugMap(indicationPushVOList, "2", start);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -257,6 +279,7 @@ public class TestFacade {
|
|
|
* @param file
|
|
|
*/
|
|
|
public Map<String, Object> testHighRiskOperationExcel(MultipartFile file, TestLineVO testLineVO) {
|
|
|
+ long start = System.currentTimeMillis();
|
|
|
List<IndicationPushVO> indicationPushVOList = new ArrayList<>();
|
|
|
List<TestIndicationVO> data = ExcelUtils.importExcelMultiSheets(file, 0, 1, testLineVO.getSheetIndex(), TestIndicationVO.class);
|
|
|
for (TestIndicationVO bean : data) {
|
|
@@ -279,7 +302,7 @@ public class TestFacade {
|
|
|
indicationPushVOList.add(indicationPushVO);
|
|
|
}
|
|
|
|
|
|
- Map<String, Object> map = getDebugMap(indicationPushVOList, "3");
|
|
|
+ Map<String, Object> map = getDebugMap(indicationPushVOList, "3", start);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -289,6 +312,7 @@ public class TestFacade {
|
|
|
* @param file
|
|
|
*/
|
|
|
public Map<String, Object> testOtherTipLis(MultipartFile file, TestLineVO testLineVO) {
|
|
|
+ long start = System.currentTimeMillis();
|
|
|
List<IndicationPushVO> indicationPushVOList = new ArrayList<>();
|
|
|
List<TestIndicationVO> data = ExcelUtils.importExcelMultiSheets(file, 0, 1, testLineVO.getSheetIndex(), TestIndicationVO.class);
|
|
|
for (TestIndicationVO bean : data) {
|
|
@@ -325,7 +349,7 @@ public class TestFacade {
|
|
|
indicationPushVOList.add(indicationPushVO);
|
|
|
}
|
|
|
|
|
|
- Map<String, Object> map = getDebugMap(indicationPushVOList, "4");
|
|
|
+ Map<String, Object> map = getDebugMap(indicationPushVOList, "4", start);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -335,6 +359,7 @@ public class TestFacade {
|
|
|
* @param file
|
|
|
*/
|
|
|
public Map<String, Object> testOtherTipPacs(MultipartFile file, TestLineVO testLineVO) {
|
|
|
+ long start = System.currentTimeMillis();
|
|
|
List<IndicationPushVO> indicationPushVOList = new ArrayList<>();
|
|
|
List<TestIndicationVO> data = ExcelUtils.importExcelMultiSheets(file, 0, 1, testLineVO.getSheetIndex(), TestIndicationVO.class);
|
|
|
for (TestIndicationVO bean : data) {
|
|
@@ -392,7 +417,7 @@ public class TestFacade {
|
|
|
indicationPushVOList.add(indicationPushVO);
|
|
|
}
|
|
|
|
|
|
- Map<String, Object> map = getDebugMap(indicationPushVOList, "4");
|
|
|
+ Map<String, Object> map = getDebugMap(indicationPushVOList, "4", start);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -402,6 +427,7 @@ public class TestFacade {
|
|
|
* @param file
|
|
|
*/
|
|
|
public Map<String, Object> testOtherTipTransfusion(MultipartFile file, TestLineVO testLineVO) {
|
|
|
+ long start = System.currentTimeMillis();
|
|
|
List<IndicationPushVO> indicationPushVOList = new ArrayList<>();
|
|
|
List<TestIndicationVO> data = ExcelUtils.importExcelMultiSheets(file, 0, 1, testLineVO.getSheetIndex(), TestIndicationVO.class);
|
|
|
for (TestIndicationVO bean : data) {
|
|
@@ -441,7 +467,7 @@ public class TestFacade {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Map<String, Object> map = getDebugMap(indicationPushVOList, "4");
|
|
|
+ Map<String, Object> map = getDebugMap(indicationPushVOList, "4", start);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -451,6 +477,7 @@ public class TestFacade {
|
|
|
* @param file
|
|
|
*/
|
|
|
public Map<String, Object> testHighRiskDrugExcel(MultipartFile file, TestLineVO testLineVO) {
|
|
|
+ long start = System.currentTimeMillis();
|
|
|
List<IndicationPushVO> indicationPushVOList = new ArrayList<>();
|
|
|
List<TestIndicationVO> data = ExcelUtils.importExcelMultiSheets(file, 0, 1, testLineVO.getSheetIndex(), TestIndicationVO.class);
|
|
|
for (TestIndicationVO bean : data) {
|
|
@@ -473,7 +500,7 @@ public class TestFacade {
|
|
|
indicationPushVOList.add(indicationPushVO);
|
|
|
}
|
|
|
|
|
|
- Map<String, Object> map = getDebugMap(indicationPushVOList, "3");
|
|
|
+ Map<String, Object> map = getDebugMap(indicationPushVOList, "3", start);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -483,6 +510,7 @@ public class TestFacade {
|
|
|
* @param file
|
|
|
*/
|
|
|
public Map<String, Object> importCriticalLisExcel(MultipartFile file, TestLineVO testLineVO) {
|
|
|
+ long start = System.currentTimeMillis();
|
|
|
List<IndicationPushVO> indicationPushVOList = new ArrayList<>();
|
|
|
List<TestIndicationVO> data = ExcelUtils.importExcelMultiSheets(file, 0, 1, testLineVO.getSheetIndex(), TestIndicationVO.class);
|
|
|
for (TestIndicationVO bean : data) {
|
|
@@ -522,7 +550,7 @@ public class TestFacade {
|
|
|
indicationPushVOList.add(indicationPushVO);
|
|
|
}
|
|
|
|
|
|
- Map<String, Object> map = getDebugMap(indicationPushVOList, "1");
|
|
|
+ Map<String, Object> map = getDebugMap(indicationPushVOList, "1", start);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -532,6 +560,7 @@ public class TestFacade {
|
|
|
* @param file
|
|
|
*/
|
|
|
public Map<String, Object> importCriticalPacsExcel(MultipartFile file, TestLineVO testLineVO) {
|
|
|
+ long start = System.currentTimeMillis();
|
|
|
List<IndicationPushVO> indicationPushVOList = new ArrayList<>();
|
|
|
List<TestIndicationVO> data = ExcelUtils.importExcelMultiSheets(file, 0, 1, testLineVO.getSheetIndex(), TestIndicationVO.class);
|
|
|
for (TestIndicationVO bean : data) {
|
|
@@ -553,7 +582,7 @@ public class TestFacade {
|
|
|
indicationPushVOList.add(indicationPushVO);
|
|
|
}
|
|
|
|
|
|
- Map<String, Object> map = getDebugMap(indicationPushVOList, "1");
|
|
|
+ Map<String, Object> map = getDebugMap(indicationPushVOList, "1", start);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -632,6 +661,7 @@ public class TestFacade {
|
|
|
* @return
|
|
|
*/
|
|
|
public Map<String, Object> testHighRiskProcess(MultipartFile file, TestLineVO testLineVO) {
|
|
|
+ long start = System.currentTimeMillis();
|
|
|
List<IndicationPushVO> indicationPushVOList = new ArrayList<>();
|
|
|
List<TestIndicationVO> data = ExcelUtils.importExcelMultiSheets(file, 0, 1, testLineVO.getSheetIndex(), TestIndicationVO.class);
|
|
|
for (TestIndicationVO bean : data) {
|
|
@@ -798,25 +828,7 @@ public class TestFacade {
|
|
|
// indicationPushVOList.add(indicationPushVO);
|
|
|
}
|
|
|
|
|
|
- Map<String, Object> map = new LinkedHashMap<>();
|
|
|
- List<String> msg = new ArrayList<>();
|
|
|
- List<String> errMsg = new ArrayList<>();
|
|
|
- for (IndicationPushVO indicationPushVO : indicationPushVOList) {
|
|
|
- try {
|
|
|
- IndicationDTO indicationDTO = indicationFacade.indicationFac(indicationPushVO);
|
|
|
- if (ListUtil.isEmpty(indicationDTO.getHighRiskList())) {
|
|
|
- msg.add("第【" + indicationPushVO.getIdNum() + "】行未匹配" + indicationPushVO.getMsg());
|
|
|
-
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
- errMsg.add(indicationPushVO.getIdNum() + "行出错了");
|
|
|
- }
|
|
|
- }
|
|
|
- map.put("总条数", indicationPushVOList.size() + "条");
|
|
|
- map.put("出错条数", msg.size() + "条");
|
|
|
- map.put("出错信息", msg);
|
|
|
- map.put("程序报错", errMsg);
|
|
|
+ Map<String, Object> map = getDebugMap(indicationPushVOList, "3", start);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -827,7 +839,7 @@ public class TestFacade {
|
|
|
* @param ruleType
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map getDebugMap(List<IndicationPushVO> indicationPushVOList, String ruleType) {
|
|
|
+ public Map getDebugMap(List<IndicationPushVO> indicationPushVOList, String ruleType, long start) {
|
|
|
Map<String, Object> map = new LinkedHashMap<>();
|
|
|
List<String> msg = new ArrayList<>();
|
|
|
List<String> errMsg = new ArrayList<>();
|
|
@@ -837,22 +849,26 @@ public class TestFacade {
|
|
|
switch (ruleType) {
|
|
|
case "1":
|
|
|
if (ListUtil.isEmpty(indicationDTO.getCriticalValList())) {
|
|
|
- msg.add("第【" + indicationPushVO.getIdNum() + "】行未匹配");
|
|
|
+ msg.add("第【" + indicationPushVO.getIdNum() + "】行未匹配,"
|
|
|
+ + (StringUtil.isNotBlank(indicationPushVO.getMsg()) ? indicationPushVO.getMsg() : ""));
|
|
|
}
|
|
|
break;
|
|
|
case "2":
|
|
|
if (ListUtil.isEmpty(indicationDTO.getBillMsgList())) {
|
|
|
- msg.add("第【" + indicationPushVO.getIdNum() + "】行未匹配");
|
|
|
+ msg.add("第【" + indicationPushVO.getIdNum() + "】行未匹配。"
|
|
|
+ + (StringUtil.isNotBlank(indicationPushVO.getMsg()) ? indicationPushVO.getMsg() : ""));
|
|
|
}
|
|
|
break;
|
|
|
case "3":
|
|
|
if (ListUtil.isEmpty(indicationDTO.getHighRiskList())) {
|
|
|
- msg.add("第【" + indicationPushVO.getIdNum() + "】行未匹配");
|
|
|
+ msg.add("第【" + indicationPushVO.getIdNum() + "】行未匹配。"
|
|
|
+ + (StringUtil.isNotBlank(indicationPushVO.getMsg()) ? indicationPushVO.getMsg() : ""));
|
|
|
}
|
|
|
break;
|
|
|
case "4":
|
|
|
if (ListUtil.isEmpty(indicationDTO.getOtherList())) {
|
|
|
- msg.add("第【" + indicationPushVO.getIdNum() + "】行未匹配");
|
|
|
+ msg.add("第【" + indicationPushVO.getIdNum() + "】行未匹配。"
|
|
|
+ + (StringUtil.isNotBlank(indicationPushVO.getMsg()) ? indicationPushVO.getMsg() : ""));
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
@@ -867,6 +883,7 @@ public class TestFacade {
|
|
|
map.put("出错条数", msg.size() + "条");
|
|
|
map.put("出错信息", msg);
|
|
|
map.put("程序报错", errMsg);
|
|
|
+ map.put("执行时间", (System.currentTimeMillis() - start) / 1000.0 + "秒");
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -879,21 +896,52 @@ public class TestFacade {
|
|
|
indicationPushVO.setOperationOrder(operationOrder);
|
|
|
}
|
|
|
|
|
|
- private FileItem createFileItem(File file) {
|
|
|
- String fieldName = "textField";
|
|
|
+ public Map testAll() {
|
|
|
+ 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);
|
|
|
+
|
|
|
+ file = getMulFileByPath(picPathPacs);
|
|
|
+ Map<String, Object> criticalMapPacs = importCriticalPacsExcel(file, new TestLineVO());
|
|
|
+ map.put("【危急值_辅检】",criticalMapPacs);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ private MultipartFile getMulFileByPath(String picPath) {
|
|
|
+ FileItem fileItem = createFileItem(picPath);
|
|
|
+ MultipartFile mfile = new CommonsMultipartFile(fileItem);
|
|
|
+ return mfile;
|
|
|
+ }
|
|
|
+
|
|
|
+ private FileItem createFileItem(String filePath) {
|
|
|
FileItemFactory factory = new DiskFileItemFactory(16, null);
|
|
|
- FileItem item = factory.createItem(fieldName, "text/plain", true, file.getName());
|
|
|
+ String textFieldName = "textField";
|
|
|
+ int num = filePath.lastIndexOf(".");
|
|
|
+ String extFile = filePath.substring(num);
|
|
|
+ FileItem item = factory.createItem(textFieldName, "text/plain", true,
|
|
|
+ "MyFileName" + extFile);
|
|
|
+ File newfile = new File(filePath);
|
|
|
int bytesRead = 0;
|
|
|
byte[] buffer = new byte[8192];
|
|
|
- try {
|
|
|
- FileInputStream fis = new FileInputStream(file);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ FileInputStream fis = new FileInputStream(newfile);
|
|
|
OutputStream os = item.getOutputStream();
|
|
|
- while ((bytesRead = fis.read(buffer, 0, 8192)) != -1) {
|
|
|
+ while ((bytesRead = fis.read(buffer, 0, 8192))
|
|
|
+ != -1)
|
|
|
+ {
|
|
|
os.write(buffer, 0, bytesRead);
|
|
|
}
|
|
|
os.close();
|
|
|
fis.close();
|
|
|
- } catch (IOException e) {
|
|
|
+ }
|
|
|
+ catch (IOException e)
|
|
|
+ {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return item;
|