From 7ca339e3c7c795d1a5d0fa316d5302f5672d98f4 Mon Sep 17 00:00:00 2001 From: "Wang.Huan" Date: Mon, 10 Mar 2025 15:22:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=B1=82=E7=BA=A7=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PractitionerRoleController.java | 2 +- .../IDoctorStationEmrAppService.java | 52 ++++-- .../IDoctorStationMainAppService.java | 23 +++ .../impl/DoctorStationEmrAppServiceImpl.java | 151 +++++++++++++---- .../impl/DoctorStationMainAppServiceImpl.java | 63 +++++++ .../DoctorStationEmrController.java | 81 ++++++--- .../DoctorStationMainController.java | 58 +++++++ .../dto/EmrTemplateDto.java | 2 +- .../dto/PatientEmrDto.java | 2 +- .../mapper/DoctorStationEmrAppMapper.java | 23 --- .../mapper/DoctorStationMainAppMapper.java | 34 ++++ .../emr/controller/PatientEmrController.java | 157 ------------------ .../DoctorStationEmrAppMapper.xml | 63 ------- .../DoctorStationMainAppMapper.xml | 63 +++++++ 14 files changed, 458 insertions(+), 316 deletions(-) create mode 100644 openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationMainAppService.java create mode 100644 openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationMainAppServiceImpl.java create mode 100644 openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationMainController.java rename openhis-server/openhis-application/src/main/java/com/openhis/web/{emr => doctorstation}/dto/EmrTemplateDto.java (94%) rename openhis-server/openhis-application/src/main/java/com/openhis/web/{emr => doctorstation}/dto/PatientEmrDto.java (94%) create mode 100644 openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationMainAppMapper.java delete mode 100644 openhis-server/openhis-application/src/main/java/com/openhis/web/emr/controller/PatientEmrController.java create mode 100644 openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationMainAppMapper.xml diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/controller/PractitionerRoleController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/controller/PractitionerRoleController.java index 198cd26f..a2341b27 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/controller/PractitionerRoleController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/controller/PractitionerRoleController.java @@ -120,7 +120,7 @@ public class PractitionerRoleController { // 编辑practitionerRole信息 PractitionerRole practitionerRole = new PractitionerRole(); BeanUtils.copyProperties(practitionerRoleDto, practitionerRole); - if (practitionerRole.getRole_code() == null) { + if (practitionerRole.getRoleCode() == null) { return R.fail(PromptMsgConstant.Common.M00007, "角色编码不能为空"); } if (practitionerRole.getOrgId() == null) { diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationEmrAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationEmrAppService.java index 58a1755e..32a18f44 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationEmrAppService.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationEmrAppService.java @@ -1,23 +1,55 @@ package com.openhis.web.doctorstation.appservice; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.openhis.web.doctorstation.dto.PatientInfoDto; +import com.core.common.core.domain.R; +import com.openhis.web.doctorstation.dto.EmrTemplateDto; +import com.openhis.web.doctorstation.dto.PatientEmrDto; /** * 医生站-电子病历 应用Service */ public interface IDoctorStationEmrAppService { + /** + * 添加病人病历信息 + * + * @param patientEmrDto 电子病历信息dto + * @return 操作结果 + */ + R addPatientEmr(PatientEmrDto patientEmrDto); /** - * 查询就诊患者信息 + * 获取患者历史病历 * - * @param patientInfoDto 查询条件 (前端传 statusEnum 区分就诊状态tab) - * @param searchKey 模糊查询关键字 - * @param pageNo 当前页 - * @param pageSize 每页多少条 - * @return 就诊患者信息 + * @param patientEmrDto 查询条件 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @return 分页数据列表 */ - IPage getPatientInfo(PatientInfoDto patientInfoDto, String searchKey, Integer pageNo, - Integer pageSize); + R getPatientEmrHistory(PatientEmrDto patientEmrDto, Integer pageNo, Integer pageSize); + + /** + * 保存病历模板 + * + * @param emrTemplateDto 病历模板信息 + * @return 操作结果 + */ + R addEmrTemplate(EmrTemplateDto emrTemplateDto); + + /** + * 获取电子病历模板列表 + * + * @param emrTemplateDto 查询参数 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @return + */ + R getEmrTemplate(EmrTemplateDto emrTemplateDto, Integer pageNo, Integer pageSize); + + /** + * 删除病历模板 + * + * @param id 模板id + * @return 操作结果 + */ + R deleteEmrTemplate(Long id); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationMainAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationMainAppService.java new file mode 100644 index 00000000..3da7caec --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationMainAppService.java @@ -0,0 +1,23 @@ +package com.openhis.web.doctorstation.appservice; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.openhis.web.doctorstation.dto.PatientInfoDto; + +/** + * 医生站-电子病历 应用Service + */ +public interface IDoctorStationMainAppService { + + /** + * 查询就诊患者信息 + * + * @param patientInfoDto 查询条件 (前端传 statusEnum 区分就诊状态tab) + * @param searchKey 模糊查询关键字 + * @param pageNo 当前页 + * @param pageSize 每页多少条 + * @return 就诊患者信息 + */ + IPage getPatientInfo(PatientInfoDto patientInfoDto, String searchKey, Integer pageNo, + Integer pageSize); + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java index d6653da7..3520e9f8 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java @@ -1,25 +1,31 @@ package com.openhis.web.doctorstation.appservice.impl; -import java.util.Arrays; -import java.util.HashSet; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; import javax.annotation.Resource; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; +import com.alibaba.fastjson2.JSONObject; +import com.alibaba.fastjson2.TypeReference; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.core.common.utils.AgeCalculatorUtil; -import com.openhis.common.enums.AdministrativeGender; -import com.openhis.common.enums.ClinicalStatus; -import com.openhis.common.enums.EncounterStatus; -import com.openhis.common.enums.ParticipantType; -import com.openhis.common.utils.EnumUtils; -import com.openhis.common.utils.HisQueryUtils; +import com.core.common.core.domain.R; +import com.openhis.document.domain.Emr; +import com.openhis.document.domain.EmrDetail; +import com.openhis.document.domain.EmrDict; +import com.openhis.document.domain.EmrTemplate; +import com.openhis.document.service.IEmrDetailService; +import com.openhis.document.service.IEmrDictService; +import com.openhis.document.service.IEmrService; +import com.openhis.document.service.IEmrTemplateService; import com.openhis.web.doctorstation.appservice.IDoctorStationEmrAppService; -import com.openhis.web.doctorstation.dto.PatientInfoDto; -import com.openhis.web.doctorstation.mapper.DoctorStationEmrAppMapper; +import com.openhis.web.doctorstation.dto.EmrTemplateDto; +import com.openhis.web.doctorstation.dto.PatientEmrDto; /** * 医生站-电子病历 应用实现类 @@ -28,34 +34,107 @@ import com.openhis.web.doctorstation.mapper.DoctorStationEmrAppMapper; public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppService { @Resource - DoctorStationEmrAppMapper doctorStationEmrAppMapper; + IEmrService emrService; + + @Resource + IEmrTemplateService emrTemplateService; + + @Resource + IEmrDetailService emrDetailService; + + @Resource + IEmrDictService emrDictService; /** - * 查询就诊患者信息 + * 添加病人病历信息 * - * @param patientInfoDto 查询条件 (前端传 statusEnum 区分就诊状态tab) - * @param searchKey 模糊查询关键字 - * @param pageNo 当前页 - * @param pageSize 每页多少条 - * @return 就诊患者信息 + * @param patientEmrDto 电子病历信息dto + * @return 操作结果 */ @Override - public IPage getPatientInfo(PatientInfoDto patientInfoDto, String searchKey, Integer pageNo, - Integer pageSize) { - // 构建查询条件 - QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(patientInfoDto, searchKey, - new HashSet<>(Arrays.asList("patient_name", "id_card", "phone")), null); - IPage patientInfo = doctorStationEmrAppMapper.getPatientInfo(new Page<>(pageNo, pageSize), - ParticipantType.ADMITTER.getCode(), ClinicalStatus.INACTIVE.getValue(), null, null, queryWrapper); - patientInfo.getRecords().forEach(e -> { - // 性别 - e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum())); - // 计算年龄 - e.setAge(AgeCalculatorUtil.getAge(e.getBirthDate())); - // 就诊状态 - e.setStatusEnum_enumText(EnumUtils.getInfoByValue(EncounterStatus.class, e.getStatusEnum())); - }); - return patientInfo; + public R addPatientEmr(PatientEmrDto patientEmrDto) { + Emr emr = new Emr(); + BeanUtils.copyProperties(patientEmrDto, emr); + String contextStr = patientEmrDto.getContextJson().toString(); + boolean saveSuccess = emrService.save(emr.setContextJson(contextStr)); + if (!saveSuccess) { + return R.fail(); + } + // 获取电子病历字典表中全部key,用来判断病历JSON串中是否有需要加入到病历详情表的字段 + List emrDictList = emrDictService.list(new LambdaQueryWrapper().select(EmrDict::getEmrKey)) + .stream().map(EmrDict::getEmrKey).collect(Collectors.toList()); + Map emrContextMap = + JSONObject.parseObject(contextStr, new TypeReference>() {}); + List emrDetailList = new ArrayList<>(); + // 遍历病历内容map + for (Map.Entry entry : emrContextMap.entrySet()) { + EmrDetail emrDetail = new EmrDetail(); + emrDetail.setEmrId(emr.getId()); + if (!emrDictList.isEmpty() && emrDictList.contains(entry.getKey())) { + emrDetail.setEmrKey(entry.getKey()); + emrDetail.setEmrValue(entry.getValue()); + } + emrDetailList.add(emrDetail); + } + boolean save = emrDetailService.saveBatch(emrDetailList); + return save ? R.ok() : R.fail(); + } + + /** + * 获取患者历史病历 + * + * @param patientEmrDto 查询条件 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @return 分页数据列表 + */ + @Override + public R getPatientEmrHistory(PatientEmrDto patientEmrDto, Integer pageNo, Integer pageSize) { + Page page = emrService.page(new Page<>(pageNo, pageSize), + new LambdaQueryWrapper().eq(Emr::getPatientId, patientEmrDto.getPatientId())); + return R.ok(page); + } + + /** + * 保存病历模板 + * + * @param emrTemplateDto 病历模板信息 + * @return 操作结果 + */ + @Override + public R addEmrTemplate(EmrTemplateDto emrTemplateDto) { + EmrTemplate emrTemplate = new EmrTemplate(); + BeanUtils.copyProperties(emrTemplateDto, emrTemplate); + return emrTemplateService.save(emrTemplate) ? R.ok() : R.fail(); + } + + /** + * 获取电子病历模板列表 + * + * @param emrTemplateDto 查询参数 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @return + */ + @Override + public R getEmrTemplate(EmrTemplateDto emrTemplateDto, Integer pageNo, Integer pageSize) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.like(EmrTemplate::getTemplateName, emrTemplateDto.getTemplateName()) + .eq(EmrTemplate::getUseScopeCode, emrTemplateDto.getUseScopeCode()) + .eq(EmrTemplate::getUserId, emrTemplateDto.getUserId()); + Page emrTemplatePage = emrTemplateService.page(new Page<>(pageNo, pageSize), queryWrapper); + return R.ok(emrTemplatePage); + } + + /** + * 删除病历模板 + * + * @param id 模板id + * @return 操作结果 + */ + @Override + public R deleteEmrTemplate(Long id) { + return emrTemplateService.removeById(id) ? R.ok() : R.fail(); } } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationMainAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationMainAppServiceImpl.java new file mode 100644 index 00000000..fefae69c --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationMainAppServiceImpl.java @@ -0,0 +1,63 @@ +package com.openhis.web.doctorstation.appservice.impl; + +import java.util.Arrays; +import java.util.HashSet; + +import javax.annotation.Resource; + +import com.openhis.web.doctorstation.appservice.IDoctorStationMainAppService; +import com.openhis.web.doctorstation.mapper.DoctorStationMainAppMapper; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.core.common.utils.AgeCalculatorUtil; +import com.openhis.common.enums.AdministrativeGender; +import com.openhis.common.enums.ClinicalStatus; +import com.openhis.common.enums.EncounterStatus; +import com.openhis.common.enums.ParticipantType; +import com.openhis.common.utils.EnumUtils; +import com.openhis.common.utils.HisQueryUtils; +import com.openhis.web.doctorstation.appservice.IDoctorStationEmrAppService; +import com.openhis.web.doctorstation.dto.PatientInfoDto; +import com.openhis.web.doctorstation.mapper.DoctorStationEmrAppMapper; + +/** + * 医生站-电子病历 应用实现类 + */ +@Service +public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppService { + + @Resource + DoctorStationMainAppMapper doctorStationMainAppMapper; + + /** + * 查询就诊患者信息 + * + * @param patientInfoDto 查询条件 (前端传 statusEnum 区分就诊状态tab) + * @param searchKey 模糊查询关键字 + * @param pageNo 当前页 + * @param pageSize 每页多少条 + * @return 就诊患者信息 + */ + @Override + public IPage getPatientInfo(PatientInfoDto patientInfoDto, String searchKey, Integer pageNo, + Integer pageSize) { + // 构建查询条件 + QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(patientInfoDto, searchKey, + new HashSet<>(Arrays.asList("patient_name", "id_card", "phone")), null); + IPage patientInfo = doctorStationMainAppMapper.getPatientInfo(new Page<>(pageNo, pageSize), + ParticipantType.ADMITTER.getCode(), ClinicalStatus.INACTIVE.getValue(), null, null, queryWrapper); + patientInfo.getRecords().forEach(e -> { + // 性别 + e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum())); + // 计算年龄 + e.setAge(AgeCalculatorUtil.getAge(e.getBirthDate())); + // 就诊状态 + e.setStatusEnum_enumText(EnumUtils.getInfoByValue(EncounterStatus.class, e.getStatusEnum())); + }); + return patientInfo; + } + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationEmrController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationEmrController.java index cd29874e..841a0655 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationEmrController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationEmrController.java @@ -3,15 +3,13 @@ */ package com.openhis.web.doctorstation.controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; import com.core.common.core.domain.R; import com.openhis.web.doctorstation.appservice.IDoctorStationEmrAppService; -import com.openhis.web.doctorstation.dto.DoctorStationInitDto; -import com.openhis.web.doctorstation.dto.PatientInfoDto; +import com.openhis.web.doctorstation.dto.EmrTemplateDto; +import com.openhis.web.doctorstation.dto.PatientEmrDto; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -28,31 +26,66 @@ public class DoctorStationEmrController { private final IDoctorStationEmrAppService iDoctorStationEmrAppService; /** - * 医生站基础数据初始化 - * - * @return 基础数据 + * 添加病人病历信息 + * + * @param patientEmrDto 电子病历信息dto + * @return 操作结果 */ - @GetMapping(value = "/init") - public R init() { - // DoctorStationInitDto doctorStationInitDto = new DoctorStationInitDto(); - return R.ok(new DoctorStationInitDto()); + @PostMapping("/emr") + public R addPatientEmr(@Validated @RequestBody PatientEmrDto patientEmrDto) { + return iDoctorStationEmrAppService.addPatientEmr(patientEmrDto); } /** - * 查询就诊患者信息 - * - * @param patientInfoDto 查询条件 (前端传 statusEnum 区分就诊状态tab) - * @param searchKey 模糊查询关键字 - * @param pageNo 当前页 - * @param pageSize 每页多少条 - * @return 就诊患者信息 + * 获取患者历史病历 + * + * @param patientEmrDto 查询条件 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @return 分页数据列表 */ - @GetMapping(value = "/patient-info") - public R getPatientInfo(PatientInfoDto patientInfoDto, - @RequestParam(value = "searchKey", defaultValue = "") String searchKey, + @GetMapping("/emr-page") + public R getPatientEmrHistory(PatientEmrDto patientEmrDto, @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { - return R.ok(iDoctorStationEmrAppService.getPatientInfo(patientInfoDto, searchKey, pageNo, pageSize)); + return iDoctorStationEmrAppService.getPatientEmrHistory(patientEmrDto, pageNo, pageSize); + } + + /** + * 保存病历模板 + * + * @param emrTemplateDto 病历模板信息 + * @return 操作结果 + */ + @PostMapping("emr-template") + public R addEmrTemplate(@RequestBody @Validated EmrTemplateDto emrTemplateDto) { + return iDoctorStationEmrAppService.addEmrTemplate(emrTemplateDto); + } + + /** + * 获取电子病历模板列表 + * + * @param emrTemplateDto 查询参数 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @return + */ + @GetMapping("emr-template-page") + public R getEmrTemplate(EmrTemplateDto emrTemplateDto, + @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { + return iDoctorStationEmrAppService.getEmrTemplate(emrTemplateDto, pageNo, pageSize); + } + + /** + * 删除病历模板 + * + * @param id 模板id + * @return 操作结果 + */ + @DeleteMapping("emr-template") + public R deleteEmrTemplate(@RequestParam Long id) { + return iDoctorStationEmrAppService.deleteEmrTemplate(id); } } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationMainController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationMainController.java new file mode 100644 index 00000000..f3b88e27 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationMainController.java @@ -0,0 +1,58 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.doctorstation.controller; + +import com.openhis.web.doctorstation.appservice.IDoctorStationMainAppService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import com.core.common.core.domain.R; +import com.openhis.web.doctorstation.appservice.IDoctorStationEmrAppService; +import com.openhis.web.doctorstation.dto.DoctorStationInitDto; +import com.openhis.web.doctorstation.dto.PatientInfoDto; + +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * 医生站-主页面 controller + */ +@RestController +@RequestMapping("/doctor-station/main") +@Slf4j +@AllArgsConstructor +public class DoctorStationMainController { + + private final IDoctorStationMainAppService iDoctorStationMainAppService; + + /** + * 医生站基础数据初始化 + * + * @return 基础数据 + */ + @GetMapping(value = "/init") + public R init() { + return R.ok(new DoctorStationInitDto()); + } + + /** + * 查询就诊患者信息 + * + * @param patientInfoDto 查询条件 (前端传 statusEnum 区分就诊状态tab) + * @param searchKey 模糊查询关键字 + * @param pageNo 当前页 + * @param pageSize 每页多少条 + * @return 就诊患者信息 + */ + @GetMapping(value = "/patient-info") + public R getPatientInfo(PatientInfoDto patientInfoDto, + @RequestParam(value = "searchKey", defaultValue = "") String searchKey, + @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { + return R.ok(iDoctorStationMainAppService.getPatientInfo(patientInfoDto, searchKey, pageNo, pageSize)); + } + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/emr/dto/EmrTemplateDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/EmrTemplateDto.java similarity index 94% rename from openhis-server/openhis-application/src/main/java/com/openhis/web/emr/dto/EmrTemplateDto.java rename to openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/EmrTemplateDto.java index 0a1a9a51..7d56fc28 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/emr/dto/EmrTemplateDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/EmrTemplateDto.java @@ -1,7 +1,7 @@ /* * Copyright ©2023 CJB-CNIT Team. All rights reserved */ -package com.openhis.web.emr.dto; +package com.openhis.web.doctorstation.dto; import lombok.Data; import lombok.experimental.Accessors; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/emr/dto/PatientEmrDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/PatientEmrDto.java similarity index 94% rename from openhis-server/openhis-application/src/main/java/com/openhis/web/emr/dto/PatientEmrDto.java rename to openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/PatientEmrDto.java index 1376fe02..50c73b8e 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/emr/dto/PatientEmrDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/PatientEmrDto.java @@ -1,7 +1,7 @@ /* * Copyright ©2023 CJB-CNIT Team. All rights reserved */ -package com.openhis.web.emr.dto; +package com.openhis.web.doctorstation.dto; import javax.validation.constraints.NotNull; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationEmrAppMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationEmrAppMapper.java index 965a39df..6bb8c008 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationEmrAppMapper.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationEmrAppMapper.java @@ -1,34 +1,11 @@ package com.openhis.web.doctorstation.mapper; -import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.Constants; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.openhis.web.doctorstation.dto.PatientInfoDto; - /** * 医生站-电子病历 应用Mapper */ @Repository public interface DoctorStationEmrAppMapper { - /** - * 查询就诊患者信息 - * - * @param page 分页参数 - * @param participantType 参与者类型 - * @param ClinicalStatus 过敏史状态 - * @param userId 当前登录账号ID - * @param currentUserOrganizationId 当前登录账号所属的科室ID - * @param queryWrapper 查询条件 - * @return 就诊患者信息 - */ - IPage getPatientInfo(@Param("page") Page page, - @Param("participantType") String participantType, @Param("ClinicalStatus") Integer ClinicalStatus, - @Param("userId") Long userId, @Param("currentUserOrganizationId") Long currentUserOrganizationId, - @Param(Constants.WRAPPER) QueryWrapper queryWrapper); - } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationMainAppMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationMainAppMapper.java new file mode 100644 index 00000000..a8316cd6 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationMainAppMapper.java @@ -0,0 +1,34 @@ +package com.openhis.web.doctorstation.mapper; + +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.openhis.web.doctorstation.dto.PatientInfoDto; + +/** + * 医生站-电子病历 应用Mapper + */ +@Repository +public interface DoctorStationMainAppMapper { + + /** + * 查询就诊患者信息 + * + * @param page 分页参数 + * @param participantType 参与者类型 + * @param ClinicalStatus 过敏史状态 + * @param userId 当前登录账号ID + * @param currentUserOrganizationId 当前登录账号所属的科室ID + * @param queryWrapper 查询条件 + * @return 就诊患者信息 + */ + IPage getPatientInfo(@Param("page") Page page, + @Param("participantType") String participantType, @Param("ClinicalStatus") Integer ClinicalStatus, + @Param("userId") Long userId, @Param("currentUserOrganizationId") Long currentUserOrganizationId, + @Param(Constants.WRAPPER) QueryWrapper queryWrapper); + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/emr/controller/PatientEmrController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/emr/controller/PatientEmrController.java deleted file mode 100644 index 8d50c107..00000000 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/emr/controller/PatientEmrController.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright ©2023 CJB-CNIT Team. All rights reserved - */ -package com.openhis.web.emr.controller; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import com.alibaba.fastjson2.JSONObject; -import com.alibaba.fastjson2.TypeReference; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.core.common.core.domain.R; -import com.openhis.document.domain.Emr; -import com.openhis.document.domain.EmrDetail; -import com.openhis.document.domain.EmrDict; -import com.openhis.document.domain.EmrTemplate; -import com.openhis.document.service.IEmrDetailService; -import com.openhis.document.service.IEmrDictService; -import com.openhis.document.service.IEmrService; -import com.openhis.document.service.IEmrTemplateService; -import com.openhis.web.emr.dto.EmrTemplateDto; -import com.openhis.web.emr.dto.PatientEmrDto; - -import lombok.extern.slf4j.Slf4j; - -/** - * 电子病历controller - * - * @author ZhangYC - * @date 2025-02-22 - */ -@RestController -@RequestMapping("/doc-emr") -@Slf4j -public class PatientEmrController { - - @Autowired - private IEmrService emrService; - @Autowired - private IEmrTemplateService emrTemplateService; - @Autowired - private IEmrDetailService emrDetailService; - @Autowired - private IEmrDictService emrDictService; - - /** - * 添加病人病历信息 - * - * @param patientEmrDto 电子病历信息dto - * @return 操作结果 - */ - @PostMapping("/emr") - public R addPatientEmr(@Validated @RequestBody PatientEmrDto patientEmrDto) { - Emr emr = new Emr(); - BeanUtils.copyProperties(patientEmrDto, emr); - String contextStr = patientEmrDto.getContextJson().toString(); - boolean saveSuccess = emrService.save(emr.setContextJson(contextStr)); - if (!saveSuccess) { - return R.fail(); - } - // 获取电子病历字典表中全部key,用来判断病历JSON串中是否有需要加入到病历详情表的字段 - List emrDictList = emrDictService.list(new LambdaQueryWrapper().select(EmrDict::getEmrKey)) - .stream().map(EmrDict::getEmrKey).collect(Collectors.toList()); - Map emrContextMap = - JSONObject.parseObject(contextStr, new TypeReference>() {}); - List emrDetailList = new ArrayList<>(); - // 遍历病历内容map - for (Map.Entry entry : emrContextMap.entrySet()) { - EmrDetail emrDetail = new EmrDetail(); - emrDetail.setEmrId(emr.getId()); - if (!emrDictList.isEmpty() && emrDictList.contains(entry.getKey())) { - emrDetail.setEmrKey(entry.getKey()); - emrDetail.setEmrValue(entry.getValue()); - } - emrDetailList.add(emrDetail); - } - boolean save = emrDetailService.saveBatch(emrDetailList); - return save ? R.ok() : R.fail(); - } - - /** - * 获取患者历史病历 - * - * @param patientEmrDto 查询条件 - * @param pageNo 当前页码 - * @param pageSize 查询条数 - * @return 分页数据列表 - */ - @GetMapping("/emr-page") - public R getPatientEmrHistory(PatientEmrDto patientEmrDto, - @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { - - // 根据患者id 获取历史病历列表 - Page emrPage = emrService.page(new Page<>(pageNo, pageSize), - new LambdaQueryWrapper().eq(Emr::getPatientId, patientEmrDto.getPatientId())); - - return R.ok(emrPage); - } - - /** - * 保存病历模板 - * - * @param emrTemplateDto 病历模板信息 - * @return 操作结果 - */ - @PostMapping("emr-template") - public R addEmrTemplate(@RequestBody @Validated EmrTemplateDto emrTemplateDto) { - EmrTemplate emrTemplate = new EmrTemplate(); - BeanUtils.copyProperties(emrTemplateDto, emrTemplate); - return emrTemplateService.save(emrTemplate) ? R.ok() : R.fail(); - } - - /** - * 获取电子病历模板列表 - * - * @param emrTemplateDto 查询参数 - * @param pageNo 当前页码 - * @param pageSize 查询条数 - * @return - */ - @GetMapping("emr-template-page") - public R getEmrTemplate(EmrTemplateDto emrTemplateDto, - @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { - - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.like(EmrTemplate::getTemplateName, emrTemplateDto.getTemplateName()) - .eq(EmrTemplate::getUseScopeCode, emrTemplateDto.getUseScopeCode()) - .eq(EmrTemplate::getUserId, emrTemplateDto.getUserId()); - Page emrTemplatePage = emrTemplateService.page(new Page<>(pageNo, pageSize), queryWrapper); - - return R.ok(emrTemplatePage); - } - - /** - * 删除病历模板 - * - * @param id 模板id - * @return 操作结果 - */ - @DeleteMapping("emr-template") - public R deleteEmrTemplate(@RequestParam Long id) { - - return emrTemplateService.removeById(id) ? R.ok() : R.fail(); - - } - -} diff --git a/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationEmrAppMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationEmrAppMapper.xml index 68e29c72..5e0b6a16 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationEmrAppMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationEmrAppMapper.xml @@ -4,67 +4,4 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationMainAppMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationMainAppMapper.xml new file mode 100644 index 00000000..057d3474 --- /dev/null +++ b/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationMainAppMapper.xml @@ -0,0 +1,63 @@ + + + + + + + \ No newline at end of file