diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 000000000..59b39fea6 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,5 @@ +{ + "enabledPlugins": { + "agent-sdk-dev@claude-plugins-official": true + } +} diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/appservice/IOutpatientChargeAppService.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/appservice/IOutpatientChargeAppService.java index 84687919a..a0d345853 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/appservice/IOutpatientChargeAppService.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/appservice/IOutpatientChargeAppService.java @@ -35,9 +35,10 @@ public interface IOutpatientChargeAppService { * 根据就诊id查询患者处方列表 * * @param encounterId 就诊id + * @param statusEnum 收费状态过滤(可选,不传则返回全部状态) * @return 患者处方列表 */ - List getEncounterPatientPrescription(Long encounterId); + List getEncounterPatientPrescription(Long encounterId, Integer statusEnum); /** * 根据就诊id查询患者处方列表并新增字段:实收金额、应收金额、优惠金额、折扣率 diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/appservice/impl/OutpatientChargeAppServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/appservice/impl/OutpatientChargeAppServiceImpl.java index d20bd6e21..cf47ec298 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/appservice/impl/OutpatientChargeAppServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/appservice/impl/OutpatientChargeAppServiceImpl.java @@ -111,10 +111,11 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi * 根据就诊id查询患者处方列表 * * @param encounterId 就诊id + * @param statusEnum 收费状态过滤(可选,不传则返回全部状态) * @return 患者处方列表 */ @Override - public List getEncounterPatientPrescription(Long encounterId) { + public List getEncounterPatientPrescription(Long encounterId, Integer statusEnum) { List prescriptionDtoList = outpatientChargeAppMapper.selectEncounterPatientPrescription(encounterId, ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.MEDICATION.getValue(), @@ -123,7 +124,7 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi ChargeItemStatus.PLANNED.getValue(), ChargeItemStatus.BILLABLE.getValue(), ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDING.getValue(), ChargeItemStatus.REFUNDED.getValue(), ChargeItemStatus.PART_REFUND.getValue(), - CommonConstants.TableName.WOR_DEVICE_REQUEST); + CommonConstants.TableName.WOR_DEVICE_REQUEST, statusEnum); prescriptionDtoList.forEach(e -> { // 收费状态枚举 e.setStatusEnum_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getStatusEnum())); diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/controller/OutpatientChargeController.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/controller/OutpatientChargeController.java index 6b87dfcfc..6a1a23eb4 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/controller/OutpatientChargeController.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/controller/OutpatientChargeController.java @@ -61,11 +61,13 @@ public class OutpatientChargeController { * 根据就诊id查询患者处方列表 * * @param encounterId 就诊id + * @param statusEnum 收费状态过滤(可选,不传则返回全部状态) * @return 患者处方列表 */ @GetMapping(value = "/patient-prescription") - public R getEncounterPatientPrescription(@RequestParam Long encounterId) { - return R.ok(outpatientChargeAppService.getEncounterPatientPrescription(encounterId)); + public R getEncounterPatientPrescription(@RequestParam Long encounterId, + @RequestParam(required = false) Integer statusEnum) { + return R.ok(outpatientChargeAppService.getEncounterPatientPrescription(encounterId, statusEnum)); } /** diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/mapper/OutpatientChargeAppMapper.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/mapper/OutpatientChargeAppMapper.java index 463982b01..1087b6757 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/mapper/OutpatientChargeAppMapper.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/mapper/OutpatientChargeAppMapper.java @@ -59,7 +59,8 @@ public interface OutpatientChargeAppMapper { @Param("chinesePatentMedicine") Integer chinesePatentMedicine, @Param("planned") Integer planned, @Param("billable") Integer billable, @Param("billed") Integer billed, @Param("refunding") Integer refunding, @Param("refunded") Integer refunded, - @Param("partRefund") Integer partRefund, @Param("worDeviceRequest") String worDeviceRequest); + @Param("partRefund") Integer partRefund, @Param("worDeviceRequest") String worDeviceRequest, + @Param("filterStatus") Integer filterStatus); /** * 根据就诊id查询患者处方列表并新增字段:应收金额,实收金额,优惠金额,折扣率 diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/common/appservice/impl/CommonServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/common/appservice/impl/CommonServiceImpl.java index 092510ade..48a128690 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/common/appservice/impl/CommonServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/common/appservice/impl/CommonServiceImpl.java @@ -521,9 +521,9 @@ public class CommonServiceImpl implements ICommonService { } } - // 方式 3:如果仍然没有病区,且 currentOrgId 为空,尝试获取所有病区 - if (wardList.isEmpty() && currentOrgId == null) { - log.info("getPractitionerWard - 尝试获取所有病区"); + // 方式 3:如果仍然没有病区,尝试获取所有活动病区 + if (wardList.isEmpty()) { + log.info("getPractitionerWard - 未查到指定病区,获取所有病区"); List allWards = locationService.getWardList(null); log.info("getPractitionerWard - 所有病区数:{}", allWards != null ? allWards.size() : 0); if (allWards != null && !allWards.isEmpty()) { diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/doctorstation/appservice/impl/DoctorStationChineseMedicalAppServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/doctorstation/appservice/impl/DoctorStationChineseMedicalAppServiceImpl.java index 7ff2c6c5b..d9c5e86f3 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/doctorstation/appservice/impl/DoctorStationChineseMedicalAppServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/doctorstation/appservice/impl/DoctorStationChineseMedicalAppServiceImpl.java @@ -140,8 +140,8 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation .setSourceEnum(ConditionDefinitionSource.TRADITIONAL_CHINESE_MEDICINE_SYNDROME_CATALOG.getValue()); QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(conditionDefinition, searchKey, new HashSet<>(Arrays.asList("name", "py_str", "wb_str")), null); - // 设置排序 - queryWrapper.orderByDesc("update_time"); + // 设置排序(与诊断目录页保持一致,按编码升序,确保取到原始标准编码记录) + queryWrapper.orderByAsc("condition_code"); // 诊断信息 Page conditionDefinitionMetadataPage = HisPageUtils .selectPage(conditionDefinitionMapper, queryWrapper, pageNo, pageSize, ConditionDefinitionMetadata.class); diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalcharge/appservice/impl/InHospitalRegisterAppServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalcharge/appservice/impl/InHospitalRegisterAppServiceImpl.java index a2aadc4a8..0626efc0e 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalcharge/appservice/impl/InHospitalRegisterAppServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalcharge/appservice/impl/InHospitalRegisterAppServiceImpl.java @@ -5,6 +5,7 @@ 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.core.domain.R; +import com.core.common.enums.DelFlag; import com.core.common.exception.ServiceException; import com.core.common.utils.*; import com.core.common.utils.bean.BeanUtils; @@ -87,6 +88,12 @@ public class InHospitalRegisterAppServiceImpl implements IInHospitalRegisterAppS @Resource private IChargeItemService iChargeItemService; + @Resource + private ILocationService iLocationService; + + @Resource + private IOrganizationService iOrganizationService; + /** * 门诊医生开住院申请 * @@ -357,17 +364,38 @@ public class InHospitalRegisterAppServiceImpl implements IInHospitalRegisterAppS */ @Override public List getWardList(Long orgId) { - List wardList = inHospitalRegisterAppMapper.selectWardList(orgId, LocationForm.WARD.getValue(), - LocationStatus.ACTIVE.getValue()); - - // 2. 转换为 LocationDto(逻辑与原代码完全一致) - List locationDtoList = new ArrayList<>(); - for (Location location : wardList) { - LocationDto locationDto = new LocationDto(); - BeanUtils.copyProperties(location, locationDto); - locationDtoList.add(locationDto); + Set orgIds = new LinkedHashSet<>(); + if (orgId != null) { + orgIds.add(orgId); + // 通过 busNo 层级查找所有子孙科室(busNo 用 "." 分隔层级,如 "1" → "1.1" → "1.1.1") + Organization org = iOrganizationService.getById(orgId); + if (org != null && StringUtils.isNotEmpty(org.getBusNo())) { + List children = iOrganizationService.list( + new LambdaQueryWrapper() + .likeRight(Organization::getBusNo, org.getBusNo() + ".") + .eq(Organization::getDeleteFlag, DelFlag.NO.getCode())); + for (Organization child : children) { + orgIds.add(child.getId()); + } + } } + // 查询所有关联科室下的病区 + List wardList = new ArrayList<>(); + for (Long id : orgIds) { + wardList.addAll(iLocationService.getWardList(id)); + } + + // 按 ID 去重 + List locationDtoList = new ArrayList<>(); + Set seen = new HashSet<>(); + for (Location location : wardList) { + if (seen.add(location.getId())) { + LocationDto dto = new LocationDto(); + BeanUtils.copyProperties(location, dto); + locationDtoList.add(dto); + } + } return locationDtoList; } diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/AdviceProcessAppServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/AdviceProcessAppServiceImpl.java index 869b2151b..25eaa9717 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/AdviceProcessAppServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/AdviceProcessAppServiceImpl.java @@ -268,15 +268,9 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { e.setSingleDose(doseStr + unitStr); } - // 总量:剂量 × 数量 + 单位(仅药品医嘱) - if (e.getDose() != null && e.getQuantity() != null) { - BigDecimal total = e.getDose().multiply(BigDecimal.valueOf(e.getQuantity())); - String totalStr = total.stripTrailingZeros().toPlainString(); - String unitStr = e.getUnitCode_dictText() != null ? e.getUnitCode_dictText() : ""; - e.setTotalAmount(totalStr + unitStr); - } else if (e.getQuantity() != null) { - String unitStr = e.getUnitCode_dictText() != null ? e.getUnitCode_dictText() : ""; - e.setTotalAmount(e.getQuantity() + unitStr); + // 总量:数量(总量就是数量,不需要乘以剂量,单位由前端显示) + if (e.getQuantity() != null) { + e.setTotalAmount(String.valueOf(e.getQuantity())); } // 频次/用法组合 diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/paymentmanage/appservice/IChargeBillService.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/paymentmanage/appservice/IChargeBillService.java index cb68b7c9c..71a172146 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/paymentmanage/appservice/IChargeBillService.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/paymentmanage/appservice/IChargeBillService.java @@ -72,6 +72,10 @@ public interface IChargeBillService { */ R checkYbNo(); - + /** + * 分页查询收费账单列表 + */ + Map getBillPage(String searchKey, String billType, String payStatus, + String startTime, String endTime, Integer pageNo, Integer pageSize); } diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/paymentmanage/appservice/impl/ChargeBillQueryService.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/paymentmanage/appservice/impl/ChargeBillQueryService.java index 2b289feae..fb5ba909b 100644 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/paymentmanage/appservice/impl/ChargeBillQueryService.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/paymentmanage/appservice/impl/ChargeBillQueryService.java @@ -608,4 +608,221 @@ public class ChargeBillQueryService { map.put("insutype", "自费"); return map; } + + /** + * 分页查询收费账单列表 + */ + public Map getBillPage(String searchKey, String billType, String payStatus, + String startTime, String endTime, Integer pageNo, Integer pageSize) { + // 预解析searchKey,避免后续重复查询 + List searchPatientIds = null; + List searchEncounterIds = null; + if (StringUtils.isNotEmpty(searchKey)) { + searchPatientIds = iPatientService.list(new LambdaQueryWrapper() + .like(Patient::getName, searchKey) + .eq(Patient::getDeleteFlag, DelFlag.NO.getCode()) + .select(Patient::getId)) + .stream().map(Patient::getId).collect(Collectors.toList()); + searchEncounterIds = iEncounterService.list(new LambdaQueryWrapper() + .like(Encounter::getBusNo, searchKey) + .eq(Encounter::getDeleteFlag, DelFlag.NO.getCode()) + .select(Encounter::getId)) + .stream().map(Encounter::getId).collect(Collectors.toList()); + } + + // 分页查询 + LambdaQueryWrapper pageWrapper = buildBillQueryWrapper( + billType, payStatus, startTime, endTime, searchPatientIds, searchEncounterIds); + pageWrapper.orderByDesc(PaymentReconciliation::getBillDate); + com.baomidou.mybatisplus.extension.plugins.pagination.Page page = + new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(pageNo, pageSize); + List billList = paymentReconciliationService.page(page, pageWrapper).getRecords(); + + // 总数 + long total = paymentReconciliationService.count(buildBillQueryWrapper( + billType, payStatus, startTime, endTime, searchPatientIds, searchEncounterIds)); + + // 转换为DTO + List records = convertToDtoList(billList); + + // 汇总:查询全部匹配记录(不受分页限制) + Map summary = computeBillSummary(billType, payStatus, startTime, endTime, + searchPatientIds, searchEncounterIds, total); + + Map result = new HashMap<>(); + result.put("records", records); + result.put("total", total); + result.put("summary", summary); + return result; + } + + /** + * 将账单实体列表转换为DTO列表 + */ + private List convertToDtoList(List billList) { + List records = new ArrayList<>(); + if (billList.isEmpty()) { + return records; + } + + List patientIds = billList.stream().map(PaymentReconciliation::getPatientId).distinct().collect(Collectors.toList()); + List encounterIds = billList.stream().map(PaymentReconciliation::getEncounterId).distinct().collect(Collectors.toList()); + List entererIds = billList.stream().map(PaymentReconciliation::getEntererId).distinct().collect(Collectors.toList()); + + Map patientMap = listToMap(iPatientService.listByIds(patientIds), Patient::getId); + Map encounterMap = listToMap(iEncounterService.listByIds(encounterIds), Encounter::getId); + Map practitionerMap = listToMap(iPractitionerService.listByIds(entererIds), Practitioner::getId); + + // 查询当前页账单的退费金额 + List paymentIds = billList.stream().map(PaymentReconciliation::getId).collect(Collectors.toList()); + Map refundMap = new HashMap<>(); + if (!paymentIds.isEmpty()) { + List refunds = paymentReconciliationService.list( + new LambdaQueryWrapper() + .in(PaymentReconciliation::getRelationId, paymentIds) + .eq(PaymentReconciliation::getDeleteFlag, DelFlag.NO.getCode()) + .in(PaymentReconciliation::getStatusEnum, + PaymentStatus.REFUND_ALL.getValue(), PaymentStatus.REFUND_PART.getValue())); + for (PaymentReconciliation refund : refunds) { + refundMap.merge(refund.getRelationId(), refund.getTenderedAmount(), BigDecimal::add); + } + } + + for (PaymentReconciliation bill : billList) { + BillListDto dto = new BillListDto(); + dto.setId(bill.getId()); + dto.setBillNo(bill.getPaymentNo()); + dto.setPatientId(bill.getPatientId()); + dto.setEncounterId(bill.getEncounterId()); + dto.setTotalAmount(bill.getTenderedAmount() != null ? bill.getTenderedAmount() : BigDecimal.ZERO); + dto.setRefundAmount(refundMap.getOrDefault(bill.getId(), BigDecimal.ZERO)); + dto.setPayStatus(bill.getStatusEnum()); + dto.setOperatorId(bill.getEntererId()); + dto.setPayTime(bill.getBillDate()); + dto.setContractNo(bill.getContractNo()); + + Patient patient = patientMap.get(bill.getPatientId()); + if (patient != null) { + dto.setPatientName(patient.getName()); + dto.setGenderEnum(patient.getGenderEnum()); + dto.setBirthDate(patient.getBirthDate()); + if (patient.getBirthDate() != null) { + dto.setAge(AgeCalculatorUtil.calculateAge(patient.getBirthDate())); + } + } + + Encounter encounter = encounterMap.get(bill.getEncounterId()); + if (encounter != null) { + dto.setEncounterNo(encounter.getBusNo()); + } + + Practitioner practitioner = practitionerMap.get(bill.getEntererId()); + if (practitioner != null) { + dto.setOperatorName(practitioner.getName()); + } + + if (bill.getStatusEnum() != null) { + PaymentStatus ps = PaymentStatus.getByValue(bill.getStatusEnum()); + dto.setPayStatus_dictText(ps != null ? ps.getInfo() : ""); + } + + records.add(dto); + } + return records; + } + + /** + * 将List转为Map,keyExtractor为key提取函数 + */ + private Map listToMap(List list, java.util.function.Function keyExtractor) { + Map map = new HashMap<>(); + for (T item : list) { + map.put(keyExtractor.apply(item), item); + } + return map; + } + + /** + * 构建查询条件 + * @param searchPatientIds 预解析的患者ID列表(null表示无searchKey) + * @param searchEncounterIds 预解析的就诊ID列表(null表示无searchKey) + */ + private LambdaQueryWrapper buildBillQueryWrapper( + String billType, String payStatus, String startTime, String endTime, + List searchPatientIds, List searchEncounterIds) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(PaymentReconciliation::getDeleteFlag, DelFlag.NO.getCode()) + .eq(PaymentReconciliation::getKindEnum, PaymentKind.OUTPATIENT_CLINIC.getValue()); + + if (StringUtils.isNotEmpty(payStatus)) { + int ps = Integer.parseInt(payStatus); + if (ps == 0) { + wrapper.eq(PaymentReconciliation::getStatusEnum, PaymentStatus.DRAFT.getValue()); + } else if (ps == 1) { + wrapper.eq(PaymentReconciliation::getStatusEnum, PaymentStatus.SUCCESS.getValue()); + } else if (ps == 2) { + wrapper.in(PaymentReconciliation::getStatusEnum, + PaymentStatus.REFUND_ALL.getValue(), PaymentStatus.REFUND_PART.getValue()); + } + } + + if (StringUtils.isNotEmpty(startTime)) { + wrapper.ge(PaymentReconciliation::getBillDate, startTime); + } + if (StringUtils.isNotEmpty(endTime)) { + wrapper.le(PaymentReconciliation::getBillDate, endTime); + } + + // searchKey 过滤:使用预解析的ID列表 + if (searchPatientIds != null && searchEncounterIds != null) { + boolean hasPatients = !searchPatientIds.isEmpty(); + boolean hasEncounters = !searchEncounterIds.isEmpty(); + if (hasPatients || hasEncounters) { + wrapper.and(w -> { + if (hasPatients) { + w.or().in(PaymentReconciliation::getPatientId, searchPatientIds); + } + if (hasEncounters) { + w.or().in(PaymentReconciliation::getEncounterId, searchEncounterIds); + } + }); + } else { + wrapper.eq(PaymentReconciliation::getId, -1L); + } + } + + return wrapper; + } + + /** + * 查询全部匹配记录的汇总数据(不受分页限制) + */ + private Map computeBillSummary(String billType, String payStatus, String startTime, String endTime, + List searchPatientIds, List searchEncounterIds, + long totalCount) { + Map summary = new HashMap<>(); + LambdaQueryWrapper wrapper = buildBillQueryWrapper( + billType, payStatus, startTime, endTime, searchPatientIds, searchEncounterIds); + wrapper.select(PaymentReconciliation::getStatusEnum, PaymentReconciliation::getTenderedAmount); + List allBills = paymentReconciliationService.list(wrapper); + + BigDecimal totalAmount = BigDecimal.ZERO; + BigDecimal refundAmount = BigDecimal.ZERO; + for (PaymentReconciliation bill : allBills) { + BigDecimal amount = bill.getTenderedAmount() != null ? bill.getTenderedAmount() : BigDecimal.ZERO; + Integer status = bill.getStatusEnum(); + if (PaymentStatus.SUCCESS.getValue().equals(status)) { + totalAmount = totalAmount.add(amount); + } else if (PaymentStatus.REFUND_ALL.getValue().equals(status) + || PaymentStatus.REFUND_PART.getValue().equals(status)) { + refundAmount = refundAmount.add(amount); + } + } + + summary.put("totalAmount", totalAmount); + summary.put("refundAmount", refundAmount); + summary.put("actualAmount", totalAmount.subtract(refundAmount)); + summary.put("totalCount", totalCount); + return summary; + } } diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/paymentmanage/appservice/impl/IChargeBillServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/paymentmanage/appservice/impl/IChargeBillServiceImpl.java index 6519736c2..79693ffc2 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/paymentmanage/appservice/impl/IChargeBillServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/paymentmanage/appservice/impl/IChargeBillServiceImpl.java @@ -72,4 +72,11 @@ public class IChargeBillServiceImpl implements IChargeBillService { public R checkYbNo() { return chargeBillStatisticsService.checkYbNo(); } + + @Override + public Map getBillPage(String searchKey, String billType, String payStatus, + String startTime, String endTime, Integer pageNo, Integer pageSize) { + return chargeBillQueryService.getBillPage(searchKey, billType, payStatus, + startTime, endTime, pageNo, pageSize); + } } diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/paymentmanage/controller/ChargeBillController.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/paymentmanage/controller/ChargeBillController.java index 21d2b6958..10a02fbc9 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/paymentmanage/controller/ChargeBillController.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/paymentmanage/controller/ChargeBillController.java @@ -115,4 +115,27 @@ public class ChargeBillController { return iChargeBillService.checkYbNo(); } + /** + * 分页查询收费账单列表 + */ + @GetMapping("/page") + public R page(@RequestParam(value = "searchKey", required = false) String searchKey, + @RequestParam(value = "billType", required = false) String billType, + @RequestParam(value = "payStatus", required = false) String payStatus, + @RequestParam(value = "startTime", required = false) String startTime, + @RequestParam(value = "endTime", required = false) String endTime, + @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { + return R.ok(iChargeBillService.getBillPage(searchKey, billType, payStatus, + startTime, endTime, pageNo, pageSize)); + } + + /** + * 获取收费详情(按ID) + */ + @GetMapping("/{id}") + public R getById(@PathVariable Long id) { + return R.ok(iChargeBillService.getDetail(id)); + } + } diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/paymentmanage/dto/BillListDto.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/paymentmanage/dto/BillListDto.java new file mode 100644 index 000000000..4c1fc2bf2 --- /dev/null +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/paymentmanage/dto/BillListDto.java @@ -0,0 +1,78 @@ +package com.healthlink.his.web.paymentmanage.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 收费账单列表DTO + */ +@Data +@Accessors(chain = true) +public class BillListDto { + + /** 账单ID */ + private Long id; + + /** 账单号 */ + private String billNo; + + /** 患者ID */ + private Long patientId; + + /** 患者姓名 */ + private String patientName; + + /** 性别枚举 */ + private Integer genderEnum; + + /** 性别文本 */ + private String genderEnum_enumText; + + /** 年龄 */ + private Integer age; + + /** 出生日期 */ + private Date birthDate; + + /** 就诊ID */ + private Long encounterId; + + /** 门诊号 */ + private String encounterNo; + + /** 收费类型枚举 */ + private Integer billType; + + /** 收费类型文本 */ + private String billType_dictText; + + /** 收费金额 */ + private BigDecimal totalAmount; + + /** 退费金额 */ + private BigDecimal refundAmount; + + /** 收费状态枚举 */ + private Integer payStatus; + + /** 收费状态文本 */ + private String payStatus_dictText; + + /** 支付方式文本 */ + private String payMethod_dictText; + + /** 收费员ID */ + private Long operatorId; + + /** 收费员姓名 */ + private String operatorName; + + /** 收费时间 */ + private Date payTime; + + /** 合同编号 */ + private String contractNo; +} diff --git a/healthlink-his-server/healthlink-his-application/src/main/resources/db/migration/V20260626_2__seed_tpr_dict_data.sql b/healthlink-his-server/healthlink-his-application/src/main/resources/db/migration/V20260626_2__seed_tpr_dict_data.sql new file mode 100644 index 000000000..5e45207bd --- /dev/null +++ b/healthlink-his-server/healthlink-his-application/src/main/resources/db/migration/V20260626_2__seed_tpr_dict_data.sql @@ -0,0 +1,68 @@ +-- Bug #818: TPR变更体温单下拉框无数据 — 补充缺失的字典类型和字典数据 +-- 涉及的字典: temperature_select_type, breathe_unit, measurement_select_type, +-- urination_frequency_unit, stoolfrequency_unit + +-- ============================================================ +-- 1. 插入字典类型 (sys_dict_type) +-- ============================================================ +INSERT INTO sys_dict_type (dict_id, dict_name, dict_type, status, create_by, create_time, remark) +VALUES + (543, '体温测量类型', 'temperature_select_type', '0', 'admin', NOW(), 'TPR体温单-体温下拉选项'), + (544, '呼吸类型', 'breathe_unit', '0', 'admin', NOW(), 'TPR体温单-呼吸下拉选项'), + (545, '测量特殊状态', 'measurement_select_type', '0', 'admin', NOW(), 'TPR体温单-体重/腹围/身高特殊状态'), + (546, '小便次数符号', 'urination_frequency_unit', '0', 'admin', NOW(), 'TPR体温单-小便次数特殊符号'), + (547, '大便次数符号', 'stoolfrequency_unit', '0', 'admin', NOW(), 'TPR体温单-大便次数特殊符号') +ON CONFLICT DO NOTHING; + +-- ============================================================ +-- 2. 插入字典数据 (sys_dict_data) +-- ============================================================ + +-- temperature_select_type: 腋温/口温/额温/耳温/肛温 + 拒测/外出/请假 +-- Codes 1-5 = measurement types (do NOT replace temperature value) +-- Codes 6-8 = special statuses (replace temperature value with text) +INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time) +VALUES + (4142, 1, '腋温', '1', 'temperature_select_type', '', 'default', 'Y', '0', 'admin', NOW()), + (4143, 2, '口温', '2', 'temperature_select_type', '', 'default', 'N', '0', 'admin', NOW()), + (4144, 3, '额温', '3', 'temperature_select_type', '', 'default', 'N', '0', 'admin', NOW()), + (4145, 4, '耳温', '4', 'temperature_select_type', '', 'default', 'N', '0', 'admin', NOW()), + (4146, 5, '肛温', '5', 'temperature_select_type', '', 'default', 'N', '0', 'admin', NOW()), + (4147, 6, '拒测', '6', 'temperature_select_type', '', 'danger', 'N', '0', 'admin', NOW()), + (4148, 7, '外出', '7', 'temperature_select_type', '', 'warning', 'N', '0', 'admin', NOW()), + (4149, 8, '请假', '8', 'temperature_select_type', '', 'info', 'N', '0', 'admin', NOW()) +ON CONFLICT DO NOTHING; + +-- breathe_unit: 平稳/急促/浅慢/叹息样呼吸/潮式呼吸/抑制呼吸/@ +INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time) +VALUES + (4150, 1, '平稳', '1', 'breathe_unit', '', 'success', 'Y', '0', 'admin', NOW()), + (4151, 2, '急促', '2', 'breathe_unit', '', 'danger', 'N', '0', 'admin', NOW()), + (4152, 3, '浅慢', '3', 'breathe_unit', '', 'warning', 'N', '0', 'admin', NOW()), + (4153, 4, '叹息样呼吸', '4', 'breathe_unit', '', 'info', 'N', '0', 'admin', NOW()), + (4154, 5, '潮式呼吸', '5', 'breathe_unit', '', 'info', 'N', '0', 'admin', NOW()), + (4155, 6, '抑制呼吸', '6', 'breathe_unit', '', 'danger', 'N', '0', 'admin', NOW()), + (4156, 7, '@', '7', 'breathe_unit', '', 'default', 'N', '0', 'admin', NOW()) +ON CONFLICT DO NOTHING; + +-- measurement_select_type: 卧床/未测 +INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time) +VALUES + (4157, 1, '卧床', '1', 'measurement_select_type', '', 'warning', 'N', '0', 'admin', NOW()), + (4158, 2, '未测', '2', 'measurement_select_type', '', 'info', 'Y', '0', 'admin', NOW()) +ON CONFLICT DO NOTHING; + +-- urination_frequency_unit: ※/C +INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time) +VALUES + (4159, 1, '※', '1', 'urination_frequency_unit', '', 'default', 'N', '0', 'admin', NOW()), + (4160, 2, 'C', '2', 'urination_frequency_unit', '', 'default', 'N', '0', 'admin', NOW()) +ON CONFLICT DO NOTHING; + +-- stoolfrequency_unit: ※/☆/人工肛门 +INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time) +VALUES + (4161, 1, '※', '1', 'stoolfrequency_unit', '', 'default', 'N', '0', 'admin', NOW()), + (4162, 2, '☆', '2', 'stoolfrequency_unit', '', 'default', 'N', '0', 'admin', NOW()), + (4163, 3, '人工肛门', '3', 'stoolfrequency_unit', '', 'default', 'N', '0', 'admin', NOW()) +ON CONFLICT DO NOTHING; diff --git a/healthlink-his-server/healthlink-his-application/src/main/resources/db/migration/V20260626_3__fix_tpr_dict_data_complete.sql b/healthlink-his-server/healthlink-his-application/src/main/resources/db/migration/V20260626_3__fix_tpr_dict_data_complete.sql new file mode 100644 index 000000000..a6b085146 --- /dev/null +++ b/healthlink-his-server/healthlink-his-application/src/main/resources/db/migration/V20260626_3__fix_tpr_dict_data_complete.sql @@ -0,0 +1,76 @@ +-- Bug #818: TPR变更体温单下拉框无数据 — 完整修复 +-- 原因: V20260626_2 使用的 dict_code 4142-4163 已被其他字典占用(rate_code/inpatient_diag_category/separate_decocting), +-- dict_id 543-546 也被占用,导致 ON CONFLICT DO NOTHING 跳过所有插入。 +-- 本迁移使用全新未占用的 dict_id(548-552) 和 dict_code(4237-4258)。 +-- 同时恢复被 V20260626_2 误覆盖的两行原始数据(dict_code 4142→rate_code, 4153→inpatient_diag_category)。 + +-- ============================================================ +-- 1. 恢复被误覆盖的两行原始 dict_type +-- ============================================================ +UPDATE sys_dict_data SET dict_type = 'rate_code' WHERE dict_code = 4142; +UPDATE sys_dict_data SET dict_type = 'inpatient_diag_category' WHERE dict_code = 4153; + +-- ============================================================ +-- 2. 插入字典类型 (sys_dict_type) — dict_id 548-552 +-- ============================================================ +INSERT INTO sys_dict_type (dict_id, dict_name, dict_type, status, create_by, create_time, remark) +VALUES + (548, '体温测量类型', 'temperature_select_type', '0', 'admin', NOW(), 'TPR体温单-体温下拉选项'), + (549, '呼吸类型', 'breathe_unit', '0', 'admin', NOW(), 'TPR体温单-呼吸下拉选项'), + (550, '测量特殊状态', 'measurement_select_type', '0', 'admin', NOW(), 'TPR体温单-体重/腹围/身高特殊状态'), + (551, '小便次数符号', 'urination_frequency_unit', '0', 'admin', NOW(), 'TPR体温单-小便次数特殊符号'), + (552, '大便次数符号', 'stoolfrequency_unit', '0', 'admin', NOW(), 'TPR体温单-大便次数特殊符号') +ON CONFLICT DO NOTHING; + +-- ============================================================ +-- 3. 插入字典数据 (sys_dict_data) — dict_code 4237-4258 +-- ============================================================ + +-- temperature_select_type: 腋温/口温/额温/耳温/肛温 + 拒测/外出/请假 +-- Codes 1-5 = measurement types (do NOT replace temperature value) +-- Codes 6-8 = special statuses (replace temperature value with text) +INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time) +VALUES + (4237, 1, '腋温', '1', 'temperature_select_type', '', 'default', 'Y', '0', 'admin', NOW()), + (4238, 2, '口温', '2', 'temperature_select_type', '', 'default', 'N', '0', 'admin', NOW()), + (4239, 3, '额温', '3', 'temperature_select_type', '', 'default', 'N', '0', 'admin', NOW()), + (4240, 4, '耳温', '4', 'temperature_select_type', '', 'default', 'N', '0', 'admin', NOW()), + (4241, 5, '肛温', '5', 'temperature_select_type', '', 'default', 'N', '0', 'admin', NOW()), + (4242, 6, '拒测', '6', 'temperature_select_type', '', 'danger', 'N', '0', 'admin', NOW()), + (4243, 7, '外出', '7', 'temperature_select_type', '', 'warning', 'N', '0', 'admin', NOW()), + (4244, 8, '请假', '8', 'temperature_select_type', '', 'info', 'N', '0', 'admin', NOW()) +ON CONFLICT DO NOTHING; + +-- breathe_unit: 平稳/急促/浅慢/叹息样呼吸/潮式呼吸/抑制呼吸/@ +INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time) +VALUES + (4245, 1, '平稳', '1', 'breathe_unit', '', 'success', 'Y', '0', 'admin', NOW()), + (4246, 2, '急促', '2', 'breathe_unit', '', 'danger', 'N', '0', 'admin', NOW()), + (4247, 3, '浅慢', '3', 'breathe_unit', '', 'warning', 'N', '0', 'admin', NOW()), + (4248, 4, '叹息样呼吸', '4', 'breathe_unit', '', 'info', 'N', '0', 'admin', NOW()), + (4249, 5, '潮式呼吸', '5', 'breathe_unit', '', 'info', 'N', '0', 'admin', NOW()), + (4250, 6, '抑制呼吸', '6', 'breathe_unit', '', 'danger', 'N', '0', 'admin', NOW()), + (4251, 7, '@', '7', 'breathe_unit', '', 'default', 'N', '0', 'admin', NOW()) +ON CONFLICT DO NOTHING; + +-- measurement_select_type: 卧床/未测 +INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time) +VALUES + (4252, 1, '卧床', '1', 'measurement_select_type', '', 'warning', 'N', '0', 'admin', NOW()), + (4253, 2, '未测', '2', 'measurement_select_type', '', 'info', 'Y', '0', 'admin', NOW()) +ON CONFLICT DO NOTHING; + +-- urination_frequency_unit: ※/C +INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time) +VALUES + (4254, 1, '※', '1', 'urination_frequency_unit', '', 'default', 'N', '0', 'admin', NOW()), + (4255, 2, 'C', '2', 'urination_frequency_unit', '', 'default', 'N', '0', 'admin', NOW()) +ON CONFLICT DO NOTHING; + +-- stoolfrequency_unit: ※/☆/人工肛门 +INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time) +VALUES + (4256, 1, '※', '1', 'stoolfrequency_unit', '', 'default', 'N', '0', 'admin', NOW()), + (4257, 2, '☆', '2', 'stoolfrequency_unit', '', 'default', 'N', '0', 'admin', NOW()), + (4258, 3, '人工肛门', '3', 'stoolfrequency_unit', '', 'default', 'N', '0', 'admin', NOW()) +ON CONFLICT DO NOTHING; diff --git a/healthlink-his-server/healthlink-his-application/src/main/resources/db/migration/V20260626__add_encounter_id_to_lab_apply.sql b/healthlink-his-server/healthlink-his-application/src/main/resources/db/migration/V20260626__add_encounter_id_to_lab_apply.sql new file mode 100644 index 000000000..42c90542d --- /dev/null +++ b/healthlink-his-server/healthlink-his-application/src/main/resources/db/migration/V20260626__add_encounter_id_to_lab_apply.sql @@ -0,0 +1,12 @@ +-- Bug #806: lab_apply 表增加 encounter_id 列,用于按就诊流水隔离检验申请单 +ALTER TABLE lab_apply ADD COLUMN IF NOT EXISTS encounter_id bigint; + +-- 对已有数据:尝试通过 visit_no 关联 adm_encounter.bus_no 回填 encounter_id +UPDATE lab_apply la +SET encounter_id = ae.id +FROM adm_encounter ae +WHERE la.visit_no IS NOT NULL + AND la.visit_no <> '' + AND la.visit_no = ae.bus_no + AND la.delete_flag = '0' + AND ae.delete_flag = '0'; diff --git a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml index acd3dbd7e..636d1c5ef 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml +++ b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml @@ -173,13 +173,20 @@ AND T9sr.delete_flag = '0' LEFT JOIN wor_service_request AS wsrp ON wsrp.id = wsr.parent_id AND wsrp.delete_flag = '0' WHERE T1.encounter_id = #{encounterId} - AND T1.status_enum IN (0 - , #{planned} - , #{billable} - , #{billed} - , #{refunding} - , #{refunded} - , #{partRefund}) + + + AND T1.status_enum = #{filterStatus} + + + AND T1.status_enum IN (0 + , #{planned} + , #{billable} + , #{billed} + , #{refunding} + , #{refunded} + , #{partRefund}) + + AND T1.context_enum != #{register} AND ( -- 若能关联到请求表,则必须是“已签发”后才允许收费端展示 diff --git a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/doctorstation/DoctorStationLabApplyMapper.xml b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/doctorstation/DoctorStationLabApplyMapper.xml index fb8d38545..d7040f210 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/doctorstation/DoctorStationLabApplyMapper.xml +++ b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/doctorstation/DoctorStationLabApplyMapper.xml @@ -23,9 +23,8 @@ t1.apply_status AS applyStatus, t1.apply_remark AS applyRemark FROM lab_apply AS t1 - INNER JOIN adm_encounter AS t3 ON t1.patient_id::bigint = t3.patient_id WHERE t1.delete_flag = '0' - AND t3.id = #{encounterId} + AND t1.encounter_id = #{encounterId} ORDER BY t1.apply_time DESC diff --git a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inhospitalcharge/InHospitalRegisterAppMapper.xml b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inhospitalcharge/InHospitalRegisterAppMapper.xml index 38ed6edf6..0b7a3dd1a 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inhospitalcharge/InHospitalRegisterAppMapper.xml +++ b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inhospitalcharge/InHospitalRegisterAppMapper.xml @@ -187,6 +187,6 @@ AND organization_id = #{orgId} - AND tenant_id = 1 + diff --git a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inhospitalnursestation/AdviceProcessAppMapper.xml b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inhospitalnursestation/AdviceProcessAppMapper.xml index be50dffd7..1b5146588 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inhospitalnursestation/AdviceProcessAppMapper.xml +++ b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inhospitalnursestation/AdviceProcessAppMapper.xml @@ -323,7 +323,7 @@ T1.performer_check_id, T1.reason_text AS reason_text, T1.check_time AS check_time, - T2."name" AS advice_name, + COALESCE(T2."name", T1.content_json::jsonb->>'adviceName') AS advice_name, T2.id AS item_id, NULL::varchar AS volume, NULL::varchar AS lot_number, diff --git a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/paymentmanage/ChargeBillMapper.xml b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/paymentmanage/ChargeBillMapper.xml index c9a1c7b4f..2babbc3b5 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/paymentmanage/ChargeBillMapper.xml +++ b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/paymentmanage/ChargeBillMapper.xml @@ -11,10 +11,7 @@ SELECT a.total_price, COALESCE(b1.org_id, b2.org_id, b3.org_id, b4.offered_org_id, b5.org_id) AS org_id, - --COALESCE(b1.yb_class_enum, b2.yb_class_enum, b3.yb_class_enum) AS yb_class_enum, b5.yb_type - - -- 添加更多需要的字段 FROM adm_charge_item a LEFT JOIN @@ -42,4 +39,5 @@ + \ No newline at end of file diff --git a/healthlink-his-server/healthlink-his-domain/src/main/java/com/healthlink/his/lab/domain/InspectionLabApply.java b/healthlink-his-server/healthlink-his-domain/src/main/java/com/healthlink/his/lab/domain/InspectionLabApply.java index cd5d03479..141f87161 100755 --- a/healthlink-his-server/healthlink-his-domain/src/main/java/com/healthlink/his/lab/domain/InspectionLabApply.java +++ b/healthlink-his-server/healthlink-his-domain/src/main/java/com/healthlink/his/lab/domain/InspectionLabApply.java @@ -124,6 +124,11 @@ public class InspectionLabApply extends HisBaseEntity { * 备注 */ private String applyRemark; + /** + * 就诊ID(本次就诊流水,用于数据隔离) + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long encounterId; /** * 操作员工号 */ diff --git a/healthlink-his-ui/src/views/charge/cliniccharge/components/api.js b/healthlink-his-ui/src/views/charge/cliniccharge/components/api.js index 2f3de9a82..c3efbf2d8 100755 --- a/healthlink-his-ui/src/views/charge/cliniccharge/components/api.js +++ b/healthlink-his-ui/src/views/charge/cliniccharge/components/api.js @@ -14,9 +14,13 @@ export function getList(queryParams) { /** * 患者处方列表 */ -export function getChargeList(encounterId, config = {}) { +export function getChargeList(encounterId, statusEnum, config = {}) { + let url = '/charge-manage/charge/patient-prescription?encounterId=' + encounterId + if (statusEnum !== undefined && statusEnum !== null) { + url += '&statusEnum=' + statusEnum + } return request({ - url: '/charge-manage/charge/patient-prescription?encounterId=' + encounterId, + url: url, method: 'get', ...config }) diff --git a/healthlink-his-ui/src/views/charge/cliniccharge/index.vue b/healthlink-his-ui/src/views/charge/cliniccharge/index.vue index f6ffea538..02fe1518d 100755 --- a/healthlink-his-ui/src/views/charge/cliniccharge/index.vue +++ b/healthlink-his-ui/src/views/charge/cliniccharge/index.vue @@ -468,9 +468,11 @@ function handleSelectionChange(selection) { } function handleTotalAmount() { if (selectedRows.value.length == 0) { - totalAmounts.value = chargeList.value.reduce((accumulator, currentRow) => { - return new Decimal(accumulator).add(currentRow.totalPrice.toFixed(2) || 0); - }, new Decimal(0)); + totalAmounts.value = chargeList.value + .filter((row) => row.statusEnum === 1) + .reduce((accumulator, currentRow) => { + return new Decimal(accumulator).add(currentRow.totalPrice.toFixed(2) || 0); + }, new Decimal(0)); } else { totalAmounts.value = selectedRows.value.reduce((accumulator, currentRow) => { return new Decimal(accumulator).add(currentRow.totalPrice.toFixed(2) || 0); @@ -532,7 +534,7 @@ function clickRow(params) { patientInfo.value = { ...row, encounterId: encId }; chargeLoading.value = true; encounterId.value = encId; - getChargeList(encId).then((res) => { + getChargeList(encId, queryParams.value.statusEnum).then((res) => { chargeList.value = res.data; setTimeout(() => { chargeLoading.value = false; @@ -546,7 +548,7 @@ function handleClose(value, msg) { if (value == 'success') { proxy.$modal.msgSuccess(msg); chargeLoading.value = true; - getChargeList(patientInfo.value.encounterId, { skipErrorMsg: true }).then((res) => { + getChargeList(patientInfo.value.encounterId, queryParams.value.statusEnum, { skipErrorMsg: true }).then((res) => { chargeList.value = res.data; setTimeout(() => { chargeLoading.value = false; diff --git a/healthlink-his-ui/src/views/doctorstation/components/inspection/inspectionApplication.vue b/healthlink-his-ui/src/views/doctorstation/components/inspection/inspectionApplication.vue index 39a967c0c..bf3ef1bc0 100755 --- a/healthlink-his-ui/src/views/doctorstation/components/inspection/inspectionApplication.vue +++ b/healthlink-his-ui/src/views/doctorstation/components/inspection/inspectionApplication.vue @@ -2003,16 +2003,16 @@ const formatAmount = (amount) => { // 单据状态标签文字 const getStatusLabel = (applyStatus, row) => { - // applyStatus: 0=待开立, 1=已开立(已签发) + // applyStatus: 0=待签发, 1=已签发 // 结合收费/执行标记推导更丰富的状态 if (applyStatus === 1) { // 已收费后根据执行标记判断 if (row.needExecute === true) { return '已执行' } - return '已开立' + return '已签发' } - return '待开立' + return '待签发' } // 单据状态标签颜色 diff --git a/healthlink-his-ui/src/views/inHospitalManagement/charge/register/components/patientRegister.vue b/healthlink-his-ui/src/views/inHospitalManagement/charge/register/components/patientRegister.vue index 526d93b7c..a5e077696 100755 --- a/healthlink-his-ui/src/views/inHospitalManagement/charge/register/components/patientRegister.vue +++ b/healthlink-his-ui/src/views/inHospitalManagement/charge/register/components/patientRegister.vue @@ -485,10 +485,8 @@ const handleEditSubmit = () => { const openAct = () => { console.log(props.patientInfo, 'patientRegister.vue'); console.log(props.inHospitalInfo, 'inHospitalInfo.vue'); - /* 初始化数据 */ advance.value = props.inHospitalInfo.balanceAmount || 0; advancePaymentVisible.value = false; - RegisterFormRef.value.init(); }; const closedAct = () => { dialogVisible.value = false; diff --git a/healthlink-his-ui/src/views/inHospitalManagement/charge/register/components/registerForm.vue b/healthlink-his-ui/src/views/inHospitalManagement/charge/register/components/registerForm.vue index bfdccc988..fa2f89b9b 100755 --- a/healthlink-his-ui/src/views/inHospitalManagement/charge/register/components/registerForm.vue +++ b/healthlink-his-ui/src/views/inHospitalManagement/charge/register/components/registerForm.vue @@ -312,11 +312,12 @@ const props = defineProps({ }); const organization = ref([]); +const fullOrgTree = ref([]); // 未过滤的完整组织树(保留 children 层级) const wardListOptions = ref([]); +const practitionerWardList = ref([]); // 当前用户有权限的病区(与护士站同源) const contractList = ref([]); const verificationStatusOptions = ref([]); const diagnosisDefinitionList = ref([]); -const wardLoading = ref(false); const rules = reactive({ inHospitalOrgId: [ { @@ -451,17 +452,6 @@ watch( }, { immediate: true } ); -watch( - () => props.isRegistered, - (newVal) => { - if (newVal) { - // 已登记状态可以做一些数据锁定操作 - } else { - init(); - } - } -); - onMounted(async () => { await getInitOptions(); setValue(); @@ -501,15 +491,21 @@ function handleWardClick(item) { function getInitOptions() { // 获取所有科室 const orgPromise = getOrgList(); - // 获取所有病区 + // 获取当前用户有权限的病区(与护士站入出管理同款数据源) const wardPromise = getPractitionerWard(); const initPromise = Promise.all([orgPromise, wardPromise]).then(([orgRes, wardRes]) => { + // 保存完整组织树(含 children 层级),用于 findOrgNode 递归查找 + fullOrgTree.value = orgRes.data.records || []; + // 入院科室:展示所有 typeEnum=2(科室) + classEnum含"2"(住院) 的科室 organization.value = orgRes.data.records.filter( (record) => record.typeEnum === 2 && checkClassEnumValue(record.classEnum, 2) ); + // 保存当前用户有权限的病区列表(与护士站使用相同数据源) + practitionerWardList.value = wardRes.data || []; + // Bug #178 Fix: 如果已选科室不在列表中,手动添加以确保正确显示 const selectedOrgId = props.inHospitalInfo?.inHospitalOrgId; const selectedOrgName = props.inHospitalInfo?.inHospitalOrgName; @@ -545,39 +541,43 @@ function getDiagnosisInfo(value) { } function handleNodeClick(orgInfo) { - const savedWardId = props.inHospitalInfo?.wardLocationId; // 保存原始病区ID,用于编辑模式恢复 - submitForm.wardLocationId = undefined; // 切换科室时,先清空原有病区 + const savedWardId = props.inHospitalInfo?.wardLocationId; + submitForm.wardLocationId = undefined; submitForm.totalBedsNum = undefined; submitForm.idleBedsNum = undefined; - wardListOptions.value = []; // 先清空列表,避免旧数据残留 - wardLoading.value = true; - wardList({ orgId: orgInfo.id }) - .then((res) => { - wardListOptions.value = res.data || []; - if (wardListOptions.value.length > 0) { - // 编辑模式:尝试恢复之前保存的病区 - if (savedWardId) { - const savedWard = wardListOptions.value.find((item) => String(item.id) === String(savedWardId)); - if (savedWard) { - submitForm.wardLocationId = savedWardId; - handleWardClick(savedWard); - return; - } - } - // 新增模式 或 原病区不在新科室下:自动选中第一个病区 - if (!submitForm.wardLocationId) { - submitForm.wardLocationId = wardListOptions.value[0].id; - handleWardClick(wardListOptions.value[0]); - } + wardListOptions.value = []; + + if (orgInfo.id) { + // 后端查询:自动包含子孙科室的病区(通过 busNo 层级匹配) + wardList({ orgId: orgInfo.id }) + .then((res) => { + wardListOptions.value = res.data || []; + selectSavedOrFirstWard(savedWardId); + }) + .catch(() => { + wardListOptions.value = []; + }); + } else { + wardListOptions.value = practitionerWardList.value || []; + selectSavedOrFirstWard(savedWardId); + } +} + +function selectSavedOrFirstWard(savedWardId) { + if (wardListOptions.value.length > 0) { + if (savedWardId) { + const savedWard = wardListOptions.value.find((item) => String(item.id) === String(savedWardId)); + if (savedWard) { + submitForm.wardLocationId = savedWardId; + handleWardClick(savedWard); + return; } - }) - .catch((err) => { - console.error('加载病区失败:', err); - wardListOptions.value = []; - }) - .finally(() => { - wardLoading.value = false; - }); + } + if (!submitForm.wardLocationId) { + submitForm.wardLocationId = wardListOptions.value[0].id; + handleWardClick(wardListOptions.value[0]); + } + } } function handleChange(value) { @@ -586,7 +586,6 @@ function handleChange(value) { submitForm.wardLocationId = undefined; submitForm.totalBedsNum = undefined; submitForm.idleBedsNum = undefined; - wardLoading.value = false; // 同步停止加载 } } @@ -649,14 +648,6 @@ const validateData = async (callback) => { }); }; -const init = () => { - if (!props.isRegistered) { - // 只有待登记状态才重置 - submitForm.inDocterWorkGroupCode = ''; - submitForm.wardLocationId = ''; - } -}; - // 检查classEnum值是否包含指定值(支持多选) function checkClassEnumValue(classEnum, targetValue) { if (!classEnum) return false; @@ -671,7 +662,7 @@ function checkClassEnumValue(classEnum, targetValue) { return classEnum == targetValue; } -defineExpose({ validateData, submitForm, init, medicalInsuranceTitle }); +defineExpose({ validateData, submitForm, medicalInsuranceTitle });