diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/patientinfo/PatientInfoMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/patientinfo/PatientInfoMapper.java index 5fc4e354..6410ed05 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/patientinfo/PatientInfoMapper.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/patientinfo/PatientInfoMapper.java @@ -3,7 +3,6 @@ package com.xinelu.manage.mapper.patientinfo; import com.xinelu.manage.domain.patientinfo.PatientInfo; import com.xinelu.manage.dto.patientinfo.PatientInfoDto; import com.xinelu.manage.vo.patientinfo.PatientBaseInfoVo; - import java.util.List; /** @@ -51,7 +50,15 @@ public interface PatientInfoMapper { * @param patientInfo 患者信息 * @return 结果 */ - int updatePatientInfo(PatientInfo patientInfo); + int updatePatientInfoSelective(PatientInfo patientInfo); + + /** + * 修改患者信息 + * + * @param patientInfo 患者信息 + * @return 结果 + */ + int updatePatientInfo(PatientInfo patientInfo); /** * 删除患者信息 diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientinfo/impl/PatientInfoServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientinfo/impl/PatientInfoServiceImpl.java index 3ea6473b..5fb0b922 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientinfo/impl/PatientInfoServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientinfo/impl/PatientInfoServiceImpl.java @@ -1,18 +1,24 @@ package com.xinelu.manage.service.patientinfo.impl; +import com.xinelu.common.constant.SignRecordServiceStatusConstants; +import com.xinelu.common.exception.ServiceException; import com.xinelu.common.utils.SecurityUtils; +import com.xinelu.common.utils.StringUtils; import com.xinelu.common.utils.bean.BeanUtils; import com.xinelu.manage.domain.patientinfo.PatientInfo; import com.xinelu.manage.domain.patientvisitrecord.PatientVisitRecord; import com.xinelu.manage.domain.residentinfo.ResidentInfo; +import com.xinelu.manage.domain.signpatientrecord.SignPatientRecord; import com.xinelu.manage.dto.patientinfo.PatientInfoDto; import com.xinelu.manage.dto.patientvisitrecord.PatientVisitRecordDto; import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper; import com.xinelu.manage.mapper.residentinfo.ResidentInfoMapper; +import com.xinelu.manage.mapper.signpatientrecord.SignPatientRecordMapper; import com.xinelu.manage.service.patientinfo.IPatientInfoService; import com.xinelu.manage.service.patientvisitrecord.IPatientVisitRecordService; import java.time.LocalDateTime; import java.util.List; +import java.util.Objects; import javax.annotation.Resource; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; @@ -34,6 +40,8 @@ public class PatientInfoServiceImpl implements IPatientInfoService { private ResidentInfoMapper residentInfoMapper; @Resource private IPatientVisitRecordService patientVisitRecordService; + @Resource + private SignPatientRecordMapper signPatientRecordMapper; /** * 查询患者信息 @@ -125,7 +133,7 @@ public class PatientInfoServiceImpl implements IPatientInfoService { patientInfo.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName()); patientInfo.setUpdateTime(LocalDateTime.now()); patientInfo.setDelFlag(0); - patientInfoMapper.updatePatientInfo(patientInfo); + patientInfoMapper.updatePatientInfoSelective(patientInfo); return patientInfo; } @@ -136,11 +144,18 @@ public class PatientInfoServiceImpl implements IPatientInfoService { * @return 结果 */ @Override - @Transactional + @Transactional(rollbackFor = Exception.class) public int deletePatientInfoByIds(Long[] ids) { int flag = 0; for (Long id : ids) { PatientInfo patientInfo = patientInfoMapper.selectPatientInfoById(id); + // 查询关联的就诊记录是否已签约 + if (patientInfo.getSignPatientRecordId() != null && StringUtils.equals(SignRecordServiceStatusConstants.SERVICE_CENTER, patientInfo.getServiceStatus())) { + SignPatientRecord signPatientRecord = signPatientRecordMapper.selectByPrimaryKey(patientInfo.getSignPatientRecordId()); + if (ObjectUtils.isNotEmpty(signPatientRecord) && Objects.equals(patientInfo.getPatientVisitRecordId(), signPatientRecord.getPatientVisitRecordId()) && signPatientRecord.getDelFlag() == 0) { + throw new ServiceException("该居民已签约不能删除该就诊记录!"); + } + } patientVisitRecordService.deletePatientVisitRecordById(patientInfo.getPatientVisitRecordId()); // 根据患者最新一条就诊记录修改患者状态 PatientVisitRecordDto patientVisitRecordDto = new PatientVisitRecordDto(); @@ -156,6 +171,7 @@ public class PatientInfoServiceImpl implements IPatientInfoService { // 设置patientType patientVisitRecordService.setPatientType(patientInfo, patientVisitRecord); } + patientInfo.setPatientType(null); flag += patientInfoMapper.updatePatientInfo(patientInfo); } return flag; diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientprehospitalization/impl/PatientPreHospitalizationServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientprehospitalization/impl/PatientPreHospitalizationServiceImpl.java index 92bd8a53..b2ba6efe 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientprehospitalization/impl/PatientPreHospitalizationServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientprehospitalization/impl/PatientPreHospitalizationServiceImpl.java @@ -105,7 +105,7 @@ public class PatientPreHospitalizationServiceImpl implements IPatientPreHospital preHospitalization.setCreateTime(LocalDateTime.now()); int flag = preHospitalizationMapper.insertSelective(preHospitalization); patientInfo.setPatientPreHospitalizationId(preHospitalization.getId()); - patientInfoMapper.updatePatientInfo(patientInfo); + patientInfoMapper.updatePatientInfoSelective(patientInfo); return flag; } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientvisitrecord/impl/PatientVisitRecordServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientvisitrecord/impl/PatientVisitRecordServiceImpl.java index 6dafdc9c..dca9920e 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientvisitrecord/impl/PatientVisitRecordServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientvisitrecord/impl/PatientVisitRecordServiceImpl.java @@ -391,7 +391,7 @@ public class PatientVisitRecordServiceImpl implements IPatientVisitRecordService // 修改居民信息 PatientInfo updInfo = patientInfoList.get(0); BeanUtils.copyBeanProp(updInfo, item); - patientMapper.updatePatientInfo(updInfo); + patientMapper.updatePatientInfoSelective(updInfo); patientVisitRecord.setPatientId(patientInfoList.get(0).getId()); } else { PatientInfo saveInfo = new PatientInfo(); 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 2036f69b..85b8c45a 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 @@ -150,7 +150,7 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService { patient.setSignStatus(SignRecordServiceStatusConstants.IN_SIGN); patient.setServiceStatus(SignRecordServiceStatusConstants.SERVICE_CENTER); patient.setSignTime(LocalDateTime.now()); - patientInfoMapper.updatePatientInfo(patient); + patientInfoMapper.updatePatientInfoSelective(patient); if (flag > 0) { // 保存签约服务包信息 SignPatientPackage signPatientPackage = new SignPatientPackage(); @@ -261,7 +261,7 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService { // 签约信息保存到患者表 patient.setSignStatus(patientCancelSignDto.getSignStatus()); patient.setServiceStatus(patientCancelSignDto.getServiceStatus()); - patientInfoMapper.updatePatientInfo(patient); + patientInfoMapper.updatePatientInfoSelective(patient); } return signPatientRecordMapper.updateByPrimaryKeySelective(signRecord); } @@ -298,7 +298,7 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService { int flag = signPatientRecordMapper.insertSelective(signRecord); if (flag > 0) { patientInfo.setSignPatientRecordId(signRecord.getId()); - patientInfoMapper.updatePatientInfo(patientInfo); + patientInfoMapper.updatePatientInfoSelective(patientInfo); } return flag; } 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 ed9920c5..bd38a5d4 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientInfoMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientInfoMapper.xml @@ -375,7 +375,7 @@ - + update patient_info @@ -515,6 +515,55 @@ where id = #{id} + + update patient_info + set resident_id = #{residentId}, + patient_name = #{patientName}, + patient_phone = #{patientPhone}, + family_member_phone = #{familyMemberPhone}, + birth_date = #{birthDate}, + card_no = #{cardNo}, + sex = #{sex}, + address = #{address}, + patient_type = #{patientType}, + sign_status = #{signStatus}, + sign_patient_record_id = #{signPatientRecordId}, + service_status = #{serviceStatus}, + sign_time = #{signTime}, + visit_method = #{visitMethod}, + attending_physician_id = #{attendingPhysicianId}, + attending_physician_name = #{attendingPhysicianName}, + main_diagnosis = #{mainDiagnosis}, + hospital_agency_id = #{hospitalAgencyId}, + hospital_agency_name = #{hospitalAgencyName}, + campus_agency_id = #{campusAgencyId}, + campus_agency_name = #{campusAgencyName}, + department_id = #{departmentId}, + department_name = #{departmentName}, + ward_id = #{wardId}, + ward_name = #{wardName}, + responsible_nurse = #{responsibleNurse}, + patient_visit_record_id = #{patientVisitRecordId}, + visit_serial_number = #{visitSerialNumber}, + admission_time = #{admissionTime}, + discharge_time = #{dischargeTime}, + patient_pre_hospitalization_id = #{patientPreHospitalizationId}, + appointment_treatment_group = #{appointmentTreatmentGroup}, + registration_no = #{registrationNo}, + registration_date = #{registrationDate}, + appointment_date = #{appointmentDate}, + in_hospital_number = #{inHospitalNumber}, + visit_date = #{visitDate}, + discharge_method = #{dischargeMethod}, + patient_source = #{patientSource}, + surgical_name = #{surgicalName}, + del_flag = #{delFlag}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime} + where id = #{id} + update patient_info set del_flag = 1 where id = #{id} diff --git a/postdischarge-manage/src/main/resources/mapper/manage/signpatientrecord/SignPatientRecordMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/signpatientrecord/SignPatientRecordMapper.xml index a5f12134..8410a7fe 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/signpatientrecord/SignPatientRecordMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/signpatientrecord/SignPatientRecordMapper.xml @@ -102,8 +102,8 @@ patient_name, patient_phone, card_no, - sex, - birth_date, + sex, + birth_date, sign_time, hospital_agency_id, hospital_agency_name, @@ -113,9 +113,10 @@ department_name, ward_id, ward_name, + patient_visit_record_id, visit_serial_number, visit_method, - in_hospital_number, + in_hospital_number, sign_diagnosis, review_diagnosis, service_status, @@ -126,8 +127,8 @@ billing_doctor_name, price, payment_status, - health_manage_id, - health_manage_name, + health_manage_id, + health_manage_name, del_flag, create_by, create_time, @@ -140,8 +141,8 @@ #{patientName,jdbcType=VARCHAR}, #{patientPhone,jdbcType=VARCHAR}, #{cardNo,jdbcType=VARCHAR}, - #{sex,jdbcType=VARCHAR}, - #{birthDate,jdbcType=DATE}, + #{sex,jdbcType=VARCHAR}, + #{birthDate,jdbcType=DATE}, #{signTime,jdbcType=TIMESTAMP}, #{hospitalAgencyId,jdbcType=BIGINT}, #{hospitalAgencyName,jdbcType=VARCHAR}, @@ -151,9 +152,10 @@ #{departmentName,jdbcType=VARCHAR}, #{wardId,jdbcType=BIGINT}, #{wardName,jdbcType=VARCHAR}, + #{patientVisitRecordId,jdbcType=BIGINT}, #{visitSerialNumber,jdbcType=VARCHAR}, #{visitMethod,jdbcType=VARCHAR}, - #{inHospitalNumber,jdbcType=VARCHAR}, + #{inHospitalNumber,jdbcType=VARCHAR}, #{signDiagnosis,jdbcType=VARCHAR}, #{reviewDiagnosis,jdbcType=VARCHAR}, #{serviceStatus,jdbcType=VARCHAR}, @@ -164,8 +166,8 @@ #{billingDoctorName,jdbcType=VARCHAR}, #{price,jdbcType=DECIMAL}, #{paymentStatus,jdbcType=VARCHAR}, - #{healthManageId,jdbcType=BIGINT}, - #{healthManageName,jdbcType=VARCHAR}, + #{healthManageId,jdbcType=BIGINT}, + #{healthManageName,jdbcType=VARCHAR}, #{delFlag,jdbcType=TINYINT}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, @@ -221,6 +223,9 @@ ward_name = #{wardName,jdbcType=VARCHAR}, + + patient_visit_record_id = #{patientVisitRecordId,jdbcType=BIGINT}, + visit_serial_number = #{visitSerialNumber,jdbcType=VARCHAR}, @@ -302,6 +307,7 @@ department_name = #{departmentName,jdbcType=VARCHAR}, ward_id = #{wardId,jdbcType=BIGINT}, ward_name = #{wardName,jdbcType=VARCHAR}, + patient_visit_record_id = #{patientVisitRecordId,jdbcType=BIGINT}, visit_serial_number = #{visitSerialNumber,jdbcType=VARCHAR}, visit_method = #{visitMethod,jdbcType=VARCHAR}, in_hospital_number = #{inHospitalNumber,jdbcType=VARCHAR}, diff --git a/postdischarge-mobile/src/main/java/com/xinelu/mobile/controller/homepage/HomePageController.java b/postdischarge-mobile/src/main/java/com/xinelu/mobile/controller/homepage/HomePageController.java index ec8d8b66..26fcfe2d 100644 --- a/postdischarge-mobile/src/main/java/com/xinelu/mobile/controller/homepage/HomePageController.java +++ b/postdischarge-mobile/src/main/java/com/xinelu/mobile/controller/homepage/HomePageController.java @@ -1,6 +1,6 @@ package com.xinelu.mobile.controller.homepage; -import com.xinelu.common.core.domain.AjaxResult; +import com.xinelu.common.core.page.TableDataInfo; import com.xinelu.mobile.service.homepage.HomePageService; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -22,7 +22,7 @@ public class HomePageController { private HomePageService homePageService; @GetMapping("/myFollowUp") - public AjaxResult myFollowUp(Long residentId) { + public TableDataInfo myFollowUp(Long residentId) { return homePageService.myFollowUp(residentId); } } diff --git a/postdischarge-mobile/src/main/java/com/xinelu/mobile/service/homepage/HomePageService.java b/postdischarge-mobile/src/main/java/com/xinelu/mobile/service/homepage/HomePageService.java index 6e1de6ac..b849ecb4 100644 --- a/postdischarge-mobile/src/main/java/com/xinelu/mobile/service/homepage/HomePageService.java +++ b/postdischarge-mobile/src/main/java/com/xinelu/mobile/service/homepage/HomePageService.java @@ -1,8 +1,8 @@ package com.xinelu.mobile.service.homepage; -import com.xinelu.common.core.domain.AjaxResult; +import com.xinelu.common.core.page.TableDataInfo; public interface HomePageService { - AjaxResult myFollowUp(Long residentId); + TableDataInfo myFollowUp(Long residentId); } \ No newline at end of file diff --git a/postdischarge-mobile/src/main/java/com/xinelu/mobile/service/homepage/Impl/HomePageServiceImpl.java b/postdischarge-mobile/src/main/java/com/xinelu/mobile/service/homepage/Impl/HomePageServiceImpl.java index 1dc33fed..0a00fb65 100644 --- a/postdischarge-mobile/src/main/java/com/xinelu/mobile/service/homepage/Impl/HomePageServiceImpl.java +++ b/postdischarge-mobile/src/main/java/com/xinelu/mobile/service/homepage/Impl/HomePageServiceImpl.java @@ -1,14 +1,18 @@ package com.xinelu.mobile.service.homepage.Impl; -import com.xinelu.common.core.domain.AjaxResult; +import com.xinelu.common.core.page.TableDataInfo; import com.xinelu.common.enums.RouteNodeNameEnum; +import com.xinelu.common.utils.PageServiceUtil; import com.xinelu.mobile.mapper.homepage.HomePageMapper; import com.xinelu.mobile.service.homepage.HomePageService; import com.xinelu.mobile.vo.myfollowup.MyFollowUpVO; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.Objects; @@ -18,16 +22,23 @@ public class HomePageServiceImpl implements HomePageService { @Resource private HomePageMapper homePageMapper; + @Resource + private PageServiceUtil pageServiceUtil; @Override - public AjaxResult myFollowUp(Long residentId) { + public TableDataInfo myFollowUp(Long residentId) { + pageServiceUtil.startPage(); List myFollowUpList = homePageMapper.selectManageRouteNode(residentId, RouteNodeNameEnum.AFTER_ADMISSION.getInfo()); + if (CollectionUtils.isEmpty(myFollowUpList)) { + return pageServiceUtil.getDataTable(new ArrayList<>()); + } for (MyFollowUpVO myFollowUpVO : myFollowUpList) { if (Objects.nonNull(myFollowUpVO) && Objects.nonNull(myFollowUpVO.getDischargeTime())) { myFollowUpVO.setFollowDate(myFollowUpVO.getDischargeTime().plusDays(myFollowUpVO.getRouteNodeDay())); } - myFollowUpVO.setRouteNodeName((myFollowUpVO.getRouteNodeName() == null ? "出院后" : myFollowUpVO.getRouteNodeName()) + myFollowUpVO.getRouteNodeDay()); + myFollowUpVO.setRouteNodeName("出院后第" + myFollowUpVO.getRouteNodeDay() + "天"); } - return AjaxResult.success(myFollowUpList); + myFollowUpList.sort(Comparator.comparing(MyFollowUpVO::getFollowDate).reversed()); + return pageServiceUtil.getDataTable(myFollowUpList); } } \ No newline at end of file diff --git a/postdischarge-mobile/src/main/resources/mapper/homepage/HomePageMapper.xml b/postdischarge-mobile/src/main/resources/mapper/homepage/HomePageMapper.xml index 706c3f82..9d597dc7 100644 --- a/postdischarge-mobile/src/main/resources/mapper/homepage/HomePageMapper.xml +++ b/postdischarge-mobile/src/main/resources/mapper/homepage/HomePageMapper.xml @@ -9,7 +9,7 @@ spmrn.route_node_name, IFNULL( spmrn.route_node_day,0) routeNodeDay, pi.discharge_time, - IF(pter.id==NULL,0,1) sign + IF(pter.id=NULL,0,1) sign FROM patient_info pi LEFT JOIN sign_patient_manage_route spmr ON spmr.patient_id = pi.id LEFT JOIN sign_patient_manage_route_node spmrn ON spmrn.manage_route_id = spmr.id diff --git a/postdischarge-quartz/src/main/java/com/xinelu/quartz/task/SignPackageExpireTask.java b/postdischarge-quartz/src/main/java/com/xinelu/quartz/task/SignPackageExpireTask.java index 0af40125..65ed00d0 100644 --- a/postdischarge-quartz/src/main/java/com/xinelu/quartz/task/SignPackageExpireTask.java +++ b/postdischarge-quartz/src/main/java/com/xinelu/quartz/task/SignPackageExpireTask.java @@ -47,7 +47,7 @@ public class SignPackageExpireTask { patientInfo.setId(sign.getPatientId()); patientInfo.setSignStatus(SignRecordServiceStatusConstants.EXPIRE_SIGN); patientInfo.setServiceStatus(SignRecordServiceStatusConstants.SERVICE_END); - patientInfoMapper.updatePatientInfo(patientInfo); + patientInfoMapper.updatePatientInfoSelective(patientInfo); } } }