diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationDiagnosisAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationDiagnosisAppServiceImpl.java index 8431a795..87e162aa 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationDiagnosisAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationDiagnosisAppServiceImpl.java @@ -15,6 +15,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; import com.core.common.utils.MessageUtils; +import com.core.common.utils.SecurityUtils; import com.openhis.administration.domain.EncounterDiagnosis; import com.openhis.administration.service.IEncounterDiagnosisService; import com.openhis.clinical.domain.Condition; @@ -219,14 +220,29 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn doctorStationDiagnosisAppMapper.getPatientHistoryList(PublicationStatus.ACTIVE.getValue(), patientId); this.handleConditionDefinitionMetadata(patientHistoryList); conditionDefinitionBusinessClass.setPatientHistoryList(patientHistoryList); - // - + // 医生常用诊断 + Long userId = SecurityUtils.getLoginUser().getUserId(); // 当前登录账号ID + List doctorCommonUseList = + doctorStationDiagnosisAppMapper.getDoctorCommonUseList(PublicationStatus.ACTIVE.getValue(), userId); + this.handleConditionDefinitionMetadata(doctorCommonUseList); + conditionDefinitionBusinessClass.setDoctorCommonUseList(doctorCommonUseList); + // 用户个人诊断 + List userPersonalList = doctorStationDiagnosisAppMapper + .getUserPersonalList(PublicationStatus.ACTIVE.getValue(), BindingType.PERSONAL.getValue(), userId); + this.handleConditionDefinitionMetadata(userPersonalList); + conditionDefinitionBusinessClass.setUserPersonalList(userPersonalList); + // 科室诊断 + // TODO: currentUserOrganizationId(当前登录账号所属的科室ID) 待补充 + List organizationList = doctorStationDiagnosisAppMapper + .getOrganizationList(PublicationStatus.ACTIVE.getValue(), BindingType.DEFINITION.getValue(), null); + this.handleConditionDefinitionMetadata(organizationList); + conditionDefinitionBusinessClass.setOrganizationList(organizationList); return R.ok(conditionDefinitionBusinessClass); } /** * 处理诊断定义元数据 - * + * * @param conditionDefinitionMetadataList 诊断定义元数据集合 */ private void handleConditionDefinitionMetadata(List conditionDefinitionMetadataList) { diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationDiagnosisController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationDiagnosisController.java index e0607259..51f935d6 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationDiagnosisController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationDiagnosisController.java @@ -54,7 +54,6 @@ public class DoctorStationDiagnosisController { status.getInfo())) .collect(Collectors.toList()); diagnosisBelongBindingInitDto.setVerificationStatusOptions(verificationStatusOptions); - return R.ok(diagnosisBelongBindingInitDto); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationDiagnosisAppMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationDiagnosisAppMapper.java index b19c6d45..5a958e1c 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationDiagnosisAppMapper.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationDiagnosisAppMapper.java @@ -41,4 +41,36 @@ public interface DoctorStationDiagnosisAppMapper { List getPatientHistoryList(@Param("statusEnum") Integer statusEnum, @Param("patientId") Long patientId); + /** + * 查询医生常用诊断 + * + * @param statusEnum 状态 + * @param userId 当前登录账号id + * @return 医生常用诊断 + */ + List getDoctorCommonUseList(@Param("statusEnum") Integer statusEnum, + @Param("userId") Long userId); + + /** + * 查询用户个人诊断 + * + * @param statusEnum 状态 + * @param bindingEnum 绑定类型 + * @param userId 当前登录账号id + * @return 用户个人诊断 + */ + List getUserPersonalList(@Param("statusEnum") Integer statusEnum, + @Param("bindingEnum") Integer bindingEnum, @Param("userId") Long userId); + + /** + * 查询科室诊断 + * + * @param statusEnum 状态 + * @param bindingEnum 绑定类型 + * @param currentUserOrganizationId 当前登录账号所属的科室ID + * @return 科室诊断 + */ + List getOrganizationList(@Param("statusEnum") Integer statusEnum, + @Param("bindingEnum") Integer bindingEnum, @Param("currentUserOrganizationId") Long currentUserOrganizationId); + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/IOutpatientSkinTestRecordService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/IOutpatientSkinTestRecordService.java index 2de38042..c77a6e34 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/IOutpatientSkinTestRecordService.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/IOutpatientSkinTestRecordService.java @@ -2,16 +2,12 @@ package com.openhis.web.outpatientmanage.appservice; import java.util.List; -import com.core.common.core.domain.R; import org.apache.ibatis.annotations.Param; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordDto; import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordSearchParam; import com.openhis.web.patientmanage.dto.PatientListDto; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; /** * 门诊管理 应用实现类 @@ -31,6 +27,11 @@ public interface IOutpatientSkinTestRecordService { */ List getSkinTestResult(); + /** + * 获取药品状态列表 + */ + List getMedicationStatus(); + /** * 分页查询门诊皮试记录,可选条件 * @@ -67,13 +68,13 @@ public interface IOutpatientSkinTestRecordService { * * @param outpatientSkinTestRecordDto 皮试记录信息 */ - int editSkinTestRecord(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto); + boolean editSkinTestRecord(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto); /** * 护士核对皮试结果后,确认签名(服务申请管理与过敏与不耐受的相关字段更新) * * @param outpatientSkinTestRecordDto 皮试记录信息 */ - int nurseSignChkPs(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto); + boolean nurseSignChkPs(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/impl/OutpatientSkinTestRecordServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/impl/OutpatientSkinTestRecordServiceImpl.java index 800fb6fc..82a05e05 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/impl/OutpatientSkinTestRecordServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/impl/OutpatientSkinTestRecordServiceImpl.java @@ -26,6 +26,7 @@ import com.openhis.clinical.domain.AllergyIntolerance; import com.openhis.clinical.mapper.AllergyIntoleranceMapper; import com.openhis.clinical.service.IAllergyIntoleranceService; import com.openhis.common.enums.ClinicalStatus; +import com.openhis.common.enums.EventStatus; import com.openhis.common.enums.VerificationStatus; import com.openhis.common.utils.EnumUtils; import com.openhis.web.outpatientmanage.appservice.IOutpatientSkinTestRecordService; @@ -59,7 +60,7 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR PractitionerRoleMapper practitionerRoleMapper; @Autowired - IAllergyIntoleranceService AllergyIntoleranceService; + IAllergyIntoleranceService allergyIntoleranceService; @Autowired IPractitionerRoleService practitionerRoleService; @@ -109,6 +110,24 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR return dtos; } + /** + * 获取药品状态列表 + */ + @Override + public List getMedicationStatus() { + // 获取药品状态列表 + List statusList = Arrays.asList(EventStatus.values()); + List dtos = new ArrayList<>(); + // 取得更新值 + for (EventStatus status : statusList) { + PatientListDto dto = new PatientListDto(); + dto.setValue(status.getValue()); + dto.setInfo(status.getInfo()); + dtos.add(dto); + } + return dtos; + } + /** * 分页查询门诊皮试记录,可选条件 * @@ -136,6 +155,9 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR // 皮试检查项目状态枚举类回显赋值 e.setVerificationStatusEnum_enumText( EnumUtils.getInfoByValue(VerificationStatus.class, e.getVerificationStatusEnum())); + // 药品状态状态枚举类回显赋值 + e.setMedicationStatusEnum_enumText( + EnumUtils.getInfoByValue(EventStatus.class, e.getMedicationStatusEnum())); }); return outpatientSkinTestRecordPage; } @@ -173,11 +195,12 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR * @param outpatientSkinTestRecordDto 皮试记录信息 */ @Override - public int editSkinTestRecord(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) { - // 判断核对人是否不为空 - if (outpatientSkinTestRecordDto.getPerformerCheckId() != null) { - // 签名后不能修改 - return 0; + public boolean editSkinTestRecord(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) { + // 判断核对人是否不为空,药品状态不是已发药 + if (outpatientSkinTestRecordDto.getPerformerCheckId() != null + || outpatientSkinTestRecordDto.getMedicationStatusEnum() != EventStatus.COMPLETED.getValue()) { + // 签名后不能修改,未发药不能修改 + return false; } // 更新服务申请管理表 @@ -187,7 +210,7 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR // 判断开始时间为空,不允许更新表 if (StringUtils.isEmpty(outpatientSkinTestRecordDto.getOccurrenceStartTime())) { - return 0; + return false; } Date endTime; // 判断结束时间,为空以开始时间基础加10分钟 @@ -208,7 +231,7 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR Practitioner practitioner = practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId()); if (practitioner == null) { - return 0; + return false; } // 设置执行人ID serviceRequest.setPerformerId(practitioner.getId()); @@ -249,26 +272,20 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR // 设置备注 .setNote(outpatientSkinTestRecordDto.getNote()); - // 当皮试结果是为阳性的时候,设置过敏时间 - if (allergyIntolerance.getClinicalStatusEnum() == 0) { - // 设置过敏时间(当下日期) - allergyIntolerance.setOnsetDateTime(DateUtils.getNowDate()); - } - // 以服务申请ID为主条件更新过敏与不耐受表 UpdateWrapper updateWrapperAI = new UpdateWrapper<>(); updateWrapperAI.eq("request_id", allergyIntolerance.getRequestId()); - boolean result = AllergyIntoleranceService.saveOrUpdate(allergyIntolerance, updateWrapperAI); + boolean result = allergyIntoleranceService.saveOrUpdate(allergyIntolerance, updateWrapperAI); // 更新或插入失败 if (!result || countUpdate <= 0) { - return 0; + return false; } - return 1; + return true; } @Override - public int nurseSignChkPs(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) { + public boolean nurseSignChkPs(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) { // 过敏与不耐受表更新 QueryWrapper queryWrapper = new QueryWrapper<>(); @@ -276,9 +293,10 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR AllergyIntolerance allergyIntolerance = allergyIntoleranceMapper.selectOne(queryWrapper); // 检查的状态是确定和反驳的时候,不更新 - if (allergyIntolerance == null || (allergyIntolerance.getVerificationStatusEnum() != 2 - && allergyIntolerance.getVerificationStatusEnum() != 3)) { - return 0; + if (allergyIntolerance == null + || (allergyIntolerance.getVerificationStatusEnum() != VerificationStatus.CONFIRMED.getValue() + && allergyIntolerance.getVerificationStatusEnum() != VerificationStatus.REFUTED.getValue())) { + return false; } // 更新服务申请管理表的 @@ -288,30 +306,42 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId()); // 找不到找到practitionerId时,不更新 if (practitioner == null) { - return 0; + return false; } // 设置核对人ID serviceRequest.setPerformerCheckId(practitioner.getId()); + // 把服务请求的状态设置为已完成 + serviceRequest.setStatusEnum(EventStatus.COMPLETED.getValue()); // 以id为主条件更新服务申请管理表 UpdateWrapper updateWrapper = new UpdateWrapper<>(); - updateWrapper.eq("id", outpatientSkinTestRecordDto.getId()).set("performer_check_id", - serviceRequest.getPerformerCheckId()); + updateWrapper.eq("id", outpatientSkinTestRecordDto.getId()) + .set("performer_check_id", serviceRequest.getPerformerCheckId()) + .set("status_enum", serviceRequest.getStatusEnum()); boolean resultUpdateRequestService = serviceRequestService.update(null, updateWrapper); // 设置断言人 allergyIntolerance.setCheckPractitionerId(practitioner.getId()); - // 以服务申请ID为主条件更新服务申请管理表 - UpdateWrapper updateWrapperAI = new UpdateWrapper<>(); - updateWrapperAI.eq("request_id", outpatientSkinTestRecordDto.getId()).set("check_practitioner_id", - allergyIntolerance.getCheckPractitionerId()); - boolean resultUpdateAllergyIntolerance = serviceRequestService.update(updateWrapper); - if (resultUpdateRequestService && resultUpdateAllergyIntolerance) { - return 1; + // 当皮试结果是为阳性的时候,设置过敏时间 + if (allergyIntolerance.getClinicalStatusEnum() == ClinicalStatus.ACTIVE.getValue()) { + // 设置过敏时间(皮实结束时间) + allergyIntolerance + .setOnsetDateTime(DateUtils.parseDate(outpatientSkinTestRecordDto.getOccurrenceEndTime())); } - return 0; + // 以服务申请ID为主条件更新服务申请管理表 + UpdateWrapper updateWrapperAI = new UpdateWrapper<>(); + updateWrapperAI.eq("request_id", outpatientSkinTestRecordDto.getId()) + .set("check_practitioner_id", allergyIntolerance.getCheckPractitionerId()) + .set("onset_date_time", allergyIntolerance.getOnsetDateTime()); + boolean resultUpdateAllergyIntolerance = allergyIntoleranceService.update(null, updateWrapperAI); + + if (resultUpdateRequestService && resultUpdateAllergyIntolerance) { + return true; + } + + return false; } } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/controller/OutpatientSkinTestRecordController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/controller/OutpatientSkinTestRecordController.java index f924b817..a09cc463 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/controller/OutpatientSkinTestRecordController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/controller/OutpatientSkinTestRecordController.java @@ -47,6 +47,16 @@ public class OutpatientSkinTestRecordController { return R.ok(OutpatientSkinTestRecordService.getSkinTestResult()); } + + /** + * 获取药品状态列表 + */ + @GetMapping("/list-medicationstatus") + public R getMedicationStatus() { + + return R.ok(OutpatientSkinTestRecordService.getMedicationStatus()); + } + /** * 护士确认执行皮试后,更新皮试记录信息 * @@ -55,7 +65,7 @@ public class OutpatientSkinTestRecordController { @PutMapping("/outpatient-record-skintest") public R editSkinTestRecord(@Validated @RequestBody OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) { - if (OutpatientSkinTestRecordService.editSkinTestRecord(outpatientSkinTestRecordDto) <= 0) { + if (!OutpatientSkinTestRecordService.editSkinTestRecord(outpatientSkinTestRecordDto)) { return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); } return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"皮试项目检查"})); @@ -69,7 +79,7 @@ public class OutpatientSkinTestRecordController { @PutMapping("/outpatient-record-signcheck") public R nurseSignChkPs(@Validated @RequestBody OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) { - if (OutpatientSkinTestRecordService.nurseSignChkPs(outpatientSkinTestRecordDto) <= 0) { + if (!OutpatientSkinTestRecordService.nurseSignChkPs(outpatientSkinTestRecordDto)) { return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00003, null)); } return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"皮试记录护士核对签名"})); diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientSkinTestRecordDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientSkinTestRecordDto.java index 7e788db2..38cf73de 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientSkinTestRecordDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientSkinTestRecordDto.java @@ -72,6 +72,7 @@ public class OutpatientSkinTestRecordDto { /** 药品状态 */ private Integer medicationStatusEnum; + private String medicationStatusEnum_enumText; /** 皮试结果 */ private Integer clinicalStatusEnum; diff --git a/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationDiagnosisAppMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationDiagnosisAppMapper.xml index 2f5037e3..568adb51 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationDiagnosisAppMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationDiagnosisAppMapper.xml @@ -58,4 +58,62 @@ ) + + + + + + \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/resources/mapper/outpatientmanage/OutpatientManageMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/outpatientmanage/OutpatientManageMapper.xml index c1a4a3e4..192fdba5 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/outpatientmanage/OutpatientManageMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/outpatientmanage/OutpatientManageMapper.xml @@ -16,7 +16,7 @@ ad.name AS medicationInformation, --药品信息 md.bus_no || ' ' || md.name || ' 规格:' || COALESCE(m.total_volume, '') AS medicationDetail,--药品 m.lot_number AS medicationLotNumber, --药品批次号 - mr.status_enum, --药品状态 + mr.status_enum AS medicationStatusEnum, --药品状态 sr.performer_id, --执行护士 sr.performer_check_id,--核对人 to_char(sr.occurrence_start_time, 'YYYY-MM-DD HH24:MI:SS') AS occurrenceStartTime, --预计执行时间 @@ -39,7 +39,7 @@ ad.bus_no = 'ps001' -- 皮试检查的编号,todo:编号未定,后期修改 AND mr.skin_test_flag = 1 AND md.skin_test_flag = 1 - AND sr.status_enum = 2 --服务状态有效 + AND sr.status_enum in (2,3,6) --服务状态有效 AND ep.type_code = '1' --参与者身份类型是医生 @@ -95,7 +95,7 @@ ad.bus_no = 'ps001' -- 皮试检查的编号,todo:编号未定,后期修改 AND mr.skin_test_flag = 1 AND md.skin_test_flag = 1 - AND sr.status_enum = 2 --服务状态有效 + AND sr.status_enum in (2,3,6) --服务状态有效 AND ep.type_code = '1' --参与者身份类型是医生 diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/EventStatus.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/EventStatus.java index 04a86be8..40cfb096 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/EventStatus.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/EventStatus.java @@ -11,7 +11,7 @@ import lombok.Getter; */ @Getter @AllArgsConstructor -public enum EventStatus { +public enum EventStatus implements HisEnumInterface { /** * 草稿 diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/utils/EnumUtils.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/utils/EnumUtils.java index 535690a0..0cb36d6d 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/utils/EnumUtils.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/utils/EnumUtils.java @@ -1,24 +1,21 @@ package com.openhis.common.utils; -import com.openhis.common.enums.HisEnumInterface; - import java.util.Arrays; +import com.openhis.common.enums.HisEnumInterface; + public class EnumUtils { /** * 根据 value 获取枚举的 info * * @param enumClass 枚举类 - * @param value 枚举的 value - * @param 枚举类型 + * @param value 枚举的 value + * @param 枚举类型 * @return 对应的 info,如果未找到则返回 null */ public static & HisEnumInterface> String getInfoByValue(Class enumClass, Integer value) { - return Arrays.stream(enumClass.getEnumConstants()) - .filter(e -> e.getValue().equals(value)) - .findFirst() - .map(HisEnumInterface::getInfo) - .orElse(null); + return Arrays.stream(enumClass.getEnumConstants()).filter(e -> e.getValue().equals(value)).findFirst() + .map(HisEnumInterface::getInfo).orElse(null); } } diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/utils/HisPageUtils.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/utils/HisPageUtils.java index 4a70f7e5..eb80405e 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/utils/HisPageUtils.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/utils/HisPageUtils.java @@ -1,29 +1,30 @@ package com.openhis.common.utils; +import java.util.List; +import java.util.stream.Collectors; + +import org.springframework.beans.BeanUtils; + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.beans.BeanUtils; - -import java.util.List; -import java.util.stream.Collectors; public class HisPageUtils { /** * 执行分页查询并转换为目标类型 * - * @param mapper MyBatis Plus Mapper 接口 + * @param mapper MyBatis Plus Mapper 接口 * @param queryWrapper 查询条件 - * @param pageNo 当前页 - * @param pageSize 每页大小 - * @param targetClass 目标类(如 MedicationDto.class) - * @param 源对象类型(数据库实体类) - * @param 目标对象类型(DTO 类) + * @param pageNo 当前页 + * @param pageSize 每页大小 + * @param targetClass 目标类(如 MedicationDto.class) + * @param 源对象类型(数据库实体类) + * @param 目标对象类型(DTO 类) * @return 分页结果(目标类型) */ - public static Page selectPage(BaseMapper mapper, QueryWrapper queryWrapper, - int pageNo, int pageSize, Class targetClass) { + public static Page selectPage(BaseMapper mapper, QueryWrapper queryWrapper, int pageNo, + int pageSize, Class targetClass) { // 构建分页对象 Page page = new Page<>(pageNo, pageSize); // 执行分页查询 @@ -40,25 +41,23 @@ public class HisPageUtils { /** * 将源对象列表转换为目标对象列表 * - * @param sourceList 源对象列表 + * @param sourceList 源对象列表 * @param targetClass 目标类 - * @param 源对象类型 - * @param 目标对象类型 + * @param 源对象类型 + * @param 目标对象类型 * @return 目标对象列表 */ private static List convertToDtoList(List sourceList, Class targetClass) { - return sourceList.stream() - .map(source -> convertToDto(source, targetClass)) - .collect(Collectors.toList()); + return sourceList.stream().map(source -> convertToDto(source, targetClass)).collect(Collectors.toList()); } /** * 将源对象转换为目标对象 * - * @param source 源对象 + * @param source 源对象 * @param targetClass 目标类 - * @param 源对象类型 - * @param 目标对象类型 + * @param 源对象类型 + * @param 目标对象类型 * @return 目标对象 */ private static R convertToDto(T source, Class targetClass) { diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/utils/HisQueryUtils.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/utils/HisQueryUtils.java index 057de430..6ae19567 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/utils/HisQueryUtils.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/utils/HisQueryUtils.java @@ -24,14 +24,14 @@ public class HisQueryUtils { /** * 条件查询构造器 * - * @param entity 传参实体 - * @param searchKey 模糊查询关键字 + * @param entity 传参实体 + * @param searchKey 模糊查询关键字 * @param searchFields 支持模糊查询的字段集合 ; 不需要模糊查询传 null 即可 - * @param request 请求 + * @param request 请求 * @return 构造条件 */ public static QueryWrapper buildQueryWrapper(Object entity, String searchKey, HashSet searchFields, - HttpServletRequest request) { + HttpServletRequest request) { QueryWrapper queryWrapper = new QueryWrapper<>(); // 添加租户id查询条件 queryWrapper.eq(CommonConstants.Common.TENANT_ID, getCurrentTenantId()); @@ -51,7 +51,7 @@ public class HisQueryUtils { String paramName = entry.getKey(); // 检查参数名是否以 "STime" 或 "ETime" 结尾 if (paramName.endsWith(CommonConstants.Common.S_TIME) - || paramName.endsWith(CommonConstants.Common.E_TIME)) { + || paramName.endsWith(CommonConstants.Common.E_TIME)) { // 提取字段名(去掉 "STime" 或 "ETime" 后缀) String fieldName = paramName.substring(0, paramName.length() - 5); // 驼峰转下划线