diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientRefundAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientRefundAppService.java index 9386da1c..6d6216ac 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientRefundAppService.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientRefundAppService.java @@ -3,10 +3,13 @@ */ package com.openhis.web.chargemanage.appservice; -import com.core.common.core.domain.R; - import java.util.List; +import javax.servlet.http.HttpServletRequest; + +import com.core.common.core.domain.R; +import com.openhis.web.chargemanage.dto.EncounterPatientPageParam; + /** * 门诊退费 service * @@ -30,4 +33,17 @@ public interface IOutpatientRefundAppService { * @return 操作结果 */ R refundPayment(List paymentIdList); + + /** + * 查询结算过的就诊患者分页列表 + * + * @param encounterPatientPageParam 查询条件 + * @param searchKey 模糊查询关键字 + * @param pageNo 当前页 + * @param pageSize 每页多少条 + * @param request 请求 + * @return 就诊患者分页列表 + */ + R getBilledEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, String searchKey, + Integer pageNo, Integer pageSize, HttpServletRequest request); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRefundAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRefundAppServiceImpl.java index fdc0baaf..21f1f6d7 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRefundAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRefundAppServiceImpl.java @@ -3,20 +3,37 @@ */ package com.openhis.web.chargemanage.appservice.impl; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; import java.util.List; +import javax.servlet.http.HttpServletRequest; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; +import com.core.common.utils.AgeCalculatorUtil; +import com.core.common.utils.MessageUtils; import com.openhis.administration.service.IChargeItemService; import com.openhis.common.constant.CommonConstants; -import com.openhis.common.enums.PaymentStatus; +import com.openhis.common.constant.PromptMsgConstant; +import com.openhis.common.enums.*; +import com.openhis.common.utils.EnumUtils; +import com.openhis.common.utils.HisQueryUtils; import com.openhis.financial.service.IPaymentReconciliationService; +import com.openhis.medication.service.IMedicationDispenseService; import com.openhis.web.chargemanage.appservice.IOutpatientRefundAppService; +import com.openhis.web.chargemanage.dto.EncounterPatientPageDto; +import com.openhis.web.chargemanage.dto.EncounterPatientPageParam; import com.openhis.web.chargemanage.dto.EncounterPatientPaymentDto; import com.openhis.web.chargemanage.dto.RefundItemDto; import com.openhis.web.chargemanage.mapper.OutpatientRefundAppMapper; +import com.openhis.workflow.service.IDeviceDispenseService; +import com.openhis.workflow.service.IServiceRequestService; /** * 门诊退费 impl @@ -33,6 +50,12 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi private IPaymentReconciliationService paymentReconciliationService; @Autowired private IChargeItemService chargeItemService; + @Autowired + private IMedicationDispenseService medicationDispenseService; + @Autowired + private IDeviceDispenseService deviceDispenseService; + @Autowired + private IServiceRequestService serviceRequestService; /** * 根据就诊id查询患者的账单 @@ -56,20 +79,97 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi */ @Override public R refundPayment(List paymentIdList) { - - // 医生同意退费 - // 查询所有的chargeid,对应生成一个负的chargeitem - // 根据每个 chargeitem判断对应的服务,药品,耗材是否已发放执行 - // 若已发放/执行需要对应的发药人/执行人审批(药品耗材需要先退药) - + // todo:医生同意退费(审批流) // 根据支付id获取对应收费项目的id列表 List chargeItemIdList = paymentReconciliationService.getChargeItemIdListByPayment(paymentIdList); - //根据收费项目id列表查询退费项 + // 根据收费项目id列表查询退费项 List refundItemList = outpatientRefundAppMapper.selectRefundItem(chargeItemIdList, CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_SERVICE_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.Common.THREE); - return null; + List medDisIdList = new ArrayList<>(); + List devDisIdList = new ArrayList<>(); + List serReqIdList = new ArrayList<>(); + + for (RefundItemDto refundItem : refundItemList) { + if (CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(refundItem.getServiceTable())) { + + // 药品需要先退药 + if (DispenseStatus.COMPLETED.getValue().equals(refundItem.getRefundStatus()) + || DispenseStatus.PART_COMPLETED.getValue().equals(refundItem.getRefundStatus())) { + return R + .fail(MessageUtils.createMessage(PromptMsgConstant.ChargeRefund.M00001, new Object[] {"药品"})); + } else { + // todo:审批流药师同意退费 + medDisIdList.add(refundItem.getDispenseId()); + } + } else if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(refundItem.getServiceTable())) { + // 诊疗项目需医技科室同意退费 + if (RequestStatus.COMPLETED.getValue().equals(refundItem.getRefundStatus())) { + return R.fail(MessageUtils.createMessage(PromptMsgConstant.ChargeRefund.M00002, null)); + } else { + // todo:审批流医技师同意退费 + serReqIdList.add(refundItem.getServiceId()); + } + } else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(refundItem.getServiceTable())) { + // 耗材需要先退药 + if (DispenseStatus.COMPLETED.getValue().equals(refundItem.getRefundStatus()) + || DispenseStatus.PART_COMPLETED.getValue().equals(refundItem.getRefundStatus())) { + return R + .fail(MessageUtils.createMessage(PromptMsgConstant.ChargeRefund.M00001, new Object[] {"耗材"})); + } else { + devDisIdList.add(refundItem.getDispenseId()); + } + } + } + // 更新收费状态:已退费 + chargeItemService.updateRefundChargeStatus(chargeItemIdList); + // 更新未发放药品状态:停止发放,停止原因:退费 + medicationDispenseService.updateStopDispenseStatus(medDisIdList, NotPerformedReason.REFUND.getValue()); + // 更新未发放耗材状态:停止发放,停止原因:退费 + deviceDispenseService.updateStopDispenseStatus(devDisIdList, NotPerformedReason.REFUND.getValue()); + // 更新执行诊疗状态:停止 + serviceRequestService.updateStopRequestStatus(serReqIdList); + // 返回退费成功信息 + return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"处方退费"})); + } + + /** + * 查询结算过的就诊患者分页列表 + * + * @param encounterPatientPageParam 查询条件 + * @param searchKey 模糊查询关键字 + * @param pageNo 当前页 + * @param pageSize 每页多少条 + * @param request 请求 + * @return 就诊患者分页列表 + */ + @Override + public R getBilledEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, String searchKey, + Integer pageNo, Integer pageSize, HttpServletRequest request) { + // 构建查询条件 + QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper( + encounterPatientPageParam, searchKey, + new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientWbStr, CommonConstants.FieldName.PatientPyStr, + CommonConstants.FieldName.PatientName, CommonConstants.FieldName.PatientBusNo, + CommonConstants.FieldName.EncounterBusNo, CommonConstants.FieldName.idCard)), + request); + // 就诊患者分页列表 + Page encounterPatientPage = + outpatientRefundAppMapper.selectBilledEncounterPatientPage(new Page<>(pageNo, pageSize), queryWrapper, + ChargeItemStatus.BILLED.getValue(), AccountType.MEDICAL_INSURANCE.getValue()); + + encounterPatientPage.getRecords().forEach(e -> { + // 性别枚举 + e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum())); + // 收费状态枚举 + e.setStatusEnum_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getStatusEnum())); + // 计算年龄 + e.setAge(AgeCalculatorUtil.getAge(e.getBirthDate())); + // 合同类型枚举 + e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(ContractCategory.class, e.getCategoryEnum())); + }); + return R.ok(encounterPatientPage); } } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRefundController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRefundController.java index 174d080b..4e195c6f 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRefundController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRefundController.java @@ -3,17 +3,20 @@ */ package com.openhis.web.chargemanage.controller; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import com.core.common.core.domain.R; import com.openhis.web.chargemanage.appservice.IOutpatientRefundAppService; +import com.openhis.web.chargemanage.dto.EncounterPatientPageParam; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; -import java.util.List; - /** * 门诊退费 controller * @@ -29,6 +32,25 @@ public class OutpatientRefundController { @Autowired private IOutpatientRefundAppService outpatientRefundAppService; + /** + * 查询结算过的就诊患者分页列表 + * + * @param encounterPatientPageParam 查询条件 + * @param searchKey 模糊查询关键字 + * @param pageNo 当前页 + * @param pageSize 每页多少条 + * @param request 请求 + * @return 就诊患者分页列表 + */ + @GetMapping(value = "/encounter-patient-page") + public R getBilledEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, + @RequestParam(value = "searchKey", defaultValue = "") String searchKey, + @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) { + return R.ok(outpatientRefundAppService.getBilledEncounterPatientPage(encounterPatientPageParam, searchKey, + pageNo, pageSize, request)); + } + /** * 根据就诊id查询患者的账单 * diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageDto.java index f38b4f45..a8231c02 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageDto.java @@ -8,6 +8,7 @@ import java.util.Date; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.openhis.common.annotation.Dict; import lombok.Data; import lombok.experimental.Accessors; @@ -72,7 +73,9 @@ public class EncounterPatientPageDto { /** * 账户类型编码 */ + @Dict(dictCode = "account_code") private String typeCode; + private String typeCode_dictText; /** * 账户余额 @@ -92,4 +95,28 @@ public class EncounterPatientPageDto { /** 收费状态 */ private Integer statusEnum; private String statusEnum_enumText; + + /** + * 医保总额 + */ + private BigDecimal insurancePrice; + + /** + * 自费总额 + */ + private BigDecimal selfPrice; + + /** + * 付款总额 + */ + private BigDecimal totalAmount; + + /** 合同类型 */ + private Integer categoryEnum; + private String categoryEnum_enumText; + + /** + * 结算时间 + */ + private Date billDate; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageParam.java index db852eae..ff776799 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageParam.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageParam.java @@ -53,13 +53,13 @@ public class EncounterPatientPageParam { */ private Date startTime; + /** + * 收费时间 + */ + private Date billTime; + /** * 收费状态 */ private Integer statusEnum; - - /** - * 退款标识 - */ - private Integer refundFlag; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/RefundItemDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/RefundItemDto.java index c4ce3eb4..1b9212e3 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/RefundItemDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/RefundItemDto.java @@ -14,4 +14,35 @@ import lombok.experimental.Accessors; */ @Data @Accessors(chain = true) -public class RefundItemDto {} +public class RefundItemDto { + + /** 收费ID */ + private Long chargeId; + + /** 医疗服务所在表 */ + private String serviceTable; + + /** 医疗服务ID */ + private Long serviceId; + + /** 请求编码 */ + private String busNo; + + /** 请求数量 */ + private Integer quantity; + + /** 请求单位编码 */ + private String unitCode; + + /** 退款状态 */ + private Integer refundStatus; + + /** 项目id */ + private Long itemId; + + /** 发放id */ + private Long dispenseId; + + /** 项目名 */ + private Long itemName; +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/mapper/OutpatientRefundAppMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/mapper/OutpatientRefundAppMapper.java index a4e7132c..293d17b6 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/mapper/OutpatientRefundAppMapper.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/mapper/OutpatientRefundAppMapper.java @@ -8,6 +8,11 @@ import java.util.List; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.openhis.web.chargemanage.dto.EncounterPatientPageDto; +import com.openhis.web.chargemanage.dto.EncounterPatientPageParam; import com.openhis.web.chargemanage.dto.EncounterPatientPaymentDto; import com.openhis.web.chargemanage.dto.RefundItemDto; @@ -47,4 +52,17 @@ public interface OutpatientRefundAppMapper { @Param("medMedicationRequest") String medMedicationRequest, @Param("worServiceRequest") String worServiceRequest, @Param("worDeviceRequest") String worDeviceRequest, @Param("three") Integer three); + + /** + * 查询已结算就诊患者分页列表 + * + * @param page 分页 + * @param queryWrapper 查询条件 + * @param billed 收费状态:已结算 + * @param insurance 账户类型:医保 + * @return 已结算就诊患者分页列表 + */ + Page selectBilledEncounterPatientPage(@Param("page") Page page, + @Param(Constants.WRAPPER) QueryWrapper queryWrapper, @Param("billed") Integer billed, + @Param("insurance") Integer insurance); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/DiagnosisTreatmentManageAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/DiagnosisTreatmentManageAppServiceImpl.java index 181bdee9..698656ce 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/DiagnosisTreatmentManageAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/DiagnosisTreatmentManageAppServiceImpl.java @@ -11,6 +11,8 @@ import java.util.stream.Stream; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import com.openhis.administration.domain.Supplier; +import com.openhis.administration.service.ISupplierService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -20,21 +22,20 @@ 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.core.domain.entity.SysDictData; -import com.core.common.utils.MessageUtils; -import com.core.common.utils.SecurityUtils; +import com.core.common.utils.*; import com.core.common.utils.bean.BeanUtils; import com.core.system.service.ISysDictTypeService; +import com.openhis.administration.domain.ChargeItemDefinition; import com.openhis.administration.domain.Organization; import com.openhis.administration.service.IOrganizationService; +import com.openhis.common.constant.CommonConstants; import com.openhis.common.constant.PromptMsgConstant; import com.openhis.common.enums.*; import com.openhis.common.utils.EnumUtils; import com.openhis.common.utils.HisQueryUtils; import com.openhis.web.datadictionary.appservice.IDiagnosisTreatmentManageAppService; -import com.openhis.web.datadictionary.dto.DiagnosisTreatmentDto; -import com.openhis.web.datadictionary.dto.DiagnosisTreatmentInitDto; -import com.openhis.web.datadictionary.dto.DiagnosisTreatmentSelParam; -import com.openhis.web.datadictionary.dto.DiagnosisTreatmentUpDto; +import com.openhis.web.datadictionary.appservice.IItemDefinitionService; +import com.openhis.web.datadictionary.dto.*; import com.openhis.web.datadictionary.mapper.ActivityDefinitionManageMapper; import com.openhis.workflow.domain.ActivityDefinition; import com.openhis.workflow.mapper.ActivityDefinitionMapper; @@ -59,6 +60,13 @@ public class DiagnosisTreatmentManageAppServiceImpl implements IDiagnosisTreatme private ISysDictTypeService iSysDictTypeService; @Resource private ActivityDefinitionManageMapper activityDefinitionManageMapper; + @Autowired + private IItemDefinitionService itemDefinitionServic; + @Autowired + private ISysDictTypeService sysDictTypeService; + + @Autowired(required = false) + AssignSeqUtil assignSeqUtil; /** * 诊疗目录初期查询 @@ -82,7 +90,15 @@ public class DiagnosisTreatmentManageAppServiceImpl implements IDiagnosisTreatme .collect(Collectors.toList()); diagnosisTreatmentInitDto.setExeOrganizations(exeOrganizations); - // 获取诊疗分类 + // 获取诊目录疗分类 + List diagnosisList = + sysDictTypeService.selectDictDataByType(CommonConstants.DictName.DIAGNOSIS_CATEGORY_CODE); + // 获取诊疗录疗分类 + List diagnosisCategories = diagnosisList.stream().map( + category -> new DiagnosisTreatmentInitDto.dictCategoryCode(category.getDictValue(), category.getDictLabel())) + .collect(Collectors.toList()); + diagnosisTreatmentInitDto.setDiagnosisCategoryOptions(diagnosisCategories); + // 查询医疗服务项类型 List medical_service_items = iSysDictTypeService.selectDictDataByType(ActivityDefCategory.MEDICAL_SERVICE_ITEM.getCode()); @@ -92,30 +108,31 @@ public class DiagnosisTreatmentManageAppServiceImpl implements IDiagnosisTreatme status.getDictLabel())) .collect(Collectors.toList()); List diseaseTreatmentCategories = new ArrayList<>(); - - DiagnosisTreatmentInitDto.diseaseTreatmentCategory diseaseTreatmentCategory = - new DiagnosisTreatmentInitDto.diseaseTreatmentCategory(ActivityDefCategory.MEDICAL_SERVICE_ITEM.getValue(), - ActivityDefCategory.MEDICAL_SERVICE_ITEM.getInfo()); - diseaseTreatmentCategory.setChildren(diseaseTreatmentCategoryList); - diseaseTreatmentCategories.add(diseaseTreatmentCategory); - diagnosisTreatmentInitDto.setDiseaseTreatmentCategoryList(diseaseTreatmentCategories); - - // 查询手术与治疗类型 - List medical_service_items2 = - iSysDictTypeService.selectDictDataByType(ActivityDefCategory.TREATMENT_SURGERY.getCode()); - // 获取手术与治疗List - List diseaseTreatmentCategoryList2 = medical_service_items2 - .stream().map(status -> new DiagnosisTreatmentInitDto.diseaseTreatmentType(status.getDictValue(), - status.getDictLabel())) - .collect(Collectors.toList()); - - DiagnosisTreatmentInitDto.diseaseTreatmentCategory diseaseTreatmentCategory2 = - new DiagnosisTreatmentInitDto.diseaseTreatmentCategory(ActivityDefCategory.TREATMENT_SURGERY.getValue(), - ActivityDefCategory.TREATMENT_SURGERY.getInfo()); - diseaseTreatmentCategory2.setChildren(diseaseTreatmentCategoryList2); - diseaseTreatmentCategories.add(diseaseTreatmentCategory2); - - diagnosisTreatmentInitDto.setDiseaseTreatmentCategoryList(diseaseTreatmentCategories); +// +// //获取目录分类 +// DiagnosisTreatmentInitDto.diseaseTreatmentCategory diseaseTreatmentCategory = +// new DiagnosisTreatmentInitDto.diseaseTreatmentCategory(ActivityDefCategory.MEDICAL_SERVICE_ITEM.getValue(), +// ActivityDefCategory.MEDICAL_SERVICE_ITEM.getInfo()); +// diseaseTreatmentCategory.setChildren(diseaseTreatmentCategoryList); +// diseaseTreatmentCategories.add(diseaseTreatmentCategory); +// diagnosisTreatmentInitDto.setDiseaseTreatmentCategoryList(diseaseTreatmentCategories); +// +// // 查询手术与治疗类型 +// List medical_service_items2 = +// iSysDictTypeService.selectDictDataByType(ActivityDefCategory.TREATMENT_SURGERY.getCode()); +// // 获取手术与治疗List +// List diseaseTreatmentCategoryList2 = medical_service_items2 +// .stream().map(status -> new DiagnosisTreatmentInitDto.diseaseTreatmentType(status.getDictValue(), +// status.getDictLabel())) +// .collect(Collectors.toList()); +// +// DiagnosisTreatmentInitDto.diseaseTreatmentCategory diseaseTreatmentCategory2 = +// new DiagnosisTreatmentInitDto.diseaseTreatmentCategory(ActivityDefCategory.TREATMENT_SURGERY.getValue(), +// ActivityDefCategory.TREATMENT_SURGERY.getInfo()); +// diseaseTreatmentCategory2.setChildren(diseaseTreatmentCategoryList2); +// diseaseTreatmentCategories.add(diseaseTreatmentCategory2); +// +// diagnosisTreatmentInitDto.setDiseaseTreatmentCategoryList(diseaseTreatmentCategories); // 获取类型 List typeEnumOptions = Stream.of(ActivityType.values()) @@ -138,15 +155,6 @@ public class DiagnosisTreatmentManageAppServiceImpl implements IDiagnosisTreatme @Override public R getDiseaseTreatmentPage(DiagnosisTreatmentSelParam DiagnosisTreatmentSelParam, String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) { - // - // // 构建查询条件 - // QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(DiagnosisTreatmentSelParam, - // searchKey, new HashSet<>(Arrays.asList("bus_no", "name", "py_str", "wb_str")), request); - // // 设置排序 - // queryWrapper.orderByAsc("bus_no"); - // // 分页查询 - // Page diseaseTreatmentPage = HisPageUtils.selectPage(activityDefinitionMapper, - // queryWrapper, pageNo, pageSize, DiagnosisTreatmentDto.class); // 构建查询条件 QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(DiagnosisTreatmentSelParam, @@ -163,8 +171,6 @@ public class DiagnosisTreatmentManageAppServiceImpl implements IDiagnosisTreatme e.setYbMatchFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbMatchFlag())); // 类型举类回显赋值 e.setTypeEnum_enumText(EnumUtils.getInfoByValue(ActivityType.class, e.getTypeEnum())); - // 目录类别举类回显赋值 - e.setCategory_enumText(EnumUtils.getInfoByValue(ActivityDefCategory.class, e.getCategoryEnum())); // 状态举类回显赋值 e.setStatusEnum_enumText(EnumUtils.getInfoByValue(PublicationStatus.class, e.getStatusEnum())); }); @@ -198,14 +204,32 @@ public class DiagnosisTreatmentManageAppServiceImpl implements IDiagnosisTreatme @Override public R editDiseaseTreatment(DiagnosisTreatmentUpDto diagnosisTreatmentUpDto) { - ActivityDefinition ActivityDefinition = new ActivityDefinition(); - BeanUtils.copyProperties(diagnosisTreatmentUpDto, ActivityDefinition); + ActivityDefinition activityDefinition = new ActivityDefinition(); + BeanUtils.copyProperties(diagnosisTreatmentUpDto, activityDefinition); + + // 使用10位数基础采番 + String code = assignSeqUtil.getSeq(AssignSeqEnum.DEVICE_NUM.getPrefix(), 10); + activityDefinition.setBusNo(code); + // 拼音码 + activityDefinition.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(activityDefinition.getName())); + // 五笔码 + activityDefinition.setWbStr(ChineseConvertUtils.toWBFirstLetter(activityDefinition.getName())); // 更新诊疗信息 - return iActivityDefinitionService.updateById(ActivityDefinition) - ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊疗目录"})) - : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + if (iActivityDefinitionService.updateById(activityDefinition)) { + ChargeItemDefinition chargeItemDefinition = new ChargeItemDefinition(); + chargeItemDefinition.setYbType(diagnosisTreatmentUpDto.getYbType()) + .setTypeCode(diagnosisTreatmentUpDto.getItemTypeCode()) + .setInstanceTable(CommonConstants.TableName.WOR_ACTIVITY_DEFINITION) + .setInstanceId(diagnosisTreatmentUpDto.getId()); + // 更新价格表 + return itemDefinitionServic.updateItem(chargeItemDefinition) + ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊疗目录"})) + : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + + } + return R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); } /** @@ -267,13 +291,31 @@ public class DiagnosisTreatmentManageAppServiceImpl implements IDiagnosisTreatme @Override public R addDiseaseTreatment(DiagnosisTreatmentUpDto diagnosisTreatmentUpDto) { - ActivityDefinition ActivityDefinition = new ActivityDefinition(); - BeanUtils.copyProperties(diagnosisTreatmentUpDto, ActivityDefinition); + ActivityDefinition activityDefinition = new ActivityDefinition(); + BeanUtils.copyProperties(diagnosisTreatmentUpDto, activityDefinition); + // 拼音码 + activityDefinition.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(activityDefinition.getName())); + // 五笔码 + activityDefinition.setWbStr(ChineseConvertUtils.toWBFirstLetter(activityDefinition.getName())); + // 新增外来诊疗目录 - ActivityDefinition.setStatusEnum(PublicationStatus.DRAFT.getValue()); - return iActivityDefinitionService.addDiagnosisTreatment(ActivityDefinition) - ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊疗目录"})) - : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null)); + activityDefinition.setStatusEnum(PublicationStatus.DRAFT.getValue()); + if (iActivityDefinitionService.addDiagnosisTreatment(activityDefinition)) { + + ItemUpFromDirectoryDto itemUpFromDirectoryDto = new ItemUpFromDirectoryDto(); + BeanUtils.copyProperties(diagnosisTreatmentUpDto, itemUpFromDirectoryDto); + itemUpFromDirectoryDto.setTypeCode(diagnosisTreatmentUpDto.getItemTypeCode()) + .setInstanceTable(CommonConstants.TableName.WOR_ACTIVITY_DEFINITION) + .setEffectiveStart(DateUtils.getNowDate()).setStatusEnum(PublicationStatus.ACTIVE.getValue()) + .setConditionFlag(Whether.YES.getValue()).setChargeName(diagnosisTreatmentUpDto.getName()) + .setInstanceId(activityDefinition.getId()).setPrice(diagnosisTreatmentUpDto.getRetailPrice()); + + return itemDefinitionServic.addItem(itemUpFromDirectoryDto) + ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊疗目录"})) + : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null)); + + } + return R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null)); } } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentDto.java index dec2ecb1..9b91cc16 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentDto.java @@ -26,8 +26,9 @@ public class DiagnosisTreatmentDto { private Long id; /** 目录类别 */ - private Integer categoryEnum; - private String category_enumText; + @Dict(dictCode = "activity_category_code") + private String categoryCode; + private String categoryCode_dictText; /** 编码 */ private String busNo; @@ -93,9 +94,6 @@ public class DiagnosisTreatmentDto { private Long locationId; private String locationId_dictText; - /** 售价 */ - private BigDecimal price; - /** 财务类别 */ @Dict(dictCode = "fin_type_code") private String typeCode; @@ -114,6 +112,6 @@ public class DiagnosisTreatmentDto { /** 最高零售价 */ private BigDecimal maximumRetailPrice; - + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentInitDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentInitDto.java index 77408654..7ebbb51a 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentInitDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentInitDto.java @@ -3,6 +3,8 @@ package com.openhis.web.datadictionary.dto; import java.util.ArrayList; import java.util.List; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import lombok.Data; import lombok.experimental.Accessors; @@ -19,6 +21,8 @@ public class DiagnosisTreatmentInitDto { private List diseaseTreatmentCategoryList; private List exeOrganizations; private List typeEnumOptions; + //诊疗目录 + private List diagnosisCategoryOptions; /** * 状态 @@ -64,6 +68,21 @@ public class DiagnosisTreatmentInitDto { } } + /** + * 诊疗目录类型 + */ + @Data + public static class dictCategoryCode { + private String value; + private String info; + private List children = new ArrayList<>(); + + public dictCategoryCode(String value, String info) { + this.value = value; + this.info = info; + } + } + /** * 执行机构 */ @@ -77,4 +96,5 @@ public class DiagnosisTreatmentInitDto { this.label = label; } } + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentSelParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentSelParam.java index 48c42698..e5fd9eb5 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentSelParam.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentSelParam.java @@ -16,7 +16,7 @@ import lombok.experimental.Accessors; public class DiagnosisTreatmentSelParam { /** 目录类别 */ - private Integer categoryEnum; + private Integer categoryCode; /** 类型 */ private Integer typeEnum; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentUpDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentUpDto.java index e46683b7..5425e648 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentUpDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentUpDto.java @@ -22,13 +22,14 @@ import java.math.BigDecimal; @Data @Accessors(chain = true) public class DiagnosisTreatmentUpDto { + /** ID */ @JsonSerialize(using = ToStringSerializer.class) private Long id; /** 目录类别 */ @NotNull(message = "目录类别不能为空") - private ActivityDefCategory categoryEnum; + private String categoryCode; /** 编码 */ @NotBlank(message = "项目编码不能为空") diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationManageUpDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationManageUpDto.java index b809a736..aa77d98d 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationManageUpDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationManageUpDto.java @@ -53,7 +53,6 @@ public class MedicationManageUpDto { private Integer activeFlag; /** 批次号 */ - @NotBlank(message = "批次号不能为空") private String lotNumber; /** 生效日期 */ diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ReceiptApprovalAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ReceiptApprovalAppServiceImpl.java index 4cd470a5..c9a63fe7 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ReceiptApprovalAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ReceiptApprovalAppServiceImpl.java @@ -246,6 +246,7 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService List chargeDetailList) { List resultList = new ArrayList<>(); + // todo:同一批次不能改价 // 将各个项目的定价信息按项目id分组 Map> chargeDetailGroup = chargeDetailList.stream().collect(Collectors.groupingBy(ItemChargeDetailDto::getInstanceId)); @@ -307,7 +308,7 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService */ private ChargeItemDefDetail addChargeItemDefApp(String conditionValue, BigDecimal sellPrice, Long definitionId) { ChargeItemDefDetail chargeItemDefDetail = new ChargeItemDefDetail(); - // todo:命中条件或建成字典枚举,此处为批次号,单位 + // todo:命中条件或建成字典枚举,此处为批次号,单位,优先级加一 chargeItemDefDetail // 命中值 .setConditionValue(conditionValue) diff --git a/openhis-server/openhis-application/src/main/resources/i18n/messages.properties b/openhis-server/openhis-application/src/main/resources/i18n/messages.properties index 31c39ddf..653376ce 100644 --- a/openhis-server/openhis-application/src/main/resources/i18n/messages.properties +++ b/openhis-server/openhis-application/src/main/resources/i18n/messages.properties @@ -31,9 +31,6 @@ no.update.permission=您没有修改数据的权限,请联系管理员添加 no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}] no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}] no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] - - - apl.common.M00001={0}添加成功 apl.common.M00002={0}保存成功 apl.common.M00003={0}已经存在 @@ -43,4 +40,5 @@ apl.common.M00006=操作失败,该数据已被他人删除,请刷新后重试 apl.common.M00007=操作失败,该数据已被他人更改,请刷新后重试 apl.common.M00008=请勿重复提交 apl.common.M00009=查询成功 -apl.common.M00010=操作失败,请联系管理员 \ No newline at end of file +apl.common.M00010=操作失败,请联系管理员 +apl.chargeRefund.M00001=该收费单相关{0}已经发出,请先退药后再进行退费 \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml index 8a322737..2e9074f6 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml @@ -4,22 +4,23 @@ diff --git a/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRefundAppMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRefundAppMapper.xml index 93fbf507..d37d7496 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRefundAppMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRefundAppMapper.xml @@ -24,46 +24,144 @@ AND T1.delete_flag = '0' + \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/ActivityDefinitionManageMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/ActivityDefinitionManageMapper.xml index d0192249..a615f28f 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/ActivityDefinitionManageMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/ActivityDefinitionManageMapper.xml @@ -6,7 +6,7 @@ SELECT T3.id, - T3.category_enum, + T3.category_code, T3.bus_no, T3.name, T3.py_str, @@ -33,7 +33,7 @@ ( SELECT T1.id, - T1.category_enum, + T1.category_code, T1.bus_no, T1.name, T1.py_str, @@ -83,7 +83,7 @@