From 55fea1032f426eab7b4bb5d2d8705a8bf21a86d0 Mon Sep 17 00:00:00 2001 From: zhangheng <3226558941@qq.com> Date: Fri, 3 Jan 2025 14:38:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=BD=93=E6=9C=88=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/patientinfo/PatientInfoMapper.java | 11 +++++- .../impl/PatientInfoServiceImpl.java | 34 +++++++++++++++---- .../vo/patientinfo/PatientImportVo.java | 21 ++++++++++++ .../manage/patientinfo/PatientInfoMapper.xml | 28 +++++++++++++++ 4 files changed, 87 insertions(+), 7 deletions(-) create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/vo/patientinfo/PatientImportVo.java 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 b565da80..789eae9c 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 @@ -5,6 +5,7 @@ import com.xinelu.manage.domain.patientinfoimport.PatientInfoImport; import com.xinelu.manage.domain.residentinfo.ResidentInfo; import com.xinelu.manage.dto.patientinfo.PatientInfoDto; import com.xinelu.manage.vo.patientinfo.PatientBaseInfoVo; +import com.xinelu.manage.vo.patientinfo.PatientImportVo; import com.xinelu.manage.vo.patientinfo.PatientInfoVo; import com.xinelu.manage.vo.patientinfo.PatientNextTaskVo; import org.apache.ibatis.annotations.Param; @@ -142,13 +143,21 @@ public interface PatientInfoMapper { int selectPatientSignServiceCount(); /** - * 批量查询患者信息 + * 批量当天查询患者信息 * * @param list 集合 * @return PatientInfo */ List selectPatientInfoByPatientName(@Param("list") List list, @Param("nowDate") LocalDate nowDate); + /** + * 批量当月查询患者信息 + * + * @param list 集合 + * @return PatientInfo + */ + List selectPatientInfoByTime(@Param("list") List list, @Param("startDate") String startDate, @Param("endDate") String endDate); + /** * 新增患者信息 * 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 20ae4f73..c8c36137 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 @@ -36,10 +36,12 @@ 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 com.xinelu.manage.vo.patientinfo.PatientImportVo; import com.xinelu.manage.vo.patientinfo.PatientInfoVo; import com.xinelu.manage.vo.patientinfoimport.DeptAliasVO; import com.xinelu.manage.vo.patientinfoimport.PatientInfoImportVO; import com.xinelu.system.mapper.SysUserMapper; +import com.xinelu.system.service.ISysConfigService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.BooleanUtils; @@ -48,13 +50,11 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; /** @@ -89,6 +89,8 @@ public class PatientInfoServiceImpl implements IPatientInfoService { private PatientInfoImportMainMapper patientInfoImportMainMapper; @Resource private AgencyMapper agencyMapper; + @Resource + private ISysConfigService sysConfigService; /** * 查询患者信息 @@ -374,9 +376,21 @@ public class PatientInfoServiceImpl implements IPatientInfoService { //如果要求自动去重(同数据库中 当日已导入患者列表 比对,如果患者姓名和手机号相同,视为重复) if (Objects.isNull(isDistinct) || isDistinct == 1) { LocalDate nowDate = LocalDate.now(); - //此处实现是跟患者表数据比对,(也可以直接跟已导入患者表数据比对) + //此处实现是当天跟患者表数据比对,(也可以直接跟已导入患者表数据比对) patientInfos_CurrentDay = patientInfoMapper.selectPatientInfoByPatientName(list, nowDate); } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Date date = new Date(); + Calendar calendar = new GregorianCalendar(); + calendar.setTime(date); + //获得本月第一天 + calendar.add(Calendar.MONTH, 0); + calendar.set(Calendar.DAY_OF_MONTH, 1); + String firstDay = sdf.format(calendar.getTime()); + //获得本月最后一天 + calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); + String lastDay = sdf.format(calendar.getTime()); + List patientInfoList = patientInfoMapper.selectPatientInfoByTime(list, firstDay, lastDay); //sn 导入流水号; String sn = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); @@ -390,6 +404,7 @@ public class PatientInfoServiceImpl implements IPatientInfoService { List patientInfoImportList = new ArrayList<>(); //要导入的居民信息列表 List patientInfoImportList_forResident = new ArrayList<>(); + String aiobMaxCount = sysConfigService.selectConfigByKey("aiob_max_count"); for (PatientInfoImport patientInfoImport : distinctCollect) { //选择自动去除当日重复记录 // if (CollectionUtils.isNotEmpty(residentInfos)) { @@ -401,7 +416,14 @@ public class PatientInfoServiceImpl implements IPatientInfoService { // 如果当日已有导入,则不再重复导入 if (CollectionUtils.isNotEmpty(patientInfos_CurrentDay) && (Objects.isNull(isDistinct) || isDistinct == 1)) { List collect1 = patientInfos_CurrentDay.stream().filter(Objects::nonNull).filter(item -> patientInfoImport.getPatientName().equals(item.getPatientName()) && patientInfoImport.getPatientPhone().equals(item.getPatientPhone())).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(collect1)) { + if (CollectionUtils.isNotEmpty(collect1) || collect1.size() != 0) { + continue; + } + } + //同一手机号每月可最多拔打xx次 + if (CollectionUtils.isNotEmpty(patientInfoList) && StringUtils.isNotBlank(aiobMaxCount)) { + List collect1 = patientInfoList.stream().filter(Objects::nonNull).filter(item -> patientInfoImport.getPatientPhone().equals(item.getPatientPhone()) && item.getCountPhone() >= Long.parseLong(aiobMaxCount)).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(collect1) || collect1.size() != 0) { continue; } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/patientinfo/PatientImportVo.java b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/patientinfo/PatientImportVo.java new file mode 100644 index 00000000..b64111d4 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/patientinfo/PatientImportVo.java @@ -0,0 +1,21 @@ +package com.xinelu.manage.vo.patientinfo; + +import com.xinelu.manage.domain.patientinfo.PatientInfo; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * @description: 某时间段电话外呼数量 + * @author: zh + * @create: 2025-01-3 + **/ +@EqualsAndHashCode(callSuper = true) +@Data +public class PatientImportVo extends PatientInfo { + + /** + * 某时间段电话外呼数量 + */ + private Long countPhone; +} 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 3768ae7f..8118ee39 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientInfoMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientInfoMapper.xml @@ -882,6 +882,34 @@ AND date_format(create_time,'%y%m%d') = date_format(#{nowDate},'%y%m%d') + + insert into patient_info( resident_id,