From 7b2b6d4675f4278c4cb617f5b85c00a18fb9e875 Mon Sep 17 00:00:00 2001 From: haown <454902499@qq.com> Date: Fri, 9 Aug 2024 11:27:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=84=8F=E5=90=91=E3=80=81?= =?UTF-8?q?=E6=92=A4=E9=94=80=E6=84=8F=E5=90=91=E3=80=81=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=AD=BE=E7=BA=A6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SignPatientRecordController.java | 56 +++++++ .../SignPatientUpdateDto.java | 44 +++++ .../SignPatientRecordMapper.java | 9 + .../ISignPatientRecordService.java | 35 ++++ .../impl/SignPatientRecordServiceImpl.java | 155 +++++++++++++++++- .../manage/vo/patientinfo/PatientInfoVo.java | 5 + .../signpatientrecord/IntentionalSignVo.java | 50 ++++++ .../manage/patientinfo/PatientInfoMapper.xml | 10 +- .../SignPatientRecordMapper.xml | 7 +- 9 files changed, 367 insertions(+), 4 deletions(-) create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/dto/signpatientrecord/SignPatientUpdateDto.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/vo/signpatientrecord/IntentionalSignVo.java diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/signpatientrecord/SignPatientRecordController.java b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/signpatientrecord/SignPatientRecordController.java index 400a8a28..62081310 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/signpatientrecord/SignPatientRecordController.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/signpatientrecord/SignPatientRecordController.java @@ -11,6 +11,7 @@ import com.xinelu.manage.dto.signpatientrecord.SignPatientListDto; import com.xinelu.manage.dto.signpatientrecord.SignPatientStatusDto; import com.xinelu.manage.service.signpatientrecord.ISignPatientRecordService; import com.xinelu.manage.vo.patientinfo.PatientPortaitVo; +import com.xinelu.manage.vo.signpatientrecord.IntentionalSignVo; import com.xinelu.manage.vo.signpatientrecord.SignPatientInfoVo; import com.xinelu.manage.vo.signpatientrecord.SignPatientListVo; import com.xinelu.manage.vo.signpatientrecord.SignPatientRecordVo; @@ -63,6 +64,50 @@ public class SignPatientRecordController extends BaseController { return flag > 0 ? R.ok() : R.fail(); } + /** + * @description 查询意向签约 + * @param id 签约记录表主键 + * @return 意向签约详情 + * @Author haown + * @Date 2024-08-08 11:00 + */ + @ApiOperation("查询意向签约") + @PreAuthorize("@ss.hasPermi('manage:signRecord:list')") + @PostMapping("/getIntentionalSign/{id}") + public R getIntentionalSign(@PathVariable("id") Long id) { + return R.ok(signPatientRecordService.getIntentionalSign(id)); + } + + /** + * @description 修改意向签约 + * @param body 意向签约传输对象 + * @return 结果 + * @Author haown + * @Date 2024-08-07 14:35 + */ + @ApiOperation("修改意向签约") + @PreAuthorize("@ss.hasPermi('manage:signRecord:edit')") + @PostMapping("/updateIntentionalSign") + public R updateIntentionalSign(@Valid @RequestBody IntentionalSignDto body) { + int flag = signPatientRecordService.updateIntentionalSign(body); + return flag > 0 ? R.ok() : R.fail(); + } + + /** + * @description 撤销意向签约 + * @param patientId 患者主键 + * @return 结果 + * @Author haown + * @Date 2024-08-07 14:34 + */ + @ApiOperation("撤销意向签约") + @PreAuthorize("@ss.hasPermi('manage:signRecord:add')") + @GetMapping("/cancelIntentionalSign/{patientId}") + public R cancelIntentionalSign(@PathVariable("patientId") Long patientId) { + int flag = signPatientRecordService.cancelIntentionalSign(patientId); + return flag > 0 ? R.ok() : R.fail(); + } + /** * 签约 */ @@ -74,6 +119,17 @@ public class SignPatientRecordController extends BaseController { return flag > 0 ? R.ok() : R.fail(); } + /** + * 修改签约信息 + */ + @ApiOperation("修改签约信息") + @PreAuthorize("@ss.hasPermi('manage:signRecord:edit')") + @PostMapping("/updateSign") + public R updateSign(@Valid @RequestBody SignPatientAddDto body) { + int flag = signPatientRecordService.edit(body); + return flag > 0 ? R.ok() : R.fail(); + } + /** * 根据患者主键查询签约记录 */ diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/signpatientrecord/SignPatientUpdateDto.java b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/signpatientrecord/SignPatientUpdateDto.java new file mode 100644 index 00000000..14555927 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/signpatientrecord/SignPatientUpdateDto.java @@ -0,0 +1,44 @@ +package com.xinelu.manage.dto.signpatientrecord; + +import com.xinelu.manage.domain.signpatientinformed.SignPatientInformed; +import com.xinelu.manage.domain.signpatientmanageroute.SignPatientManageRoute; +import com.xinelu.manage.domain.signpatientpackagehardware.SignPatientPackageHardware; +import com.xinelu.manage.dto.signpatientpackage.SignPatientPackageSaveDto; +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import lombok.Data; + +/** + * @description: 患者签约记录修改传输对象 + * @author: haown + * @create: 2024-08-07 15:54 + **/ +@Data +public class SignPatientUpdateDto { + + private Long signPatientRecordId; + + /** + * 服务包 + */ + @ApiModelProperty("服务包对象") + private SignPatientPackageSaveDto signPackage; + + /** + * 管理路径 + */ + @ApiModelProperty("管理路径") + private SignPatientManageRoute route; + + /** + * 硬件设备 + */ + @ApiModelProperty("硬件设备列表") + private List devices; + + /** + * 签约知情书 + */ + @ApiModelProperty("签约知情书列表") + private List informeds; +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/signpatientrecord/SignPatientRecordMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/signpatientrecord/SignPatientRecordMapper.java index 1ac29b8b..8bd2b94c 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/signpatientrecord/SignPatientRecordMapper.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/signpatientrecord/SignPatientRecordMapper.java @@ -2,6 +2,7 @@ package com.xinelu.manage.mapper.signpatientrecord; import com.xinelu.manage.domain.signpatientrecord.SignPatientRecord; import com.xinelu.manage.dto.signpatientrecord.SignPatientListDto; +import com.xinelu.manage.vo.signpatientrecord.IntentionalSignVo; import com.xinelu.manage.vo.signpatientrecord.SignPatientInfoVo; import com.xinelu.manage.vo.signpatientrecord.SignPatientRecordVo; import com.xinelu.manage.vo.signpatientrecord.SignPatientListVo; @@ -33,4 +34,12 @@ public interface SignPatientRecordMapper { List getByPatient(Long patientId); + /** + * @description 查询意向签约 + * @param id 签约记录表主键 + * @return 意向签约详情 + * @Author haown + * @Date 2024-08-08 11:00 + */ + IntentionalSignVo getIntentionalSign(Long id); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientrecord/ISignPatientRecordService.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientrecord/ISignPatientRecordService.java index 0ddf5104..f4ae0407 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientrecord/ISignPatientRecordService.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientrecord/ISignPatientRecordService.java @@ -7,6 +7,7 @@ import com.xinelu.manage.dto.signpatientrecord.SignPatientAddDto; import com.xinelu.manage.dto.signpatientrecord.SignPatientListDto; import com.xinelu.manage.dto.signpatientrecord.SignPatientStatusDto; import com.xinelu.manage.vo.patientinfo.PatientPortaitVo; +import com.xinelu.manage.vo.signpatientrecord.IntentionalSignVo; import com.xinelu.manage.vo.signpatientrecord.SignPatientInfoVo; import com.xinelu.manage.vo.signpatientrecord.SignPatientListVo; import com.xinelu.manage.vo.signpatientrecord.SignPatientRecordVo; @@ -41,6 +42,13 @@ public interface ISignPatientRecordService { */ int add(SignPatientAddDto body); + /** + * 修改签约信息 + * @param body 修改签约信息传输对象 + * @return 结果 + */ + int edit(SignPatientAddDto body); + int updateSignStatus(SignPatientStatusDto patientCancelSignDto); /** @@ -50,6 +58,33 @@ public interface ISignPatientRecordService { */ int intentionalSign(IntentionalSignDto intentionalSignDto); + /** + * @description 查询意向签约 + * @param id 签约记录表主键 + * @return 意向签约详情 + * @Author haown + * @Date 2024-08-08 11:00 + */ + IntentionalSignVo getIntentionalSign(Long id); + + /** + * @description 修改意向签约 + * @param intentionalSignDto 意向签约传输对象 + * @return 结果 + * @Author haown + * @Date 2024-08-07 14:35 + */ + int updateIntentionalSign(IntentionalSignDto intentionalSignDto); + + /** + * @description 撤销意向签约 + * @param patientId 患者主键 + * @return 结果 + * @Author haown + * @Date 2024-08-07 11:16 + */ + int cancelIntentionalSign(Long patientId); + PatientPortaitVo getPortaitInfo(Long patientId); /** * 画像审核 diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientrecord/impl/SignPatientRecordServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientrecord/impl/SignPatientRecordServiceImpl.java index e6f41eb3..b03c9e5c 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientrecord/impl/SignPatientRecordServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientrecord/impl/SignPatientRecordServiceImpl.java @@ -33,6 +33,7 @@ import com.xinelu.manage.mapper.labelfieldcontent.LabelFieldContentMapper; import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper; import com.xinelu.manage.mapper.patientnodeparamslcurrent.PatientNodeParamsCurrentMapper; import com.xinelu.manage.mapper.patientnodeparamslog.PatientNodeParamsLogMapper; +import com.xinelu.manage.mapper.patientvisitrecord.PatientVisitRecordMapper; import com.xinelu.manage.mapper.signpatientinformed.SignPatientInformedMapper; import com.xinelu.manage.mapper.signpatientmanageroute.SignPatientManageRouteMapper; import com.xinelu.manage.mapper.signpatientmanageroutenode.SignPatientManageRouteNodeMapper; @@ -47,6 +48,7 @@ import com.xinelu.manage.service.signpatientrecord.ISignPatientRecordService; import com.xinelu.manage.vo.labelfieldcontent.LabelField; import com.xinelu.manage.vo.labelfieldcontent.LabelFieldInfoContentVo; import com.xinelu.manage.vo.patientinfo.PatientPortaitVo; +import com.xinelu.manage.vo.signpatientrecord.IntentionalSignVo; import com.xinelu.manage.vo.signpatientrecord.SignPatientInfoVo; import com.xinelu.manage.vo.signpatientrecord.SignPatientListVo; import com.xinelu.manage.vo.signpatientrecord.SignPatientRecordVo; @@ -55,6 +57,7 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.stream.Collectors; import javax.annotation.Resource; import org.apache.commons.lang3.ObjectUtils; @@ -106,6 +109,8 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService { private LabelFieldContentMapper labelFieldContentMapper; @Resource private ILabelFieldContentService labelFieldContentService; + @Resource + private PatientVisitRecordMapper patientVisitRecordMapper; @Override @DataScope(agencyAlias = "sign", deptAlias = "sign", userAlias = "sign.billing_doctor_id") @@ -229,7 +234,98 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService { return 0; } - @Override + @Override + @Transactional(rollbackFor = Exception.class) + public int edit(SignPatientAddDto body) { + SignPatientPackageSaveDto signPatientPackageDto = body.getSignPackage(); + if (ObjectUtils.isEmpty(signPatientPackageDto) || signPatientPackageDto.getServicePackageId() == null) { + throw new ServiceException("请选择服务包"); + } + SignPatientRecord record = body.getRecord(); + if (record.getId() == null) { + throw new ServiceException("数据传输错误"); + } + SignPatientRecord signPatientRecord = signPatientRecordMapper.selectByPrimaryKey(record.getId()); + BeanUtils.copyBeanProp(signPatientRecord, record); + // 修改签约记录表 + int flag = signPatientRecordMapper.updateByPrimaryKeySelective(signPatientRecord); + if (flag > 0) { + // 修改签约服务包信息 + SignPatientPackage signPatientPackage = new SignPatientPackage(); + // 服务开始时间、服务结束时间 + BeanUtils.copyBeanProp(signPatientPackage, signPatientPackageDto); + signPatientPackage.setSignPatientRecordId(signPatientRecord.getId()); + signPatientPackage.setPatientId(signPatientRecord.getPatientId()); + signPatientPackage.setServiceStartTime(signPatientPackageDto.getServiceStartTime().atStartOfDay()); + signPatientPackage.setServiceEndTime(signPatientPackageDto.getServiceEndTime().atTime(23,59,59)); + signPatientPackage.setUpdateTime(LocalDateTime.now()); + signPatientPackage.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName()); + signPatientPackageMapper.updateSignPatientPackage(signPatientPackage); + + if (ObjectUtils.isEmpty(body.getRoute()) || body.getRoute().getRouteId() == null) { + throw new ServiceException("请选择管理路径"); + } + // 修改签约路径信息,判断签约路径是否修改,修改:删除未执行的任务、路径审核状态改为未审核,未修改:不做处理 + SignPatientManageRoute signRouteQuery = new SignPatientManageRoute(); + signRouteQuery.setSignPatientRecordId(record.getId()); + signRouteQuery.setTaskCreateType(TaskCreateTypeConstant.MANUAL_MATCHE); + List signPatientManageRouteList = signPatientManageRouteMapper.selectSignPatientManageRouteList(signRouteQuery); + if (!CollectionUtils.isEmpty(signPatientManageRouteList) && Objects.equals(signPatientManageRouteList.get(0).getRouteId(), body.getRoute().getRouteId())) { + + } else { + SignPatientManageRouteNodeDto signPatientManageRouteNodeDto = new SignPatientManageRouteNodeDto(); + signPatientManageRouteNodeDto.setManageRouteId(signPatientManageRouteList.get(0).getId()); + List nodeList = signPatientManageRouteNodeService.selectSignPatientManageRouteNodeList(signPatientManageRouteNodeDto); + if (!CollectionUtils.isEmpty(nodeList)) { + // 删除未执行的任务 + List ids = nodeList.stream() + .filter(node -> !StringUtils.equals(NodeExecuteStatusEnum.EXECUTED.getInfo(), node.getNodeExecuteStatus())) + .map(SignPatientManageRouteNode::getId).collect(Collectors.toList()); + signPatientManageRouteNodeService.deleteSignPatientManageRouteNodeByIds(ids.toArray(new Long[0])); + + // 路径改为未审核 + signPatientRecord.setRouteCheckStatus(null); + signPatientRecord.setRouteCheckDate(null); + signPatientRecord.setRouteCheckPerson(null); + signPatientRecord.setRouteCheckRemark(null); + signPatientRecordMapper.updateByPrimaryKey(signPatientRecord); + } + } + // 修改硬件 + if (!CollectionUtils.isEmpty(body.getDevices())) { + SignPatientPackageHardware signPatientPackageHardware = new SignPatientPackageHardware(); + signPatientPackageHardware.setSignPatientRecordId(signPatientRecord.getId()); + List hardwareList = hardwareMapper.selectSignPatientPackageHardwareList(signPatientPackageHardware); + if (!CollectionUtils.isEmpty(hardwareList)) { + List hardwareIds = hardwareList.stream().map(SignPatientPackageHardware::getId).collect(Collectors.toList()); + hardwareMapper.deleteSignPatientPackageHardwareByIds(hardwareIds.toArray(new Long[0])); + } + for(SignPatientPackageHardware hardware : body.getDevices()) { + hardware.setSignPatientRecordId(signPatientRecord.getId()); + hardwareMapper.insertSignPatientPackageHardware(hardware); + } + } + + // 修改告知书 + if (!CollectionUtils.isEmpty(body.getInformeds())) { + SignPatientInformed signPatientInformed = new SignPatientInformed(); + signPatientInformed.setSignPatientRecordId(signPatientRecord.getId()); + List signPatientInformedList = informedMapper.selectSignPatientInformedList(signPatientInformed); + if (!CollectionUtils.isEmpty(signPatientInformedList)) { + List informedIds = signPatientInformedList.stream().map(SignPatientInformed::getId).collect(Collectors.toList()); + informedMapper.deleteSignPatientInformedByIds(informedIds.toArray(new Long[0])); + } + for (SignPatientInformed informed : body.getInformeds()) { + informed.setSignPatientRecordId(signPatientRecord.getId()); + informed.setPatientId(signPatientRecord.getPatientId()); + informedMapper.insertSignPatientInformed(informed); + } + } + } + return flag; + } + + @Override @Transactional(rollbackFor = Exception.class) public int updateSignStatus(SignPatientStatusDto patientCancelSignDto) { if (patientCancelSignDto.getPatientId() == null) { @@ -322,6 +418,63 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService { return flag; } + @Override public IntentionalSignVo getIntentionalSign(Long id) { + return signPatientRecordMapper.getIntentionalSign(id); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public int updateIntentionalSign(IntentionalSignDto intentionalSignDto) { + PatientInfo patientInfo = patientInfoMapper.selectPatientInfoById(intentionalSignDto.getPatientId()); + if (ObjectUtils.isEmpty(patientInfo)) { + throw new ServiceException("未找到该居民"); + } + + patientInfo.setServiceStatus(SignRecordServiceStatusConstants.INTENTIONAL_SIGNING); + SignPatientRecord signRecord = new SignPatientRecord(); + signRecord.setId(patientInfo.getSignPatientRecordId()); + // 患者信息保存到签约表 + signRecord.setBillingDoctorId(intentionalSignDto.getBillingDoctorId()); + signRecord.setBillingDoctorName(intentionalSignDto.getBillingDoctorName()); + signRecord.setIntentionalSource(intentionalSignDto.getIntentionalSource()); + signRecord.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName()); + signRecord.setUpdateTime(LocalDateTime.now()); + signRecord.setId(signRecord.getId()); + int flag = signPatientRecordMapper.updateByPrimaryKeySelective(signRecord); + if (flag > 0) { + patientInfo.setSignPatientRecordId(signRecord.getId()); + patientInfoMapper.updatePatientInfoSelective(patientInfo); + } + return flag; + } + + /** + * @description 撤销意向签约 + * @param patientId 患者主键 + * @return 结果 + * @Author haown + * @Date 2024-08-07 11:16 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int cancelIntentionalSign(Long patientId) { + PatientInfo patientInfo = patientInfoMapper.selectPatientInfoById(patientId); + if (ObjectUtils.isEmpty(patientInfo)) { + throw new ServiceException("未找到该居民"); + } + patientInfo.setServiceStatus(null); + // 删除签约记录 + signPatientRecordMapper.deleteByPrimaryKey(patientInfo.getSignPatientRecordId()); + // 患者信息表设置最新一条签约记录id + List signPatientRecords = signPatientRecordMapper.getByPatient(patientId); + if (CollectionUtils.isEmpty(signPatientRecords)) { + patientInfo.setSignPatientRecordId(null); + } else { + patientInfo.setSignPatientRecordId(signPatientRecords.get(0).getId()); + } + return patientInfoMapper.updatePatientInfo(patientInfo); + } + /** * 任务审核页面左侧画像信息 * @param patientId 患者主键 diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/patientinfo/PatientInfoVo.java b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/patientinfo/PatientInfoVo.java index 92df8c87..858e6e0f 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/patientinfo/PatientInfoVo.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/patientinfo/PatientInfoVo.java @@ -189,6 +189,11 @@ public class PatientInfoVo { */ private Integer routeNodeDay; + /** + * 患者签约状态 + */ + private String patientSignStatus; + /** * 任务执行时间 */ diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/signpatientrecord/IntentionalSignVo.java b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/signpatientrecord/IntentionalSignVo.java new file mode 100644 index 00000000..e4b319bf --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/signpatientrecord/IntentionalSignVo.java @@ -0,0 +1,50 @@ +package com.xinelu.manage.vo.signpatientrecord; + +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +/** + * @description: 意向签约查询视图类 + * @author: haown + * @create: 2024-08-08 11:01 + **/ +@Data +public class IntentionalSignVo { + + /** + * 签约记录表主键 + */ + @ApiModelProperty("签约记录表主键") + private Long id; + + /** + * 患者主键 + */ + @ApiModelProperty("患者主键") + private Long patientId; + + /** + * 意向来源(意向签约,字典枚举) + */ + @ApiModelProperty(value = "意向来源(意向签约,字典枚举),DOCTOR_BILLING:医生开单") + private String intentionalSource; + + /** + * 加入意向时间(意向签约) + */ + @ApiModelProperty(value = "加入意向时间(意向签约)") + private LocalDateTime intentionalTime; + + /** + * 开单医生id(意向签约) + */ + @ApiModelProperty(value = "开单医生id(意向签约)") + private Long billingDoctorId; + + /** + * 开单医生姓名(意向签约) + */ + @ApiModelProperty(value = "开单医生姓名(意向签约)") + private String billingDoctorName; +} diff --git a/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientInfoMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientInfoMapper.xml index 1e514639..64105970 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientInfoMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientInfoMapper.xml @@ -172,8 +172,14 @@ - delete from sign_patient_record + update sign_patient_record set del_flag = 1 where id = #{id,jdbcType=BIGINT} @@ -518,4 +518,9 @@ order by sign.sign_time desc + +