|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.supervision.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
@ -9,6 +10,7 @@ import com.supervision.model.*;
|
|
|
|
|
import com.supervision.model.Process;
|
|
|
|
|
import com.supervision.pojo.vo.*;
|
|
|
|
|
import com.supervision.service.*;
|
|
|
|
|
import com.supervision.vo.manage.DiseaseTreatmentPlanResVo;
|
|
|
|
|
import com.supervision.vo.result.AncillaryRecordByResultDAO;
|
|
|
|
|
import com.supervision.vo.result.PhysicalRecordByResultDAO;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
@ -45,6 +47,13 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
|
|
|
|
|
|
|
|
|
|
private final DiseaseService diseaseService;
|
|
|
|
|
|
|
|
|
|
private final TreatmentPlanRecordService treatmentPlanRecordService;
|
|
|
|
|
|
|
|
|
|
private final DiseaseTreatmentPlanService diseaseTreatmentPlanService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final DiseaseTreatmentPlanDrugService diseaseTreatmentPlanDrugService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void finishAsk(FinishAskReqVO reqVO) {
|
|
|
|
@ -63,6 +72,8 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
|
|
|
|
|
diagnosisResult.setTreatmentPlanType(reqVO.getTreatmentPlanType());
|
|
|
|
|
diagnosisResult.setTreatmentPlan(reqVO.getTreatmentPlan());
|
|
|
|
|
diagnosisResultService.save(diagnosisResult);
|
|
|
|
|
|
|
|
|
|
// todo:修改流程状态
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -87,15 +98,46 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
|
|
|
|
|
// 5.全面检查-(暂无相关数据) 后面再看
|
|
|
|
|
diagnosisResultResVO.setFullCheck(null);
|
|
|
|
|
// 6.处置方案
|
|
|
|
|
diagnosisResultResVO.setDealPlan(createDealPlan(medicalRec, diagnosisResult, patient));
|
|
|
|
|
diagnosisResultResVO.setDealPlan(createDealPlan(process.getDiseaseId(), processId));
|
|
|
|
|
return diagnosisResultResVO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private DealPlanResVO createDealPlan(MedicalRec medicalRec, DiagnosisResult diagnosisResult, Patient patient) {
|
|
|
|
|
private DealPlanResVO createDealPlan(String diseaseId, String processId) {
|
|
|
|
|
|
|
|
|
|
DealPlanResVO dealPlanResVO = new DealPlanResVO();
|
|
|
|
|
dealPlanResVO.setUserTreatmentPlanType(diagnosisResult.getTreatmentPlanType());
|
|
|
|
|
dealPlanResVO.setUserTreatmentPlan(diagnosisResult.getTreatmentPlan());
|
|
|
|
|
dealPlanResVO.setRealTreatmentPlan("2.0修改,后期修改这个问题");
|
|
|
|
|
|
|
|
|
|
// 1. 查询处置计划记录
|
|
|
|
|
List<TreatmentPlanRecord> treatmentPlanRecordList = treatmentPlanRecordService.lambdaQuery().eq(TreatmentPlanRecord::getProcessId, processId).list();
|
|
|
|
|
if (CollectionUtil.isEmpty(treatmentPlanRecordList)){
|
|
|
|
|
return dealPlanResVO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 2. 查询出疾病处置计划
|
|
|
|
|
List<DiseaseTreatmentPlanResVo> diseaseTreatmentPlanResVos = diseaseTreatmentPlanService.queryListByDiseaseId(diseaseId);
|
|
|
|
|
List<String> planIds = diseaseTreatmentPlanResVos.stream().map(DiseaseTreatmentPlanResVo::getPlanId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
// 3. 查出疾病处置计划用药
|
|
|
|
|
List<DiseaseTreatmentPlanDrug> diseaseTreatmentPlanDrugList = diseaseTreatmentPlanDrugService.lambdaQuery().eq(DiseaseTreatmentPlanDrug::getDiseaseId, diseaseId).list();
|
|
|
|
|
List<String> drugIds = diseaseTreatmentPlanDrugList.stream().map(DiseaseTreatmentPlanDrug::getDrugId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
// 4. 组装数据
|
|
|
|
|
ArrayList<DealPlanResVO.TreatmentPlanResult> drugTreatmentPlanResults = new ArrayList<>();
|
|
|
|
|
ArrayList<DealPlanResVO.TreatmentPlanResult> otherTreatmentPlanResults = new ArrayList<>();
|
|
|
|
|
for (TreatmentPlanRecord treatmentPlanRecord : treatmentPlanRecordList) {
|
|
|
|
|
DealPlanResVO.TreatmentPlanResult bean = BeanUtil.toBean(treatmentPlanRecord, DealPlanResVO.TreatmentPlanResult.class);
|
|
|
|
|
boolean flag = bean.getDisposalPlan().equals(1) ? drugIds.contains(bean.getDrugId()) : planIds.contains(bean.getTreatmentPlanId());
|
|
|
|
|
bean.setFlag(flag ? 1 : 0);
|
|
|
|
|
if (bean.getDisposalPlan().equals(1)){
|
|
|
|
|
drugTreatmentPlanResults.add(bean);
|
|
|
|
|
}else {
|
|
|
|
|
otherTreatmentPlanResults.add(bean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
dealPlanResVO.setUserTreatmentPlanType(CollectionUtil.getFirst(treatmentPlanRecordList).getDisposalMethod());
|
|
|
|
|
dealPlanResVO.setDrugTreatmentPlan(drugTreatmentPlanResults);
|
|
|
|
|
dealPlanResVO.setOtherTreatmentPlan(otherTreatmentPlanResults.stream().sorted(
|
|
|
|
|
Comparator.comparing(TreatmentPlanRecord::getDisposalPlan)).collect(Collectors.toList()));
|
|
|
|
|
return dealPlanResVO;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|