|
|
@@ -1,6 +1,7 @@
|
|
|
package com.fs.his.service.impl;
|
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
import com.fs.common.BeanCopyUtils;
|
|
|
import com.fs.common.exception.CustomException;
|
|
|
import com.fs.common.utils.DateUtils;
|
|
|
@@ -11,6 +12,8 @@ import com.fs.his.mapper.*;
|
|
|
import com.fs.his.service.IFsPrescribeDataScrmService;
|
|
|
import com.fs.his.service.IPollingAssignDoctorService;
|
|
|
import com.fs.his.service.PrescriptionTaskRecordService;
|
|
|
+import com.fs.his.vo.DoctorScrmExportVO;
|
|
|
+import com.fs.his.vo.DoctorScrmPrescribeVO;
|
|
|
import com.fs.his.vo.DoctorSignVO;
|
|
|
import com.fs.qw.domain.FsCompanyCustomer;
|
|
|
import com.fs.qw.mapper.FsCompanyCustomerMapper;
|
|
|
@@ -19,11 +22,14 @@ import com.fs.qw.vo.FsPrescribeDataScrmVO;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.ApplicationContext;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.io.ByteArrayOutputStream;
|
|
|
+import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -356,20 +362,52 @@ public class FsPrescribeDataScrmServiceImpl implements IFsPrescribeDataScrmServi
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<FsPrescribeDataScrm> doctorNotPrescribeList(DoctorNotPrescribeQueryDto queryDto) {
|
|
|
- FsPrescribeDataScrm fsPrescribeDataScrm = new FsPrescribeDataScrm();
|
|
|
- BeanCopyUtils.copy(queryDto, fsPrescribeDataScrm);
|
|
|
- fsPrescribeDataScrm.setDoctorConfirm(-2);//医生不开方
|
|
|
- List<FsPrescribeDataScrm> fsPrescribeDataScrms = fsPrescribeDataScrmMapper.selectFsPrescribeDataScrmList(fsPrescribeDataScrm);
|
|
|
- if (CollectionUtils.isEmpty(fsPrescribeDataScrms)){
|
|
|
+ public List<DoctorScrmPrescribeVO> doctorNotPrescribeList(DoctorNotPrescribeQueryDto queryDto) {
|
|
|
+ List<DoctorScrmPrescribeVO> prescribeList = fsPrescribeDataScrmMapper.selectFsPrescribeDataScrmAndOrderList(queryDto);
|
|
|
+ if (CollectionUtils.isEmpty(prescribeList)) {
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
|
- //收集医生id
|
|
|
- Set<Long> doctorIds = fsPrescribeDataScrms.stream().map(FsPrescribeDataScrm::getDoctorId).collect(Collectors.toSet());
|
|
|
- List<FsDoctor> doctorList = fsDoctorMapper.selectDoctorByIds(new ArrayList<>(doctorIds));
|
|
|
- Map<Long, String> doctorMap = doctorList.stream().collect(Collectors.toMap(FsDoctor::getDoctorId, FsDoctor::getDoctorName));
|
|
|
- fsPrescribeDataScrms.forEach(item -> item.setDoctorName(doctorMap.get(item.getDoctorId())));
|
|
|
- return fsPrescribeDataScrms;
|
|
|
+ populateDoctorNames(prescribeList);
|
|
|
+ maskPatientPhone(prescribeList);
|
|
|
+
|
|
|
+ return prescribeList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据处方列表中的医生ID批量填充医生姓名
|
|
|
+ */
|
|
|
+ private void populateDoctorNames(List<DoctorScrmPrescribeVO> prescribeList) {
|
|
|
+ Set<Long> doctorIds = prescribeList.stream()
|
|
|
+ .map(DoctorScrmPrescribeVO::getDoctorId)
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ if (doctorIds.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<FsDoctor> doctors = fsDoctorMapper.selectDoctorByIds(new ArrayList<>(doctorIds));
|
|
|
+ Map<Long, String> doctorNameMap = doctors.stream()
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+ FsDoctor::getDoctorId,
|
|
|
+ FsDoctor::getDoctorName,
|
|
|
+ (existing, replacement) -> existing
|
|
|
+ ));
|
|
|
+
|
|
|
+ prescribeList.forEach(item -> {
|
|
|
+ String name = doctorNameMap.get(item.getDoctorId());
|
|
|
+ item.setDoctorName(name);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 对患者电话进行脱敏处理(保留前3位和后4位,中间替换为****)
|
|
|
+ */
|
|
|
+ private void maskPatientPhone(List<DoctorScrmPrescribeVO> prescribeList) {
|
|
|
+ prescribeList.stream()
|
|
|
+ .filter(vo -> vo.getPatientTel() != null)
|
|
|
+ .forEach(vo -> vo.setPatientTel(
|
|
|
+ vo.getPatientTel().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2")
|
|
|
+ ));
|
|
|
}
|
|
|
|
|
|
/**
|