修改门诊在院患者删除。

This commit is contained in:
haown 2024-04-19 14:32:33 +08:00
parent 4b580c2e47
commit 13429f9c0f
7 changed files with 83 additions and 11 deletions

View File

@ -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);
/**
* 删除患者信息

View File

@ -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 (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;

View File

@ -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;
}

View File

@ -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();

View File

@ -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;
}

View File

@ -375,7 +375,7 @@
</trim>
</insert>
<update id="updatePatientInfo" parameterType="com.xinelu.manage.domain.patientinfo.PatientInfo">
<update id="updatePatientInfoSelective" parameterType="com.xinelu.manage.domain.patientinfo.PatientInfo">
update patient_info
<trim prefix="SET" suffixOverrides=",">
<if test="residentId != null">
@ -515,6 +515,55 @@
where id = #{id}
</update>
<update id="updatePatientInfo" parameterType="com.xinelu.manage.domain.patientinfo.PatientInfo">
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>
<update id="deletePatientInfoById" parameterType="Long">
update patient_info set del_flag = 1
where id = #{id}

View File

@ -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);
}
}
}