|
|
@@ -21,6 +21,7 @@ import org.jeecg.modules.medical.common.bo.ExportRuleTitleDTO;
|
|
|
import org.jeecg.modules.medical.entity.MaterialItems;
|
|
|
import org.jeecg.modules.medical.entity.MedicalInsRuleProject;
|
|
|
import org.jeecg.modules.medical.mapper.MedicalInsRuleProjectMapper;
|
|
|
+import org.jeecg.modules.medical.service.IMedicalInsRuleProjectDiagnoseService;
|
|
|
import org.jeecg.modules.medical.service.IMedicalInsRuleProjectService;
|
|
|
import org.jeecg.modules.system.service.ISysDataSourceService;
|
|
|
import org.jeecg.modules.system.service.ISysDictService;
|
|
|
@@ -70,6 +71,7 @@ public class MedicalInsRuleProjectServiceImpl extends ServiceImpl<MedicalInsRule
|
|
|
public static final String PROJECTCODE = "projectCode";
|
|
|
public static final String CORRELATIONPROJECTCODE = "correlationProjectCode";
|
|
|
|
|
|
+ private final IMedicalInsRuleProjectDiagnoseService diagnoseService;
|
|
|
@Value("${jeecg.path.upload}")
|
|
|
private String upLoadPath;
|
|
|
|
|
|
@@ -148,7 +150,7 @@ public class MedicalInsRuleProjectServiceImpl extends ServiceImpl<MedicalInsRule
|
|
|
|
|
|
// mv.addObject("mapList", maps);
|
|
|
//update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
|
|
|
- ExportParams exportParams = new ExportParams(noCodeTitle + "模板", " " , noCodeTitle);
|
|
|
+ ExportParams exportParams = new ExportParams(noCodeTitle + "模板", " ", noCodeTitle);
|
|
|
exportParams.setImageBasePath(upLoadPath);
|
|
|
// String[] array = (String[]) ignoreField.stream().map(String::valueOf).toArray();
|
|
|
String[] array1 = ignoreField.toArray(new String[0]);
|
|
|
@@ -234,7 +236,6 @@ public class MedicalInsRuleProjectServiceImpl extends ServiceImpl<MedicalInsRule
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
Field[] fields = PoiPublicUtil.getClassFields(medicalInsRuleProjectClass);
|
|
|
List<String> ignoreField = new ArrayList<>();
|
|
|
if (fields != null) {
|
|
|
@@ -289,8 +290,6 @@ public class MedicalInsRuleProjectServiceImpl extends ServiceImpl<MedicalInsRule
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
// List<MedicalInsRuleProject> list = ExcelImportUtil.importExcel(file.getInputStream(), MedicalInsRuleProject.class, params);
|
|
|
List<MedicalInsRuleProject> list = DefaultExcelImportUtil
|
|
|
.importExcel(file.getInputStream(), MedicalInsRuleProject.class, params);
|
|
|
@@ -298,8 +297,8 @@ public class MedicalInsRuleProjectServiceImpl extends ServiceImpl<MedicalInsRule
|
|
|
log.error("导入文件没有数据,请检查");
|
|
|
return Result.ok("上传的文件没有数据,请检查");
|
|
|
}
|
|
|
- //去空格
|
|
|
- list.forEach(it->{
|
|
|
+ //去空格 medicalDiagnoseCode correlationMedicalDiagnoseCode
|
|
|
+ list.forEach(it -> {
|
|
|
DefaultExcelImportUtil.objectToTrim(it);
|
|
|
});
|
|
|
totalNumber = list.size();
|
|
|
@@ -372,15 +371,16 @@ public class MedicalInsRuleProjectServiceImpl extends ServiceImpl<MedicalInsRule
|
|
|
updateList = excelImportUtilService.getUpdateDatas(list, dbExistsList,
|
|
|
this::getDuplicateRm,
|
|
|
(nd, od) -> {
|
|
|
- nd.setId(od.getId());
|
|
|
- nd.setUpdateBy(finalUsername); //更新人
|
|
|
- nd.setUpdateTime(new Date());
|
|
|
- return nd;
|
|
|
- });//
|
|
|
+ nd.setId(od.getId());
|
|
|
+ nd.setUpdateBy(finalUsername); //更新人
|
|
|
+ nd.setUpdateTime(new Date());
|
|
|
+ return nd;
|
|
|
+ });//
|
|
|
// 如果有则需要更新
|
|
|
if (!CollectionUtils.isEmpty(updateList)) {
|
|
|
updateNumber = updateList.size();
|
|
|
this.updateBatchById(updateList, 500);
|
|
|
+
|
|
|
}
|
|
|
// 取出差集
|
|
|
instalList = excelImportUtilService.getInsertDatas(list, dbExistsList, this::getDuplicateRm);
|
|
|
@@ -398,6 +398,21 @@ public class MedicalInsRuleProjectServiceImpl extends ServiceImpl<MedicalInsRule
|
|
|
// this.saveBatch(instalList, 500);
|
|
|
// insertService.apply(instalList, 500);
|
|
|
this.saveBatch(instalList, 500);
|
|
|
+// list<MedicalInsRuleProject>
|
|
|
+ instalList.stream().forEach(it -> {
|
|
|
+ if (StringUtils.hasText(it.getMedicalDiagnoseCode())) {
|
|
|
+ List<String> code = Arrays.asList(it.getMedicalDiagnoseCode().split("\n"));
|
|
|
+ Integer projectCodeType = 1;
|
|
|
+ diagnoseService.saveDiagnose(code, projectCodeType, it.getMedicalInsRuleInfoId(), it.getProjectCode());
|
|
|
+ }
|
|
|
+ if (StringUtils.hasText(it.getCorrelationMedicalDiagnoseCode())) {
|
|
|
+ List<String> code = Arrays.asList(it.getCorrelationMedicalDiagnoseCode().split("\n"));
|
|
|
+ Integer projectCodeType = 2;
|
|
|
+ diagnoseService.saveDiagnose(code, projectCodeType, it.getMedicalInsRuleInfoId(), it.getProjectCode());
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
//400条 saveBatch消耗时间1592毫秒 循环插入消耗时间1947毫秒
|
|
|
//1200条 saveBatch消耗时间3687毫秒 循环插入消耗时间5212毫秒
|
|
|
@@ -425,6 +440,7 @@ public class MedicalInsRuleProjectServiceImpl extends ServiceImpl<MedicalInsRule
|
|
|
return Result.error("文件导入失败!");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
private String getDuplicateRm(MedicalInsRuleProject medicalInsRuleProject) {
|
|
|
// log.info("调试信息,输入id={}, projectCode={}, corren={}", medicalInsRuleProject.getId(), medicalInsRuleProject.getCode(),
|
|
|
// medicalInsRuleProject.getCorrelationProjectCode());
|
|
|
@@ -451,7 +467,7 @@ public class MedicalInsRuleProjectServiceImpl extends ServiceImpl<MedicalInsRule
|
|
|
@Override
|
|
|
public List<MedicalInsRuleProject> loadDbExistsList(List<MedicalInsRuleProject> list, ExportRuleTitleDTO exportRuleTitle, Integer ruleId) {
|
|
|
// 固定这两个字段,projectCode为必须,correlationProjectCode为可选
|
|
|
- if (exportRuleTitle.getSelectedRoles().indexOf(PROJECTCODE) <= -1) {
|
|
|
+ if (exportRuleTitle.getSelectedRoles().indexOf(PROJECTCODE) <= -1) {
|
|
|
log.warn("导入时,没有找到字段={}, 本次导入不做导入数据与数据库去重", PROJECTCODE);
|
|
|
return new ArrayList<>();
|
|
|
}
|