修改测试问题。
This commit is contained in:
parent
8738919289
commit
6f0f54304e
@ -1,6 +1,5 @@
|
||||
package com.xinelu.manage.dto.patientblacklist;
|
||||
|
||||
import com.xinelu.common.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@ -11,14 +10,16 @@ import lombok.Data;
|
||||
**/
|
||||
@Data
|
||||
public class PatientBlacklistDto {
|
||||
|
||||
/** 患者id */
|
||||
private Long patientId;
|
||||
|
||||
/** 患者姓名 */
|
||||
@ApiModelProperty(value = "患者姓名")
|
||||
@Excel(name = "患者姓名")
|
||||
private String patientName;
|
||||
|
||||
/** 患者电话 */
|
||||
@ApiModelProperty(value = "患者电话")
|
||||
@Excel(name = "患者电话")
|
||||
private String patientPhone;
|
||||
|
||||
/** 身份证号 */
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.xinelu.manage.service.patientblacklist.impl;
|
||||
|
||||
import com.xinelu.common.exception.ServiceException;
|
||||
import com.xinelu.common.utils.DateUtils;
|
||||
import com.xinelu.common.utils.bean.BeanUtils;
|
||||
import com.xinelu.manage.domain.patientblacklist.PatientBlacklist;
|
||||
import com.xinelu.manage.domain.patientinfo.PatientInfo;
|
||||
@ -12,14 +11,12 @@ import com.xinelu.manage.mapper.patientblacklist.PatientBlacklistMapper;
|
||||
import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper;
|
||||
import com.xinelu.manage.service.patientblacklist.IPatientBlacklistService;
|
||||
import com.xinelu.manage.vo.patientblacklist.PatientBlacklistVo;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 患者-黑明单关系Service业务层处理
|
||||
*
|
||||
@ -69,6 +66,7 @@ public class PatientBlacklistServiceImpl implements IPatientBlacklistService {
|
||||
patientInfoDto.setPatientName(blacklistSaveDto.getPatientName());
|
||||
patientInfoDto.setPatientPhone(blacklistSaveDto.getPatientPhone());
|
||||
patientInfoDto.setCardNo(blacklistSaveDto.getCardNo());
|
||||
patientInfoDto.setHospitalAgencyId(blacklistSaveDto.getHospitalAgencyId());
|
||||
List<PatientInfo> patientList = patientInfoMapper.selectPatientInfoList(patientInfoDto);
|
||||
if (CollectionUtils.isEmpty(patientList)) {
|
||||
throw new ServiceException("未找到该患者,请确认姓名身份证号手机号是否正确");
|
||||
@ -76,6 +74,13 @@ public class PatientBlacklistServiceImpl implements IPatientBlacklistService {
|
||||
if (patientList.size() > 1) {
|
||||
throw new ServiceException("找到多名患者信息,请确认姓名身份证号手机号是否正确");
|
||||
}
|
||||
// 查询患者是否已加入黑名单
|
||||
PatientBlacklistDto blacklistQuery = new PatientBlacklistDto();
|
||||
blacklistQuery.setPatientId(patientList.get(0).getId());
|
||||
List<PatientBlacklistVo> patientBlacklists = patientBlacklistMapper.selectPatientBlacklistList(blacklistQuery);
|
||||
if (!CollectionUtils.isEmpty(patientBlacklists)) {
|
||||
throw new ServiceException("该患者已加入黑名单,请勿重复加入");
|
||||
}
|
||||
PatientBlacklist patientBlacklist = new PatientBlacklist();
|
||||
BeanUtils.copyBeanProp(patientBlacklist, blacklistSaveDto);
|
||||
patientBlacklist.setPatientId(patientList.get(0).getId());
|
||||
|
||||
@ -2,6 +2,7 @@ package com.xinelu.manage.service.patientinfo.impl;
|
||||
|
||||
import com.xinelu.common.constant.SignRecordServiceStatusConstants;
|
||||
import com.xinelu.common.exception.ServiceException;
|
||||
import com.xinelu.common.utils.BaseUtil;
|
||||
import com.xinelu.common.utils.SecurityUtils;
|
||||
import com.xinelu.common.utils.StringUtils;
|
||||
import com.xinelu.common.utils.bean.BeanUtils;
|
||||
@ -74,14 +75,41 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
||||
@Override
|
||||
@Transactional
|
||||
public PatientInfo insertPatientInfo(PatientInfo patientInfo) {
|
||||
patientInfo.setCreateTime(LocalDateTime.now());
|
||||
patientInfo.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
|
||||
if (StringUtils.isBlank(patientInfo.getCardNo())) {
|
||||
throw new ServiceException("请输入身份证号");
|
||||
}
|
||||
// 根据身份证号+机构id判断用户信息是否存在
|
||||
PatientInfoDto patientQuery = new PatientInfoDto();
|
||||
patientQuery.setCardNo(patientInfo.getCardNo());
|
||||
patientQuery.setHospitalAgencyId(patientInfo.getHospitalAgencyId());
|
||||
List<PatientInfo> patientList = patientInfoMapper.selectPatientInfoList(patientQuery);
|
||||
boolean exist = false;
|
||||
if(CollectionUtils.isNotEmpty(patientList)) {
|
||||
PatientInfo patientOld = patientList.get(0);
|
||||
patientInfo.setId(patientOld.getId());
|
||||
exist = true;
|
||||
} else {
|
||||
patientInfo.setCreateTime(LocalDateTime.now());
|
||||
patientInfo.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
|
||||
}
|
||||
patientInfo.setDelFlag(0);
|
||||
// 根据身份证号查询是否有该居民
|
||||
// 根据身份证号计算性别出生日期
|
||||
if (patientInfo.getBirthDate() == null) {
|
||||
patientInfo.setBirthDate(BaseUtil.getBirthday(patientInfo.getCardNo()));
|
||||
}
|
||||
if (StringUtils.isBlank(patientInfo.getSex())) {
|
||||
patientInfo.setSex(BaseUtil.getGender(patientInfo.getCardNo()));
|
||||
}
|
||||
// 先根据身份证号查询是否有该居民
|
||||
ResidentInfo residentQuery = new ResidentInfo();
|
||||
residentQuery.setCardNo(patientInfo.getCardNo());
|
||||
List<ResidentInfo> residentList = residentInfoMapper.selectResidentInfoList(residentQuery);
|
||||
|
||||
// 身份证号没查到居民,通过手机号查询居民
|
||||
if (CollectionUtils.isEmpty(residentList) && StringUtils.isNotBlank(patientInfo.getPatientPhone())) {
|
||||
residentQuery.setCardNo(null);
|
||||
residentQuery.setPatientPhone(patientInfo.getPatientPhone());
|
||||
residentList = residentInfoMapper.selectResidentInfoList(residentQuery);
|
||||
}
|
||||
ResidentInfo residentInfo = new ResidentInfo();
|
||||
BeanUtils.copyBeanProp(residentInfo, patientInfo);
|
||||
if (CollectionUtils.isEmpty(residentList)) {
|
||||
@ -94,7 +122,11 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
||||
residentInfoMapper.updateResidentInfo(residentInfo);
|
||||
patientInfo.setResidentId(residentList.get(0).getId());
|
||||
}
|
||||
patientInfoMapper.insertPatientInfo(patientInfo);
|
||||
if (exist) {
|
||||
patientInfoMapper.updatePatientInfoSelective(patientInfo);
|
||||
} else {
|
||||
patientInfoMapper.insertPatientInfo(patientInfo);
|
||||
}
|
||||
return patientInfo;
|
||||
}
|
||||
|
||||
@ -106,6 +138,16 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
||||
*/
|
||||
@Override
|
||||
public PatientInfo updatePatientInfo(PatientInfo patientInfo) {
|
||||
if (StringUtils.isBlank(patientInfo.getCardNo())) {
|
||||
throw new ServiceException("请输入身份证号");
|
||||
}
|
||||
// 根据身份证号计算性别出生日期
|
||||
if (patientInfo.getBirthDate() == null) {
|
||||
patientInfo.setBirthDate(BaseUtil.getBirthday(patientInfo.getCardNo()));
|
||||
}
|
||||
if (StringUtils.isBlank(patientInfo.getSex())) {
|
||||
patientInfo.setSex(BaseUtil.getGender(patientInfo.getCardNo()));
|
||||
}
|
||||
ResidentInfo residentInfo = new ResidentInfo();
|
||||
if (patientInfo.getResidentId() != null) {
|
||||
residentInfo = residentInfoMapper.selectResidentInfoById(patientInfo.getResidentId());
|
||||
@ -113,10 +155,16 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
||||
residentInfo.setId(patientInfo.getResidentId());
|
||||
residentInfoMapper.updateResidentInfo(residentInfo);
|
||||
} else {
|
||||
// 根据身份证号查询是否有该居民
|
||||
// 先根据身份证号查询是否有该居民
|
||||
ResidentInfo residentQuery = new ResidentInfo();
|
||||
residentQuery.setCardNo(patientInfo.getCardNo());
|
||||
List<ResidentInfo> residentList = residentInfoMapper.selectResidentInfoList(residentQuery);
|
||||
// 身份证号没查到居民,通过手机号查询居民
|
||||
if (CollectionUtils.isEmpty(residentList) && StringUtils.isNotBlank(patientInfo.getPatientPhone())) {
|
||||
residentQuery.setCardNo(null);
|
||||
residentQuery.setPatientPhone(patientInfo.getPatientPhone());
|
||||
residentList = residentInfoMapper.selectResidentInfoList(residentQuery);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(residentList)) {
|
||||
Long residentId = residentList.get(0).getId();
|
||||
residentInfo = residentList.get(0);
|
||||
|
||||
@ -215,9 +215,9 @@ public class PatientVisitRecordServiceImpl implements IPatientVisitRecordService
|
||||
BeanUtils.copyBeanProp(patientVisitRecord, patientBaseInfo);
|
||||
// 根据机构id、患者身份证号判断门诊/住院号是否重复
|
||||
PatientVisitRecordDto patientVisitRecordDto = new PatientVisitRecordDto();
|
||||
patientVisitRecordDto.setHospitalAgencyId(patientVisitRecord.getHospitalAgencyId());
|
||||
patientVisitRecordDto.setHospitalAgencyId(saveDto.getHospitalAgencyId());
|
||||
patientVisitRecordDto.setCardNo(patientVisitRecord.getCardNo());
|
||||
patientVisitRecordDto.setInHospitalNumber(patientVisitRecord.getInHospitalNumber());
|
||||
patientVisitRecordDto.setInHospitalNumber(saveDto.getInHospitalNumber());
|
||||
PatientVisitRecord object = patientVisitRecordMapper.getLastRecord(patientVisitRecordDto);
|
||||
if (ObjectUtils.isNotEmpty(object)) {
|
||||
throw new ServiceException("门诊/住院号重复,请确认后重新输入!");
|
||||
|
||||
@ -2,13 +2,11 @@ package com.xinelu.manage.service.projectdevice.impl;
|
||||
|
||||
import com.xinelu.common.constant.DeviceStatusConstants;
|
||||
import com.xinelu.common.exception.ServiceException;
|
||||
import com.xinelu.common.utils.DateUtils;
|
||||
import com.xinelu.common.utils.SecurityUtils;
|
||||
import com.xinelu.common.utils.StringUtils;
|
||||
import com.xinelu.manage.domain.projectdevice.ProjectDevice;
|
||||
import com.xinelu.manage.mapper.projectdevice.ProjectDeviceMapper;
|
||||
import com.xinelu.manage.service.projectdevice.IProjectDeviceService;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
@ -64,14 +62,14 @@ public class ProjectDeviceServiceImpl implements IProjectDeviceService {
|
||||
query.setPatientId(projectDevice.getPatientId());
|
||||
query.setDeviceType(projectDevice.getDeviceType());
|
||||
query.setDeviceStatus(DeviceStatusConstants.BIND);
|
||||
List<ProjectDevice> deviceList = projectDeviceMapper.selectProjectDeviceList(projectDevice);
|
||||
List<ProjectDevice> deviceList = projectDeviceMapper.selectProjectDeviceList(query);
|
||||
if (CollectionUtils.isNotEmpty(deviceList)) {
|
||||
throw new ServiceException("该居民已绑定过相同设备类型的设备,请解绑后重新绑定");
|
||||
}
|
||||
// 根据设备编码查询是否已被绑定
|
||||
query.setPatientId(null);
|
||||
query.setDeviceCode(projectDevice.getDeviceCode());
|
||||
deviceList = projectDeviceMapper.selectProjectDeviceList(projectDevice);
|
||||
deviceList = projectDeviceMapper.selectProjectDeviceList(query);
|
||||
if (CollectionUtils.isNotEmpty(deviceList)) {
|
||||
throw new ServiceException("该设备已被绑定,请解绑后重新绑定");
|
||||
}
|
||||
|
||||
@ -141,6 +141,7 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
|
||||
case (TaskContentConstants.PROPAGANDA_ARTICLE): // 宣教文章-返回宣教库信息
|
||||
if (node.getPropagandaInfoId() != null) {
|
||||
PropagandaMaterialsVo propagandaMaterialsVo = propagandaInfoService.selectPropagandaInfoById(node.getPropagandaInfoId());
|
||||
signNodeInfo.setPropagandaContent(propagandaMaterialsVo.getPropagandaContent());
|
||||
detailInfo = JSONObject.parseObject(JSONObject.toJSONString(propagandaMaterialsVo));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -41,6 +41,9 @@
|
||||
left join patient_info p on b.patient_id = p.id
|
||||
<where>
|
||||
b.del_flag = 0
|
||||
<if test="patientId != null">
|
||||
and b.patient_id = #{patientId}
|
||||
</if>
|
||||
<if test="patientName != null and patientName != ''">
|
||||
and p.patient_name like concat('%', #{patientName}, '%')
|
||||
</if>
|
||||
|
||||
@ -251,17 +251,23 @@
|
||||
select d.id,
|
||||
d.department_name,
|
||||
count(p.id) AS countNum
|
||||
from department d left join propaganda_info p on d.id = p.department_id
|
||||
from department d left join
|
||||
(select id, department_id, propaganda_status from propaganda_info
|
||||
<where>
|
||||
del_flag = 0
|
||||
<if test="propagandaStatus != null and propagandaStatus != ''">
|
||||
and propaganda_status = #{propagandaStatus}
|
||||
</if>
|
||||
</where>
|
||||
) as p on d.id = p.department_id
|
||||
<where>
|
||||
p.del_flag = 0
|
||||
<if test="departmentName != null and departmentName != ''">
|
||||
and d.department_name like concat('%', #{departmentName}, '%')
|
||||
</if>
|
||||
<if test="propagandaStatus != null and propagandaStatus != ''">
|
||||
and p.propaganda_status = #{propagandaStatus}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY d.id
|
||||
GROUP BY d.id,
|
||||
d.department_name,
|
||||
d.department_code
|
||||
order by countNum desc
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user