|
|
|
@ -5,12 +5,13 @@ import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
|
|
import cn.hutool.core.lang.Pair;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.hutool.poi.excel.ExcelReader;
|
|
|
|
|
import com.supervision.dto.HandlingPlanDtoDown;
|
|
|
|
|
import com.supervision.dto.HandlingPlanDtoTop;
|
|
|
|
|
import com.supervision.manage.service.ConfigTreatmentPlanManageService;
|
|
|
|
|
import com.supervision.manage.service.DiseaseTreatmentPlanManageService;
|
|
|
|
|
import com.supervision.model.CommonDic;
|
|
|
|
|
import com.supervision.model.ConfigDrug;
|
|
|
|
|
import com.supervision.model.DiseaseTreatmentPlan;
|
|
|
|
|
import com.supervision.model.DiseaseTreatmentPlanDrug;
|
|
|
|
|
import com.supervision.manage.service.DrugManageService;
|
|
|
|
|
import com.supervision.model.*;
|
|
|
|
|
import com.supervision.service.CommonDicService;
|
|
|
|
|
import com.supervision.service.ConfigDrugService;
|
|
|
|
|
import com.supervision.service.DiseaseTreatmentPlanDrugService;
|
|
|
|
@ -20,13 +21,13 @@ import com.supervision.vo.manage.DiseaseTreatmentPlanResVo;
|
|
|
|
|
import com.supervision.vo.manage.DiseaseTreatmentPlanTreeNode;
|
|
|
|
|
import com.supervision.vo.manage.TreatmentPlanTreeNode;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import lombok.SneakyThrows;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@ -43,13 +44,16 @@ public class DiseaseTreatmentPlanManageServiceImpl implements DiseaseTreatmentPl
|
|
|
|
|
|
|
|
|
|
private final CommonDicService commonDicService;
|
|
|
|
|
|
|
|
|
|
private final DrugManageService drugManageService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<DiseaseTreatmentPlanResVo> queryListByDiseaseId(String diseaseId) {
|
|
|
|
|
|
|
|
|
|
Assert.notEmpty(diseaseId,"疾病id不能为空");
|
|
|
|
|
Assert.notEmpty(diseaseId, "疾病id不能为空");
|
|
|
|
|
List<DiseaseTreatmentPlanResVo> diseaseTreatmentPlanResVos = diseaseTreatmentPlanService.queryListByDiseaseId(diseaseId);
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isEmpty(diseaseTreatmentPlanResVos)){
|
|
|
|
|
if (CollUtil.isEmpty(diseaseTreatmentPlanResVos)) {
|
|
|
|
|
return diseaseTreatmentPlanResVos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -64,23 +68,23 @@ public class DiseaseTreatmentPlanManageServiceImpl implements DiseaseTreatmentPl
|
|
|
|
|
// 翻译处置计划 **处置计划对应于药物中的剂型**
|
|
|
|
|
List<String> drugIds = diseaseTreatmentPlanDrugList.stream()
|
|
|
|
|
.map(DiseaseTreatmentPlanDrug::getDrugId).filter(StrUtil::isNotEmpty).collect(Collectors.toList());
|
|
|
|
|
Map<String, Pair<String,String>> drugIdMapDose = new HashMap<>();
|
|
|
|
|
if (CollUtil.isNotEmpty(drugIds)){
|
|
|
|
|
Map<String, Pair<String, String>> drugIdMapDose = new HashMap<>();
|
|
|
|
|
if (CollUtil.isNotEmpty(drugIds)) {
|
|
|
|
|
List<ConfigDrug> configDrugs = configDrugService.listByIds(drugIds);
|
|
|
|
|
if (CollUtil.isNotEmpty(configDrugs)){
|
|
|
|
|
if (CollUtil.isNotEmpty(configDrugs)) {
|
|
|
|
|
Map<String, String> doseDic = commonDicService.lambdaQuery().eq(CommonDic::getGroupCode, "DOSE").list()
|
|
|
|
|
.stream().collect(Collectors.toMap(CommonDic::getCode, CommonDic::getNameZh));
|
|
|
|
|
// 组合药物id与剂型之间的映射关系
|
|
|
|
|
drugIdMapDose = configDrugs.stream().collect(Collectors.toMap(ConfigDrug::getId, drug -> {
|
|
|
|
|
// 组合药物id与剂型之间的映射关系
|
|
|
|
|
drugIdMapDose = configDrugs.stream().collect(Collectors.toMap(ConfigDrug::getId, drug -> {
|
|
|
|
|
if (StrUtil.isNotEmpty(drug.getDosageForm())) {
|
|
|
|
|
return Pair.of(drug.getDosageForm(),doseDic.getOrDefault(drug.getDosageForm(),StrUtil.EMPTY));
|
|
|
|
|
return Pair.of(drug.getDosageForm(), doseDic.getOrDefault(drug.getDosageForm(), StrUtil.EMPTY));
|
|
|
|
|
}
|
|
|
|
|
return Pair.of(StrUtil.EMPTY,StrUtil.EMPTY);
|
|
|
|
|
return Pair.of(StrUtil.EMPTY, StrUtil.EMPTY);
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Map<String, List<DiseaseTreatmentPlanDrug>> group = diseaseTreatmentPlanDrugList.stream()
|
|
|
|
|
.filter(item->Objects.nonNull(item.getDiseaseTreatmentPlanId())).collect(Collectors.groupingBy(DiseaseTreatmentPlanDrug::getDiseaseTreatmentPlanId));
|
|
|
|
|
.filter(item -> Objects.nonNull(item.getDiseaseTreatmentPlanId())).collect(Collectors.groupingBy(DiseaseTreatmentPlanDrug::getDiseaseTreatmentPlanId));
|
|
|
|
|
|
|
|
|
|
for (DiseaseTreatmentPlanResVo item : diseaseTreatmentPlanResVos) {
|
|
|
|
|
// 设置处置药物id集合
|
|
|
|
@ -89,8 +93,8 @@ public class DiseaseTreatmentPlanManageServiceImpl implements DiseaseTreatmentPl
|
|
|
|
|
.stream().map(DiseaseTreatmentPlanDrug::getDrugId).collect(Collectors.toList()));
|
|
|
|
|
// 设置处置药物剂型与剂型的翻译数据
|
|
|
|
|
String drugId = CollUtil.getFirst(item.getDrugIds());
|
|
|
|
|
if (StrUtil.isNotEmpty(drugId)){
|
|
|
|
|
item.setFirstMeasuresId(drugIdMapDose.getOrDefault(drugId, Pair.of(StrUtil.EMPTY,StrUtil.EMPTY)).getKey());
|
|
|
|
|
if (StrUtil.isNotEmpty(drugId)) {
|
|
|
|
|
item.setFirstMeasuresId(drugIdMapDose.getOrDefault(drugId, Pair.of(StrUtil.EMPTY, StrUtil.EMPTY)).getKey());
|
|
|
|
|
item.setFirstMeasures(drugIdMapDose.getOrDefault(drugId, Pair.of(StrUtil.EMPTY, StrUtil.EMPTY)).getValue());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -103,14 +107,14 @@ public class DiseaseTreatmentPlanManageServiceImpl implements DiseaseTreatmentPl
|
|
|
|
|
assertDiseaseTreatmentPlan(diseaseTreatmentPlan);
|
|
|
|
|
|
|
|
|
|
// note: 如果diseaseTreatmentPlan.getDiseaseId()不为空,则表示处置计划为药品,需要进行手动矫正,统一设置为20
|
|
|
|
|
if (CollUtil.isNotEmpty(diseaseTreatmentPlan.getDrugIds())){
|
|
|
|
|
if (CollUtil.isNotEmpty(diseaseTreatmentPlan.getDrugIds())) {
|
|
|
|
|
diseaseTreatmentPlan.setTreatmentPlanId(mapDrugTreatPlanId(diseaseTreatmentPlan.getDisposalMethod()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
diseaseTreatmentPlanService.save(diseaseTreatmentPlan);
|
|
|
|
|
|
|
|
|
|
// 保存处置计划药品信息
|
|
|
|
|
if (CollUtil.isNotEmpty(diseaseTreatmentPlan.getDrugIds())){
|
|
|
|
|
if (CollUtil.isNotEmpty(diseaseTreatmentPlan.getDrugIds())) {
|
|
|
|
|
List<DiseaseTreatmentPlanDrug> diseaseTreatmentPlanDrugList = diseaseTreatmentPlan.getDrugIds().stream().map(item -> {
|
|
|
|
|
DiseaseTreatmentPlanDrug diseaseTreatmentPlanDrug = new DiseaseTreatmentPlanDrug();
|
|
|
|
|
diseaseTreatmentPlanDrug.setDiseaseId(diseaseTreatmentPlan.getDiseaseId());
|
|
|
|
@ -128,11 +132,12 @@ public class DiseaseTreatmentPlanManageServiceImpl implements DiseaseTreatmentPl
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 映射药品的处置计划id
|
|
|
|
|
*
|
|
|
|
|
* @param disposeMethod
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private String mapDrugTreatPlanId(String disposeMethod){
|
|
|
|
|
if (StrUtil.isEmpty(disposeMethod)){
|
|
|
|
|
private String mapDrugTreatPlanId(String disposeMethod) {
|
|
|
|
|
if (StrUtil.isEmpty(disposeMethod)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return "0".equals(disposeMethod) ? "20" : "252";
|
|
|
|
@ -140,7 +145,7 @@ public class DiseaseTreatmentPlanManageServiceImpl implements DiseaseTreatmentPl
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void batchSaveTreatmentPlan(List<DiseaseTreatmentPlan> diseaseTreatmentPlanList) {
|
|
|
|
|
Assert.notEmpty(diseaseTreatmentPlanList,"数据不能为空");
|
|
|
|
|
Assert.notEmpty(diseaseTreatmentPlanList, "数据不能为空");
|
|
|
|
|
diseaseTreatmentPlanList.forEach(this::assertDiseaseTreatmentPlan);
|
|
|
|
|
|
|
|
|
|
diseaseTreatmentPlanService.saveBatch(diseaseTreatmentPlanList);
|
|
|
|
@ -149,22 +154,22 @@ public class DiseaseTreatmentPlanManageServiceImpl implements DiseaseTreatmentPl
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public boolean deleteDiseaseTreatmentPlan(String id) {
|
|
|
|
|
Assert.notEmpty(id,"id不能为空");
|
|
|
|
|
Assert.notEmpty(id, "id不能为空");
|
|
|
|
|
|
|
|
|
|
DiseaseTreatmentPlan diseaseTreatmentPlan = diseaseTreatmentPlanService.getById(id);
|
|
|
|
|
if (Objects.isNull(diseaseTreatmentPlan)){
|
|
|
|
|
if (Objects.isNull(diseaseTreatmentPlan)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
diseaseTreatmentPlanService.removeById(id);
|
|
|
|
|
diseaseTreatmentPlanDrugService.lambdaUpdate().eq(DiseaseTreatmentPlanDrug::getDiseaseTreatmentPlanId,id).remove();
|
|
|
|
|
diseaseTreatmentPlanDrugService.lambdaUpdate().eq(DiseaseTreatmentPlanDrug::getDiseaseTreatmentPlanId, id).remove();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean deleteByDiseaseId(String diseaseId) {
|
|
|
|
|
Assert.notEmpty(diseaseId,"疾病id不能为空");
|
|
|
|
|
Assert.notEmpty(diseaseId, "疾病id不能为空");
|
|
|
|
|
|
|
|
|
|
return diseaseTreatmentPlanService.lambdaUpdate().eq(DiseaseTreatmentPlan::getDiseaseId,diseaseId).remove();
|
|
|
|
|
return diseaseTreatmentPlanService.lambdaUpdate().eq(DiseaseTreatmentPlan::getDiseaseId, diseaseId).remove();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -172,7 +177,7 @@ public class DiseaseTreatmentPlanManageServiceImpl implements DiseaseTreatmentPl
|
|
|
|
|
|
|
|
|
|
// 1. 查询处置计划树
|
|
|
|
|
List<TreatmentPlanTreeNode> treatmentPlanTreeNodes = configTreatmentPlanManageService.queryTree(disposalMethod);
|
|
|
|
|
if (CollUtil.isEmpty(treatmentPlanTreeNodes)){
|
|
|
|
|
if (CollUtil.isEmpty(treatmentPlanTreeNodes)) {
|
|
|
|
|
return CollectionUtil.newArrayList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -184,7 +189,7 @@ public class DiseaseTreatmentPlanManageServiceImpl implements DiseaseTreatmentPl
|
|
|
|
|
List<DiseaseTreatmentPlanResVo> diseaseTreatmentPlanResVos = this.queryListByDiseaseId(diseaseId);
|
|
|
|
|
|
|
|
|
|
// 3. 初始化flag
|
|
|
|
|
if (CollUtil.isNotEmpty(diseaseTreatmentPlanResVos)){
|
|
|
|
|
if (CollUtil.isNotEmpty(diseaseTreatmentPlanResVos)) {
|
|
|
|
|
rootNode.initFlag(diseaseTreatmentPlanResVos.stream().map(DiseaseTreatmentPlanResVo::getTreatmentPlanId).collect(Collectors.toList()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -192,16 +197,16 @@ public class DiseaseTreatmentPlanManageServiceImpl implements DiseaseTreatmentPl
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor=Exception.class)
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public boolean updateDiseaseTreatmentPlan(DiseaseTreatmentPlanReqVo diseaseTreatmentPlan) {
|
|
|
|
|
Assert.notEmpty(diseaseTreatmentPlan.getId(),"id允许为空");
|
|
|
|
|
Assert.notEmpty(diseaseTreatmentPlan.getId(), "id允许为空");
|
|
|
|
|
|
|
|
|
|
DiseaseTreatmentPlan dtp = diseaseTreatmentPlanService.getById(diseaseTreatmentPlan.getId());
|
|
|
|
|
// 删除旧的数据
|
|
|
|
|
if (Objects.nonNull(dtp)){
|
|
|
|
|
if (Objects.nonNull(dtp)) {
|
|
|
|
|
diseaseTreatmentPlanService.removeById(diseaseTreatmentPlan.getId());
|
|
|
|
|
diseaseTreatmentPlanDrugService.lambdaUpdate()
|
|
|
|
|
.eq(DiseaseTreatmentPlanDrug::getDiseaseTreatmentPlanId,dtp.getId()).remove();
|
|
|
|
|
.eq(DiseaseTreatmentPlanDrug::getDiseaseTreatmentPlanId, dtp.getId()).remove();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
diseaseTreatmentPlan.setId(null);
|
|
|
|
@ -211,13 +216,13 @@ public class DiseaseTreatmentPlanManageServiceImpl implements DiseaseTreatmentPl
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void assertDiseaseTreatmentPlan(DiseaseTreatmentPlan diseaseTreatmentPlan){
|
|
|
|
|
private void assertDiseaseTreatmentPlan(DiseaseTreatmentPlan diseaseTreatmentPlan) {
|
|
|
|
|
|
|
|
|
|
Assert.isTrue(StrUtil.isEmpty(diseaseTreatmentPlan.getId()),"id需要为空");
|
|
|
|
|
Assert.isTrue(StrUtil.isEmpty(diseaseTreatmentPlan.getId()), "id需要为空");
|
|
|
|
|
|
|
|
|
|
Assert.notEmpty(diseaseTreatmentPlan.getDiseaseId(),"疾病id不能为空");
|
|
|
|
|
Assert.notEmpty(diseaseTreatmentPlan.getDiseaseId(), "疾病id不能为空");
|
|
|
|
|
|
|
|
|
|
Assert.notEmpty(diseaseTreatmentPlan.getTreatmentPlanId(),"处置计划id不能为空");
|
|
|
|
|
Assert.notEmpty(diseaseTreatmentPlan.getTreatmentPlanId(), "处置计划id不能为空");
|
|
|
|
|
|
|
|
|
|
// 根据疾病id和处置计划id进行重复校验
|
|
|
|
|
Long count = diseaseTreatmentPlanService.lambdaQuery()
|
|
|
|
@ -226,4 +231,162 @@ public class DiseaseTreatmentPlanManageServiceImpl implements DiseaseTreatmentPl
|
|
|
|
|
Assert.isFalse(count > 0, "该处置计划已存在");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 保存处置计划
|
|
|
|
|
* 文档导入
|
|
|
|
|
*
|
|
|
|
|
* @param excelReader
|
|
|
|
|
* @param diseaseId
|
|
|
|
|
*/
|
|
|
|
|
@SneakyThrows
|
|
|
|
|
@Override
|
|
|
|
|
public void batchSaveTreatmentPlanToDoc(ExcelReader excelReader, Disease diseaseId) {
|
|
|
|
|
|
|
|
|
|
// 判断表头
|
|
|
|
|
List<List<Object>> listList = excelReader.read();
|
|
|
|
|
for (int i = 0; i < listList.size(); i++) {
|
|
|
|
|
List<Object> objectList = listList.get(i);
|
|
|
|
|
String colNumString = String.valueOf(objectList.get(0));
|
|
|
|
|
if (colNumString.equals("处置计划")) {
|
|
|
|
|
// 第一个表头
|
|
|
|
|
List<Object> sheetHeadOne = excelReader.read().get(i);
|
|
|
|
|
checkSheetHeadOne(sheetHeadOne);
|
|
|
|
|
}
|
|
|
|
|
if (colNumString.equals("用药计划")) {
|
|
|
|
|
// 第二个表头
|
|
|
|
|
List<Object> sheetHeadTwo = excelReader.read().get(i);
|
|
|
|
|
checkSheetHeadTwo(sheetHeadTwo);
|
|
|
|
|
}
|
|
|
|
|
if (colNumString.equals("用药计划\n填写说明")) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 处置方案
|
|
|
|
|
List<Object> handlingPlanDtos = excelReader.read().get(1);
|
|
|
|
|
Object object = handlingPlanDtos.get(0);
|
|
|
|
|
Assert.isTrue(object.equals("*处置方案\n(请选择)"), "请检查应答策略模板是否正确");
|
|
|
|
|
String disposalMethod = String.valueOf(handlingPlanDtos.get(1)).equals("入院治疗") ? "1" : "0";
|
|
|
|
|
|
|
|
|
|
// 读取数据
|
|
|
|
|
readExcel(excelReader, disposalMethod, diseaseId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断模板中的处置计划是否准确
|
|
|
|
|
*
|
|
|
|
|
* @param excelReader
|
|
|
|
|
* @param disposalMethod 处置方案
|
|
|
|
|
* @param disease 病历id
|
|
|
|
|
*/
|
|
|
|
|
public void readExcel(ExcelReader excelReader, String disposalMethod, Disease disease) {
|
|
|
|
|
|
|
|
|
|
String diseaseId = disease.getId();
|
|
|
|
|
// 处置方案同一种病不可再修改
|
|
|
|
|
List<DiseaseTreatmentPlanResVo> diseaseTreatmentPlanResVos = queryListByDiseaseId(diseaseId);
|
|
|
|
|
if (!diseaseTreatmentPlanResVos.isEmpty()) {
|
|
|
|
|
String disposalMethod1 = String.valueOf(queryListByDiseaseId(diseaseId).get(0).getDisposalMethod());
|
|
|
|
|
if (StringUtils.isNotEmpty(disposalMethod1)) {
|
|
|
|
|
disposalMethod = disposalMethod1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 索引
|
|
|
|
|
int upHeadIndex = 0;
|
|
|
|
|
int downHeadIndex = 0;
|
|
|
|
|
int endHeadIndex = 0;
|
|
|
|
|
Sheet sheet = excelReader.getSheet();
|
|
|
|
|
int lastRowNum = sheet.getLastRowNum();
|
|
|
|
|
for (int i = 0; i <= lastRowNum; i++) {
|
|
|
|
|
Row row = sheet.getRow(i);
|
|
|
|
|
for (Cell cell : row) {
|
|
|
|
|
cell.setCellType(CellType.STRING);
|
|
|
|
|
String stringCellValue = cell.getStringCellValue();
|
|
|
|
|
if (stringCellValue.equals("处置计划")) {
|
|
|
|
|
// 第一个表头
|
|
|
|
|
List<Object> sheetHeadOne = excelReader.read().get(i);
|
|
|
|
|
upHeadIndex = i;
|
|
|
|
|
}
|
|
|
|
|
if (stringCellValue.equals("用药计划")) {
|
|
|
|
|
// 第二个表头
|
|
|
|
|
List<Object> sheetHeadTwo = excelReader.read().get(i);
|
|
|
|
|
downHeadIndex = i;
|
|
|
|
|
}
|
|
|
|
|
if (stringCellValue.equals("用药计划\n填写说明")) {
|
|
|
|
|
endHeadIndex = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 查询 该疾病和处置方式 下的处置计划
|
|
|
|
|
List<DiseaseTreatmentPlanTreeNode> diseaseTreatmentPlanTreeNodes = queryDiseaseTreatmentPlanTree(Integer.parseInt(disposalMethod), diseaseId);
|
|
|
|
|
|
|
|
|
|
// 获取列表数据
|
|
|
|
|
List<List<Object>> listListUp = excelReader.read(upHeadIndex + 1, downHeadIndex - 2);
|
|
|
|
|
// 模板中未有药物所以药物暂不用
|
|
|
|
|
// List<List<Object>> listListDown = excelReader.read(downHeadIndex + 1, endHeadIndex - 1);
|
|
|
|
|
for (int i = 0; i < listListUp.size(); i++) {
|
|
|
|
|
// 读取每一行
|
|
|
|
|
List<Object> objects = listListUp.get(i);
|
|
|
|
|
|
|
|
|
|
// 有一个为空则pass
|
|
|
|
|
String firstLevelMeasure = String.valueOf(objects.get(1));
|
|
|
|
|
String secondLevelMeasure = String.valueOf(objects.get(2));
|
|
|
|
|
if (StringUtils.isEmpty(firstLevelMeasure) || StringUtils.isEmpty(secondLevelMeasure)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(firstLevelMeasure)) {
|
|
|
|
|
// 查询一级措施
|
|
|
|
|
List<DiseaseTreatmentPlanTreeNode> diseaseTreatmentPlanTreeNodeList = diseaseTreatmentPlanTreeNodes
|
|
|
|
|
.stream()
|
|
|
|
|
.filter(e -> firstLevelMeasure.equals(e.getName()))
|
|
|
|
|
.toList();
|
|
|
|
|
Assert.notNull(diseaseTreatmentPlanTreeNodeList, "请检查处置计划一级措施");
|
|
|
|
|
// 二级措施
|
|
|
|
|
if (StringUtils.isNotEmpty(secondLevelMeasure)) {
|
|
|
|
|
// 查询二级措施
|
|
|
|
|
List<DiseaseTreatmentPlanTreeNode> child = diseaseTreatmentPlanTreeNodeList.get(0).getChild();
|
|
|
|
|
List<DiseaseTreatmentPlanTreeNode> planTreeNodes = child
|
|
|
|
|
.stream()
|
|
|
|
|
.filter(e -> secondLevelMeasure.equals(e.getName()))
|
|
|
|
|
.toList();
|
|
|
|
|
Assert.notNull(planTreeNodes, "请检查处置计划二级措施");
|
|
|
|
|
// 保存
|
|
|
|
|
DiseaseTreatmentPlanReqVo diseaseTreatmentPlanReqVo = new DiseaseTreatmentPlanReqVo();
|
|
|
|
|
if (!diseaseTreatmentPlanTreeNodeList.isEmpty()) {
|
|
|
|
|
String disposalPlanId = diseaseTreatmentPlanTreeNodeList.get(0).getId();
|
|
|
|
|
diseaseTreatmentPlanReqVo.setPlanId(disposalPlanId);
|
|
|
|
|
}
|
|
|
|
|
if (!planTreeNodes.isEmpty()) {
|
|
|
|
|
String firstMeasuresId = planTreeNodes.get(0).getId();
|
|
|
|
|
diseaseTreatmentPlanReqVo.setTreatmentPlanId(firstMeasuresId);
|
|
|
|
|
diseaseTreatmentPlanReqVo.setFirstMeasuresId(firstMeasuresId);
|
|
|
|
|
}
|
|
|
|
|
diseaseTreatmentPlanReqVo.setDiseaseId(diseaseId);
|
|
|
|
|
diseaseTreatmentPlanReqVo.setDisposalMethod(disposalMethod);
|
|
|
|
|
saveTreatmentPlan(diseaseTreatmentPlanReqVo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void checkSheetHeadOne(List<Object> sheetHeadOne) {
|
|
|
|
|
for (int i = 0; i < HandlingPlanDtoTop.CASE_TEMPLATE_SHEET_SINGLE_DISEASE_TITLE.size(); i++) {
|
|
|
|
|
Assert.isTrue(sheetHeadOne.size() > i, "表头格式有误,请重新导入");
|
|
|
|
|
Assert.isTrue(HandlingPlanDtoTop.CASE_TEMPLATE_SHEET_SINGLE_DISEASE_TITLE.get(i).equals(sheetHeadOne.get(i)), "表头格式有误,请重新导入");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void checkSheetHeadTwo(List<Object> sheetHeadOne) {
|
|
|
|
|
for (int i = 0; i < HandlingPlanDtoDown.CASE_TEMPLATE_SHEET_SINGLE_DISEASE_TITLE.size(); i++) {
|
|
|
|
|
Assert.isTrue(sheetHeadOne.size() > i, "表头格式有误,请重新导入");
|
|
|
|
|
Assert.isTrue(HandlingPlanDtoDown.CASE_TEMPLATE_SHEET_SINGLE_DISEASE_TITLE.get(i).equals(sheetHeadOne.get(i)), "表头格式有误,请重新导入");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|