Browse Source

修改诊疗档案评估导出

newMaster
zzc 3 months ago
parent
commit
79b27f2844
  1. 45
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java

45
acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java

@ -12,6 +12,7 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.pinyin.PinyinUtil;
import cn.hutool.poi.excel.BigExcelWriter;
import cn.hutool.poi.excel.ExcelUtil;
import com.acupuncture.common.constant.UserConstants;
import com.acupuncture.common.core.redis.RedisCache;
import com.acupuncture.common.exception.base.BaseException;
import com.acupuncture.common.utils.AsposeUtils;
@ -25,10 +26,7 @@ import com.acupuncture.system.domain.vo.PmsPatientVo;
import com.acupuncture.system.domain.vo.PmsTreatmentVo;
import com.acupuncture.system.persist.dao.FmsFollowupDao;
import com.acupuncture.system.persist.dao.PmsTreatmentDao;
import com.acupuncture.system.persist.mapper.FmsPatientQueueRelationMapper;
import com.acupuncture.system.persist.mapper.PmsPatientMapper;
import com.acupuncture.system.persist.mapper.PmsTreatmentMapper;
import com.acupuncture.system.persist.mapper.PmsTreatmentRecordMapper;
import com.acupuncture.system.persist.mapper.*;
import com.acupuncture.system.service.PmsPatientService;
import com.acupuncture.system.service.PmsTreatmentService;
import com.deepoove.poi.XWPFTemplate;
@ -72,6 +70,8 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService {
private FmsFollowupDao fmsFollowupDao;
@Resource
private RedisCache redisCache;
@Resource
private DmsTenantMapper dmsTenantMapper;
@Value("${file.TreamentTemplate}")
private String treamentTemplate;
@Value("${file.pgTemplate}")
@ -117,6 +117,8 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService {
FmsPatientQueueRelation patientQueueRelation = BeanUtil.copyProperties(dto, FmsPatientQueueRelation.class);
patientQueueRelation.setId(IdUtil.getSnowflakeNextId());
patientQueueRelation.setDelFlag((byte) 0);
patientQueueRelation.setPinyinFull(PinyinUtil.getPinyin(pmsTreatment.getName(), ""));
patientQueueRelation.setPinyinSimple(PinyinUtil.getFirstLetter(pmsTreatment.getName(), ""));
patientQueueRelation.setIdCard(dto.getIdCard());
patientQueueRelation.setIdCardType(dto.getIdCardType().byteValue());
patientQueueRelation.setCreateBy(SecurityUtils.getUsername());
@ -129,6 +131,8 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService {
FmsPatientQueueRelation patientQueueRelation = BeanUtil.copyProperties(dto, FmsPatientQueueRelation.class);
patientQueueRelation.setId(IdUtil.getSnowflakeNextId());
patientQueueRelation.setDelFlag((byte) 0);
patientQueueRelation.setPinyinFull(PinyinUtil.getPinyin(pmsTreatment.getName(), ""));
patientQueueRelation.setPinyinSimple(PinyinUtil.getFirstLetter(pmsTreatment.getName(), ""));
patientQueueRelation.setCreateBy(SecurityUtils.getUsername());
patientQueueRelation.setTenantId(SecurityUtils.getTenantId());
patientQueueRelation.setIdCard(dto.getIdCard());
@ -462,7 +466,7 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService {
writer.writeCellValue(13, row, treatmentVOList.get(i).getDoctor());
writer.writeCellValue(14, row, treatmentVOList.get(i).getCreateBy());
}
String filename = StrUtil.format("患者档案-{}.xlsx", DateUtil.date().toString("yyyyMMdd"));
String filename = StrUtil.format("HZDA-{}.xlsx", DateUtil.date().toString("yyyyMMdd"));
//response为HttpServletResponse对象
response.setContentType("application/vnd.ms-excel;charset=utf-8");
@ -493,6 +497,9 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService {
pmsTreatmentRecordExample.createCriteria().andTreatmentIdEqualTo(dto.getTreatmentId()).andDelFlagEqualTo((byte) 0);
List<PmsTreatmentRecord> pmsTreatmentRecords = pmsTreatmentRecordMapper.selectByExample(pmsTreatmentRecordExample);
//查询租户
DmsTenant dmsTenant = dmsTenantMapper.selectByPrimaryKey(pmsTreatment.getTenantId());
String pdfName = pmsTreatment.getName() + "_" + pmsTreatment.getVisitNumber();
String wordPath = profilePath + File.separator + pdfName + ".docx";
String pdfPath = profilePath + File.separator + pdfName + ".pdf";
@ -501,17 +508,39 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService {
Map<String, Object> map = new HashMap<>();
map.put("name", pmsTreatment.getName());
map.put("sex", pmsTreatment.getGender() == 0 ? "男" : "女");
map.put("age", pmsTreatment.getAge());
map.put("age", pmsTreatment.getAge() + " 岁");
map.put("phone", pmsTreatment.getPhone());
map.put("visitNum", pmsTreatment.getVisitNumber());
map.put("visitTime", DateUtil.format(pmsTreatment.getVisitTime(), "yyyy-MM-dd HH:mm:ss"));
map.put("visitTime", DateUtil.format(pmsTreatment.getVisitTime(), "yyyy-MM-dd"));
map.put("doctor", pmsTreatment.getDoctor());
map.put("createBy", pmsTreatment.getCreateBy());
map.put("createTime", DateUtil.format(pmsTreatment.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
map.put("status", pmsTreatment.getStatus() == 0 ? "未完成" : "已完成");
map.put("report_date", DateUtil.format(new Date(), "yyyy-MM-dd"));
if (dmsTenant != null) {
map.put("h_name", dmsTenant.getName());
}
if (CollectionUtil.isNotEmpty(pmsTreatmentRecords)) {
Map<String, PmsTreatmentRecord> recordMap = pmsTreatmentRecords.stream().collect(Collectors.toMap(PmsTreatmentRecord::getQuestionCode, Function.identity()));
map.put("Clinical_diagnosis", recordMap.get("JBXX_ZYZD") == null ? "" : StrUtil.split(recordMap.get("JBXX_ZYZD").getAnswer(), UserConstants.ANSWER_JOIN_STRING).stream().collect(Collectors.joining(", ")));
map.put("PG_RTCF_TXLX", recordMap.get("PG_RTCF_TXLX") == null ? "" : recordMap.get("PG_RTCF_TXLX").getAnswer());
map.put("PG_RTCF_STNL", recordMap.get("PG_RTCF_STNL") == null ? "" : recordMap.get("PG_RTCF_STNL").getAnswer());
map.put("PG_RTCF_JKPF", recordMap.get("PG_RTCF_JKPF") == null ? "" : recordMap.get("PG_RTCF_JKPF").getAnswer());
map.put("PG_RTCF_TZ", recordMap.get("PG_RTCF_TZ") == null ? "" : recordMap.get("PG_RTCF_TZ").getAnswer());
map.put("PG_RTCF_QZTZ", recordMap.get("PG_RTCF_QZTZ") == null ? "" : recordMap.get("PG_RTCF_QZTZ").getAnswer());
map.put("PG_RTCF_JRL", recordMap.get("PG_RTCF_JRL") == null ? "" : recordMap.get("PG_RTCF_JRL").getAnswer());
map.put("PG_RTCF_TBW", recordMap.get("PG_RTCF_TBW") == null ? "" : recordMap.get("PG_RTCF_TBW").getAnswer());
map.put("PG_RTCF_DBZ", recordMap.get("PG_RTCF_DBZ") == null ? "" : recordMap.get("PG_RTCF_DBZ").getAnswer());
map.put("PG_RTCF_GZ", recordMap.get("PG_RTCF_GZ") == null ? "" : recordMap.get("PG_RTCF_GZ").getAnswer());
map.put("PG_RTCF_GGJ", recordMap.get("PG_RTCF_GGJ") == null ? "" : recordMap.get("PG_RTCF_GGJ").getAnswer());
map.put("PG_RTCF_ZF", recordMap.get("PG_RTCF_ZF") == null ? "" : recordMap.get("PG_RTCF_ZF").getAnswer());
map.put("PG_RTCF_WHR", recordMap.get("PG_RTCF_WHR") == null ? "" : recordMap.get("PG_RTCF_WHR").getAnswer());
map.put("PG_RTCF_BMI", recordMap.get("PG_RTCF_BMI") == null ? "" : recordMap.get("PG_RTCF_BMI").getAnswer());
map.put("PG_RTCF_PBF", recordMap.get("PG_RTCF_PBF") == null ? "" : recordMap.get("PG_RTCF_PBF").getAnswer());
map.put("PG_RTCF_NZZFSP", recordMap.get("PG_RTCF_NZZFSP") == null ? "" : recordMap.get("PG_RTCF_NZZFSP").getAnswer());
map.put("PG_TZBS_ZYTZ", recordMap.get("PG_TZBS_ZYTZ") == null ? "" : recordMap.get("PG_TZBS_ZYTZ").getAnswer());
map.put("PG_TZBS_JJTZ", recordMap.get("PG_TZBS_JJTZ") == null ? "" : StrUtil.split(recordMap.get("PG_TZBS_JJTZ").getAnswer(), UserConstants.ANSWER_JOIN_STRING).stream().collect(Collectors.joining(",")));
map.put("score1", recordMap.get("PG_TT_TAPS_DF") == null ? "" : recordMap.get("PG_TT_TAPS_DF").getAnswer());
map.put("score2", recordMap.get("PG_TT_TRACE_DF") == null ? "" : recordMap.get("PG_TT_TRACE_DF").getAnswer());
map.put("score3", recordMap.get("PG_TT_SRS22_DF") == null ? "" : recordMap.get("PG_TT_SRS22_DF").getAnswer());

Loading…
Cancel
Save