From 9a26d30beec245cd90ec7c3baf9b528bf7d95b56 Mon Sep 17 00:00:00 2001 From: zzc Date: Mon, 17 Mar 2025 22:08:30 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E8=AF=8A=E7=96=97=E6=A1=A3=E6=A1=88=E8=AF=84=E4=BC=B0=E5=AF=BC?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/AdminPmsTreatmentController.java | 12 ++--- .../controller/web/ExternalController.java | 43 ++++++++++------- .../acupuncture/web/task/TaskController.java | 16 +++++-- .../aspectj/AdminGlobalDataSourceAspect.java | 3 +- .../framework/config/SecurityConfig.java | 2 +- .../system/domain/dto/AdminTenantUserDto.java | 2 + .../system/domain/dto/ExternalDto.java | 2 + .../system/domain/dto/FmsFollowupDto.java | 2 + .../system/domain/vo/PmsTreatmentVo.java | 4 -- .../service/impl/ExternalServiceImpl.java | 40 +++++++++++++++- .../service/impl/PmsTreatmentServiceImpl.java | 47 ++++++++++++++++++- .../service/impl/ScreeningServiceImpl.java | 1 + .../resources/mapper/dao/AdminDmsUserDao.xml | 3 ++ .../mapper/dao/ScreeningDetailDao.xml | 3 ++ 14 files changed, 145 insertions(+), 35 deletions(-) diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.java index 8f900a27..b6dd684b 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.java @@ -85,14 +85,14 @@ public class AdminPmsTreatmentController { DynamicDataSourceContextHolder.setDataSourceType(dataSourceKey); } - @ApiOperation("导出诊疗档案评估报告") - @PostMapping("/exportTreatmentPg") - public JsonResponse exportTreatmentPg(HttpServletResponse response, @RequestBody @Validated PmsTreatmentDto.ExportVO dto){ - return JsonResponse.ok(treatmentService.exportTreatmentPg(response, dto)); - } +// @ApiOperation("导出诊疗档案评估报告") +// @PostMapping("/exportTreatmentPg") +// public JsonResponse exportTreatmentPg(HttpServletResponse response, @RequestBody @Validated PmsTreatmentDto.ExportVO dto){ +// return JsonResponse.ok(treatmentService.exportTreatmentPg(response, dto)); +// } @ApiOperation("后台导出诊疗档案评估报告") - @PostMapping("/admin/exportTreatmentPg") + @PostMapping("/exportTreatmentPg") public JsonResponse adminExportTreatmentPg(HttpServletResponse response, @RequestBody @Validated PmsTreatmentDto.ExportVO dto){ return JsonResponse.ok(treatmentService.adminExportTreatmentPg(response, dto)); } diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java index ba6c7c30..469dadbe 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java @@ -1,8 +1,10 @@ package com.acupuncture.web.controller.web; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONArray; import com.acupuncture.common.annotation.Anonymous; import com.acupuncture.common.config.RuoYiConfig; import com.acupuncture.common.core.domain.AjaxResult; @@ -35,6 +37,7 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; /** @@ -103,24 +106,28 @@ public class ExternalController { // return "upload ok"; // } -// @Anonymous -// @ApiOperation("上传数据") -// @PostMapping("/http/uploadMemberInfo") -// public Object add(@RequestBody String str){ -// JsonArray jsonValues = new JsonArray(); -// -// log.info("上传数据dto123:{}",list); -//// List list = dto.getList(); -// int add = 0; -// for (ExternalDto.RtcfInfoDto rtcfInfoDto : list) { -// checkoutData(rtcfInfoDto.getUUID()); -// add += externalService.add(rtcfInfoDto); -// } -// if (add == 0) { -// return "upload fail"; -// } -// return "upload ok"; -// } + @Anonymous + @ApiOperation("上传数据") + @PostMapping("/http/uploadMemberInfo") + public Object add(@RequestBody String str){ + + JSONArray objects = new JSONArray(str); + List list = new ArrayList<>(); + for (Object object : objects) { + list.add(BeanUtil.copyProperties(object, ExternalDto.RtcfInfoDto.class)); + } + log.info("上传数据dto123:{}",list); +// List list = dto.getList(); + int add = 0; + for (ExternalDto.RtcfInfoDto rtcfInfoDto : list) { + checkoutData(rtcfInfoDto.getUUID()); + add += externalService.add(rtcfInfoDto); + } + if (add == 0) { + return "upload fail"; + } + return "upload ok"; + } @Anonymous @ApiOperation("上传数据") diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java index 58fdcd19..ae352a71 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java @@ -17,6 +17,7 @@ import com.acupuncture.system.persist.dao.FmsFollowupDao; import com.acupuncture.system.persist.dao.UmsDataSourceDao; import com.acupuncture.system.persist.mapper.FmsFollowupTaskMapper; import com.acupuncture.system.persist.mapper.FmsPatientQueueRelationMapper; +import com.acupuncture.system.service.FmsFollowupQueueService; import com.acupuncture.system.service.FmsFollowupService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -60,6 +61,8 @@ public class TaskController { private FmsPatientQueueRelationMapper fmsPatientQueueRelationMapper; @Resource private RedisCache redisCache; + @Resource + private FmsFollowupQueueService fmsFollowupQueueService; @ApiOperation("定时任务添加随访工单") @PostMapping("/task") @@ -78,10 +81,14 @@ public class TaskController { } //查询公共队列 List queueResults = redisCache.getCacheList("common_followup_queue"); + List followupQueueVOS = new ArrayList<>(); + if (CollectionUtil.isEmpty(queueResults)) { + followupQueueVOS = fmsFollowupQueueService.queryCommonQueue(null); + } // List queueResults = fmsFollowupDao.queryCommonQueue(null); //切换数据源 for (UmsDataSourceVo.Result result : query) { - if ("MASTER".equals(result.getDataSourceKey())) { + if ("MASTER".equals(result.getDataSourceKey()) || "SXYFYY".equals(result.getDataSourceKey())) { continue; } changeDataSource(result); @@ -92,11 +99,11 @@ public class TaskController { if (CollectionUtil.isEmpty(queueList)) { if (CollectionUtil.isEmpty(queueResults)) { - queueList = BeanUtil.copyToList(queueResults, FmsFollowupVo.FollowupQueueVO.class); + queueList = followupQueueVOS; } } else { if (CollectionUtil.isEmpty(queueResults)) { - queueList.addAll(BeanUtil.copyToList(queueResults, FmsFollowupVo.FollowupQueueVO.class)); + queueList.addAll(followupQueueVOS); } } for (FmsFollowupVo.FollowupQueueVO followupQueueVO : queueList) { @@ -106,6 +113,9 @@ public class TaskController { // changeDataSource(result); FmsFollowupDto.FollowupPatientQueryDTO followupPatientQueryDTO = new FmsFollowupDto.FollowupPatientQueryDTO(); followupPatientQueryDTO.setQueueId(followupQueueVO.getId()); + followupPatientQueryDTO.setTenantId(followupQueueVO.getTenantId()); + changeDataSource(result); + List patientList = fmsFollowupService.queryPatient(followupPatientQueryDTO); // List patientList = fmsFollowupDao.queryPatient(followupQueueVO.getId(), null, null); if (CollectionUtil.isEmpty(patientList)) { diff --git a/acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java b/acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java index 56b94a62..a2ef04ab 100644 --- a/acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java +++ b/acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java @@ -42,7 +42,8 @@ public class AdminGlobalDataSourceAspect { private static final String DATASOURCE_NOT_FOUND = "未找到数据源"; - @Pointcut("(execution(* com.acupuncture.web.controller..*.*(..))) && !@annotation(com.acupuncture.common.annotation.DataSource)") + @Pointcut("(execution(* com.acupuncture.web.controller..*.*(..))) && !@annotation(com.acupuncture.common.annotation.DataSource)" + + "|| @within(com.acupuncture.web.task.*)") public void dsPointCut() { } diff --git a/acupuncture-framework/src/main/java/com/acupuncture/framework/config/SecurityConfig.java b/acupuncture-framework/src/main/java/com/acupuncture/framework/config/SecurityConfig.java index 1ab1b6ce..aeb17097 100644 --- a/acupuncture-framework/src/main/java/com/acupuncture/framework/config/SecurityConfig.java +++ b/acupuncture-framework/src/main/java/com/acupuncture/framework/config/SecurityConfig.java @@ -114,7 +114,7 @@ public class SecurityConfig .authorizeHttpRequests((requests) -> { permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll()); // 对于登录login 注册register 验证码captchaImage 允许匿名访问 - requests.antMatchers("/login", "/register", "/captchaImage", "/web/login", "/web/queryTenantById", "/api/http/getUserInfo", "/api/http/addReportImage", "/api/http/uploadMemberInfo").permitAll() + requests.antMatchers("/login", "/register", "/captchaImage", "/web/login", "/web/queryTenantById", "/api/http/getUserInfo", "/api/http/addReportImage", "/api/http/uploadMemberInfo", "/task/task").permitAll() // 静态资源,可匿名访问 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**", "/static/**").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantUserDto.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantUserDto.java index 51288f14..ea3dfb94 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantUserDto.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantUserDto.java @@ -71,6 +71,8 @@ public class AdminTenantUserDto { @Data public static class Query { private Long tenantId; + + private String tenantName; } } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java index ca5ed4bb..45c63fa4 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java @@ -2,6 +2,7 @@ package com.acupuncture.system.domain.dto; import com.acupuncture.system.domain.po.UplReportImage; import com.acupuncture.system.domain.po.UplRtcfInfo; +import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; import lombok.Data; @@ -34,6 +35,7 @@ public class ExternalDto { private String message; + @JsonProperty(value = "UUID") private String UUID; private String deviceID; diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/FmsFollowupDto.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/FmsFollowupDto.java index 038bb3f4..11cba362 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/FmsFollowupDto.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/FmsFollowupDto.java @@ -107,6 +107,8 @@ public class FmsFollowupDto { private Integer educationYears; + private Date dischargeTime; + private String phone; private Byte idCardType; diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java index 80ab8576..9ec92e90 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java @@ -94,9 +94,6 @@ public class PmsTreatmentVo { private Date createTime; - public TreatmentRecordVO() { - } - public TreatmentRecordVO(PmsTreatment pmsTreatment) { this.treatmentId = pmsTreatment.getId(); this.name = pmsTreatment.getName(); @@ -118,7 +115,6 @@ public class PmsTreatmentVo { this.diagnosisName = pmsTreatment.getDiagnosisName(); this.status = pmsTreatment.getStatus(); this.organizationId = pmsTreatment.getTenantId(); - } } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java index 5062df71..9def122e 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java @@ -53,7 +53,7 @@ public class ExternalServiceImpl implements ExternalService { uplRtcfInfos.setId(IdUtil.getSnowflakeNextId()); uplRtcfInfos.setCreateTime(new Date()); uplRtcfInfos.setDelFlag((byte) 0); - + uplRtcfInfos.setUuid(rtcfInfoDto.getUUID()); uplRtcfInfos.setAsmi(rtcfInfoDto.getASMI()); uplRtcfInfos.setBmi(rtcfInfoDto.getBMI()); uplRtcfInfos.setDeviceId(rtcfInfoDto.getDeviceID()); @@ -100,6 +100,44 @@ public class ExternalServiceImpl implements ExternalService { uplRtcfInfos.setRlFat(rtcfInfoDto.getRL_fat()); uplRtcfInfos.setTrWater(rtcfInfoDto.getTR_water()); uplRtcfInfos.setLaWater(rtcfInfoDto.getLA_water()); + uplRtcfInfos.setBoneMax(rtcfInfoDto.getBoneMax()); + uplRtcfInfos.setBoneMin(rtcfInfoDto.getBoneMin()); + uplRtcfInfos.setBone(rtcfInfoDto.getBone()); + uplRtcfInfos.setProtein(rtcfInfoDto.getProtein()); + uplRtcfInfos.setWater(rtcfInfoDto.getWater()); + uplRtcfInfos.setIcw(rtcfInfoDto.getICW()); + uplRtcfInfos.setEcw(rtcfInfoDto.getECW()); + uplRtcfInfos.setMuscleControl(rtcfInfoDto.getMuscle_control()); + uplRtcfInfos.setRaWater(rtcfInfoDto.getRA_water()); + uplRtcfInfos.setRlWater(rtcfInfoDto.getRL_water()); + uplRtcfInfos.setLaMuscle(rtcfInfoDto.getLA_muscle()); + uplRtcfInfos.setTrMuscle(rtcfInfoDto.getTR_muscle()); + uplRtcfInfos.setRaMuscle(rtcfInfoDto.getRA_muscle()); + uplRtcfInfos.setRlMuscle(rtcfInfoDto.getRL_muscle()); + uplRtcfInfos.setTrBone(rtcfInfoDto.getTR_bone()); + uplRtcfInfos.setLaBone(rtcfInfoDto.getLA_bone()); + uplRtcfInfos.setRaBone(rtcfInfoDto.getRA_bone()); + uplRtcfInfos.setRlBone(rtcfInfoDto.getRL_bone()); + uplRtcfInfos.setBoneMin(rtcfInfoDto.getBoneMin()); + uplRtcfInfos.setBoneMax(rtcfInfoDto.getBoneMax()); + uplRtcfInfos.setVfiMax(rtcfInfoDto.getVFIMax()); + uplRtcfInfos.setVfiMin(rtcfInfoDto.getVFIMin()); + uplRtcfInfos.setWhr(rtcfInfoDto.getWHR()); + uplRtcfInfos.setWhrMax(rtcfInfoDto.getWHRMax()); + uplRtcfInfos.setWhrMin(rtcfInfoDto.getWHRMin()); + uplRtcfInfos.setEdemaMax(rtcfInfoDto.getEdemaMax()); + uplRtcfInfos.setEdemaMin(rtcfInfoDto.getEdemaMin()); + uplRtcfInfos.setEdema(rtcfInfoDto.getEdema()); + uplRtcfInfos.setProteinMax(rtcfInfoDto.getProteinMax()); + uplRtcfInfos.setProteinMin(rtcfInfoDto.getProteinMin()); + uplRtcfInfos.setWaterMax(rtcfInfoDto.getWaterMax()); + uplRtcfInfos.setWaterMin(rtcfInfoDto.getWaterMin()); + uplRtcfInfos.setMuscleMax(rtcfInfoDto.getMuscleMax()); + uplRtcfInfos.setWaterMin(rtcfInfoDto.getWaterMin()); + uplRtcfInfos.setSmmMax(rtcfInfoDto.getSMMMax()); + uplRtcfInfos.setSmmMin(rtcfInfoDto.getSMMMin()); + uplRtcfInfos.setBmiMax(rtcfInfoDto.getBMIMax()); + uplRtcfInfos.setBmiMin(rtcfInfoDto.getBMIMin()); int insert = uplRtcfInfoMapper.insert(uplRtcfInfos); if (insert > 0) { diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java index d22b9bd4..db2e47bc 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java @@ -284,6 +284,7 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { patientQueueRelation.setId(IdUtil.getSnowflakeNextId()); patientQueueRelation.setDelFlag((byte) 0); patientQueueRelation.setIdCard(pmsTreatment.getIdCard()); + patientQueueRelation.setDischargeTime(pmsTreatment.getDischargeTime()); patientQueueRelation.setIdCardType(pmsTreatment.getIdCardType().byteValue()); patientQueueRelation.setCreateBy(SecurityUtils.getUsername()); patientQueueRelation.setPatientId(pmsTreatment.getPatientId()); @@ -298,6 +299,7 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { patientQueueRelation.setIdCard(pmsTreatment.getIdCard()); patientQueueRelation.setIdCardType(pmsTreatment.getIdCardType().byteValue()); patientQueueRelation.setCreateBy(SecurityUtils.getUsername()); + patientQueueRelation.setDischargeTime(pmsTreatment.getDischargeTime()); patientQueueRelation.setPatientId(pmsTreatment.getPatientId()); patientQueueRelation.setQueueId(null); patientQueueRelation.setCreateTime(new Date()); @@ -345,8 +347,51 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { } else { recordVoMap = MapUtil.newHashMap(); } - treatmentRecordVO.setRecordValDict(recordVoMap); + //查询公共队列 + List commonFollowupQueue = redisCache.getCacheList("common_followup_queue"); + PmsTreatmentRecordExample pmsTreatmentRecordExample = new PmsTreatmentRecordExample(); + pmsTreatmentRecordExample.createCriteria().andDelFlagEqualTo((byte) 0).andQuestionCodeEqualTo("JBXX_ZYZD").andTreatmentIdEqualTo(pmsTreatment.getId()); + List pmsTreatmentRecords = pmsTreatmentRecordMapper.selectByExample(pmsTreatmentRecordExample); + if (CollectionUtil.isNotEmpty(pmsTreatmentRecords)) { + String answer = pmsTreatmentRecords.get(0).getAnswer(); + if (StrUtil.isNotEmpty(answer)) { + pmsTreatment.setDiagnosisName(answer.replace("!@#", ",")); + } + } + List queueVos = fmsFollowupDao.queryQueueListByPatientId(pmsTreatment.getPatientId()); + if (CollectionUtil.isNotEmpty(queueVos)) { + Map map = new HashMap<>(); + if (CollectionUtil.isNotEmpty(commonFollowupQueue)) { + List followupQueueVOS1 = BeanUtil.copyToList(commonFollowupQueue, FmsFollowupVo.FollowupQueueVO.class); + map = followupQueueVOS1.stream().collect(Collectors.toMap(FmsFollowupVo.FollowupQueueVO::getId, Function.identity())); + } + List list = new ArrayList<>(); + for (PmsTreatmentVo.TreatmentVO.QueueVo queueVo : queueVos) { + if (queueVo == null || queueVo.getQueueId() == null) { + list.add(queueVo); + continue; + } + FmsFollowupVo.FollowupQueueVO followupQueueVO = map.get(queueVo.getQueueId()); + if (followupQueueVO != null) { + queueVo.setQueueName(followupQueueVO.getName()); + } + } + queueVos.removeAll(list); + } + + PmsTreatmentVo.TreatmentRecord treatmentRecord = new PmsTreatmentVo.TreatmentRecord(); + List queueIdList = new ArrayList<>(); + if (CollectionUtil.isNotEmpty(queueVos)) { + for (PmsTreatmentVo.TreatmentVO.QueueVo vo : queueVos) { + queueIdList.add(vo.getQueueId() + ""); + } + } + treatmentRecord.setValid(true); + treatmentRecord.setAnswerString(queueIdList.stream().collect(Collectors.joining("!@#"))); + treatmentRecord.setQuestionCode("SFDL"); + recordVoMap.put("SFDL", CollectionUtil.newArrayList(treatmentRecord)); + treatmentRecordVO.setRecordValDict(recordVoMap); return treatmentRecordVO; } 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 84df4a3a..c073475b 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 @@ -320,6 +320,7 @@ public class ScreeningServiceImpl implements IScreeningService { } @Override public PageInfo queryDetailByPage(ScreeningDto.Query param, Integer pageNum, Integer pageSize) { + param.setTenantId(SecurityUtils.getTenantId()); List results = screeningDetailDao.queryResult(null, null, param); if (CollectionUtil.isNotEmpty(results)) { List screeningDetailVos = screeningDetailDao.queryDetailList(results.stream().map(ScrScreenVo.Result::getId).collect(Collectors.toList())); diff --git a/acupuncture-system/src/main/resources/mapper/dao/AdminDmsUserDao.xml b/acupuncture-system/src/main/resources/mapper/dao/AdminDmsUserDao.xml index 351a7b0d..ac387340 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/AdminDmsUserDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/AdminDmsUserDao.xml @@ -30,6 +30,9 @@ AND u.tenant_id = #{dto.tenantId} + + AND t.name like concat('%',#{dto.tenantName},'%') + diff --git a/acupuncture-system/src/main/resources/mapper/dao/ScreeningDetailDao.xml b/acupuncture-system/src/main/resources/mapper/dao/ScreeningDetailDao.xml index a9181da4..54db2bbd 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/ScreeningDetailDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/ScreeningDetailDao.xml @@ -87,6 +87,9 @@ ) + + and r.tenant_id = #{tenantId} + and r.create_time >= #{param.startTime} From 86dffc98afb27f33a7d7b1323fd9a6e65d476bab Mon Sep 17 00:00:00 2001 From: zzc Date: Mon, 17 Mar 2025 22:11:28 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/aspectj/AdminGlobalDataSourceAspect.java | 3 +-- .../src/main/resources/mapper/dao/ScreeningDetailDao.xml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java b/acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java index a2ef04ab..ec5ab7d6 100644 --- a/acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java +++ b/acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java @@ -42,8 +42,7 @@ public class AdminGlobalDataSourceAspect { private static final String DATASOURCE_NOT_FOUND = "未找到数据源"; - @Pointcut("(execution(* com.acupuncture.web.controller..*.*(..))) && !@annotation(com.acupuncture.common.annotation.DataSource)" + - "|| @within(com.acupuncture.web.task.*)") + @Pointcut("(execution(* com.acupuncture.web.controller..*.*(..))) && !@annotation(com.acupuncture.common.annotation.DataSource)") public void dsPointCut() { } diff --git a/acupuncture-system/src/main/resources/mapper/dao/ScreeningDetailDao.xml b/acupuncture-system/src/main/resources/mapper/dao/ScreeningDetailDao.xml index 54db2bbd..e7ec883f 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/ScreeningDetailDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/ScreeningDetailDao.xml @@ -88,7 +88,7 @@ - and r.tenant_id = #{tenantId} + and r.tenant_id = #{param.tenantId} and r.create_time >= #{param.startTime} From 987584b70a0dc71f158749125aeddec00bc76e1d Mon Sep 17 00:00:00 2001 From: zzc Date: Mon, 17 Mar 2025 22:20:56 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E8=AF=84=E4=BC=B0=E6=8A=A5=E5=91=8A=E5=8D=95=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/domain/vo/PmsTreatmentVo.java | 31 ++++++++++++++++++- .../system/persist/dao/PmsTreatmentDao.java | 1 + .../service/impl/ScreeningServiceImpl.java | 1 + 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java index 9ec92e90..8287394c 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java @@ -65,25 +65,51 @@ public class PmsTreatmentVo { @Data public static class TreatmentRecordVO { private Long id; - private Long treatmentId; + + private Long patientId; + private String name; + + private String pinyinFull; + + private String pinyinSimple; + private Byte gender; + private Integer age; + private Date birthDate; + private String ethnicity; + private Integer educationYears; + private String phone; + private Byte idCardType; + private String idCard; + private Byte visitType; + private String visitNumber; + private Date visitTime; + private Date dischargeTime; + private String doctor; + private String deptName; + private String diagnosisCode; + private String diagnosisName; + private Byte status; + + private Long treatmentId; + private Long organizationId; @ApiModelProperty("生效的code和答案字典") private Map validRecordValDict; @@ -94,6 +120,9 @@ public class PmsTreatmentVo { private Date createTime; + public TreatmentRecordVO() { + } + public TreatmentRecordVO(PmsTreatment pmsTreatment) { this.treatmentId = pmsTreatment.getId(); this.name = pmsTreatment.getName(); diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/PmsTreatmentDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/PmsTreatmentDao.java index 629353a3..c92171c0 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/PmsTreatmentDao.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/PmsTreatmentDao.java @@ -33,5 +33,6 @@ public interface PmsTreatmentDao { @DataSource(DataSourceType.MASTER) List adminQuery(@Param("query") PmsTreatmentDto.TreatmentQueryDTO query); + @DataSource(DataSourceType.MASTER) PmsTreatmentVo.TreatmentRecordVO adminQueryTreatment(@Param("id") Long id); } 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 c073475b..1f3361c1 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 @@ -466,6 +466,7 @@ public class ScreeningServiceImpl implements IScreeningService { detail.setScreenId(detailInfo.getId()); detail.setTenantId(hospitailId); detail.setSubmitStatus(UserConstants.SubmitStatus.save.status); + detail.setCreateTime(new Date()); detail.setDelFlag((byte) 0); scrScreeningRecordMapper.insertSelective(detail); detailInfo.setDetailId(detail.getId()); From 14e5c7024885e3f7768fd57834f5be15256f0b13 Mon Sep 17 00:00:00 2001 From: zzc Date: Mon, 17 Mar 2025 22:48:29 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AD=9B=E6=9F=A5?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/PmsTreatmentServiceImpl.java | 2 +- .../service/impl/ScreeningServiceImpl.java | 137 ++++++++++-------- 2 files changed, 74 insertions(+), 65 deletions(-) diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java index db2e47bc..9af11510 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java @@ -610,7 +610,7 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { if (StrUtil.isNotEmpty(idcard) && IdcardUtil.isValidCard(idcard)) { dto.setBirthDate(IdcardUtil.getBirthDate(idcard)); } - dto.setIdCardType(rowList.get(7).toString().trim().equals("身份证") ? 0 : rowList.get(7).toString().trim().equals("护照或外国人永居证") ? 1 : rowList.get(7).toString().trim().equals("港澳居民来往内地通行证") ? 2 : rowList.get(7).toString().trim().equals("台湾居民来往大陆通行证") ? 3 : 4); +// dto.setIdCardType(rowList.get(7).toString().trim().equals("身份证") ? 0 : rowList.get(7).toString().trim().equals("护照或外国人永居证") ? 1 : rowList.get(7).toString().trim().equals("港澳居民来往内地通行证") ? 2 : rowList.get(7).toString().trim().equals("台湾居民来往大陆通行证") ? 3 : 4); dto.setIdCard(idcard); dto.setVisitType(rowList.get(9).toString().trim().equals("门诊") ? 0 : 1); dto.setVisitNumber(rowList.get(10).toString()); 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 1f3361c1..69f2bb52 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 @@ -87,23 +87,20 @@ public class ScreeningServiceImpl implements IScreeningService { List headerList = CollectionUtil.newArrayList( "姓名", "性别", - "年龄", - "身份证", "出生日期", - "手机号", - "有高血压,>=140/90mmHg", - "血脂异常,或不清楚", - "有糖尿病", - "心跳不规则", - "吸烟", - "明显超重或肥胖", - "缺乏运动", - "有卒中家族史", - "有既往脑卒中病史", - "有既往短暂脑缺血病史", - "筛查结果", - "数据来源", - "科室名称"); + "年龄", +// "身份证", + "联系方式", + "身高", + "体重", + "BMI", + "体重自评结论", + "失眠自评(SRSS)得分", + "可接受的治疗方式", + "可接受的治疗周期", + "筛查时间", + "组织" + ); excelWriter.writeHeadRow(headerList); PageInfo page = queryDetailByPage(param, -1, -1); @@ -124,55 +121,66 @@ public class ScreeningServiceImpl implements IScreeningService { row += 1; excelWriter.writeCellValue(0, row, detailVos.get(i).getName() + ""); excelWriter.writeCellValue(1, row, map.get("SCWJ-SEX") == null ? "未知" : map.get("SCWJ-SEX").getAnswer()); - excelWriter.writeCellValue(2, row, map.get("SCWJ-AGE") == null ? "" : map.get("SCWJ-AGE").getAnswer()); - excelWriter.writeCellValue(3, row, map.get("SCWJ-idCard") == null ? "" : map.get("SCWJ-idCard").getAnswer()); - excelWriter.writeCellValue(4, row, map.get("SCWJ-BIRTH") == null ? "" : map.get("SCWJ-BIRTH").getAnswer()); - excelWriter.writeCellValue(5, row, map.get("SCWJ-PHONE") == null ? "" : map.get("SCWJ-PHONE").getAnswer()); +// excelWriter.writeCellValue(3, row, map.get("SCWJ-idCard") == null ? "" : map.get("SCWJ-idCard").getAnswer()); + excelWriter.writeCellValue(2, row, map.get("SCWJ-BIRTH") == null ? "" : map.get("SCWJ-BIRTH").getAnswer()); + excelWriter.writeCellValue(3, row, map.get("SCWJ-AGE") == null ? "" : map.get("SCWJ-AGE").getAnswer()); + excelWriter.writeCellValue(4, row, map.get("SCWJ-PHONE") == null ? "" : map.get("SCWJ-PHONE").getAnswer()); - if (record == null || StrUtil.isEmpty(record.getAnswer())) { - excelWriter.writeCellValue(6, row, "否"); - excelWriter.writeCellValue(7, row, "否"); - excelWriter.writeCellValue(8, row, "否"); - excelWriter.writeCellValue(9, row, "否"); - excelWriter.writeCellValue(10, row, "否"); - excelWriter.writeCellValue(11, row, "否"); - excelWriter.writeCellValue(12, row, "否"); - excelWriter.writeCellValue(13, row, "否"); - excelWriter.writeCellValue(14, row, "否"); - excelWriter.writeCellValue(15, row, "否"); - } else { - String answer = record.getAnswer(); - String[] split = answer.split(","); - excelWriter.writeCellValue(6, row, Arrays.asList(split).contains("01") ? "是" : "否"); - excelWriter.writeCellValue(7, row, Arrays.asList(split).contains("02") ? "是" : "否"); - excelWriter.writeCellValue(8, row, Arrays.asList(split).contains("03") ? "是" : "否"); - excelWriter.writeCellValue(9, row, Arrays.asList(split).contains("04") ? "是" : "否"); - excelWriter.writeCellValue(10, row, Arrays.asList(split).contains("05") ? "是" : "否"); - excelWriter.writeCellValue(11, row, Arrays.asList(split).contains("06") ? "是" : "否"); - excelWriter.writeCellValue(12, row, Arrays.asList(split).contains("07") ? "是" : "否"); - excelWriter.writeCellValue(13, row, Arrays.asList(split).contains("08") ? "是" : "否"); - excelWriter.writeCellValue(14, row, Arrays.asList(split).contains("09") ? "是" : "否"); - excelWriter.writeCellValue(15, row, Arrays.asList(split).contains("10") ? "是" : "否"); - } - String str = ""; - if (map.get("SCWJ-RESULT") != null && StrUtil.isNotEmpty(map.get("SCWJ-RESULT").getAnswer())) { - String answer1 = map.get("SCWJ-RESULT").getAnswer(); - if ("0".equals(answer1)) { - str = "正常"; - } - if ("1".equals(answer1)) { - str = "低危"; - } - if ("2".equals(answer1)) { - str = "中危"; - } - if ("3".equals(answer1)) { - str = "高危"; - } - } - excelWriter.writeCellValue(16, row, str); - excelWriter.writeCellValue(17, row, map.get("SCWJ-SQMC") == null ? "" : map.get("SCWJ-SQMC").getAnswer()); - excelWriter.writeCellValue(18, row, map.get("SCWJ-DEPT") == null ? "" : map.get("SCWJ-DEPT").getAnswer()); + excelWriter.writeCellValue(5, row, map.get("SCWJ-HEIGHT") == null ? "" : map.get("SCWJ-HEIGHT").getAnswer()); + excelWriter.writeCellValue(6, row, map.get("SCWJ-WEIGHT") == null ? "" : map.get("SCWJ-WEIGHT").getAnswer()); + excelWriter.writeCellValue(7, row, map.get("SCWJ-BMI") == null ? "" : map.get("SCWJ-BMI").getAnswer()); + excelWriter.writeCellValue(8, row, map.get("SCWJ-JL") == null ? "" : map.get("SCWJ-JL").getAnswer()); + excelWriter.writeCellValue(9, row, map.get("SCWJ-RESULT") == null ? "" : map.get("SCWJ-RESULT").getAnswer()); + excelWriter.writeCellValue(10, row, map.get("SCWJ-ZLFS") == null ? "" : map.get("SCWJ-ZLFS").getAnswer()); + excelWriter.writeCellValue(11, row, map.get("SCWJ-ZLZQ") == null ? "" : map.get("SCWJ-ZLZQ").getAnswer()); + + excelWriter.writeCellValue(12, row, DateUtil.format(detailVos.get(i).getCreateTime(), "yyyy-MM-dd HH:mm:ss")); + excelWriter.writeCellValue(13, row, detailVos.get(i).getTenantName()); + +// if (record == null || StrUtil.isEmpty(record.getAnswer())) { +// excelWriter.writeCellValue(6, row, "否"); +// excelWriter.writeCellValue(7, row, "否"); +// excelWriter.writeCellValue(8, row, "否"); +// excelWriter.writeCellValue(9, row, "否"); +// excelWriter.writeCellValue(10, row, "否"); +// excelWriter.writeCellValue(11, row, "否"); +// excelWriter.writeCellValue(12, row, "否"); +// excelWriter.writeCellValue(13, row, "否"); +// excelWriter.writeCellValue(14, row, "否"); +// excelWriter.writeCellValue(15, row, "否"); +// } else { +// String answer = record.getAnswer(); +// String[] split = answer.split(","); +// excelWriter.writeCellValue(6, row, Arrays.asList(split).contains("01") ? "是" : "否"); +// excelWriter.writeCellValue(7, row, Arrays.asList(split).contains("02") ? "是" : "否"); +// excelWriter.writeCellValue(8, row, Arrays.asList(split).contains("03") ? "是" : "否"); +// excelWriter.writeCellValue(9, row, Arrays.asList(split).contains("04") ? "是" : "否"); +// excelWriter.writeCellValue(10, row, Arrays.asList(split).contains("05") ? "是" : "否"); +// excelWriter.writeCellValue(11, row, Arrays.asList(split).contains("06") ? "是" : "否"); +// excelWriter.writeCellValue(12, row, Arrays.asList(split).contains("07") ? "是" : "否"); +// excelWriter.writeCellValue(13, row, Arrays.asList(split).contains("08") ? "是" : "否"); +// excelWriter.writeCellValue(14, row, Arrays.asList(split).contains("09") ? "是" : "否"); +// excelWriter.writeCellValue(15, row, Arrays.asList(split).contains("10") ? "是" : "否"); +// } +// String str = ""; +// if (map.get("SCWJ-RESULT") != null && StrUtil.isNotEmpty(map.get("SCWJ-RESULT").getAnswer())) { +// String answer1 = map.get("SCWJ-RESULT").getAnswer(); +// if ("0".equals(answer1)) { +// str = "正常"; +// } +// if ("1".equals(answer1)) { +// str = "低危"; +// } +// if ("2".equals(answer1)) { +// str = "中危"; +// } +// if ("3".equals(answer1)) { +// str = "高危"; +// } +// } +// excelWriter.writeCellValue(16, row, map.get("SCWJ-JL") == null ? "" : map.get("SCWJ-JL").getAnswer()); +// excelWriter.writeCellValue(17, row, map.get("SCWJ-SQMC") == null ? "" : map.get("SCWJ-SQMC").getAnswer()); +// excelWriter.writeCellValue(18, row, map.get("SCWJ-DEPT") == null ? "" : map.get("SCWJ-DEPT").getAnswer()); } } } @@ -383,6 +391,7 @@ public class ScreeningServiceImpl implements IScreeningService { } if (param.getCode().equals("SCWJ-BIRTH")) { questionnaireDetail.setAge(DateUtil.ageOfNow(param.getAnswer())); + param.setAnswer(DateUtil.format(DateUtil.parse(param.getAnswer()), "yyyy-MM-dd")); } log.info("questionnaireDetail:{}", questionnaireDetail.getId()); log.info("questionnaireDetail:{}", questionnaireDetail.getName()); From bb770aabf9c2a814a4256a304de9a1c0523b2cd1 Mon Sep 17 00:00:00 2001 From: zzc Date: Mon, 17 Mar 2025 23:15:36 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=88=87=E6=8D=A2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90=E5=88=87=E9=9D=A2=E4=BF=AE=E6=94=B9=EF=BC=8Cheader?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=84=E7=BB=87ID=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/web/ScreeningController.java | 40 ++++++++++++++----- .../common/constant/UserConstants.java | 2 + .../aspectj/AdminGlobalDataSourceAspect.java | 23 ++++++----- .../system/domain/dto/ScreeningDto.java | 2 + .../service/impl/ScreeningServiceImpl.java | 2 +- 5 files changed, 50 insertions(+), 19 deletions(-) diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ScreeningController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ScreeningController.java index a8afca11..8f0e268f 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ScreeningController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ScreeningController.java @@ -7,9 +7,14 @@ import com.acupuncture.common.annotation.Anonymous; import com.acupuncture.common.core.domain.BaseDto; import com.acupuncture.common.core.domain.JsonResponse; import com.acupuncture.common.utils.SecurityUtils; +import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder; import com.acupuncture.system.domain.dto.ScreeningDto; +import com.acupuncture.system.domain.po.DmsTenant; +import com.acupuncture.system.domain.po.UmsDataSource; import com.acupuncture.system.domain.vo.QuestionnaireVo; import com.acupuncture.system.domain.vo.ScrScreenVo; +import com.acupuncture.system.persist.mapper.DmsTenantMapper; +import com.acupuncture.system.persist.mapper.UmsDataSourceMapper; import com.acupuncture.system.service.IScreeningService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -36,10 +41,15 @@ import java.util.List; public class ScreeningController { @Resource private IScreeningService screeningService; + @Resource + private DmsTenantMapper dmsTenantMapper; + + @Resource + private UmsDataSourceMapper umsDataSourceMapper; @ApiOperation(value = "查询筛查列表", notes = "原:查询医院是否填写了调查筛查") @RequestMapping(value = "/queryDetail", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) - public JsonResponse> queryDetail(@ApiParam @Validated @RequestBody BaseDto param){ + public JsonResponse> queryDetail(@ApiParam @Validated @RequestBody BaseDto param) { log.info("查询筛查列表"); if (param.getPageNum() > 0) { PageHelper.startPage(param.getPageNum(), param.getPageSize()); @@ -49,7 +59,7 @@ public class ScreeningController { @ApiOperation(value = "后台查询筛查列表", notes = "原:查询医院是否填写了调查筛查") @RequestMapping(value = "/admin/queryDetail", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) - public JsonResponse> adminQueryDetail(@ApiParam @Validated @RequestBody BaseDto param){ + public JsonResponse> adminQueryDetail(@ApiParam @Validated @RequestBody BaseDto param) { log.info("查询筛查列表"); if (param.getPageNum() > 0) { PageHelper.startPage(param.getPageNum(), param.getPageSize()); @@ -72,11 +82,22 @@ public class ScreeningController { @RequestMapping(value = "/createNoToken", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public JsonResponse createNoToken(@ApiParam @Validated @RequestBody BaseDto params) throws Exception { log.info("创建筛查详情{}", params); - QuestionnaireVo.DetailInfo detailInfo = screeningService.createDetail(params.getParam(), params.getParam().getUserId(), params.getParam().getTenantId()); +// changeDataSource(params.getParam().getTenantId()); + QuestionnaireVo.DetailInfo detailInfo = screeningService.createDetail(params.getParam(), params.getParam().getUserId(), params.getParam().getTenantId()); log.info("创建筛查详情结束"); return JsonResponse.ok(detailInfo); } + private void changeDataSource(Long tenantId) { + DmsTenant dmsTenant = dmsTenantMapper.selectByPrimaryKey(tenantId); + if (dmsTenant != null) { + UmsDataSource umsDataSource = umsDataSourceMapper.selectByPrimaryKey(dmsTenant.getDataSourceId()); + if (umsDataSource != null) { + DynamicDataSourceContextHolder.setDataSourceType(umsDataSource.getDataSourceKey()); + } + } + } + @ApiOperation(value = "提交筛查", notes = "") @RequestMapping(value = "/submit", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public JsonResponse submitQuestionnaire(@ApiParam @Validated @RequestBody BaseDto params) throws Exception { @@ -90,16 +111,17 @@ public class ScreeningController { @RequestMapping(value = "/submitNoToken", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public JsonResponse submitNoToken(@ApiParam @Validated @RequestBody BaseDto params) throws Exception { log.info("提交筛查开始{}", params); - screeningService.submitQuestionnaire(params.getParam(), 0L); +// changeDataSource(params.getParam().getTenantId()); + screeningService.submitQuestionnaire(params.getParam(), 0L); return JsonResponse.ok(); } - @Anonymous @ApiOperation(value = "保存调查筛查**", notes = "") @RequestMapping(value = "/save", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public JsonResponse saveQuestionnaire(@ApiParam @Validated @RequestBody BaseDto params) throws Exception { log.info("保存调查筛查开始{}", params); +// changeDataSource(params.getParam().getTenantId()); screeningService.saveQuestionnaire(params.getParam(), params.getParam().getUserId()); log.info("保存调查筛查结束"); return JsonResponse.ok(); @@ -107,7 +129,7 @@ public class ScreeningController { @ApiOperation(value = "筛查随访", notes = "") @RequestMapping(value = "/follow", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) - public JsonResponse follow(@Validated @RequestBody BaseDto screenFollow){ + public JsonResponse follow(@Validated @RequestBody BaseDto screenFollow) { screeningService.follow(screenFollow.getParam().getPatientId(), screenFollow.getParam().getStatus()); return JsonResponse.ok(); } @@ -123,19 +145,19 @@ public class ScreeningController { @ApiOperation(value = "导出筛查列表", notes = "") @RequestMapping(value = "/exportScreen", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) - public void export(HttpServletResponse response, @RequestBody @Validated BaseDto param) { + public void export(HttpServletResponse response, @RequestBody @Validated BaseDto param) { screeningService.export(response, param.getParam()); } @ApiOperation(value = "导出筛查列表", notes = "") @RequestMapping(value = "/admin/exportScreen", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) - public void adminExport(HttpServletResponse response, @RequestBody @Validated BaseDto param) { + public void adminExport(HttpServletResponse response, @RequestBody @Validated BaseDto param) { screeningService.adminExport(response, param.getParam()); } @ApiOperation(value = "导出认知筛查列表", notes = "") @RequestMapping(value = "/exportRzScreen", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) - public void exportRzScreen(HttpServletResponse response, @RequestBody @Validated BaseDto param) { + public void exportRzScreen(HttpServletResponse response, @RequestBody @Validated BaseDto param) { screeningService.exportRzScreen(response, param.getParam()); } diff --git a/acupuncture-common/src/main/java/com/acupuncture/common/constant/UserConstants.java b/acupuncture-common/src/main/java/com/acupuncture/common/constant/UserConstants.java index 3a0a5c41..aec15c82 100644 --- a/acupuncture-common/src/main/java/com/acupuncture/common/constant/UserConstants.java +++ b/acupuncture-common/src/main/java/com/acupuncture/common/constant/UserConstants.java @@ -81,6 +81,8 @@ public class UserConstants public static final String HEADER_KEY_TOKEN = "Authorization"; + public static final String DEPT = "TENANT_ID"; + /** * QuestionAnswer分隔符 */ diff --git a/acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java b/acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java index ec5ab7d6..dbe8ad4c 100644 --- a/acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java +++ b/acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java @@ -70,16 +70,21 @@ public class AdminGlobalDataSourceAspect { // 获取请求携带的令牌 HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - - String authHeader = request.getHeader(UserConstants.HEADER_KEY_TOKEN); //token为空 - if(StrUtil.isEmpty(authHeader)){ - return null; - } + Long tenantId; + String header = request.getHeader(UserConstants.DEPT); + if(StrUtil.isNotEmpty(header)){ + tenantId = Long.parseLong(header); + }else { // String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); - Long tenantId = SecurityUtils.getTenantId(); - if (tenantId == null) { - return null; + String authHeader = request.getHeader(UserConstants.HEADER_KEY_TOKEN); + if (StrUtil.isEmpty(authHeader)) { + return null; + } + tenantId = SecurityUtils.getTenantId(); + if (tenantId == null) { + return null; + } } //设置所属医院和数据源 @@ -90,7 +95,7 @@ public class AdminGlobalDataSourceAspect { // if(ObjectUtil.isNull(loginUser) || loginUser.getUser().isAdmin()){ // return null; // } - //根据部门ID查询数据源 + //根据组织ID查询数据源 UmsDataSource dataSource = dmsLoginService.getDataSourceByTenantId(tenantId); if (dataSource == null) { throw new BaseException(DATASOURCE_NOT_FOUND); diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ScreeningDto.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ScreeningDto.java index de67d923..ad37fee1 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ScreeningDto.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ScreeningDto.java @@ -183,6 +183,7 @@ public class ScreeningDto { @NotNull(message = "问卷详情id不能为空") @ApiModelProperty("问卷详情id") private Long detailId; + private Long tenantId; } @Data @@ -229,6 +230,7 @@ public class ScreeningDto { @ApiModelProperty("答案") private String answer; private Long userId; + private Long tenantId; } @Data 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 69f2bb52..7fd645ea 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 @@ -391,7 +391,7 @@ public class ScreeningServiceImpl implements IScreeningService { } if (param.getCode().equals("SCWJ-BIRTH")) { questionnaireDetail.setAge(DateUtil.ageOfNow(param.getAnswer())); - param.setAnswer(DateUtil.format(DateUtil.parse(param.getAnswer()), "yyyy-MM-dd")); +// param.setAnswer(DateUtil.format(DateUtil.parse(param.getAnswer()), "yyyy-MM-dd")); } log.info("questionnaireDetail:{}", questionnaireDetail.getId()); log.info("questionnaireDetail:{}", questionnaireDetail.getName());