From 3fadd49299136099ff59fa2176b53d8e5f0df2a5 Mon Sep 17 00:00:00 2001 From: zzc Date: Thu, 20 Mar 2025 19:32:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AD=9B=E6=9F=A5=E6=B7=BB=E5=8A=A0=E6=8D=A2?= =?UTF-8?q?=E7=9D=80=E6=A1=A3=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ScreeningServiceImpl.java | 42 +++++++++++++++++-- .../resources/mapper/dao/PmsPatientDao.xml | 2 + 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ScreeningServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ScreeningServiceImpl.java index 32a44833..be3ed618 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ScreeningServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ScreeningServiceImpl.java @@ -16,14 +16,12 @@ import com.acupuncture.common.core.redis.RedisCache; import com.acupuncture.common.exception.base.BaseException; import com.acupuncture.common.utils.SecurityUtils; import com.acupuncture.system.domain.dto.ScreeningDto; -import com.acupuncture.system.domain.po.ScrScreening; -import com.acupuncture.system.domain.po.ScrScreeningDetail; -import com.acupuncture.system.domain.po.ScrScreeningExample; -import com.acupuncture.system.domain.po.ScrScreeningRecord; +import com.acupuncture.system.domain.po.*; import com.acupuncture.system.domain.vo.QuestionnaireVo; import com.acupuncture.system.domain.vo.ScrScreenVo; import com.acupuncture.system.persist.dao.ScreeningDao; import com.acupuncture.system.persist.dao.ScreeningDetailDao; +import com.acupuncture.system.persist.mapper.PmsPatientMapper; import com.acupuncture.system.persist.mapper.ScrScreeningRecordMapper; import com.acupuncture.system.service.IScreeningService; import com.github.pagehelper.PageInfo; @@ -56,6 +54,8 @@ public class ScreeningServiceImpl implements IScreeningService { private ScrScreeningRecordMapper scrScreeningRecordMapper; @Resource private RedisCache redisCache; + @Resource + private PmsPatientMapper pmsPatientMapper; /** * 提交高危筛查问卷的时间 @@ -416,6 +416,40 @@ public class ScreeningServiceImpl implements IScreeningService { screeningDetail.setId(param.getDetailId()); screeningDetail.setSubmitStatus((byte) 1); scrScreeningRecordMapper.updateByPrimaryKeySelective(screeningDetail); + + //获取CODE查询是否已经新增患者档案 + ScrScreeningDetailExample scrScreeningDetailExample = new ScrScreeningDetailExample(); + scrScreeningDetailExample.createCriteria().andDelFlagEqualTo((byte) 0).andRecordIdEqualTo(param.getDetailId()) + .andQuestionCodeIn(CollectionUtil.newArrayList("SCWJ-NAME", "SCWJ-SEX", "SCWJ-BIRTH", + "SCWJ-AGE", "SCWJ-PHONE")); + List scrScreeningDetails = screeningDetailDao.selectByExample(scrScreeningDetailExample); + if (CollectionUtil.isNotEmpty(scrScreeningDetails)) { + Map map = scrScreeningDetails.stream().collect(Collectors.toMap(ScrScreeningDetail::getQuestionCode, Function.identity())); + ScrScreeningDetail scrScreeningDetail = map.get("SCWJ-NAME"); + ScrScreeningDetail scrScreeningDetail1 = map.get("SCWJ-PHONE"); + if (scrScreeningDetail == null || scrScreeningDetail1 == null) { + return; + } + PmsPatientExample pmsPatientExample = new PmsPatientExample(); + pmsPatientExample.createCriteria().andNameEqualTo(scrScreeningDetail.getAnswer()).andPhoneEqualTo(scrScreeningDetail1.getAnswer()); + List pmsPatients = pmsPatientMapper.selectByExample(pmsPatientExample); + if (CollectionUtil.isEmpty(pmsPatients)) { + PmsPatient pmsPatient = new PmsPatient(); + pmsPatient.setId(IdUtil.getSnowflakeNextId()); + pmsPatient.setPhone(scrScreeningDetail1.getAnswer()); + pmsPatient.setName(scrScreeningDetail.getAnswer()); + if (ObjectUtil.isNotNull(map.get("SCWJ-BIRTH"))) { + pmsPatient.setBirthDate(DateUtil.parse(map.get("SCWJ-BIRTH").getAnswer())); + } + if (ObjectUtil.isNotNull(map.get("SCWJ-SEX"))) { + pmsPatient.setGender(Byte.parseByte(map.get("SCWJ-SEX").getAnswer())); + } + pmsPatient.setSource((byte) 0); + pmsPatient.setDelFlag((byte) 0); + pmsPatient.setCreateTime(new Date()); + pmsPatientMapper.insertSelective(pmsPatient); + } + } } @Override diff --git a/acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml b/acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml index bd5d0f80..0ec75735 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml @@ -56,6 +56,8 @@ p.name LIKE CONCAT('%', #{query.keywords}, '%') OR p.pinyin_full LIKE CONCAT('%', #{query.keywords}, '%') OR p.pinyin_simple LIKE CONCAT('%', #{query.keywords}, '%') + or p.id_card LIKE CONCAT('%', #{query.keywords}, '%') + or p.phone LIKE CONCAT('%', #{query.keywords}, '%') )