From 3eb0de34311e92f6b9c0e52576e786ffa9537f5a Mon Sep 17 00:00:00 2001 From: xueqingkun Date: Thu, 7 Dec 2023 14:15:55 +0800 Subject: [PATCH] =?UTF-8?q?web:=20=E6=B7=BB=E5=8A=A0=E5=A4=84=E7=BD=AE?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E8=AF=84=E4=BC=B0=E7=BB=93=E6=9E=9C=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/DiseaseTreatmentPlanDrug.java | 2 +- .../java/com/supervision/model/Process.java | 6 ++- .../model/TreatmentPlanRecord.java | 2 +- .../mapper/DiagnosisAncillaryRecordMapper.xml | 6 +-- .../mapper/DiagnosisPhysicalRecordMapper.xml | 6 +-- .../mapper/DiseaseTreatmentPlanMapper.xml | 4 +- .../supervision/pojo/vo/DealPlanResVO.java | 21 ++++++-- .../impl/AskDiagnosisResultServiceImpl.java | 52 +++++++++++++++++-- 8 files changed, 78 insertions(+), 21 deletions(-) diff --git a/virtual-patient-model/src/main/java/com/supervision/model/DiseaseTreatmentPlanDrug.java b/virtual-patient-model/src/main/java/com/supervision/model/DiseaseTreatmentPlanDrug.java index 4ffb096e..a792602f 100644 --- a/virtual-patient-model/src/main/java/com/supervision/model/DiseaseTreatmentPlanDrug.java +++ b/virtual-patient-model/src/main/java/com/supervision/model/DiseaseTreatmentPlanDrug.java @@ -10,7 +10,7 @@ import lombok.Data; * 处置计划药物关联表 * @TableName vp_treatment_plan_drug */ -@TableName(value ="vp_disease_treatment_plan") +@TableName(value ="vp_disease_treatment_plan_drug") @Data public class DiseaseTreatmentPlanDrug implements Serializable { /** diff --git a/virtual-patient-model/src/main/java/com/supervision/model/Process.java b/virtual-patient-model/src/main/java/com/supervision/model/Process.java index 3b8d64e5..cfa899b9 100644 --- a/virtual-patient-model/src/main/java/com/supervision/model/Process.java +++ b/virtual-patient-model/src/main/java/com/supervision/model/Process.java @@ -46,9 +46,11 @@ public class Process implements Serializable { private String userId; /** - * 任务状态 0进行中 1已完成 + * 待问诊状态:新建成功后默认就是待问诊状态 + * 待处置:诊毕后,进入待处置 + * 已评估状态:处置结束,系统自动评估,就是已评估状态 */ - @ApiModelProperty("任务状态 -1未开始 0进行中 1已完成") + @ApiModelProperty("任务状态 0:待问诊 1:待处置 2:已评估") private Integer status; @ApiModelProperty("实例类型 0:学习实例 1:考核实例") diff --git a/virtual-patient-model/src/main/java/com/supervision/model/TreatmentPlanRecord.java b/virtual-patient-model/src/main/java/com/supervision/model/TreatmentPlanRecord.java index edb7a621..6b269e42 100644 --- a/virtual-patient-model/src/main/java/com/supervision/model/TreatmentPlanRecord.java +++ b/virtual-patient-model/src/main/java/com/supervision/model/TreatmentPlanRecord.java @@ -36,7 +36,7 @@ public class TreatmentPlanRecord implements Serializable { private Integer disposalMethod; /** - * 处置计划(0:护理1:药物2:活动强度 3:心里咨询 4:特殊处置 5:社区资源 6:会诊 7:随诊 ) + * 处置计划(0:护理 1:药物 2:活动强度 3:心里咨询 4:特殊处置 5:社区资源 6:会诊 7:随诊 ) */ private Integer disposalPlan; diff --git a/virtual-patient-model/src/main/resources/mapper/DiagnosisAncillaryRecordMapper.xml b/virtual-patient-model/src/main/resources/mapper/DiagnosisAncillaryRecordMapper.xml index dacad4c7..e41b7852 100644 --- a/virtual-patient-model/src/main/resources/mapper/DiagnosisAncillaryRecordMapper.xml +++ b/virtual-patient-model/src/main/resources/mapper/DiagnosisAncillaryRecordMapper.xml @@ -26,9 +26,9 @@ diff --git a/virtual-patient-web/src/main/java/com/supervision/pojo/vo/DealPlanResVO.java b/virtual-patient-web/src/main/java/com/supervision/pojo/vo/DealPlanResVO.java index 1d086c79..fb544a5e 100644 --- a/virtual-patient-web/src/main/java/com/supervision/pojo/vo/DealPlanResVO.java +++ b/virtual-patient-web/src/main/java/com/supervision/pojo/vo/DealPlanResVO.java @@ -1,7 +1,11 @@ package com.supervision.pojo.vo; +import com.supervision.model.TreatmentPlanRecord; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; @Data public class DealPlanResVO { @@ -9,9 +13,18 @@ public class DealPlanResVO { @ApiModelProperty("用户的治疗计划类型(0门诊 1住院)") private Integer userTreatmentPlanType; - @ApiModelProperty("用户的治疗计划") - private String userTreatmentPlan; + @ApiModelProperty("处置方案列表") + private List drugTreatmentPlan; + + private List otherTreatmentPlan; + + + @Data + @EqualsAndHashCode(callSuper = true) + public static class TreatmentPlanResult extends TreatmentPlanRecord { + + @ApiModelProperty("结果标识 0:错误 1:正确") + private Integer flag; - @ApiModelProperty("治疗计划") - private String realTreatmentPlan; + } } diff --git a/virtual-patient-web/src/main/java/com/supervision/service/impl/AskDiagnosisResultServiceImpl.java b/virtual-patient-web/src/main/java/com/supervision/service/impl/AskDiagnosisResultServiceImpl.java index 2054a5bf..7c61c025 100644 --- a/virtual-patient-web/src/main/java/com/supervision/service/impl/AskDiagnosisResultServiceImpl.java +++ b/virtual-patient-web/src/main/java/com/supervision/service/impl/AskDiagnosisResultServiceImpl.java @@ -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 treatmentPlanRecordList = treatmentPlanRecordService.lambdaQuery().eq(TreatmentPlanRecord::getProcessId, processId).list(); + if (CollectionUtil.isEmpty(treatmentPlanRecordList)){ + return dealPlanResVO; + } + + // 2. 查询出疾病处置计划 + List diseaseTreatmentPlanResVos = diseaseTreatmentPlanService.queryListByDiseaseId(diseaseId); + List planIds = diseaseTreatmentPlanResVos.stream().map(DiseaseTreatmentPlanResVo::getPlanId).distinct().collect(Collectors.toList()); + + // 3. 查出疾病处置计划用药 + List diseaseTreatmentPlanDrugList = diseaseTreatmentPlanDrugService.lambdaQuery().eq(DiseaseTreatmentPlanDrug::getDiseaseId, diseaseId).list(); + List drugIds = diseaseTreatmentPlanDrugList.stream().map(DiseaseTreatmentPlanDrug::getDrugId).distinct().collect(Collectors.toList()); + + // 4. 组装数据 + ArrayList drugTreatmentPlanResults = new ArrayList<>(); + ArrayList 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; }