Compare commits
16 Commits
0f013715b8
...
test
| Author | SHA1 | Date | |
|---|---|---|---|
| 700e353b79 | |||
| 0b2c19d2c5 | |||
| 47394de43c | |||
| f0f1dde6b6 | |||
| 1ab1165697 | |||
| a8f1b1fdfa | |||
| 3b94d19199 | |||
| db1139a14f | |||
|
|
bea74aeac2 | ||
|
|
634a1f45f9 | ||
| 8f1ad3307c | |||
| d8080fa22d | |||
|
|
e8783d9f8f | ||
| d8c4348341 | |||
|
|
8e61490005 | ||
| f5f4e3c48e |
104
check_display_order.sql
Normal file
104
check_display_order.sql
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
-- 检查流水号(display_order)是否按“科室+医生+当天”正确递增
|
||||||
|
--
|
||||||
|
-- 说明:
|
||||||
|
-- 1. display_order 存的是纯数字(1, 2, 3...),不带时间戳前缀
|
||||||
|
-- 2. 时间戳前缀(如 20260109)是在前端显示时加上的
|
||||||
|
-- 3. 后端用 Redis key "ORG-{科室ID}-DOC-{医生ID}" 按天自增
|
||||||
|
--
|
||||||
|
-- 如何判断逻辑是否正确:
|
||||||
|
-- 同一科室、同一医生、同一天的记录,display_order 应该递增(1, 2, 3...)
|
||||||
|
-- 不同科室、不同医生、不同天的记录,可能都是 1(这是正常的)
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 查询1:按“科室+医生+日期”分组,看每组内的 display_order 是否递增
|
||||||
|
-- ========================================
|
||||||
|
SELECT
|
||||||
|
DATE(start_time) AS 日期,
|
||||||
|
organization_id AS 科室ID,
|
||||||
|
registrar_id AS 医生ID,
|
||||||
|
COUNT(*) AS 该组记录数,
|
||||||
|
MIN(display_order) AS 最小序号,
|
||||||
|
MAX(display_order) AS 最大序号,
|
||||||
|
STRING_AGG(display_order::text, ', ' ORDER BY start_time) AS 序号列表,
|
||||||
|
STRING_AGG(id::text, ', ' ORDER BY start_time) AS 记录ID列表
|
||||||
|
FROM adm_encounter
|
||||||
|
WHERE delete_flag = '0'
|
||||||
|
AND start_time >= CURRENT_DATE - INTERVAL '7 days' -- 只看最近7天
|
||||||
|
AND display_order IS NOT NULL
|
||||||
|
GROUP BY DATE(start_time), organization_id, registrar_id
|
||||||
|
ORDER BY 日期 DESC, 科室ID, 医生ID;
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 查询2:详细查看每条记录,看同组内的序号是否连续
|
||||||
|
-- ========================================
|
||||||
|
SELECT
|
||||||
|
id AS 记录ID,
|
||||||
|
DATE(start_time) AS 日期,
|
||||||
|
organization_id AS 科室ID,
|
||||||
|
registrar_id AS 医生ID,
|
||||||
|
start_time AS 挂号时间,
|
||||||
|
display_order AS 流水号,
|
||||||
|
-- 计算:同组内的序号应该是 1, 2, 3...,看是否有重复或跳号
|
||||||
|
ROW_NUMBER() OVER (
|
||||||
|
PARTITION BY DATE(start_time), organization_id, registrar_id
|
||||||
|
ORDER BY start_time
|
||||||
|
) AS 应该是第几个,
|
||||||
|
CASE
|
||||||
|
WHEN display_order = ROW_NUMBER() OVER (
|
||||||
|
PARTITION BY DATE(start_time), organization_id, registrar_id
|
||||||
|
ORDER BY start_time
|
||||||
|
) THEN '✓ 正常'
|
||||||
|
ELSE '✗ 异常'
|
||||||
|
END AS 是否正常
|
||||||
|
FROM adm_encounter
|
||||||
|
WHERE delete_flag = '0'
|
||||||
|
AND start_time >= CURRENT_DATE - INTERVAL '7 days'
|
||||||
|
AND display_order IS NOT NULL
|
||||||
|
ORDER BY DATE(start_time) DESC, organization_id, registrar_id, start_time;
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 查询3:只看今天的数据(最直观)
|
||||||
|
-- ========================================
|
||||||
|
SELECT
|
||||||
|
id AS 记录ID,
|
||||||
|
organization_id AS 科室ID,
|
||||||
|
registrar_id AS 医生ID,
|
||||||
|
start_time AS 挂号时间,
|
||||||
|
display_order AS 流水号
|
||||||
|
FROM adm_encounter
|
||||||
|
WHERE delete_flag = '0'
|
||||||
|
AND DATE(start_time) = CURRENT_DATE
|
||||||
|
AND display_order IS NOT NULL
|
||||||
|
ORDER BY organization_id, registrar_id, start_time;
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 查询4:发现问题 - 找出同组内 display_order 重复的记录
|
||||||
|
-- ========================================
|
||||||
|
WITH ranked AS (
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
DATE(start_time) AS reg_date,
|
||||||
|
organization_id,
|
||||||
|
registrar_id,
|
||||||
|
start_time,
|
||||||
|
display_order,
|
||||||
|
ROW_NUMBER() OVER (
|
||||||
|
PARTITION BY DATE(start_time), organization_id, registrar_id
|
||||||
|
ORDER BY start_time
|
||||||
|
) AS should_be_order
|
||||||
|
FROM adm_encounter
|
||||||
|
WHERE delete_flag = '0'
|
||||||
|
AND start_time >= CURRENT_DATE - INTERVAL '7 days'
|
||||||
|
AND display_order IS NOT NULL
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
reg_date AS 日期,
|
||||||
|
organization_id AS 科室ID,
|
||||||
|
registrar_id AS 医生ID,
|
||||||
|
COUNT(*) AS 重复数量,
|
||||||
|
STRING_AGG(id::text || '->' || display_order::text, ', ') AS 问题记录
|
||||||
|
FROM ranked
|
||||||
|
WHERE display_order != should_be_order
|
||||||
|
GROUP BY reg_date, organization_id, registrar_id
|
||||||
|
ORDER BY reg_date DESC;
|
||||||
|
|
||||||
10
md/test.html
Normal file
10
md/test.html
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>测试合并11111</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -141,4 +141,9 @@ public class CurrentDayEncounterDto {
|
|||||||
*/
|
*/
|
||||||
private String identifierNo;
|
private String identifierNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流水号(就诊当日序号)
|
||||||
|
*/
|
||||||
|
private Integer displayOrder;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,12 +69,3 @@ public class ReprintRegistrationDto {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import com.core.common.core.domain.R;
|
|||||||
import com.openhis.check.domain.LisGroupInfo;
|
import com.openhis.check.domain.LisGroupInfo;
|
||||||
|
|
||||||
public interface ILisGroupInfoAppService {
|
public interface ILisGroupInfoAppService {
|
||||||
R<?> getLisGroupInfoList();
|
R<?> getLisGroupInfoList(Integer pageNum, Integer pageSize);
|
||||||
|
|
||||||
R<?> add(LisGroupInfo lisGroupInfo);
|
R<?> add(LisGroupInfo lisGroupInfo);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.openhis.web.check.appservice.impl;
|
package com.openhis.web.check.appservice.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.core.common.core.domain.R;
|
import com.core.common.core.domain.R;
|
||||||
import com.openhis.check.domain.LisGroupInfo;
|
import com.openhis.check.domain.LisGroupInfo;
|
||||||
import com.openhis.check.service.ILisGroupInfoService;
|
import com.openhis.check.service.ILisGroupInfoService;
|
||||||
@@ -17,11 +18,14 @@ public class LisGroupInfoAppServiceImpl implements ILisGroupInfoAppService {
|
|||||||
@Resource
|
@Resource
|
||||||
private ILisGroupInfoService lisGroupInfoService;
|
private ILisGroupInfoService lisGroupInfoService;
|
||||||
@Override
|
@Override
|
||||||
public R<?> getLisGroupInfoList() {
|
public R<?> getLisGroupInfoList(Integer pageNum, Integer pageSize) {
|
||||||
List<LisGroupInfo> list = lisGroupInfoService.list();
|
Page<LisGroupInfo> page = new Page<>(pageNum, pageSize);
|
||||||
|
Page<LisGroupInfo> list = lisGroupInfoService.page(page);
|
||||||
return R.ok(list);
|
return R.ok(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<?> add(LisGroupInfo lisGroupInfo) {
|
public R<?> add(LisGroupInfo lisGroupInfo) {
|
||||||
if (ObjectUtil.isEmpty(lisGroupInfo)) {
|
if (ObjectUtil.isEmpty(lisGroupInfo)) {
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ public class LisGroupInfoController {
|
|||||||
*
|
*
|
||||||
* */
|
* */
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public R<?> getLisGroupInfoList(){
|
public R<?> getLisGroupInfoList(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize){
|
||||||
return R.ok(lisGroupInfoAppService.getLisGroupInfoList());
|
return R.ok(lisGroupInfoAppService.getLisGroupInfoList(pageNum, pageSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import com.openhis.web.doctorstation.dto.PrescriptionInfoBaseDto;
|
|||||||
import com.openhis.web.doctorstation.dto.PrescriptionInfoDetailDto;
|
import com.openhis.web.doctorstation.dto.PrescriptionInfoDetailDto;
|
||||||
import com.openhis.web.doctorstation.dto.ReceptionStatisticsDto;
|
import com.openhis.web.doctorstation.dto.ReceptionStatisticsDto;
|
||||||
import com.openhis.web.doctorstation.mapper.DoctorStationMainAppMapper;
|
import com.openhis.web.doctorstation.mapper.DoctorStationMainAppMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -32,6 +33,7 @@ import java.util.stream.Collectors;
|
|||||||
/**
|
/**
|
||||||
* 医生站-主页面 应用实现类
|
* 医生站-主页面 应用实现类
|
||||||
*/
|
*/
|
||||||
|
//@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppService {
|
public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppService {
|
||||||
|
|
||||||
@@ -95,6 +97,9 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
|
|||||||
ParticipantType.REGISTRATION_DOCTOR.getCode(), ParticipantType.ADMITTER.getCode(), userId,
|
ParticipantType.REGISTRATION_DOCTOR.getCode(), ParticipantType.ADMITTER.getCode(), userId,
|
||||||
currentUserOrganizationId, pricingFlag, EncounterStatus.PLANNED.getValue(),
|
currentUserOrganizationId, pricingFlag, EncounterStatus.PLANNED.getValue(),
|
||||||
EncounterActivityStatus.ACTIVE.getValue(), queryWrapper);
|
EncounterActivityStatus.ACTIVE.getValue(), queryWrapper);
|
||||||
|
//日志输出就诊患者信息,patientInfo
|
||||||
|
// log.debug("就诊患者信息: 总数={}, 记录数={}, 数据={}",
|
||||||
|
// patientInfo.getTotal(), patientInfo.getRecords().size(), patientInfo.getRecords());
|
||||||
patientInfo.getRecords().forEach(e -> {
|
patientInfo.getRecords().forEach(e -> {
|
||||||
// 性别
|
// 性别
|
||||||
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||||
|
|||||||
@@ -123,4 +123,8 @@ public class PatientInfoDto {
|
|||||||
* 病历号
|
* 病历号
|
||||||
*/
|
*/
|
||||||
private String busNo;
|
private String busNo;
|
||||||
|
/**
|
||||||
|
* 就诊卡号
|
||||||
|
*/
|
||||||
|
private String identifierNo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1818,6 +1818,10 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
|||||||
// 保存就诊信息
|
// 保存就诊信息
|
||||||
Encounter encounter = new Encounter();
|
Encounter encounter = new Encounter();
|
||||||
BeanUtils.copyProperties(encounterFormData, encounter);
|
BeanUtils.copyProperties(encounterFormData, encounter);
|
||||||
|
// 将挂号医生ID提前塞入 encounter 的 registrarId,便于生成“科室+医生+当日”序号
|
||||||
|
if (encounterParticipantFormData.getPractitionerId() != null) {
|
||||||
|
encounter.setRegistrarId(encounterParticipantFormData.getPractitionerId());
|
||||||
|
}
|
||||||
encounter.setBusNo(outpatientRegistrationSettleParam.getBusNo());
|
encounter.setBusNo(outpatientRegistrationSettleParam.getBusNo());
|
||||||
// 就诊ID
|
// 就诊ID
|
||||||
Long encounterId = iEncounterService.saveEncounterByRegister(encounter);
|
Long encounterId = iEncounterService.saveEncounterByRegister(encounter);
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
<select id="getCurrentDayEncounter" resultType="com.openhis.web.chargemanage.dto.CurrentDayEncounterDto">
|
<select id="getCurrentDayEncounter" resultType="com.openhis.web.chargemanage.dto.CurrentDayEncounterDto">
|
||||||
SELECT T9.tenant_id AS tenantId,
|
SELECT T9.tenant_id AS tenantId,
|
||||||
T9.encounter_id AS encounterId,
|
T9.encounter_id AS encounterId,
|
||||||
|
T9.display_order AS displayOrder,
|
||||||
T9.organization_id AS organizationId,
|
T9.organization_id AS organizationId,
|
||||||
T9.organization_name AS organizationName,
|
T9.organization_name AS organizationName,
|
||||||
T9.healthcare_name AS healthcareName,
|
T9.healthcare_name AS healthcareName,
|
||||||
@@ -70,6 +71,7 @@
|
|||||||
from (
|
from (
|
||||||
SELECT T1.tenant_id AS tenant_id,
|
SELECT T1.tenant_id AS tenant_id,
|
||||||
T1.id AS encounter_id,
|
T1.id AS encounter_id,
|
||||||
|
T1.display_order AS display_order,
|
||||||
T1.organization_id AS organization_id,
|
T1.organization_id AS organization_id,
|
||||||
T2.NAME AS organization_name,
|
T2.NAME AS organization_name,
|
||||||
T3.NAME AS healthcare_name,
|
T3.NAME AS healthcare_name,
|
||||||
|
|||||||
@@ -43,207 +43,247 @@
|
|||||||
abi.restricted_scope,
|
abi.restricted_scope,
|
||||||
abi.dosage_instruction,
|
abi.dosage_instruction,
|
||||||
abi.chrgitm_lv
|
abi.chrgitm_lv
|
||||||
from (
|
FROM (
|
||||||
<if test="adviceTypes == null or adviceTypes.contains(1)">
|
<!-- 确保至少有一个查询被执行以避免语法错误 -->
|
||||||
(SELECT
|
<if test="adviceTypes != null and !adviceTypes.isEmpty() and (adviceTypes.contains(1) or adviceTypes.contains(2) or adviceTypes.contains(3))">
|
||||||
DISTINCT ON (T1.ID)
|
<!-- 如果有有效的adviceTypes,则执行对应的查询 -->
|
||||||
T1.tenant_id,
|
<if test="adviceTypes.contains(1)">
|
||||||
1 AS advice_type,
|
(SELECT
|
||||||
T1.bus_no AS bus_no,
|
DISTINCT ON (T1.ID)
|
||||||
T1.category_code AS category_code,
|
T1.tenant_id,
|
||||||
T1.pharmacology_category_code AS pharmacology_category_code,
|
1 AS advice_type,
|
||||||
T1.part_percent AS part_percent,
|
T1.bus_no AS bus_no,
|
||||||
T1.unit_conversion_ratio AS unit_conversion_ratio,
|
T1.category_code AS category_code,
|
||||||
T1.part_attribute_enum AS part_attribute_enum,
|
T1.pharmacology_category_code AS pharmacology_category_code,
|
||||||
T1.tho_part_attribute_enum AS tho_part_attribute_enum,
|
T1.part_percent AS part_percent,
|
||||||
T1.skin_test_flag AS skin_test_flag,
|
T1.unit_conversion_ratio AS unit_conversion_ratio,
|
||||||
T1.inject_flag AS inject_flag,
|
T1.part_attribute_enum AS part_attribute_enum,
|
||||||
T1.ID AS advice_definition_id,
|
T1.tho_part_attribute_enum AS tho_part_attribute_enum,
|
||||||
T1.NAME AS advice_name,
|
T1.skin_test_flag AS skin_test_flag,
|
||||||
T1.bus_no AS advice_bus_no,
|
T1.inject_flag AS inject_flag,
|
||||||
T1.py_str AS py_str,
|
T1.ID AS advice_definition_id,
|
||||||
T1.wb_str AS wb_str,
|
T1.NAME AS advice_name,
|
||||||
T1.yb_no AS yb_no,
|
T1.bus_no AS advice_bus_no,
|
||||||
T1.merchandise_name AS product_name,
|
T1.py_str AS py_str,
|
||||||
0 AS activity_type,
|
T1.wb_str AS wb_str,
|
||||||
T1.unit_code AS unit_code,
|
T1.yb_no AS yb_no,
|
||||||
T1.min_unit_code AS min_unit_code,
|
T1.merchandise_name AS product_name,
|
||||||
T2.total_volume AS volume,
|
0 AS activity_type,
|
||||||
T2.method_code AS method_code,
|
T1.unit_code AS unit_code,
|
||||||
T2.rate_code AS rate_code,
|
T1.min_unit_code AS min_unit_code,
|
||||||
T2.org_id AS org_id,
|
T2.total_volume AS volume,
|
||||||
T2.location_id AS location_id,
|
T2.method_code AS method_code,
|
||||||
CAST(T2.dose AS TEXT) AS dose,
|
T2.rate_code AS rate_code,
|
||||||
T2.dose_unit_code AS dose_unit_code,
|
T2.org_id AS org_id,
|
||||||
T3.NAME AS supplier,
|
T2.location_id AS location_id,
|
||||||
T3.id AS supplier_id,
|
CAST(T2.dose AS TEXT) AS dose,
|
||||||
T1.manufacturer_text AS manufacturer,
|
T2.dose_unit_code AS dose_unit_code,
|
||||||
T5.id AS charge_item_definition_id,
|
T3.NAME AS supplier,
|
||||||
T5.instance_table AS advice_table_name,
|
T3.id AS supplier_id,
|
||||||
T6.def_location_id AS position_id,
|
T1.manufacturer_text AS manufacturer,
|
||||||
t1.restricted_flag AS restricted_flag,
|
T5.id AS charge_item_definition_id,
|
||||||
t1.restricted_scope AS restricted_scope,
|
T5.instance_table AS advice_table_name,
|
||||||
T1.dosage_instruction AS dosage_instruction,
|
T6.def_location_id AS position_id,
|
||||||
T1.chrgitm_lv as chrgitm_lv
|
t1.restricted_flag AS restricted_flag,
|
||||||
FROM med_medication_definition AS t1
|
t1.restricted_scope AS restricted_scope,
|
||||||
INNER JOIN med_medication AS T2 ON T2.medication_def_id = T1.ID
|
T1.dosage_instruction AS dosage_instruction,
|
||||||
AND T2.delete_flag = '0' AND T2.status_enum = #{statusEnum}
|
T1.chrgitm_lv as chrgitm_lv
|
||||||
LEFT JOIN adm_supplier AS T3
|
FROM med_medication_definition AS t1
|
||||||
ON T3.ID = T1.supply_id
|
INNER JOIN med_medication AS T2 ON T2.medication_def_id = T1.ID
|
||||||
AND T3.delete_flag = '0'
|
AND T2.delete_flag = '0' AND T2.status_enum = #{statusEnum}
|
||||||
LEFT JOIN adm_charge_item_definition AS T5 ON T5.instance_id = T1.ID
|
LEFT JOIN adm_supplier AS T3
|
||||||
AND T5.delete_flag = '0' AND T5.status_enum = #{statusEnum}
|
ON T3.ID = T1.supply_id
|
||||||
LEFT JOIN adm_organization_location AS T6
|
AND T3.delete_flag = '0'
|
||||||
ON T6.distribution_category_code = T1.category_code
|
LEFT JOIN adm_charge_item_definition AS T5 ON T5.instance_id = T1.ID
|
||||||
AND T6.delete_flag = '0' AND T6.item_code = '1' AND T6.organization_id = #{organizationId} AND
|
AND T5.delete_flag = '0' AND T5.status_enum = #{statusEnum}
|
||||||
(CURRENT_TIME :: time (6) BETWEEN T6.start_time AND T6.end_time)
|
LEFT JOIN adm_organization_location AS T6
|
||||||
WHERE T1.delete_flag = '0'
|
ON T6.distribution_category_code = T1.category_code
|
||||||
AND T2.status_enum = #{statusEnum}
|
AND T6.delete_flag = '0' AND T6.item_code = '1' AND T6.organization_id = #{organizationId} AND
|
||||||
<if test="pricingFlag ==1">
|
(CURRENT_TIME :: time (6) BETWEEN T6.start_time AND T6.end_time)
|
||||||
AND 1 = 2
|
WHERE T1.delete_flag = '0'
|
||||||
|
AND T2.status_enum = #{statusEnum}
|
||||||
|
<if test="pricingFlag ==1">
|
||||||
|
AND 1 = 2
|
||||||
|
</if>
|
||||||
|
<if test="adviceDefinitionIdParamList != null and !adviceDefinitionIdParamList.isEmpty()">
|
||||||
|
AND T1.id IN
|
||||||
|
<foreach collection="adviceDefinitionIdParamList" item="itemId" open="(" separator="," close=")">
|
||||||
|
#{itemId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
AND T5.instance_table = #{medicationTableName}
|
||||||
|
)
|
||||||
|
<if test="adviceTypes.contains(2) or adviceTypes.contains(3)">UNION ALL</if>
|
||||||
</if>
|
</if>
|
||||||
<if test="adviceDefinitionIdParamList != null and !adviceDefinitionIdParamList.isEmpty()">
|
|
||||||
AND T1.id IN
|
<if test="adviceTypes.contains(2)">
|
||||||
<foreach collection="adviceDefinitionIdParamList" item="itemId" open="(" separator="," close=")">
|
(SELECT
|
||||||
#{itemId}
|
DISTINCT ON (T1.ID)
|
||||||
</foreach>
|
T1.tenant_id,
|
||||||
|
2 AS advice_type,
|
||||||
|
T1.bus_no AS bus_no,
|
||||||
|
T1.category_code AS category_code,
|
||||||
|
'' AS pharmacology_category_code,
|
||||||
|
T1.part_percent AS part_percent,
|
||||||
|
0 AS unit_conversion_ratio,
|
||||||
|
null AS part_attribute_enum,
|
||||||
|
null AS tho_part_attribute_enum,
|
||||||
|
null AS skin_test_flag,
|
||||||
|
null AS inject_flag,
|
||||||
|
T1.ID AS advice_definition_id,
|
||||||
|
T1.NAME AS advice_name,
|
||||||
|
T1.bus_no AS advice_bus_no,
|
||||||
|
T1.py_str AS py_str,
|
||||||
|
T1.wb_str AS wb_str,
|
||||||
|
T1.yb_no AS yb_no,
|
||||||
|
'' AS product_name,
|
||||||
|
0 AS activity_type,
|
||||||
|
T1.unit_code AS unit_code,
|
||||||
|
T1.min_unit_code AS min_unit_code,
|
||||||
|
T1.SIZE AS volume,
|
||||||
|
'' AS method_code,
|
||||||
|
'' AS rate_code,
|
||||||
|
T1.org_id AS org_id,
|
||||||
|
T1.location_id AS location_id,
|
||||||
|
'' AS dose,
|
||||||
|
'' AS dose_unit_code,
|
||||||
|
T2.NAME AS supplier,
|
||||||
|
T2.id AS supplier_id,
|
||||||
|
T1.manufacturer_text AS manufacturer,
|
||||||
|
T4.id AS charge_item_definition_id,
|
||||||
|
T4.instance_table AS advice_table_name,
|
||||||
|
T5.def_location_id AS position_id,
|
||||||
|
0 AS restricted_flag,
|
||||||
|
'' AS restricted_scope,
|
||||||
|
'' AS dosage_instruction,
|
||||||
|
T1.chrgitm_lv as chrgitm_lv
|
||||||
|
FROM adm_device_definition AS T1
|
||||||
|
LEFT JOIN adm_supplier AS T2
|
||||||
|
ON T2.ID = T1.supply_id
|
||||||
|
AND T2.delete_flag = '0'
|
||||||
|
LEFT JOIN adm_charge_item_definition AS T4 ON T4.instance_id = T1.ID
|
||||||
|
AND T4.delete_flag = '0' AND T4.status_enum = #{statusEnum}
|
||||||
|
LEFT JOIN adm_organization_location AS T5 ON T5.distribution_category_code = T1.category_code
|
||||||
|
AND T5.delete_flag = '0' AND T5.item_code = '2' AND T5.organization_id = #{organizationId} AND
|
||||||
|
(CURRENT_TIME :: time (6) BETWEEN T5.start_time AND T5.end_time)
|
||||||
|
WHERE T1.delete_flag = '0'
|
||||||
|
<if test="adviceDefinitionIdParamList != null and !adviceDefinitionIdParamList.isEmpty()">
|
||||||
|
AND T1.id IN
|
||||||
|
<foreach collection="adviceDefinitionIdParamList" item="itemId" open="(" separator="," close=")">
|
||||||
|
#{itemId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
AND T4.instance_table = #{deviceTableName}
|
||||||
|
AND T1.status_enum = #{statusEnum}
|
||||||
|
)
|
||||||
|
<if test="adviceTypes.contains(3)">UNION ALL</if>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="adviceTypes.contains(3)">
|
||||||
|
(SELECT
|
||||||
|
DISTINCT ON (T1.ID)
|
||||||
|
T1.tenant_id,
|
||||||
|
3 AS advice_type,
|
||||||
|
T1.bus_no AS bus_no,
|
||||||
|
T1.category_code AS category_code,
|
||||||
|
'' AS pharmacology_category_code,
|
||||||
|
1 AS part_percent,
|
||||||
|
0 AS unit_conversion_ratio,
|
||||||
|
null AS part_attribute_enum,
|
||||||
|
null AS tho_part_attribute_enum,
|
||||||
|
null AS skin_test_flag,
|
||||||
|
null AS inject_flag,
|
||||||
|
T1.ID AS advice_definition_id,
|
||||||
|
T1.NAME AS advice_name,
|
||||||
|
T1.bus_no AS advice_bus_no,
|
||||||
|
T1.py_str AS py_str,
|
||||||
|
T1.wb_str AS wb_str,
|
||||||
|
T1.yb_no AS yb_no,
|
||||||
|
'' AS product_name,
|
||||||
|
T1.type_enum AS activity_type,
|
||||||
|
'' AS unit_code,
|
||||||
|
'' AS min_unit_code,
|
||||||
|
'' AS volume,
|
||||||
|
'' AS method_code,
|
||||||
|
'' AS rate_code,
|
||||||
|
T1.org_id AS org_id,
|
||||||
|
T1.location_id AS location_id,
|
||||||
|
'' AS dose,
|
||||||
|
'' AS dose_unit_code,
|
||||||
|
'' AS supplier,
|
||||||
|
null AS supplier_id,
|
||||||
|
'' AS manufacturer,
|
||||||
|
T2.ID AS charge_item_definition_id,
|
||||||
|
T2.instance_table AS advice_table_name,
|
||||||
|
T3.organization_id AS position_id,
|
||||||
|
0 AS restricted_flag,
|
||||||
|
'' AS restricted_scope,
|
||||||
|
'' AS dosage_instruction,
|
||||||
|
T1.chrgitm_lv as chrgitm_lv
|
||||||
|
FROM wor_activity_definition AS T1
|
||||||
|
LEFT JOIN adm_charge_item_definition AS T2
|
||||||
|
ON T2.instance_id = T1.ID
|
||||||
|
AND T2.delete_flag = '0' AND T2.status_enum = #{statusEnum}
|
||||||
|
AND T2.instance_table = #{activityTableName}
|
||||||
|
LEFT JOIN adm_organization_location AS T3 ON T3.activity_definition_id = T1.ID
|
||||||
|
AND T3.delete_flag = '0' AND (CURRENT_TIME :: time (6) BETWEEN T3.start_time AND T3.end_time)
|
||||||
|
WHERE T1.delete_flag = '0'
|
||||||
|
<if test="pricingFlag ==1">
|
||||||
|
AND (T1.pricing_flag = #{pricingFlag} OR T1.pricing_flag IS NULL)
|
||||||
|
</if>
|
||||||
|
<if test="adviceDefinitionIdParamList != null and !adviceDefinitionIdParamList.isEmpty()">
|
||||||
|
AND T1.id IN
|
||||||
|
<foreach collection="adviceDefinitionIdParamList" item="itemId" open="(" separator="," close=")">
|
||||||
|
#{itemId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
AND T1.status_enum = #{statusEnum}
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
AND T5.instance_table = #{medicationTableName}
|
|
||||||
)
|
|
||||||
</if>
|
</if>
|
||||||
|
<!-- 如果没有有效的adviceTypes,提供一个空的默认查询以避免语法错误 -->
|
||||||
|
<if test="adviceTypes == null or adviceTypes.isEmpty() or (!adviceTypes.contains(1) and !adviceTypes.contains(2) and !adviceTypes.contains(3))">
|
||||||
<if test="adviceTypes == null or adviceTypes.contains(1)">
|
SELECT
|
||||||
<if test="adviceTypes == null or adviceTypes.contains(2) or adviceTypes.contains(3)">UNION ALL</if>
|
mmd.tenant_id,
|
||||||
</if>
|
CAST(0 AS INTEGER) AS advice_type,
|
||||||
|
CAST('' AS VARCHAR) AS bus_no,
|
||||||
<if test="adviceTypes == null or adviceTypes.contains(2)">
|
CAST('' AS VARCHAR) AS category_code,
|
||||||
(SELECT
|
CAST('' AS VARCHAR) AS pharmacology_category_code,
|
||||||
DISTINCT ON (T1.ID)
|
CAST(0 AS NUMERIC) AS part_percent,
|
||||||
T1.tenant_id,
|
CAST(0 AS NUMERIC) AS unit_conversion_ratio,
|
||||||
2 AS advice_type,
|
CAST(0 AS INTEGER) AS part_attribute_enum,
|
||||||
T1.bus_no AS bus_no,
|
CAST(0 AS INTEGER) AS tho_part_attribute_enum,
|
||||||
T1.category_code AS category_code,
|
CAST(0 AS INTEGER) AS skin_test_flag,
|
||||||
'' AS pharmacology_category_code,
|
CAST(0 AS INTEGER) AS inject_flag,
|
||||||
T1.part_percent AS part_percent,
|
CAST(0 AS BIGINT) AS advice_definition_id,
|
||||||
0 AS unit_conversion_ratio,
|
CAST('' AS VARCHAR) AS advice_name,
|
||||||
null AS part_attribute_enum,
|
CAST('' AS VARCHAR) AS advice_bus_no,
|
||||||
null AS tho_part_attribute_enum,
|
CAST('' AS VARCHAR) AS py_str,
|
||||||
null AS skin_test_flag,
|
CAST('' AS VARCHAR) AS wb_str,
|
||||||
null AS inject_flag,
|
CAST('' AS VARCHAR) AS yb_no,
|
||||||
T1.ID AS advice_definition_id,
|
CAST('' AS VARCHAR) AS product_name,
|
||||||
T1.NAME AS advice_name,
|
CAST(0 AS INTEGER) AS activity_type,
|
||||||
T1.bus_no AS advice_bus_no,
|
CAST('' AS VARCHAR) AS unit_code,
|
||||||
T1.py_str AS py_str,
|
CAST('' AS VARCHAR) AS min_unit_code,
|
||||||
T1.wb_str AS wb_str,
|
CAST(0 AS NUMERIC) AS volume,
|
||||||
T1.yb_no AS yb_no,
|
CAST('' AS VARCHAR) AS method_code,
|
||||||
'' AS product_name,
|
CAST('' AS VARCHAR) AS rate_code,
|
||||||
0 AS activity_type,
|
CAST(0 AS BIGINT) AS org_id,
|
||||||
T1.unit_code AS unit_code,
|
CAST(0 AS BIGINT) AS location_id,
|
||||||
T1.min_unit_code AS min_unit_code,
|
CAST('' AS VARCHAR) AS dose,
|
||||||
T1.SIZE AS volume,
|
CAST('' AS VARCHAR) AS dose_unit_code,
|
||||||
'' AS method_code,
|
CAST('' AS VARCHAR) AS supplier,
|
||||||
'' AS rate_code,
|
CAST(0 AS BIGINT) AS supplier_id,
|
||||||
T1.org_id AS org_id,
|
CAST('' AS VARCHAR) AS manufacturer,
|
||||||
T1.location_id AS location_id,
|
CAST(0 AS BIGINT) AS charge_item_definition_id,
|
||||||
'' AS dose,
|
CAST('' AS VARCHAR) AS advice_table_name,
|
||||||
'' AS dose_unit_code,
|
CAST(0 AS BIGINT) AS position_id,
|
||||||
T2.NAME AS supplier,
|
CAST(0 AS INTEGER) AS restricted_flag,
|
||||||
T2.id AS supplier_id,
|
CAST('' AS VARCHAR) AS restricted_scope,
|
||||||
T1.manufacturer_text AS manufacturer,
|
CAST('' AS VARCHAR) AS dosage_instruction,
|
||||||
T4.id AS charge_item_definition_id,
|
CAST(0 AS INTEGER) AS chrgitm_lv
|
||||||
T4.instance_table AS advice_table_name,
|
FROM med_medication_definition mmd
|
||||||
T5.def_location_id AS position_id,
|
WHERE 1 = 0 -- 仍然确保不返回任何行,但使用真实表确保类型正确
|
||||||
0 AS restricted_flag,
|
|
||||||
'' AS restricted_scope,
|
|
||||||
'' AS dosage_instruction,
|
|
||||||
T1.chrgitm_lv as chrgitm_lv
|
|
||||||
FROM adm_device_definition AS T1
|
|
||||||
LEFT JOIN adm_supplier AS T2
|
|
||||||
ON T2.ID = T1.supply_id
|
|
||||||
AND T2.delete_flag = '0'
|
|
||||||
LEFT JOIN adm_charge_item_definition AS T4 ON T4.instance_id = T1.ID
|
|
||||||
AND T4.delete_flag = '0' AND T4.status_enum = #{statusEnum}
|
|
||||||
LEFT JOIN adm_organization_location AS T5 ON T5.distribution_category_code = T1.category_code
|
|
||||||
AND T5.delete_flag = '0' AND T5.item_code = '2' AND T5.organization_id = #{organizationId} AND
|
|
||||||
(CURRENT_TIME :: time (6) BETWEEN T5.start_time AND T5.end_time)
|
|
||||||
WHERE T1.delete_flag = '0'
|
|
||||||
<if test="adviceDefinitionIdParamList != null and !adviceDefinitionIdParamList.isEmpty()">
|
|
||||||
AND T1.id IN
|
|
||||||
<foreach collection="adviceDefinitionIdParamList" item="itemId" open="(" separator="," close=")">
|
|
||||||
#{itemId}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
AND T4.instance_table = #{deviceTableName}
|
|
||||||
AND T1.status_enum = #{statusEnum}
|
|
||||||
)
|
|
||||||
</if>
|
|
||||||
|
|
||||||
|
|
||||||
<if test="adviceTypes == null or adviceTypes.contains(2)">
|
|
||||||
<if test="adviceTypes == null or adviceTypes.contains(3)">UNION ALL</if>
|
|
||||||
</if>
|
|
||||||
|
|
||||||
<if test="adviceTypes == null or adviceTypes.contains(3)">
|
|
||||||
(SELECT
|
|
||||||
DISTINCT ON (T1.ID)
|
|
||||||
T1.tenant_id,
|
|
||||||
3 AS advice_type,
|
|
||||||
T1.bus_no AS bus_no,
|
|
||||||
T1.category_code AS category_code,
|
|
||||||
'' AS pharmacology_category_code,
|
|
||||||
1 AS part_percent,
|
|
||||||
0 AS unit_conversion_ratio,
|
|
||||||
null AS part_attribute_enum,
|
|
||||||
null AS tho_part_attribute_enum,
|
|
||||||
null AS skin_test_flag,
|
|
||||||
null AS inject_flag,
|
|
||||||
T1.ID AS advice_definition_id,
|
|
||||||
T1.NAME AS advice_name,
|
|
||||||
T1.bus_no AS advice_bus_no,
|
|
||||||
T1.py_str AS py_str,
|
|
||||||
T1.wb_str AS wb_str,
|
|
||||||
T1.yb_no AS yb_no,
|
|
||||||
'' AS product_name,
|
|
||||||
T1.type_enum AS activity_type,
|
|
||||||
'' AS unit_code,
|
|
||||||
'' AS min_unit_code,
|
|
||||||
'' AS volume,
|
|
||||||
'' AS method_code,
|
|
||||||
'' AS rate_code,
|
|
||||||
T1.org_id AS org_id,
|
|
||||||
T1.location_id AS location_id,
|
|
||||||
'' AS dose,
|
|
||||||
'' AS dose_unit_code,
|
|
||||||
'' AS supplier,
|
|
||||||
null AS supplier_id,
|
|
||||||
'' AS manufacturer,
|
|
||||||
T2.ID AS charge_item_definition_id,
|
|
||||||
T2.instance_table AS advice_table_name,
|
|
||||||
T3.organization_id AS position_id,
|
|
||||||
0 AS restricted_flag,
|
|
||||||
'' AS restricted_scope,
|
|
||||||
'' AS dosage_instruction,
|
|
||||||
T1.chrgitm_lv as chrgitm_lv
|
|
||||||
FROM wor_activity_definition AS T1
|
|
||||||
LEFT JOIN adm_charge_item_definition AS T2
|
|
||||||
ON T2.instance_id = T1.ID
|
|
||||||
AND T2.delete_flag = '0' AND T2.status_enum = #{statusEnum}
|
|
||||||
AND T2.instance_table = #{activityTableName}
|
|
||||||
LEFT JOIN adm_organization_location AS T3 ON T3.activity_definition_id = T1.ID
|
|
||||||
AND T3.delete_flag = '0' AND (CURRENT_TIME :: time (6) BETWEEN T3.start_time AND T3.end_time)
|
|
||||||
WHERE T1.delete_flag = '0'
|
|
||||||
<if test="pricingFlag ==1">
|
|
||||||
AND (T1.pricing_flag = #{pricingFlag} OR T1.pricing_flag IS NULL)
|
|
||||||
</if>
|
|
||||||
<if test="adviceDefinitionIdParamList != null and !adviceDefinitionIdParamList.isEmpty()">
|
|
||||||
AND T1.id IN
|
|
||||||
<foreach collection="adviceDefinitionIdParamList" item="itemId" open="(" separator="," close=")">
|
|
||||||
#{itemId}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
AND T1.status_enum = #{statusEnum}
|
|
||||||
)
|
|
||||||
</if>
|
</if>
|
||||||
) AS abi
|
) AS abi
|
||||||
${ew.customSqlSegment}
|
${ew.customSqlSegment}
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
T10.reception_time,
|
T10.reception_time,
|
||||||
T10.practitioner_user_id,
|
T10.practitioner_user_id,
|
||||||
T10.jz_practitioner_user_id,
|
T10.jz_practitioner_user_id,
|
||||||
T10.bus_no
|
T10.bus_no,
|
||||||
|
T10.identifier_no
|
||||||
from
|
from
|
||||||
(
|
(
|
||||||
SELECT T1.tenant_id AS tenant_id,
|
SELECT T1.tenant_id AS tenant_id,
|
||||||
@@ -48,7 +49,8 @@
|
|||||||
T1.create_time AS register_time,
|
T1.create_time AS register_time,
|
||||||
T1.reception_time AS reception_time,
|
T1.reception_time AS reception_time,
|
||||||
T1.organization_id AS org_id,
|
T1.organization_id AS org_id,
|
||||||
T8.bus_no AS bus_no
|
T8.bus_no AS bus_no,
|
||||||
|
T9.identifier_no AS identifier_no
|
||||||
FROM adm_encounter AS T1
|
FROM adm_encounter AS T1
|
||||||
LEFT JOIN adm_organization AS T2 ON T1.organization_id = T2.ID AND T2.delete_flag = '0'
|
LEFT JOIN adm_organization AS T2 ON T1.organization_id = T2.ID AND T2.delete_flag = '0'
|
||||||
LEFT JOIN adm_healthcare_service AS T3 ON T1.service_type_id = T3.ID AND T3.delete_flag = '0'
|
LEFT JOIN adm_healthcare_service AS T3 ON T1.service_type_id = T3.ID AND T3.delete_flag = '0'
|
||||||
@@ -67,6 +69,20 @@
|
|||||||
LEFT JOIN adm_account AS T6 ON T1.ID = T6.encounter_id AND T6.delete_flag = '0' and T6.encounter_flag = '1'
|
LEFT JOIN adm_account AS T6 ON T1.ID = T6.encounter_id AND T6.delete_flag = '0' and T6.encounter_flag = '1'
|
||||||
LEFT JOIN fin_contract AS T7 ON T6.contract_no = T7.bus_no AND T7.delete_flag = '0'
|
LEFT JOIN fin_contract AS T7 ON T6.contract_no = T7.bus_no AND T7.delete_flag = '0'
|
||||||
LEFT JOIN adm_patient AS T8 ON T1.patient_id = T8.ID AND T8.delete_flag = '0'
|
LEFT JOIN adm_patient AS T8 ON T1.patient_id = T8.ID AND T8.delete_flag = '0'
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT patient_id,
|
||||||
|
identifier_no
|
||||||
|
FROM (
|
||||||
|
SELECT patient_id,
|
||||||
|
identifier_no,
|
||||||
|
ROW_NUMBER() OVER (PARTITION BY patient_id ORDER BY create_time ASC) AS rn
|
||||||
|
FROM adm_patient_identifier
|
||||||
|
WHERE delete_flag = '0'
|
||||||
|
AND identifier_no IS NOT NULL
|
||||||
|
AND identifier_no != ''
|
||||||
|
) t
|
||||||
|
WHERE rn = 1
|
||||||
|
) AS T9 ON T8.id = T9.patient_id
|
||||||
WHERE
|
WHERE
|
||||||
T1.delete_flag = '0'
|
T1.delete_flag = '0'
|
||||||
<!-- 当前登录账号ID 和 当前登录账号所属的科室ID 用于控制数据权限 -->
|
<!-- 当前登录账号ID 和 当前登录账号所属的科室ID 用于控制数据权限 -->
|
||||||
|
|||||||
@@ -44,8 +44,16 @@ public class EncounterServiceImpl extends ServiceImpl<EncounterMapper, Encounter
|
|||||||
// 生成就诊编码 医保挂号时是先生成码后生成实体
|
// 生成就诊编码 医保挂号时是先生成码后生成实体
|
||||||
encounter.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.ENCOUNTER_NUM.getPrefix(), 4));
|
encounter.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.ENCOUNTER_NUM.getPrefix(), 4));
|
||||||
}
|
}
|
||||||
// 生成就诊序号 (患者ID + 科室ID 作为当日就诊号的唯一标识)
|
// 生成就诊序号:
|
||||||
String preFix = encounter.getPatientId() + String.valueOf(encounter.getOrganizationId());
|
// 1) 若挂号医生已传入(registrarId 充当挂号医生 ID),按“科室+医生+当日”递增
|
||||||
|
// Key 示例:ORG-123-DOC-456 -> 1、2、3...
|
||||||
|
// 2) 否则按“科室+当日”递增
|
||||||
|
String preFix;
|
||||||
|
if (encounter.getRegistrarId() != null) {
|
||||||
|
preFix = "ORG-" + encounter.getOrganizationId() + "-DOC-" + encounter.getRegistrarId();
|
||||||
|
} else {
|
||||||
|
preFix = "ORG-" + encounter.getOrganizationId();
|
||||||
|
}
|
||||||
encounter.setDisplayOrder(assignSeqUtil.getSeqNoByDay(preFix));
|
encounter.setDisplayOrder(assignSeqUtil.getSeqNoByDay(preFix));
|
||||||
// 患者ID
|
// 患者ID
|
||||||
Long patientId = encounter.getPatientId();
|
Long patientId = encounter.getPatientId();
|
||||||
|
|||||||
@@ -528,7 +528,7 @@ async function printReceipt(param) {
|
|||||||
const vxValue = param.detail?.find((t) => t.payEnum === 220100)?.amount ?? 0;
|
const vxValue = param.detail?.find((t) => t.payEnum === 220100)?.amount ?? 0;
|
||||||
const unionValue = param.detail?.find((t) => t.payEnum === 220300)?.amount ?? 0;
|
const unionValue = param.detail?.find((t) => t.payEnum === 220300)?.amount ?? 0;
|
||||||
const aliValue = param.detail?.find((t) => t.payEnum === 220200)?.amount ?? 0;
|
const aliValue = param.detail?.find((t) => t.payEnum === 220200)?.amount ?? 0;
|
||||||
return vxValue + unionValue + aliValue + ' 元';
|
return (Number(vxValue) + Number(unionValue) + Number(aliValue)).toFixed(2) + ' 元';
|
||||||
})(),
|
})(),
|
||||||
|
|
||||||
Mr_QR_Code: param.regNo,
|
Mr_QR_Code: param.regNo,
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ function getPatientList() {
|
|||||||
queryParams.value.receptionTimeETime = undefined;
|
queryParams.value.receptionTimeETime = undefined;
|
||||||
}
|
}
|
||||||
getList(queryParams.value).then((res) => {
|
getList(queryParams.value).then((res) => {
|
||||||
patientList.value = res.data.data.records;
|
patientList.value = res.data?.data?.records || [];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,17 +363,17 @@ function confirmCharge() {
|
|||||||
encounterId: patientInfo.value.encounterId,
|
encounterId: patientInfo.value.encounterId,
|
||||||
chargeItemIds: chargeItemIdList.value,
|
chargeItemIds: chargeItemIdList.value,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200 && res.data) {
|
||||||
// totalAmount.value = res.data.psnCashPay;
|
// totalAmount.value = res.data.psnCashPay;
|
||||||
paymentId.value = res.data.paymentId;
|
paymentId.value = res.data.paymentId;
|
||||||
chrgBchnoList.value = res.data.chrgBchnoList;
|
chrgBchnoList.value = res.data.chrgBchnoList;
|
||||||
totalAmount.value = res.data.details.find((item) => item.payEnum == 220000).amount;
|
totalAmount.value = res.data.details?.find((item) => item.payEnum == 220000)?.amount ?? 0;
|
||||||
details.value = res.data.details.filter((item) => {
|
details.value = res.data.details?.filter((item) => {
|
||||||
return item.amount > 0;
|
return item.amount > 0;
|
||||||
});
|
}) || [];
|
||||||
openDialog.value = true;
|
openDialog.value = true;
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError(res.msg);
|
proxy.$modal.msgError(res?.msg || '预结算失败');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// console.log(patientInfo)
|
// console.log(patientInfo)
|
||||||
@@ -517,11 +517,11 @@ async function handleReadCard(value) {
|
|||||||
ybMdtrtCertType: userCardInfo.psnCertType,
|
ybMdtrtCertType: userCardInfo.psnCertType,
|
||||||
busiCardInfo: userCardInfo.busiCardInfo,
|
busiCardInfo: userCardInfo.busiCardInfo,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200 && res.data) {
|
||||||
// totalAmount.value = res.data.psnCashPay;
|
// totalAmount.value = res.data.psnCashPay;
|
||||||
paymentId.value = res.data.paymentId;
|
paymentId.value = res.data.paymentId;
|
||||||
totalAmount.value = res.data.details.find((item) => item.payEnum == 220000).amount;
|
totalAmount.value = res.data.details?.find((item) => item.payEnum == 220000)?.amount ?? 0;
|
||||||
details.value = res.data.details;
|
details.value = res.data.details || [];
|
||||||
// chrgBchnoList.value = res.data.chrgBchnoList;
|
// chrgBchnoList.value = res.data.chrgBchnoList;
|
||||||
chargeItemIdList.value = selectRows.map((item) => {
|
chargeItemIdList.value = selectRows.map((item) => {
|
||||||
return item.id;
|
return item.id;
|
||||||
@@ -537,7 +537,7 @@ async function handleReadCard(value) {
|
|||||||
});
|
});
|
||||||
openDialog.value = true;
|
openDialog.value = true;
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError(res.msg);
|
proxy.$modal.msgError(res?.msg || '预结算失败');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -648,9 +648,9 @@ function printCharge(row) {
|
|||||||
getChargeInfo({ paymentId: row.paymentId }).then((res) => {
|
getChargeInfo({ paymentId: row.paymentId }).then((res) => {
|
||||||
// 设置实收金额
|
// 设置实收金额
|
||||||
if (res.data && res.data.detail) {
|
if (res.data && res.data.detail) {
|
||||||
const amountDetail = res.data.detail.find((item) => item.payEnum == 220000);
|
const amountDetail = res.data.detail?.find((item) => item.payEnum == 220000);
|
||||||
if (amountDetail) {
|
if (amountDetail) {
|
||||||
totalAmount.value = amountDetail.amount;
|
totalAmount.value = amountDetail.amount || 0;
|
||||||
|
|
||||||
// 为合并的行设置金额相关字段值
|
// 为合并的行设置金额相关字段值
|
||||||
rows.forEach((item) => {
|
rows.forEach((item) => {
|
||||||
|
|||||||
@@ -302,14 +302,14 @@ function handleRefund(row) {
|
|||||||
// return new Decimal(accumulator).add(new Decimal(currentRow.totalPrice || 0));
|
// return new Decimal(accumulator).add(new Decimal(currentRow.totalPrice || 0));
|
||||||
// }, 0);
|
// }, 0);
|
||||||
getReturnDetail({ id: row.paymentId }).then((res) => {
|
getReturnDetail({ id: row.paymentId }).then((res) => {
|
||||||
if (res.data.length > 0) {
|
if (res.data?.length > 0) {
|
||||||
totalAmount.value =
|
totalAmount.value =
|
||||||
res.data.find((item) => item.payEnum === 220000).amount -
|
(res.data.find((item) => item.payEnum === 220000)?.amount ?? 0) -
|
||||||
(res.data.find((item) => item.payEnum === 220500)?.amount || 0);
|
(res.data.find((item) => item.payEnum === 220500)?.amount ?? 0);
|
||||||
}
|
}
|
||||||
details.value = res.data.filter((item) => {
|
details.value = res.data?.filter((item) => {
|
||||||
return item.amount > 0;
|
return item.amount > 0;
|
||||||
});
|
}) || [];
|
||||||
});
|
});
|
||||||
paymentId.value = row.paymentId;
|
paymentId.value = row.paymentId;
|
||||||
patientInfo.value.patientId = row.patientId;
|
patientInfo.value.patientId = row.patientId;
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ const getFeeTypeText = computed(() => {
|
|||||||
}
|
}
|
||||||
// 如果只有一个选项,直接返回第一个选项的文本
|
// 如果只有一个选项,直接返回第一个选项的文本
|
||||||
if (props.medfee_paymtd_code.length === 1) {
|
if (props.medfee_paymtd_code.length === 1) {
|
||||||
return props.medfee_paymtd_code[0].label || '';
|
return props.medfee_paymtd_code[0]?.label || '';
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
});
|
});
|
||||||
@@ -351,7 +351,7 @@ async function printReceipt(param) {
|
|||||||
const vxValue = param.detail?.find((t) => t.payEnum === 220100)?.amount ?? 0;
|
const vxValue = param.detail?.find((t) => t.payEnum === 220100)?.amount ?? 0;
|
||||||
const unionValue = param.detail?.find((t) => t.payEnum === 220300)?.amount ?? 0;
|
const unionValue = param.detail?.find((t) => t.payEnum === 220300)?.amount ?? 0;
|
||||||
const aliValue = param.detail?.find((t) => t.payEnum === 220200)?.amount ?? 0;
|
const aliValue = param.detail?.find((t) => t.payEnum === 220200)?.amount ?? 0;
|
||||||
return vxValue + unionValue + aliValue + '元';
|
return (Number(vxValue) + Number(unionValue) + Number(aliValue)).toFixed(2) + '元';
|
||||||
})(),
|
})(),
|
||||||
|
|
||||||
// 患者信息
|
// 患者信息
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ watch(
|
|||||||
// 计算应退金额并更新表单数据
|
// 计算应退金额并更新表单数据
|
||||||
const targetPayEnums = [220500, 220400, 220100, 220200, 220300];
|
const targetPayEnums = [220500, 220400, 220100, 220200, 220300];
|
||||||
const sum = res.data
|
const sum = res.data
|
||||||
.filter((item) => targetPayEnums.includes(item.payEnum))
|
?.filter((item) => targetPayEnums.includes(item.payEnum))
|
||||||
.reduce((total, item) => total + (Number(item.amount) || 0), 0);
|
.reduce((total, item) => total + (Number(item.amount) || 0), 0);
|
||||||
if (sum > 0) {
|
if (sum > 0) {
|
||||||
formData.totalAmount = sum;
|
formData.totalAmount = sum;
|
||||||
@@ -313,9 +313,9 @@ const displayAmount = computed(() => {
|
|||||||
}
|
}
|
||||||
const targetPayEnums = [220500, 220400, 220100, 220200, 220300];
|
const targetPayEnums = [220500, 220400, 220100, 220200, 220300];
|
||||||
const sum = preCancelData.value
|
const sum = preCancelData.value
|
||||||
.filter((item) => targetPayEnums.includes(item.payEnum))
|
?.filter((item) => targetPayEnums.includes(item.payEnum))
|
||||||
.reduce((sum, item) => sum + (Number(item.amount) || 0), 0);
|
.reduce((sum, item) => sum + (Number(item.amount) || 0), 0);
|
||||||
return sum.toFixed(2);
|
return sum?.toFixed(2) ?? '0.00';
|
||||||
});
|
});
|
||||||
|
|
||||||
const returnedAmount = computed(() => {
|
const returnedAmount = computed(() => {
|
||||||
@@ -334,7 +334,7 @@ const calculatedTotalAmount = computed(() => {
|
|||||||
const targetPayEnums = [220500, 220400, 220100, 220200, 220300];
|
const targetPayEnums = [220500, 220400, 220100, 220200, 220300];
|
||||||
// 应退金额 = (amount - returnAmount) 的总和,即剩余应退金额
|
// 应退金额 = (amount - returnAmount) 的总和,即剩余应退金额
|
||||||
const sum = preCancelData.value
|
const sum = preCancelData.value
|
||||||
.filter((item) => targetPayEnums.includes(item.payEnum))
|
?.filter((item) => targetPayEnums.includes(item.payEnum))
|
||||||
.reduce(
|
.reduce(
|
||||||
(total, item) => total + ((Number(item.amount) || 0) - (Number(item.returnAmount) || 0)),
|
(total, item) => total + ((Number(item.amount) || 0) - (Number(item.returnAmount) || 0)),
|
||||||
0
|
0
|
||||||
@@ -348,7 +348,7 @@ const calculatedReturnAmount = computed(() => {
|
|||||||
}
|
}
|
||||||
const targetPayEnums = [220500, 220400, 220100, 220200, 220300];
|
const targetPayEnums = [220500, 220400, 220100, 220200, 220300];
|
||||||
const sum = preCancelData.value
|
const sum = preCancelData.value
|
||||||
.filter((item) => targetPayEnums.includes(item.payEnum))
|
?.filter((item) => targetPayEnums.includes(item.payEnum))
|
||||||
.reduce((total, item) => total + (Number(item.returnAmount) || 0), 0);
|
.reduce((total, item) => total + (Number(item.returnAmount) || 0), 0);
|
||||||
return sum || 0;
|
return sum || 0;
|
||||||
});
|
});
|
||||||
@@ -359,12 +359,12 @@ const refundMethodsFromApi = computed(() => {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const targetPayEnums = [220500, 220400, 220100, 220200, 220300];
|
const targetPayEnums = [220500, 220400, 220100, 220200, 220300];
|
||||||
return preCancelData.value.filter(
|
return preCancelData.value?.filter(
|
||||||
(item) =>
|
(item) =>
|
||||||
targetPayEnums.includes(item.payEnum) &&
|
targetPayEnums.includes(item.payEnum) &&
|
||||||
item.payEnum_dictText &&
|
item.payEnum_dictText &&
|
||||||
item.payEnum_dictText.trim() !== ''
|
item.payEnum_dictText.trim() !== ''
|
||||||
);
|
) || [];
|
||||||
});
|
});
|
||||||
|
|
||||||
// 根据 payEnum 获取支付方式标签
|
// 根据 payEnum 获取支付方式标签
|
||||||
@@ -380,7 +380,7 @@ const getPayMethodLabel = (payEnum) => {
|
|||||||
|
|
||||||
// 计算所有退费方式的总和
|
// 计算所有退费方式的总和
|
||||||
const totalRefundAmount = computed(() => {
|
const totalRefundAmount = computed(() => {
|
||||||
return refundMethodsFromApi.value.reduce((sum, item) => sum + (Number(item.amount) || 0), 0);
|
return refundMethodsFromApi.value?.reduce((sum, item) => sum + (Number(item.amount) || 0), 0) ?? 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 计算剩余可输入金额(应退金额 - 已输入的退费金额总和)
|
// 计算剩余可输入金额(应退金额 - 已输入的退费金额总和)
|
||||||
|
|||||||
@@ -151,10 +151,6 @@
|
|||||||
<span class="label">患者姓名:</span>
|
<span class="label">患者姓名:</span>
|
||||||
<span class="value">{{ form.name || '-' }}</span>
|
<span class="value">{{ form.name || '-' }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="info-row">
|
|
||||||
<span class="label">门诊号:</span>
|
|
||||||
<span class="value">{{ form.serialNo || '-' }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="info-row">
|
<div class="info-row">
|
||||||
<span class="label">就诊卡号:</span>
|
<span class="label">就诊卡号:</span>
|
||||||
<span class="value">{{ form.cardNo || '-' }}</span>
|
<span class="value">{{ form.cardNo || '-' }}</span>
|
||||||
@@ -233,6 +229,12 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 流水号显示在左下角 -->
|
||||||
|
<div class="serial-number-bottom-left">
|
||||||
|
<span class="serial-label">流水号:</span>
|
||||||
|
<span class="serial-value">{{ form.serialNo || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="print-footer">
|
<div class="print-footer">
|
||||||
<div class="reminder">温馨提示: 请妥善保管此凭条,就诊时请携带。</div>
|
<div class="reminder">温馨提示: 请妥善保管此凭条,就诊时请携带。</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -545,29 +547,21 @@ function formatDateTime(date) {
|
|||||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算流水号(与 fillForm 中的逻辑一致)
|
// 计算流水号:直接使用挂号记录表的主键ID(encounterId)
|
||||||
function calculateSerialNo(row) {
|
function calculateSerialNo(row) {
|
||||||
if (!row) {
|
if (!row) {
|
||||||
return '-';
|
return '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 优先使用已有的 serialNo(如果存在)
|
// 直接使用主键ID作为流水号
|
||||||
if (row.serialNo) {
|
if (row.encounterId != null && row.encounterId !== undefined) {
|
||||||
return row.serialNo;
|
return String(row.encounterId);
|
||||||
|
} else if (row.id != null && row.id !== undefined) {
|
||||||
|
// 兼容其他可能的ID字段名
|
||||||
|
return String(row.id);
|
||||||
|
} else {
|
||||||
|
return '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 使用 encounterId 的后3位计算流水号
|
|
||||||
if (row.encounterId) {
|
|
||||||
const idStr = String(row.encounterId);
|
|
||||||
const lastThree = idStr.slice(-3);
|
|
||||||
const num = parseInt(lastThree) || 0;
|
|
||||||
return String((num % 999) + 1).padStart(3, '0');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果 encounterId 为空,生成一个001-999的序列号
|
|
||||||
const timestamp = Date.now();
|
|
||||||
const serial = (timestamp % 999) + 1;
|
|
||||||
return String(serial).padStart(3, '0');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提交补打挂号
|
// 提交补打挂号
|
||||||
@@ -835,6 +829,26 @@ function handleBrowserPrint() {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
.serial-number-bottom-left {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 20px;
|
||||||
|
left: 20px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.serial-number-bottom-left .serial-label {
|
||||||
|
font-weight: bold;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
.serial-number-bottom-left .serial-value {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.print-content {
|
||||||
|
position: relative;
|
||||||
|
min-height: 500px;
|
||||||
|
padding-bottom: 60px;
|
||||||
|
}
|
||||||
.print-footer {
|
.print-footer {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
@@ -1052,6 +1066,31 @@ async function handleConfirmSelect() {
|
|||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 流水号显示在左下角,加粗 */
|
||||||
|
.serial-number-bottom-left {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 20px;
|
||||||
|
left: 20px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.serial-number-bottom-left .serial-label {
|
||||||
|
font-weight: bold;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.serial-number-bottom-left .serial-value {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-content {
|
||||||
|
position: relative;
|
||||||
|
min-height: 500px;
|
||||||
|
padding-bottom: 60px; /* 为左下角流水号留出空间 */
|
||||||
|
}
|
||||||
|
|
||||||
.print-footer {
|
.print-footer {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
|||||||
@@ -801,10 +801,10 @@ const { queryParams, form, rules } = toRefs(data);
|
|||||||
|
|
||||||
/** 根据contractNo获取费用性质名称 */
|
/** 根据contractNo获取费用性质名称 */
|
||||||
function getFeeTypeName(contractNo) {
|
function getFeeTypeName(contractNo) {
|
||||||
if (!contractNo || !medfee_paymtd_code || !Array.isArray(medfee_paymtd_code)) {
|
if (!contractNo || !medfee_paymtd_code?.value || !Array.isArray(medfee_paymtd_code.value)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
const dictItem = medfee_paymtd_code.find(item => item.value === contractNo);
|
const dictItem = medfee_paymtd_code.value.find(item => item.value === contractNo);
|
||||||
return dictItem ? dictItem.label : '';
|
return dictItem ? dictItem.label : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1185,7 +1185,7 @@ function filterDoctorsByHealthcare() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取选中的挂号类型信息
|
// 获取选中的挂号类型信息
|
||||||
const selectedHealthcare = healthcareList.value.find(
|
const selectedHealthcare = healthcareList.value?.find(
|
||||||
(healthcare) => healthcare.id === form.value.serviceTypeId
|
(healthcare) => healthcare.id === form.value.serviceTypeId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -197,7 +197,10 @@ watch(
|
|||||||
|
|
||||||
// 直接更新查询参数
|
// 直接更新查询参数
|
||||||
queryParams.value.searchKey = newValue.searchKey || '';
|
queryParams.value.searchKey = newValue.searchKey || '';
|
||||||
|
|
||||||
|
// 更新categoryCode
|
||||||
|
queryParams.value.categoryCode = newValue.categoryCode || '';
|
||||||
|
|
||||||
// 处理类型筛选
|
// 处理类型筛选
|
||||||
if (newValue.adviceType !== undefined && newValue.adviceType !== null && newValue.adviceType !== '') {
|
if (newValue.adviceType !== undefined && newValue.adviceType !== null && newValue.adviceType !== '') {
|
||||||
// 单个类型
|
// 单个类型
|
||||||
@@ -215,8 +218,18 @@ getList();
|
|||||||
// 从priceList列表中获取价格
|
// 从priceList列表中获取价格
|
||||||
function getPriceFromInventory(row) {
|
function getPriceFromInventory(row) {
|
||||||
if (row.priceList && row.priceList.length > 0) {
|
if (row.priceList && row.priceList.length > 0) {
|
||||||
const price = row.priceList[0].price || 0;
|
const price = row.priceList[0].price;
|
||||||
return Number(price).toFixed(2) + ' 元';
|
// 检查价格是否为有效数字
|
||||||
|
if (price !== undefined && price !== null && !isNaN(price) && isFinite(price)) {
|
||||||
|
return Number(price).toFixed(2) + ' 元';
|
||||||
|
}
|
||||||
|
// 如果价格无效,尝试从其他可能的字段获取价格
|
||||||
|
if (row.totalPrice !== undefined && row.totalPrice !== null && !isNaN(row.totalPrice) && isFinite(row.totalPrice)) {
|
||||||
|
return Number(row.totalPrice).toFixed(2) + ' 元';
|
||||||
|
}
|
||||||
|
if (row.price !== undefined && row.price !== null && !isNaN(row.price) && isFinite(row.price)) {
|
||||||
|
return Number(row.price).toFixed(2) + ' 元';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return '-';
|
return '-';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!--检验信息-->
|
||||||
<el-table
|
<el-table
|
||||||
ref="inspectionTableRef"
|
ref="inspectionTableRef"
|
||||||
:data="inspectionList"
|
:data="inspectionList"
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 下方:申请单和检验项目选择器 -->
|
<!-- 下方:申请单和检验项目选择器 -->
|
||||||
<div style="display: flex; gap: 20px">
|
<div style="display: flex; gap: 20px">
|
||||||
<!-- 左侧:申请单和检验信息 -->
|
<!-- 左侧:申请单和检验信息 -->
|
||||||
<div style="width: 55%">
|
<div style="width: 55%">
|
||||||
@@ -88,18 +88,18 @@
|
|||||||
<div class="application-form" style="padding: 20px; height: 700px; overflow-y: auto; border: 1px solid #e4e7ed; border-radius: 4px; margin: 10px;">
|
<div class="application-form" style="padding: 20px; height: 700px; overflow-y: auto; border: 1px solid #e4e7ed; border-radius: 4px; margin: 10px;">
|
||||||
<div style="margin-bottom: 20px">
|
<div style="margin-bottom: 20px">
|
||||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">申请单号</label>
|
<label style="display: block; margin-bottom: 5px; font-weight: bold">申请单号</label>
|
||||||
<el-input v-model="formData.applicationNo" disabled size="small" />
|
<el-input v-model="formData.applicationNo" readonly size="small" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 患者信息行 -->
|
<!-- 患者信息行 -->
|
||||||
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; margin-bottom: 20px">
|
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; margin-bottom: 20px">
|
||||||
<div>
|
<div>
|
||||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">姓名</label>
|
<label style="display: block; margin-bottom: 5px; font-weight: bold">姓名</label>
|
||||||
<el-input v-model="formData.patientName" disabled size="small" />
|
<el-input v-model="formData.patientName" readonly size="small" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">就诊卡号</label>
|
<label style="display: block; margin-bottom: 5px; font-weight: bold">就诊卡号</label>
|
||||||
<el-input v-model="formData.cardNo" disabled size="small" />
|
<el-input v-model="formData.identifierNo" readonly size="small" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">费用性质</label>
|
<label style="display: block; margin-bottom: 5px; font-weight: bold">费用性质</label>
|
||||||
@@ -115,6 +115,7 @@
|
|||||||
|
|
||||||
<!-- 申请信息行 -->
|
<!-- 申请信息行 -->
|
||||||
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; margin-bottom: 20px">
|
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; margin-bottom: 20px">
|
||||||
|
<!--申请日期-->
|
||||||
<div>
|
<div>
|
||||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">申请日期</label>
|
<label style="display: block; margin-bottom: 5px; font-weight: bold">申请日期</label>
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
@@ -127,6 +128,7 @@
|
|||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<!--申请科室-->
|
||||||
<div>
|
<div>
|
||||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">申请科室</label>
|
<label style="display: block; margin-bottom: 5px; font-weight: bold">申请科室</label>
|
||||||
<el-select v-model="formData.departmentName" placeholder="请选择申请科室" size="small" style="width: 100%" disabled>
|
<el-select v-model="formData.departmentName" placeholder="请选择申请科室" size="small" style="width: 100%" disabled>
|
||||||
@@ -135,9 +137,11 @@
|
|||||||
<el-option label="儿科" value="pediatrics" />
|
<el-option label="儿科" value="pediatrics" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!--申请医生-->
|
||||||
<div>
|
<div>
|
||||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">申请医生</label>
|
<label style="display: block; margin-bottom: 5px; font-weight: bold">申请医生</label>
|
||||||
<el-select v-model="formData.doctorName" placeholder="请选择申请医生" size="small" style="width: 100%" disabled>
|
<el-select v-model="formData.doctorName" placeholder="请选择申请医生" size="small" style="width: 100%">
|
||||||
<el-option label="张医生" value="doctor_zhang" />
|
<el-option label="张医生" value="doctor_zhang" />
|
||||||
<el-option label="李医生" value="doctor_li" />
|
<el-option label="李医生" value="doctor_li" />
|
||||||
<el-option label="王医生" value="doctor_wang" />
|
<el-option label="王医生" value="doctor_wang" />
|
||||||
@@ -164,7 +168,7 @@
|
|||||||
<div v-if="validationErrors.executeDepartment" class="error-message">请选择执行科室</div>
|
<div v-if="validationErrors.executeDepartment" class="error-message">请选择执行科室</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 诊断相关字段 -->
|
<!-- 诊断描述 -->
|
||||||
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px">
|
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px">
|
||||||
<div :class="{ 'form-item-error': validationErrors.diagnosisDesc }">
|
<div :class="{ 'form-item-error': validationErrors.diagnosisDesc }">
|
||||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">诊断描述 <span style="color: #f56c6c">*</span></label>
|
<label style="display: block; margin-bottom: 5px; font-weight: bold">诊断描述 <span style="color: #f56c6c">*</span></label>
|
||||||
@@ -248,7 +252,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
<el-tab-pane label="检验信息" name="inspectionInfo">
|
<el-tab-pane label="检验信息" name="inspectionInfo">
|
||||||
<div style="padding: 20px; height: 700px; overflow-y: auto; border: 1px solid #e4e7ed; border-radius: 4px; margin: 10px;">
|
<div style="padding: 20px; height: 700px; overflow-y: auto; border: 1px solid #e4e7ed; border-radius: 4px; margin: 10px;">
|
||||||
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px">
|
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px">
|
||||||
@@ -458,7 +461,7 @@ const formData = reactive({
|
|||||||
applicationId: null,
|
applicationId: null,
|
||||||
applicationNo: '202511210001',
|
applicationNo: '202511210001',
|
||||||
patientName: '',
|
patientName: '',
|
||||||
cardNo: '',
|
identifierNo: '',
|
||||||
feeType: 'self',
|
feeType: 'self',
|
||||||
applicationDate: new Date(),
|
applicationDate: new Date(),
|
||||||
departmentName: '',
|
departmentName: '',
|
||||||
@@ -579,11 +582,11 @@ const getFilteredItems = (categoryKey) => {
|
|||||||
|
|
||||||
// 初始化数据
|
// 初始化数据
|
||||||
function initData() {
|
function initData() {
|
||||||
console.log('检验组件初始化,patientInfo:', props.patientInfo)
|
// console.log('检验组件初始化,patientInfo:', props.patientInfo)
|
||||||
if (props.patientInfo) {
|
if (props.patientInfo) {
|
||||||
queryParams.encounterId = props.patientInfo.encounterId
|
queryParams.encounterId = props.patientInfo.encounterId
|
||||||
formData.patientName = props.patientInfo.patientName || ''
|
formData.patientName = props.patientInfo.patientName || ''
|
||||||
formData.cardNo = props.patientInfo.cardNo || ''
|
formData.identifierNo = props.patientInfo.identifierNo || ''
|
||||||
formData.departmentName = props.patientInfo.departmentName || ''
|
formData.departmentName = props.patientInfo.departmentName || ''
|
||||||
formData.doctorName = props.patientInfo.doctorName || ''
|
formData.doctorName = props.patientInfo.doctorName || ''
|
||||||
}
|
}
|
||||||
@@ -597,26 +600,26 @@ function initData() {
|
|||||||
function getInspectionList() {
|
function getInspectionList() {
|
||||||
// 如果没有encounterId,不调用接口
|
// 如果没有encounterId,不调用接口
|
||||||
if (!queryParams.encounterId) {
|
if (!queryParams.encounterId) {
|
||||||
console.warn('【检验】encounterId为空,不调用接口')
|
// console.warn('【检验】encounterId为空,不调用接口')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
|
||||||
// 调用真实的API,只传递 encounterId 参数
|
// 调用真实的API,只传递 encounterId 参数
|
||||||
console.log('【检验】调用API,encounterId:', queryParams.encounterId)
|
// console.log('【检验】调用API,encounterId:', queryParams.encounterId)
|
||||||
getInspectionApplicationList({ encounterId: queryParams.encounterId }).then((res) => {
|
getInspectionApplicationList({ encounterId: queryParams.encounterId }).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
inspectionList.value = res.data || []
|
inspectionList.value = res.data || []
|
||||||
total.value = res.data?.length || 0
|
total.value = res.data?.length || 0
|
||||||
console.log('【检验】获取数据成功,数量:', inspectionList.value.length)
|
// console.log('【检验】获取数据成功,数量:', inspectionList.value.length)
|
||||||
} else {
|
} else {
|
||||||
inspectionList.value = []
|
inspectionList.value = []
|
||||||
total.value = 0
|
total.value = 0
|
||||||
ElMessage.error('获取检验申请单列表失败')
|
ElMessage.error('获取检验申请单列表失败')
|
||||||
}
|
}
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.error('获取检验申请单列表异常:', error)
|
// console.error('获取检验申请单列表异常:', error)
|
||||||
inspectionList.value = []
|
inspectionList.value = []
|
||||||
total.value = 0
|
total.value = 0
|
||||||
ElMessage.error('获取检验申请单列表异常')
|
ElMessage.error('获取检验申请单列表异常')
|
||||||
@@ -627,7 +630,7 @@ function getInspectionList() {
|
|||||||
|
|
||||||
// 新增申请单
|
// 新增申请单
|
||||||
function handleNewApplication() {
|
function handleNewApplication() {
|
||||||
console.log('点击新增按钮')
|
// console.log('点击新增按钮')
|
||||||
resetForm()
|
resetForm()
|
||||||
// 生成申请单号
|
// 生成申请单号
|
||||||
formData.applicationNo = generateApplicationNo()
|
formData.applicationNo = generateApplicationNo()
|
||||||
@@ -737,7 +740,7 @@ function handleSave() {
|
|||||||
totalAmount: selectedInspectionItems.value.reduce((sum, item) => sum + item.price + (item.serviceFee || 0), 0)
|
totalAmount: selectedInspectionItems.value.reduce((sum, item) => sum + item.price + (item.serviceFee || 0), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('保存检验申请单数据:', saveData)
|
// console.log('保存检验申请单数据:', saveData)
|
||||||
|
|
||||||
// 调用真实的API保存
|
// 调用真实的API保存
|
||||||
saveInspectionApplication(saveData).then((res) => {
|
saveInspectionApplication(saveData).then((res) => {
|
||||||
@@ -751,7 +754,7 @@ function handleSave() {
|
|||||||
ElMessage.error(res.message || '保存失败')
|
ElMessage.error(res.message || '保存失败')
|
||||||
}
|
}
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.error('保存检验申请单异常:', error)
|
// console.error('保存检验申请单异常:', error)
|
||||||
ElMessage.error('保存异常')
|
ElMessage.error('保存异常')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -761,7 +764,7 @@ function handleFormSave() {
|
|||||||
formRef.value?.validate((valid) => {
|
formRef.value?.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
formData.inspectionItems = selectedInspectionItems.value.map(item => item.id)
|
formData.inspectionItems = selectedInspectionItems.value.map(item => item.id)
|
||||||
console.log('保存检验申请单表单数据:', formData)
|
// console.log('保存检验申请单表单数据:', formData)
|
||||||
ElMessage.success('保存成功')
|
ElMessage.success('保存成功')
|
||||||
showForm.value = false
|
showForm.value = false
|
||||||
getInspectionList()
|
getInspectionList()
|
||||||
@@ -771,7 +774,7 @@ function handleFormSave() {
|
|||||||
|
|
||||||
// 查看详情
|
// 查看详情
|
||||||
function handleView(row) {
|
function handleView(row) {
|
||||||
console.log('点击查看按钮,数据:', row)
|
// console.log('点击查看按钮,数据:', row)
|
||||||
// 加载表单数据
|
// 加载表单数据
|
||||||
Object.assign(formData, row)
|
Object.assign(formData, row)
|
||||||
|
|
||||||
@@ -811,7 +814,7 @@ function switchCategory(category) {
|
|||||||
// 处理搜索
|
// 处理搜索
|
||||||
function handleSearch() {
|
function handleSearch() {
|
||||||
// 搜索逻辑已在getFilteredItems中实现,这里可以添加额外的搜索逻辑
|
// 搜索逻辑已在getFilteredItems中实现,这里可以添加额外的搜索逻辑
|
||||||
console.log('搜索关键词:', searchKeyword.value)
|
// console.log('搜索关键词:', searchKeyword.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理项目项点击(排除勾选框点击)
|
// 处理项目项点击(排除勾选框点击)
|
||||||
@@ -866,7 +869,7 @@ function handleSelectionChange(selection) {
|
|||||||
|
|
||||||
// 打印申请单
|
// 打印申请单
|
||||||
function handlePrint(row) {
|
function handlePrint(row) {
|
||||||
console.log('打印申请单:', row)
|
// console.log('打印申请单:', row)
|
||||||
|
|
||||||
// 切换到申请单TAB
|
// 切换到申请单TAB
|
||||||
leftActiveTab.value = 'application'
|
leftActiveTab.value = 'application'
|
||||||
@@ -949,7 +952,7 @@ function handleDelete(row) {
|
|||||||
confirmButtonClass: 'el-button--danger'
|
confirmButtonClass: 'el-button--danger'
|
||||||
}
|
}
|
||||||
).then(() => {
|
).then(() => {
|
||||||
console.log('删除申请单:', row)
|
// console.log('删除申请单:', row)
|
||||||
// 调用真实的API删除
|
// 调用真实的API删除
|
||||||
deleteInspectionApplication(row.applicationId).then((res) => {
|
deleteInspectionApplication(row.applicationId).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
@@ -960,7 +963,7 @@ function handleDelete(row) {
|
|||||||
ElMessage.error(res.message || '删除失败')
|
ElMessage.error(res.message || '删除失败')
|
||||||
}
|
}
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.error('删除检验申请单异常:', error)
|
// console.error('删除检验申请单异常:', error)
|
||||||
ElMessage.error('删除异常')
|
ElMessage.error('删除异常')
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
@@ -987,10 +990,11 @@ watch(() => props.activeTab, (newVal) => {
|
|||||||
|
|
||||||
// 监听patientInfo变化,确保encounterId及时更新
|
// 监听patientInfo变化,确保encounterId及时更新
|
||||||
watch(() => props.patientInfo, (newVal) => {
|
watch(() => props.patientInfo, (newVal) => {
|
||||||
console.log('【检验】patientInfo变化:', newVal)
|
// console.log('【检验】patientInfo变化:', newVal)
|
||||||
|
console.log('【检验】接收到的完整patientInfo:', JSON.stringify(newVal, null, 2))
|
||||||
if (newVal && newVal.encounterId) {
|
if (newVal && newVal.encounterId) {
|
||||||
queryParams.encounterId = newVal.encounterId
|
queryParams.encounterId = newVal.encounterId
|
||||||
console.log('【检验】更新encounterId:', queryParams.encounterId)
|
// console.log('【检验】更新encounterId:', queryParams.encounterId)
|
||||||
}
|
}
|
||||||
}, { deep: true, immediate: true })
|
}, { deep: true, immediate: true })
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@
|
|||||||
' ' +
|
' ' +
|
||||||
scope.row.volume +
|
scope.row.volume +
|
||||||
' [' +
|
' [' +
|
||||||
Number(scope.row.unitPrice).toFixed(2) +
|
(scope.row.unitPrice !== undefined && scope.row.unitPrice !== null && !isNaN(scope.row.unitPrice) && isFinite(scope.row.unitPrice) ? Number(scope.row.unitPrice).toFixed(2) : '-') +
|
||||||
' 元' +
|
' 元' +
|
||||||
'/' +
|
'/' +
|
||||||
scope.row.unitCode_dictText +
|
scope.row.unitCode_dictText +
|
||||||
@@ -145,7 +145,7 @@
|
|||||||
<span class="medicine-info"> 注射药品:{{ scope.row.injectFlag_enumText }} </span>
|
<span class="medicine-info"> 注射药品:{{ scope.row.injectFlag_enumText }} </span>
|
||||||
<span class="total-amount">
|
<span class="total-amount">
|
||||||
总金额:{{
|
总金额:{{
|
||||||
scope.row.totalPrice
|
(scope.row.totalPrice !== undefined && scope.row.totalPrice !== null && !isNaN(scope.row.totalPrice) && isFinite(scope.row.totalPrice))
|
||||||
? Number(scope.row.totalPrice).toFixed(2) + ' 元'
|
? Number(scope.row.totalPrice).toFixed(2) + ' 元'
|
||||||
: '0.00 元'
|
: '0.00 元'
|
||||||
}}
|
}}
|
||||||
@@ -631,7 +631,7 @@
|
|||||||
" " +
|
" " +
|
||||||
scope.row.volume +
|
scope.row.volume +
|
||||||
" [" +
|
" [" +
|
||||||
Number(scope.row.unitPrice).toFixed(2) +
|
(scope.row.unitPrice !== undefined && scope.row.unitPrice !== null && !isNaN(scope.row.unitPrice) && isFinite(scope.row.unitPrice) ? Number(scope.row.unitPrice).toFixed(2) : '-') +
|
||||||
" 元" +
|
" 元" +
|
||||||
"/" +
|
"/" +
|
||||||
scope.row.unitCode_dictText +
|
scope.row.unitCode_dictText +
|
||||||
@@ -687,7 +687,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<span class="total-amount">
|
<span class="total-amount">
|
||||||
总金额:{{
|
总金额:{{
|
||||||
scope.row.totalPrice
|
(scope.row.totalPrice !== undefined && scope.row.totalPrice !== null && !isNaN(scope.row.totalPrice) && isFinite(scope.row.totalPrice))
|
||||||
? Number(scope.row.totalPrice).toFixed(2) + ' 元'
|
? Number(scope.row.totalPrice).toFixed(2) + ' 元'
|
||||||
: '0.00 元'
|
: '0.00 元'
|
||||||
}}
|
}}
|
||||||
@@ -702,7 +702,7 @@
|
|||||||
<span style="font-size: 16px; font-weight: 600">
|
<span style="font-size: 16px; font-weight: 600">
|
||||||
{{ scope.row.adviceName }}
|
{{ scope.row.adviceName }}
|
||||||
{{
|
{{
|
||||||
scope.row.unitPrice
|
(scope.row.unitPrice !== undefined && scope.row.unitPrice !== null && !isNaN(scope.row.unitPrice) && isFinite(scope.row.unitPrice))
|
||||||
? Number(scope.row.unitPrice).toFixed(2) + '/次'
|
? Number(scope.row.unitPrice).toFixed(2) + '/次'
|
||||||
: '-' + '元'
|
: '-' + '元'
|
||||||
}}
|
}}
|
||||||
@@ -748,7 +748,7 @@
|
|||||||
<span class="total-amount">
|
<span class="total-amount">
|
||||||
总金额:
|
总金额:
|
||||||
{{
|
{{
|
||||||
scope.row.totalPrice
|
(scope.row.totalPrice !== undefined && scope.row.totalPrice !== null && !isNaN(scope.row.totalPrice) && isFinite(scope.row.totalPrice))
|
||||||
? Number(scope.row.totalPrice).toFixed(2) + ' 元'
|
? Number(scope.row.totalPrice).toFixed(2) + ' 元'
|
||||||
: '0.00 元'
|
: '0.00 元'
|
||||||
}}
|
}}
|
||||||
@@ -782,6 +782,19 @@
|
|||||||
// 当医嘱类型改变时,清空当前选择的项目名称,因为不同类型项目的数据结构可能不兼容
|
// 当医嘱类型改变时,清空当前选择的项目名称,因为不同类型项目的数据结构可能不兼容
|
||||||
prescriptionList[scope.$index].adviceName = undefined;
|
prescriptionList[scope.$index].adviceName = undefined;
|
||||||
adviceQueryParams.adviceType = value;
|
adviceQueryParams.adviceType = value;
|
||||||
|
|
||||||
|
// 根据选择的类型设置categoryCode,用于药品分类筛选
|
||||||
|
if (value == 1) { // 西药
|
||||||
|
adviceQueryParams.categoryCode = '2';
|
||||||
|
} else if (value == 2) { // 中成药
|
||||||
|
adviceQueryParams.categoryCode = '1';
|
||||||
|
} else if (value == 3) { // 耗材
|
||||||
|
adviceQueryParams.categoryCode = ''; // 耗材不需要categoryCode筛选
|
||||||
|
} else if (value == 4) { // 诊疗
|
||||||
|
adviceQueryParams.categoryCode = ''; // 诊疗不需要categoryCode筛选
|
||||||
|
} else {
|
||||||
|
adviceQueryParams.categoryCode = ''; // 全部类型
|
||||||
|
}
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
@clear="
|
@clear="
|
||||||
@@ -907,7 +920,7 @@
|
|||||||
<el-table-column label="总金额" align="right" prop="" header-align="center" width="100">
|
<el-table-column label="总金额" align="right" prop="" header-align="center" width="100">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span v-if="!scope.row.isEdit" style="text-align: right">
|
<span v-if="!scope.row.isEdit" style="text-align: right">
|
||||||
{{ scope.row.totalPrice ? Number(scope.row.totalPrice).toFixed(2) + ' 元' : '-' }}
|
{{ (scope.row.totalPrice !== undefined && scope.row.totalPrice !== null && !isNaN(scope.row.totalPrice) && isFinite(scope.row.totalPrice)) ? Number(scope.row.totalPrice).toFixed(2) + ' 元' : '-' }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -2852,12 +2865,25 @@ function getGroupMarkers() {
|
|||||||
function calculateTotalPrice(row, index) {
|
function calculateTotalPrice(row, index) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
if (row.adviceType == 3) {
|
if (row.adviceType == 3) {
|
||||||
row.totalPrice = (row.unitPrice * row.quantity).toFixed(6);
|
// 检查价格是否为有效数字
|
||||||
|
if (row.unitPrice !== undefined && row.unitPrice !== null && !isNaN(row.unitPrice) && isFinite(row.unitPrice)) {
|
||||||
|
row.totalPrice = (row.unitPrice * row.quantity).toFixed(6);
|
||||||
|
} else {
|
||||||
|
row.totalPrice = '0.000000'; // 或者设置为 0
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (row.unitCode == row.minUnitCode) {
|
if (row.unitCode == row.minUnitCode) {
|
||||||
row.totalPrice = (row.minUnitPrice * row.quantity).toFixed(6);
|
if (row.minUnitPrice !== undefined && row.minUnitPrice !== null && !isNaN(row.minUnitPrice) && isFinite(row.minUnitPrice)) {
|
||||||
|
row.totalPrice = (row.minUnitPrice * row.quantity).toFixed(6);
|
||||||
|
} else {
|
||||||
|
row.totalPrice = '0.000000';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
row.totalPrice = (row.unitPrice * row.quantity).toFixed(6);
|
if (row.unitPrice !== undefined && row.unitPrice !== null && !isNaN(row.unitPrice) && isFinite(row.unitPrice)) {
|
||||||
|
row.totalPrice = (row.unitPrice * row.quantity).toFixed(6);
|
||||||
|
} else {
|
||||||
|
row.totalPrice = '0.000000';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -321,7 +321,10 @@ getPatientList();
|
|||||||
function getPatientList() {
|
function getPatientList() {
|
||||||
queryParams.value.statusEnum = 2;
|
queryParams.value.statusEnum = 2;
|
||||||
getList(queryParams.value).then((res) => {
|
getList(queryParams.value).then((res) => {
|
||||||
|
// console.log('API返回的完整数据:', res); // 添加这行来查看完整返回
|
||||||
|
// console.log('API返回的数据记录:', res.data.records); // 查看具体数据记录
|
||||||
patientList.value = res.data.records.map((item) => {
|
patientList.value = res.data.records.map((item) => {
|
||||||
|
// console.log('处理的单个患者数据:', item); // 查看处理的单个患者数据
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
active: currentEncounterId.value ? item.encounterId == currentEncounterId.value : false,
|
active: currentEncounterId.value ? item.encounterId == currentEncounterId.value : false,
|
||||||
@@ -431,7 +434,7 @@ function handleClick(tab) {
|
|||||||
// 查看本次就诊处方单(从医嘱Tab页获取已开立的处方单信息)
|
// 查看本次就诊处方单(从医嘱Tab页获取已开立的处方单信息)
|
||||||
function getEnPrescription(encounterId) {
|
function getEnPrescription(encounterId) {
|
||||||
getEnPrescriptionInfo({ encounterId: encounterId }).then((res) => {
|
getEnPrescriptionInfo({ encounterId: encounterId }).then((res) => {
|
||||||
console.log('处方单 res', res);
|
// console.log('处方单 res', res);
|
||||||
let dataArr = res.data.records || [];
|
let dataArr = res.data.records || [];
|
||||||
if (dataArr.length <= 0) {
|
if (dataArr.length <= 0) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
@@ -461,6 +464,7 @@ function handleCardClick(item, index) {
|
|||||||
patient.active = patient.encounterId === item.encounterId;
|
patient.active = patient.encounterId === item.encounterId;
|
||||||
});
|
});
|
||||||
patientInfo.value = item;
|
patientInfo.value = item;
|
||||||
|
// console.log('patientInfo.value.cardNo:', patientInfo.value.cardNo)
|
||||||
// 将患者信息保存到store中,供hospitalizationEmr组件使用
|
// 将患者信息保存到store中,供hospitalizationEmr组件使用
|
||||||
updatePatientInfo(item);
|
updatePatientInfo(item);
|
||||||
activeTab.value = 'hospitalizationEmr';
|
activeTab.value = 'hospitalizationEmr';
|
||||||
|
|||||||
@@ -291,8 +291,8 @@ import {advicePrint, getAdjustPriceSwitchState, lotNumberMatch} from '@/api/publ
|
|||||||
import {debounce} from 'lodash-es';
|
import {debounce} from 'lodash-es';
|
||||||
import TraceNoDialog from '@/components/OpenHis/TraceNoDialog/index.vue';
|
import TraceNoDialog from '@/components/OpenHis/TraceNoDialog/index.vue';
|
||||||
import {hiprint} from 'vue-plugin-hiprint';
|
import {hiprint} from 'vue-plugin-hiprint';
|
||||||
import templateJson from './components/templateJson.json';
|
import templateJson from './templateJson.json';
|
||||||
import disposalTemplate from './components/disposalTemplate.json';
|
import disposalTemplate from './disposalTemplate.json';
|
||||||
import {formatInventory} from '@/utils/his.js';
|
import {formatInventory} from '@/utils/his.js';
|
||||||
|
|
||||||
import useUserStore from '@/store/modules/user';
|
import useUserStore from '@/store/modules/user';
|
||||||
|
|||||||
@@ -0,0 +1,337 @@
|
|||||||
|
{
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"index": 0,
|
||||||
|
"name": 1,
|
||||||
|
"paperType": "A5",
|
||||||
|
"height": 210,
|
||||||
|
"width": 148,
|
||||||
|
"paperHeader": 0,
|
||||||
|
"paperFooter": 592.4409448818898,
|
||||||
|
"paperNumberDisabled": true,
|
||||||
|
"paperNumberContinue": true,
|
||||||
|
"expandCss": "",
|
||||||
|
"overPrintOptions": {
|
||||||
|
"content": "",
|
||||||
|
"opacity": 0.7,
|
||||||
|
"type": 1
|
||||||
|
},
|
||||||
|
"watermarkOptions": {
|
||||||
|
"content": "",
|
||||||
|
"fillStyle": "rgba(184, 184, 184, 0.3)",
|
||||||
|
"fontSize": "14px",
|
||||||
|
"rotate": 25,
|
||||||
|
"width": 200,
|
||||||
|
"height": 200,
|
||||||
|
"timestamp": false,
|
||||||
|
"format": "YYYY-MM-DD HH:mm"
|
||||||
|
},
|
||||||
|
"panelLayoutOptions": {},
|
||||||
|
"printElements": [
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"left": 0,
|
||||||
|
"top": 22.5,
|
||||||
|
"height": 12,
|
||||||
|
"width": 420,
|
||||||
|
"title": "{{HOSPITAL_NAME}}",
|
||||||
|
"coordinateSync": false,
|
||||||
|
"widthHeightSync": false,
|
||||||
|
"fontSize": 13.5,
|
||||||
|
"qrCodeLevel": 0,
|
||||||
|
"textAlign": "center"
|
||||||
|
},
|
||||||
|
"printElementType": {
|
||||||
|
"title": "文本",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"left": 0,
|
||||||
|
"top": 45,
|
||||||
|
"height": 9.75,
|
||||||
|
"width": 420,
|
||||||
|
"title": "处置单",
|
||||||
|
"coordinateSync": false,
|
||||||
|
"widthHeightSync": false,
|
||||||
|
"fontSize": 11.25,
|
||||||
|
"qrCodeLevel": 0,
|
||||||
|
"textAlign": "center"
|
||||||
|
},
|
||||||
|
"printElementType": {
|
||||||
|
"title": "文本",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"left": 22.5,
|
||||||
|
"top": 67.5,
|
||||||
|
"height": 9.75,
|
||||||
|
"width": 120,
|
||||||
|
"title": "姓名",
|
||||||
|
"field": "patientName",
|
||||||
|
"coordinateSync": false,
|
||||||
|
"widthHeightSync": false,
|
||||||
|
"qrCodeLevel": 0
|
||||||
|
},
|
||||||
|
"printElementType": {
|
||||||
|
"title": "文本",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"left": 157.5,
|
||||||
|
"top": 67.5,
|
||||||
|
"height": 9.75,
|
||||||
|
"width": 120,
|
||||||
|
"title": "年龄",
|
||||||
|
"field": "age",
|
||||||
|
"coordinateSync": false,
|
||||||
|
"widthHeightSync": false,
|
||||||
|
"qrCodeLevel": 0
|
||||||
|
},
|
||||||
|
"printElementType": {
|
||||||
|
"title": "文本",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"left": 300,
|
||||||
|
"top": 67.5,
|
||||||
|
"height": 9.75,
|
||||||
|
"width": 120,
|
||||||
|
"title": "性别",
|
||||||
|
"field": "genderEnum_enumText",
|
||||||
|
"coordinateSync": false,
|
||||||
|
"widthHeightSync": false,
|
||||||
|
"qrCodeLevel": 0
|
||||||
|
},
|
||||||
|
"printElementType": {
|
||||||
|
"title": "文本",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"left": 22.5,
|
||||||
|
"top": 94.5,
|
||||||
|
"height": 9.75,
|
||||||
|
"width": 96,
|
||||||
|
"title": "科室",
|
||||||
|
"field": "departmentName",
|
||||||
|
"coordinateSync": false,
|
||||||
|
"widthHeightSync": false,
|
||||||
|
"qrCodeLevel": 0
|
||||||
|
},
|
||||||
|
"printElementType": {
|
||||||
|
"title": "文本",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"left": 156,
|
||||||
|
"top": 94.5,
|
||||||
|
"height": 9.75,
|
||||||
|
"width": 118.5,
|
||||||
|
"title": "费用性质",
|
||||||
|
"field": "contractName",
|
||||||
|
"coordinateSync": false,
|
||||||
|
"widthHeightSync": false,
|
||||||
|
"qrCodeLevel": 0
|
||||||
|
},
|
||||||
|
"printElementType": {
|
||||||
|
"title": "文本",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"left": 300,
|
||||||
|
"top": 94.5,
|
||||||
|
"height": 9.75,
|
||||||
|
"width": 120,
|
||||||
|
"title": "日期",
|
||||||
|
"field": "reqTime",
|
||||||
|
"coordinateSync": false,
|
||||||
|
"widthHeightSync": false,
|
||||||
|
"qrCodeLevel": 0
|
||||||
|
},
|
||||||
|
"printElementType": {
|
||||||
|
"title": "文本",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"left": 22.5,
|
||||||
|
"top": 121.5,
|
||||||
|
"height": 9.75,
|
||||||
|
"width": 123,
|
||||||
|
"title": "门诊号",
|
||||||
|
"field": "encounterNo",
|
||||||
|
"coordinateSync": false,
|
||||||
|
"widthHeightSync": false,
|
||||||
|
"qrCodeLevel": 0
|
||||||
|
},
|
||||||
|
"printElementType": {
|
||||||
|
"title": "文本",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"left": 156,
|
||||||
|
"top": 121.5,
|
||||||
|
"height": 9.75,
|
||||||
|
"width": 120,
|
||||||
|
"title": "开单医生",
|
||||||
|
"field": "doctorName",
|
||||||
|
"coordinateSync": false,
|
||||||
|
"widthHeightSync": false,
|
||||||
|
"qrCodeLevel": 0
|
||||||
|
},
|
||||||
|
"printElementType": {
|
||||||
|
"title": "文本",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"left": 18,
|
||||||
|
"top": 141,
|
||||||
|
"height": 9,
|
||||||
|
"width": 393,
|
||||||
|
"borderWidth": "1.5",
|
||||||
|
"title": "undefined+beforeDragIn",
|
||||||
|
"coordinateSync": false,
|
||||||
|
"widthHeightSync": false
|
||||||
|
},
|
||||||
|
"printElementType": {
|
||||||
|
"title": "横线",
|
||||||
|
"type": "hline"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"left": 22.5,
|
||||||
|
"top": 156,
|
||||||
|
"height": 9.75,
|
||||||
|
"width": 24,
|
||||||
|
"title": "Rp",
|
||||||
|
"coordinateSync": false,
|
||||||
|
"widthHeightSync": false,
|
||||||
|
"fontSize": 12,
|
||||||
|
"qrCodeLevel": 0
|
||||||
|
},
|
||||||
|
"printElementType": {
|
||||||
|
"title": "文本",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"left": 22.5,
|
||||||
|
"top": 177,
|
||||||
|
"height": 36,
|
||||||
|
"width": 387,
|
||||||
|
"title": "undefined+beforeDragIn",
|
||||||
|
"coordinateSync": false,
|
||||||
|
"widthHeightSync": false,
|
||||||
|
"field": "adviceItemList",
|
||||||
|
"columns": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"title": "项目名",
|
||||||
|
"titleSync": false,
|
||||||
|
"halign": "center",
|
||||||
|
"tableQRCodeLevel": 0,
|
||||||
|
"tableSummaryTitle": true,
|
||||||
|
"tableSummary": "",
|
||||||
|
"width": 180.11284430829235,
|
||||||
|
"field": "itemName",
|
||||||
|
"checked": true,
|
||||||
|
"columnId": "itemName",
|
||||||
|
"fixed": false,
|
||||||
|
"rowspan": 1,
|
||||||
|
"colspan": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "单价",
|
||||||
|
"titleSync": false,
|
||||||
|
"align": "right",
|
||||||
|
"halign": "center",
|
||||||
|
"tableQRCodeLevel": 0,
|
||||||
|
"tableSummaryTitle": true,
|
||||||
|
"tableSummary": "",
|
||||||
|
"formatter2": "function(value,row,index,options,rowIndex,column){ return value + ' 元'; }",
|
||||||
|
"width": 65.15543233883191,
|
||||||
|
"field": "unitPrice",
|
||||||
|
"checked": true,
|
||||||
|
"columnId": "unitPrice",
|
||||||
|
"fixed": false,
|
||||||
|
"rowspan": 1,
|
||||||
|
"colspan": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "数量",
|
||||||
|
"titleSync": false,
|
||||||
|
"align": "right",
|
||||||
|
"halign": "center",
|
||||||
|
"tableQRCodeLevel": 0,
|
||||||
|
"tableSummaryTitle": true,
|
||||||
|
"tableSummary": "",
|
||||||
|
"formatter2": "function(value,row,index,options,rowIndex,column){ return value + ' ' + row.unitCode_dictText; }",
|
||||||
|
"width": 61.720533008519084,
|
||||||
|
"field": "quantity",
|
||||||
|
"checked": true,
|
||||||
|
"columnId": "quantity",
|
||||||
|
"fixed": false,
|
||||||
|
"rowspan": 1,
|
||||||
|
"colspan": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "执行次数",
|
||||||
|
"titleSync": false,
|
||||||
|
"align": "right",
|
||||||
|
"halign": "center",
|
||||||
|
"tableQRCodeLevel": 0,
|
||||||
|
"tableSummaryTitle": true,
|
||||||
|
"tableSummary": "",
|
||||||
|
"width": 80.01119034435662,
|
||||||
|
"field": "quantity",
|
||||||
|
"checked": true,
|
||||||
|
"columnId": "quantity",
|
||||||
|
"fixed": false,
|
||||||
|
"rowspan": 1,
|
||||||
|
"colspan": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"printElementType": {
|
||||||
|
"title": "表格",
|
||||||
|
"type": "table",
|
||||||
|
"editable": true,
|
||||||
|
"columnDisplayEditable": true,
|
||||||
|
"columnDisplayIndexEditable": true,
|
||||||
|
"columnTitleEditable": true,
|
||||||
|
"columnResizable": true,
|
||||||
|
"columnAlignEditable": true,
|
||||||
|
"isEnableEditField": true,
|
||||||
|
"isEnableContextMenu": true,
|
||||||
|
"isEnableInsertRow": true,
|
||||||
|
"isEnableDeleteRow": true,
|
||||||
|
"isEnableInsertColumn": true,
|
||||||
|
"isEnableDeleteColumn": true,
|
||||||
|
"isEnableMergeCell": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,339 @@
|
|||||||
|
{
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"index": 0,
|
||||||
|
"name": 1,
|
||||||
|
"paperType": "自定义",
|
||||||
|
"height": 130,
|
||||||
|
"width": 210,
|
||||||
|
"paperNumberDisabled": true,
|
||||||
|
"paperNumberContinue": true,
|
||||||
|
"overPrintOptions": {
|
||||||
|
"content": "",
|
||||||
|
"opacity": 0.7,
|
||||||
|
"type": 1
|
||||||
|
},
|
||||||
|
"watermarkOptions": {
|
||||||
|
"content": "",
|
||||||
|
"fillStyle": "rgba(184, 184, 184, 0.3)",
|
||||||
|
"fontSize": "14px",
|
||||||
|
"rotate": 25,
|
||||||
|
"width": 200,
|
||||||
|
"height": 200,
|
||||||
|
"timestamp": false,
|
||||||
|
"format": "YYYY-MM-DD HH:mm"
|
||||||
|
},
|
||||||
|
"panelLayoutOptions": {},
|
||||||
|
"paperHeader": 0,
|
||||||
|
"paperFooter": 841.8897637795277,
|
||||||
|
"printElements": [
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"left": 252,
|
||||||
|
"top": 13.5,
|
||||||
|
"height": 12,
|
||||||
|
"width": 75,
|
||||||
|
"title": "{{HOSPITAL_NAME}}医院",
|
||||||
|
"coordinateSync": false,
|
||||||
|
"widthHeightSync": false,
|
||||||
|
"fontSize": 12,
|
||||||
|
"qrCodeLevel": 0
|
||||||
|
},
|
||||||
|
"printElementType": {
|
||||||
|
"title": "文本",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"left": 19.5,
|
||||||
|
"top": 33,
|
||||||
|
"height": 9.75,
|
||||||
|
"width": 120,
|
||||||
|
"title": "日期",
|
||||||
|
"field": "occurrenceTime",
|
||||||
|
"coordinateSync": false,
|
||||||
|
"widthHeightSync": false,
|
||||||
|
"qrCodeLevel": 0
|
||||||
|
},
|
||||||
|
"printElementType": {
|
||||||
|
"title": "文本",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"left": 222,
|
||||||
|
"top": 33,
|
||||||
|
"height": 9.75,
|
||||||
|
"width": 120,
|
||||||
|
"title": "单据号",
|
||||||
|
"field": "busNo",
|
||||||
|
"coordinateSync": false,
|
||||||
|
"widthHeightSync": false,
|
||||||
|
"qrCodeLevel": 0
|
||||||
|
},
|
||||||
|
"printElementType": {
|
||||||
|
"title": "文本",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"left": 465,
|
||||||
|
"top": 33,
|
||||||
|
"height": 9.75,
|
||||||
|
"width": 120,
|
||||||
|
"title": "机构:{{HOSPITAL_NAME}}医院",
|
||||||
|
"coordinateSync": false,
|
||||||
|
"widthHeightSync": false,
|
||||||
|
"qrCodeLevel": 0
|
||||||
|
},
|
||||||
|
"printElementType": {
|
||||||
|
"title": "文本",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"left": 19.5,
|
||||||
|
"top": 57,
|
||||||
|
"height": 9.75,
|
||||||
|
"width": 322.5,
|
||||||
|
"title": "供应商",
|
||||||
|
"field": "supplierName",
|
||||||
|
"coordinateSync": false,
|
||||||
|
"widthHeightSync": false,
|
||||||
|
"qrCodeLevel": 0
|
||||||
|
},
|
||||||
|
"printElementType": {
|
||||||
|
"title": "文本",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"left": 19.5,
|
||||||
|
"top": 84,
|
||||||
|
"height": 36,
|
||||||
|
"width": 570,
|
||||||
|
"title": "undefined+beforeDragIn",
|
||||||
|
"field": "purchaseinventoryList",
|
||||||
|
"coordinateSync": false,
|
||||||
|
"widthHeightSync": false,
|
||||||
|
"columns": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"title": "项目名",
|
||||||
|
"titleSync": false,
|
||||||
|
"halign": "center",
|
||||||
|
"tableQRCodeLevel": 0,
|
||||||
|
"tableSummaryTitle": true,
|
||||||
|
"tableSummary": "",
|
||||||
|
"width": 53.52877835374887,
|
||||||
|
"field": "name",
|
||||||
|
"checked": true,
|
||||||
|
"columnId": "name",
|
||||||
|
"fixed": false,
|
||||||
|
"rowspan": 1,
|
||||||
|
"colspan": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "规格",
|
||||||
|
"titleSync": false,
|
||||||
|
"halign": "center",
|
||||||
|
"tableQRCodeLevel": 0,
|
||||||
|
"tableSummaryTitle": true,
|
||||||
|
"tableSummary": "",
|
||||||
|
"width": 50.3056193642802,
|
||||||
|
"field": "volume",
|
||||||
|
"checked": true,
|
||||||
|
"columnId": "volume",
|
||||||
|
"fixed": false,
|
||||||
|
"rowspan": 1,
|
||||||
|
"colspan": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "厂家/产地",
|
||||||
|
"titleSync": false,
|
||||||
|
"halign": "center",
|
||||||
|
"tableQRCodeLevel": 0,
|
||||||
|
"tableSummaryTitle": true,
|
||||||
|
"tableSummary": "",
|
||||||
|
"width": 84.09807741407441,
|
||||||
|
"field": "manufacturerText",
|
||||||
|
"checked": true,
|
||||||
|
"columnId": "manufacturerText",
|
||||||
|
"fixed": false,
|
||||||
|
"rowspan": 1,
|
||||||
|
"colspan": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "数量",
|
||||||
|
"titleSync": false,
|
||||||
|
"align": "right",
|
||||||
|
"halign": "center",
|
||||||
|
"tableQRCodeLevel": 0,
|
||||||
|
"tableSummaryTitle": true,
|
||||||
|
"tableSummary": "",
|
||||||
|
"formatter2": "function(value,row,index,options,rowIndex,column){ return value + ' ' + row.unitCode_dictText; }",
|
||||||
|
"width": 37.02194283284556,
|
||||||
|
"field": "itemQuantity",
|
||||||
|
"checked": true,
|
||||||
|
"columnId": "itemQuantity",
|
||||||
|
"fixed": false,
|
||||||
|
"rowspan": 1,
|
||||||
|
"colspan": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "采购单价",
|
||||||
|
"titleSync": false,
|
||||||
|
"align": "right",
|
||||||
|
"halign": "center",
|
||||||
|
"tableQRCodeLevel": 0,
|
||||||
|
"tableSummaryTitle": true,
|
||||||
|
"tableSummary": "",
|
||||||
|
"formatter2": "function(value,row,index,options,rowIndex,column){ return value + ' 元'; }",
|
||||||
|
"width": 45.05495152300426,
|
||||||
|
"field": "price",
|
||||||
|
"checked": true,
|
||||||
|
"columnId": "price",
|
||||||
|
"fixed": false,
|
||||||
|
"rowspan": 1,
|
||||||
|
"colspan": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "金额",
|
||||||
|
"titleSync": false,
|
||||||
|
"align": "right",
|
||||||
|
"halign": "center",
|
||||||
|
"tableQRCodeLevel": 0,
|
||||||
|
"tableSummaryTitle": true,
|
||||||
|
"tableSummary": "",
|
||||||
|
"formatter2": "function(value,row,index,options,rowIndex,column){ return value + ' 元'; }",
|
||||||
|
"width": 39.04544357631049,
|
||||||
|
"field": "totalPrice",
|
||||||
|
"checked": true,
|
||||||
|
"columnId": "totalPrice",
|
||||||
|
"fixed": false,
|
||||||
|
"rowspan": 1,
|
||||||
|
"colspan": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "仓库",
|
||||||
|
"titleSync": false,
|
||||||
|
"halign": "center",
|
||||||
|
"tableQRCodeLevel": 0,
|
||||||
|
"tableSummaryTitle": true,
|
||||||
|
"tableSummary": "",
|
||||||
|
"width": 40.041954542099724,
|
||||||
|
"field": "purposeLocationName",
|
||||||
|
"checked": true,
|
||||||
|
"columnId": "purposeLocationName",
|
||||||
|
"fixed": false,
|
||||||
|
"rowspan": 1,
|
||||||
|
"colspan": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "产品批号",
|
||||||
|
"titleSync": false,
|
||||||
|
"halign": "center",
|
||||||
|
"tableQRCodeLevel": 0,
|
||||||
|
"tableSummaryTitle": true,
|
||||||
|
"tableSummary": "",
|
||||||
|
"width": 47.05067091842349,
|
||||||
|
"field": "lotNumber",
|
||||||
|
"checked": true,
|
||||||
|
"columnId": "lotNumber",
|
||||||
|
"fixed": false,
|
||||||
|
"rowspan": 1,
|
||||||
|
"colspan": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "生产日期",
|
||||||
|
"titleSync": false,
|
||||||
|
"halign": "center",
|
||||||
|
"tableQRCodeLevel": 0,
|
||||||
|
"tableSummaryTitle": true,
|
||||||
|
"tableSummary": "",
|
||||||
|
"width": 63.089377997062755,
|
||||||
|
"field": "startTime",
|
||||||
|
"checked": true,
|
||||||
|
"columnId": "startTime",
|
||||||
|
"fixed": false,
|
||||||
|
"rowspan": 1,
|
||||||
|
"colspan": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "有效期至",
|
||||||
|
"titleSync": false,
|
||||||
|
"halign": "center",
|
||||||
|
"tableQRCodeLevel": 0,
|
||||||
|
"tableSummaryTitle": true,
|
||||||
|
"tableSummary": "",
|
||||||
|
"width": 59.05673483929025,
|
||||||
|
"field": "endTime",
|
||||||
|
"checked": true,
|
||||||
|
"columnId": "endTime",
|
||||||
|
"fixed": false,
|
||||||
|
"rowspan": 1,
|
||||||
|
"colspan": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "发票号",
|
||||||
|
"titleSync": false,
|
||||||
|
"halign": "center",
|
||||||
|
"tableQRCodeLevel": 0,
|
||||||
|
"tableSummaryTitle": true,
|
||||||
|
"tableSummary": "",
|
||||||
|
"width": 51.706448638859854,
|
||||||
|
"field": "invoiceNo",
|
||||||
|
"checked": true,
|
||||||
|
"columnId": "invoiceNo",
|
||||||
|
"fixed": false,
|
||||||
|
"rowspan": 1,
|
||||||
|
"colspan": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"printElementType": {
|
||||||
|
"title": "表格",
|
||||||
|
"type": "table",
|
||||||
|
"editable": true,
|
||||||
|
"columnDisplayEditable": true,
|
||||||
|
"columnDisplayIndexEditable": true,
|
||||||
|
"columnTitleEditable": true,
|
||||||
|
"columnResizable": true,
|
||||||
|
"columnAlignEditable": true,
|
||||||
|
"isEnableEditField": true,
|
||||||
|
"isEnableContextMenu": true,
|
||||||
|
"isEnableInsertRow": true,
|
||||||
|
"isEnableDeleteRow": true,
|
||||||
|
"isEnableInsertColumn": true,
|
||||||
|
"isEnableDeleteColumn": true,
|
||||||
|
"isEnableMergeCell": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"left": 480,
|
||||||
|
"top": 130.5,
|
||||||
|
"height": 12,
|
||||||
|
"width": 109.5,
|
||||||
|
"title": "合计",
|
||||||
|
"field": "totalAmount",
|
||||||
|
"coordinateSync": false,
|
||||||
|
"widthHeightSync": false,
|
||||||
|
"qrCodeLevel": 0,
|
||||||
|
"formatter": "function(title,value,options,templateData,target,paperNo){\n return value + ' 元'\n}"
|
||||||
|
},
|
||||||
|
"printElementType": {
|
||||||
|
"title": "文本",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -498,21 +498,21 @@ function confirmCharge() {
|
|||||||
encounterId: patientInfo.value.encounterId,
|
encounterId: patientInfo.value.encounterId,
|
||||||
chargeItemIds: chargeItemIdList.value,
|
chargeItemIds: chargeItemIdList.value,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200 && res.data) {
|
||||||
const item = res.data.paymentRecDetailDtoList.find((i) => {
|
const item = res.data.paymentRecDetailDtoList?.find((i) => {
|
||||||
return i.payEnum == 220000;
|
return i.payEnum == 220000;
|
||||||
});
|
});
|
||||||
totalAmount.value = item?.amount;
|
totalAmount.value = item?.amount ?? 0;
|
||||||
paymentId.value = res.data.id;
|
paymentId.value = res.data.id;
|
||||||
newId.value = res.data.newId;
|
newId.value = res.data.newId;
|
||||||
oldId.value = res.data.oldId;
|
oldId.value = res.data.oldId;
|
||||||
chrgBchnoList.value = res.data.chrgBchnoList;
|
chrgBchnoList.value = res.data.chrgBchnoList;
|
||||||
details.value = res.data.paymentRecDetailDtoList?.filter((item) => {
|
details.value = res.data.paymentRecDetailDtoList?.filter((item) => {
|
||||||
return item.amount > 0;
|
return item.amount > 0;
|
||||||
});
|
}) || [];
|
||||||
openDialog.value = true;
|
openDialog.value = true;
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError(res.msg);
|
proxy.$modal.msgError(res?.msg || '预结算失败');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// console.log(patientInfo)
|
// console.log(patientInfo)
|
||||||
@@ -656,12 +656,12 @@ async function handleReadCard(value) {
|
|||||||
ybMdtrtCertType: userCardInfo.psnCertType,
|
ybMdtrtCertType: userCardInfo.psnCertType,
|
||||||
busiCardInfo: userCardInfo.busiCardInfo,
|
busiCardInfo: userCardInfo.busiCardInfo,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200 && res.data) {
|
||||||
paymentId.value = res.data.id;
|
paymentId.value = res.data.id;
|
||||||
totalAmount.value = res.data.paymentRecDetailDtoList.find(
|
totalAmount.value = res.data.paymentRecDetailDtoList?.find(
|
||||||
(item) => item.payEnum == 220000
|
(item) => item.payEnum == 220000
|
||||||
).amount;
|
)?.amount ?? 0;
|
||||||
details.value = res.data.paymentRecDetailDtoList;
|
details.value = res.data.paymentRecDetailDtoList || [];
|
||||||
// chrgBchnoList.value = res.data.chrgBchnoList;
|
// chrgBchnoList.value = res.data.chrgBchnoList;
|
||||||
chargeItemIdList.value = selectRows.map((item) => {
|
chargeItemIdList.value = selectRows.map((item) => {
|
||||||
return item.id;
|
return item.id;
|
||||||
@@ -680,7 +680,7 @@ async function handleReadCard(value) {
|
|||||||
|
|
||||||
openDialog.value = true;
|
openDialog.value = true;
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError(res.msg);
|
proxy.$modal.msgError(res?.msg || '预结算失败');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="lis-group-maintain">
|
<div class="lis-group-maintain">
|
||||||
|
|
||||||
<!-- 标题区域 -->
|
<!-- 标题区域 -->
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h2>LIS分组维护</h2>
|
<h2>LIS分组维护</h2>
|
||||||
@@ -10,125 +10,128 @@
|
|||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<table class="data-table">
|
<table class="data-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 50px;">行</th>
|
<th style="width: 50px;">行</th>
|
||||||
<th style="width: 150px;">卫生机构</th>
|
<th style="width: 150px;">卫生机构</th>
|
||||||
<th style="width: 150px;">日期</th>
|
<th style="width: 150px;">日期</th>
|
||||||
<th style="width: 200px;">LIS分组名称</th>
|
<th style="width: 200px;">LIS分组名称</th>
|
||||||
<th style="width: 120px;">采血管</th>
|
<th style="width: 120px;">采血管</th>
|
||||||
<th style="width: 300px;">备注</th>
|
<th style="width: 300px;">备注</th>
|
||||||
<th style="width: 150px;">操作</th>
|
<th style="width: 150px;">操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr
|
<tr
|
||||||
v-for="(item, index) in tableData"
|
v-for="(item, index) in tableData"
|
||||||
:key="item.id || index"
|
:key="item.id || index"
|
||||||
:class="{ 'editing-row': item.editing }"
|
:class="{ 'editing-row': item.editing, 'success-row': item.success, 'deleting-row': item.deleting }"
|
||||||
>
|
>
|
||||||
<td>{{ index + 1 }}</td>
|
<td>{{ index + 1 }}</td>
|
||||||
<td>
|
<td>
|
||||||
<template v-if="item.editing">
|
<template v-if="item.editing">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
v-model="item.healthInstitution"
|
v-model="item.healthInstitution"
|
||||||
placeholder="请输入卫生机构"
|
disabled
|
||||||
:class="{ 'error-input': item.errors?.healthInstitution }"
|
>
|
||||||
>
|
</template>
|
||||||
<span v-if="item.errors?.healthInstitution" class="error-message">{{ item.errors.healthInstitution }}</span>
|
<template v-else>
|
||||||
|
{{ item.healthInstitution }}
|
||||||
|
</template>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<template v-if="item.editing">
|
||||||
|
<input type="text" v-model="item.date" disabled>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
{{ item.date }}
|
||||||
|
</template>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<template v-if="item.editing">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
v-model="item.lisGroupName"
|
||||||
|
placeholder="请输入分组名称"
|
||||||
|
:class="{ 'error-input': item.errors?.lisGroupName, 'focus-target': item.isNew }"
|
||||||
|
>
|
||||||
|
<span v-if="item.errors?.lisGroupName" class="error-message">{{ item.errors.lisGroupName }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
{{ item.lisGroupName }}
|
||||||
|
</template>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<template v-if="item.editing">
|
||||||
|
<select
|
||||||
|
v-model="item.bloodCollectionTube"
|
||||||
|
:class="{ 'error-input': item.errors?.bloodCollectionTube }"
|
||||||
|
>
|
||||||
|
<option value="">请选择采血管</option>
|
||||||
|
<option v-for="tube in bloodTubeOptions" :key="tube" :value="tube">
|
||||||
|
{{ tube }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<span v-if="item.errors?.bloodCollectionTube" class="error-message">{{ item.errors.bloodCollectionTube }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
{{ item.bloodCollectionTube }}
|
||||||
|
</template>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<template v-if="item.editing">
|
||||||
|
<input type="text" v-model="item.remark" placeholder="请输入备注信息">
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
{{ item.remark || '' }}
|
||||||
|
</template>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="actions">
|
||||||
|
<template v-if="!item.editing">
|
||||||
|
<button class="btn btn-edit" @click="startEdit(item)">✏️</button>
|
||||||
|
<button class="btn btn-primary" @click="addRow">+</button>
|
||||||
|
<button class="btn btn-delete" @click="deleteRow(index)">🗑</button>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
{{ item.healthInstitution }}
|
<button class="btn btn-confirm" @click="confirmEdit(item)">√</button>
|
||||||
|
<button class="btn btn-cancel" @click="cancelEdit(item)">×</button>
|
||||||
</template>
|
</template>
|
||||||
</td>
|
</div>
|
||||||
<td>
|
</td>
|
||||||
<template v-if="item.editing">
|
</tr>
|
||||||
<input type="text" v-model="item.date" disabled>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
{{ item.date }}
|
|
||||||
</template>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<template v-if="item.editing">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
v-model="item.lisGroupName"
|
|
||||||
placeholder="请输入分组名称"
|
|
||||||
:class="{ 'error-input': item.errors?.lisGroupName }"
|
|
||||||
>
|
|
||||||
<span v-if="item.errors?.lisGroupName" class="error-message">{{ item.errors.lisGroupName }}</span>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
{{ item.lisGroupName }}
|
|
||||||
</template>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<template v-if="item.editing">
|
|
||||||
<select
|
|
||||||
v-model="item.bloodCollectionTube"
|
|
||||||
:class="{ 'error-input': item.errors?.bloodCollectionTube }"
|
|
||||||
>
|
|
||||||
<option value="">请选择采血管</option>
|
|
||||||
<option v-for="tube in bloodTubeOptions" :key="tube" :value="tube">
|
|
||||||
{{ tube }}
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
<span v-if="item.errors?.bloodCollectionTube" class="error-message">{{ item.errors.bloodCollectionTube }}</span>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
{{ item.bloodCollectionTube }}
|
|
||||||
</template>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<template v-if="item.editing">
|
|
||||||
<input type="text" v-model="item.remark" placeholder="请输入备注信息">
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
{{ item.remark || '' }}
|
|
||||||
</template>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="actions">
|
|
||||||
<template v-if="!item.editing">
|
|
||||||
<button class="btn btn-edit" @click="startEdit(item)">✏️</button>
|
|
||||||
<button class="btn btn-primary" @click="addRow">+</button>
|
|
||||||
<button class="btn btn-delete" @click="deleteRow(index)">🗑</button>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
<button class="btn btn-confirm" @click="confirmEdit(item)">√</button>
|
|
||||||
<button class="btn btn-cancel" @click="cancelEdit(item)">×</button>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 分页区域 -->
|
<!-- 分页区域 -->
|
||||||
<div class="pagination">
|
<div class="pagination">
|
||||||
<button class="pagination-btn">‹</button>
|
<button class="pagination-btn" @click="prevPage" :disabled="currentPage <= 1">‹</button>
|
||||||
<span>1</span>
|
<span>{{ currentPage }}</span>
|
||||||
<button class="pagination-btn">›</button>
|
<button class="pagination-btn" @click="nextPage" :disabled="currentPage >= totalPages">›</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {computed, onMounted, reactive, ref} from 'vue'
|
import {computed, nextTick, onMounted, reactive, ref} from 'vue'
|
||||||
import {addLisGroup, delLisGroup, listLisGroup, updateLisGroup} from '@/api/system/checkType'
|
import {addLisGroup, delLisGroup, listLisGroup, updateLisGroup} from '@/api/system/checkType'
|
||||||
import {getDicts} from "@/api/system/dict/data";
|
import {getDicts} from "@/api/system/dict/data";
|
||||||
|
import useUserStore from '@/store/modules/user';
|
||||||
|
import {ElMessage, ElMessageBox} from 'element-plus';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'LisGroupMaintain',
|
name: 'LisGroupMaintain',
|
||||||
setup() {
|
setup() {
|
||||||
|
// 获取用户store
|
||||||
|
const userStore = useUserStore();
|
||||||
|
|
||||||
// 加载状态
|
// 加载状态
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
|
||||||
// 采血管选项
|
// 采血管选项
|
||||||
const bloodTubeOptions = ref([]);
|
const bloodTubeOptions = ref([]);
|
||||||
|
|
||||||
// 加载采血管颜色字典数据
|
// 加载采血管颜色字典数据
|
||||||
const loadBloodTubeDict = async () => {
|
const loadBloodTubeDict = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -138,22 +141,26 @@ export default {
|
|||||||
bloodTubeOptions.value = response.data.map(item => item.label || item.dictLabel);
|
bloodTubeOptions.value = response.data.map(item => item.label || item.dictLabel);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取采血管颜色字典失败:', error);
|
|
||||||
// 如果字典获取失败,使用默认选项作为备选
|
// 如果字典获取失败,使用默认选项作为备选
|
||||||
bloodTubeOptions.value = ['黄管', '紫管', '蓝管'];
|
bloodTubeOptions.value = ['黄管', '紫管', '蓝管'];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 分页相关数据
|
// 分页相关数据
|
||||||
const currentPage = ref(1)
|
const currentPage = ref(1)
|
||||||
const pageSize = ref(10)
|
const pageSize = ref(10)
|
||||||
const totalItems = ref(2) // 总数据量,实际应用中应该从后端获取
|
const totalItems = ref(2) // 总数据量,实际应用中应该从后端获取
|
||||||
|
|
||||||
// 总页数
|
// 总页数
|
||||||
const totalPages = computed(() => {
|
const totalPages = computed(() => {
|
||||||
return Math.ceil(totalItems.value / pageSize.value)
|
return Math.ceil(totalItems.value / pageSize.value)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 获取当前用户的卫生机构名称
|
||||||
|
const getCurrentHospital = () => {
|
||||||
|
return userStore.hospitalName || userStore.orgName || '演示医院';
|
||||||
|
};
|
||||||
|
|
||||||
// 表格数据
|
// 表格数据
|
||||||
const tableData = reactive([])
|
const tableData = reactive([])
|
||||||
|
|
||||||
@@ -165,7 +172,7 @@ export default {
|
|||||||
const day = String(date.getDate()).padStart(2, '0')
|
const day = String(date.getDate()).padStart(2, '0')
|
||||||
return `${year}-${month}-${day}`
|
return `${year}-${month}-${day}`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载LIS分组数据
|
// 加载LIS分组数据
|
||||||
const loadLisGroups = async () => {
|
const loadLisGroups = async () => {
|
||||||
// 确保采血管字典数据已加载
|
// 确保采血管字典数据已加载
|
||||||
@@ -174,217 +181,85 @@ export default {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
|
||||||
// 构建查询参数
|
// 构建查询参数
|
||||||
const query = {
|
const query = {
|
||||||
pageNum: currentPage.value,
|
pageNum: currentPage.value,
|
||||||
pageSize: pageSize.value
|
pageSize: pageSize.value
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('准备调用接口,查询参数:', query)
|
|
||||||
|
|
||||||
// 调用接口获取数据
|
// 调用接口获取数据
|
||||||
// 注意:根据checkType.js中的定义,这个接口使用GET方法和params参数
|
|
||||||
const response = await listLisGroup(query)
|
const response = await listLisGroup(query)
|
||||||
|
|
||||||
console.log('接口返回结果类型:', typeof response)
|
|
||||||
console.log('接口返回结果:', response)
|
|
||||||
console.log('响应是否包含code字段:', response && 'code' in response)
|
|
||||||
console.log('响应是否包含data字段:', response && 'data' in response)
|
|
||||||
|
|
||||||
// 清空现有数据
|
// 清空现有数据
|
||||||
tableData.splice(0, tableData.length)
|
tableData.splice(0, tableData.length)
|
||||||
totalItems.value = 0
|
totalItems.value = 0
|
||||||
|
|
||||||
// 适配可能的不同响应格式
|
// 处理明确的数据结构
|
||||||
let items = []
|
if (response && response.code === 200) {
|
||||||
let total = 0
|
// 清空现有数据
|
||||||
|
tableData.splice(0, tableData.length);
|
||||||
// 检查响应是否存在
|
|
||||||
if (response) {
|
// 获取最内层的数据结构
|
||||||
// 处理标准响应格式
|
const innerResponse = response.data;
|
||||||
if (typeof response === 'object') {
|
if (innerResponse && innerResponse.code === 200) {
|
||||||
// 检查是否是标准API响应格式 {code, data, msg}
|
const data = innerResponse.data;
|
||||||
if ('code' in response) {
|
if (data && Array.isArray(data.records)) {
|
||||||
console.log('响应包含code字段:', response.code)
|
// 更新总记录数
|
||||||
|
totalItems.value = data.total || 0;
|
||||||
// 成功状态码处理
|
|
||||||
if (response.code === 200 || response.code === '200' || response.code === 0) {
|
// 处理每条记录
|
||||||
console.log('响应状态码为成功状态')
|
data.records.forEach((item, index) => {
|
||||||
|
const formattedItem = {
|
||||||
// 检查data字段
|
id: item.id,
|
||||||
if ('data' in response) {
|
healthInstitution: item.hospital,
|
||||||
console.log('响应包含data字段,数据类型:', typeof response.data)
|
date: item.date,
|
||||||
|
lisGroupName: item.groupName,
|
||||||
// 格式1: {data: {rows: [], total: number}}
|
bloodCollectionTube: item.tube,
|
||||||
if (response.data && typeof response.data === 'object') {
|
remark: item.remark || '',
|
||||||
// 处理双重嵌套格式 {data: {code, msg, data: []}}
|
editing: false
|
||||||
if (response.data.data && (Array.isArray(response.data.data) || typeof response.data.data === 'object')) {
|
};
|
||||||
console.log('匹配到格式: 双重嵌套 data.data');
|
|
||||||
|
tableData.push(formattedItem);
|
||||||
// 如果data.data是数组,直接使用
|
|
||||||
if (Array.isArray(response.data.data)) {
|
|
||||||
items = response.data.data;
|
|
||||||
total = items.length;
|
|
||||||
console.log('双重嵌套格式1: data.data是数组,数据量:', items.length);
|
|
||||||
}
|
|
||||||
// 如果data.data是对象,检查是否有rows字段
|
|
||||||
else if (Array.isArray(response.data.data.rows)) {
|
|
||||||
items = response.data.data.rows;
|
|
||||||
total = response.data.data.total !== undefined ? response.data.data.total : items.length;
|
|
||||||
console.log('双重嵌套格式2: data.data包含rows,数据量:', items.length, ',总数:', total);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 标准格式检查
|
|
||||||
else if (Array.isArray(response.data.rows)) {
|
|
||||||
items = response.data.rows
|
|
||||||
total = response.data.total !== undefined ? response.data.total : items.length
|
|
||||||
console.log('匹配到格式1: response.data.rows,数据量:', items.length, ',总数:', total)
|
|
||||||
}
|
|
||||||
// 格式2: {data: []}
|
|
||||||
else if (Array.isArray(response.data)) {
|
|
||||||
items = response.data
|
|
||||||
total = items.length
|
|
||||||
console.log('匹配到格式2: response.data直接是数组,数据量:', items.length)
|
|
||||||
}
|
|
||||||
// 检查是否有其他可能的格式
|
|
||||||
else {
|
|
||||||
console.log('响应data不是预期格式,详细数据:', response.data)
|
|
||||||
// 尝试将整个data对象作为单个条目处理(有些API可能直接返回单个对象)
|
|
||||||
if (response.data) {
|
|
||||||
items = [response.data]
|
|
||||||
total = 1
|
|
||||||
console.log('尝试将整个data对象作为单个条目处理')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log('响应不包含data字段')
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 非成功状态码
|
|
||||||
const errorMsg = response.msg || response.message || `请求失败,状态码: ${response.code}`
|
|
||||||
console.error('请求失败:', errorMsg)
|
|
||||||
showMessage(errorMsg, 'error')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 格式3: 响应本身是一个对象但没有code字段,可能是单个记录
|
|
||||||
else if (!Array.isArray(response)) {
|
|
||||||
console.log('响应是对象但没有code字段,尝试作为单个记录处理')
|
|
||||||
items = [response]
|
|
||||||
total = 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 格式4: 响应本身是数组
|
|
||||||
if (Array.isArray(response)) {
|
|
||||||
items = response
|
|
||||||
total = items.length
|
|
||||||
console.log('匹配到格式4: 响应本身是数组,数据量:', items.length)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 记录最终解析到的数据量
|
|
||||||
console.log('最终解析到的数据量:', items.length, ',总数:', total)
|
|
||||||
} else {
|
|
||||||
console.error('接口返回空数据')
|
|
||||||
showMessage('获取LIS分组数据失败:服务器返回空响应', 'error')
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理获取到的数据
|
|
||||||
if (items && items.length > 0) {
|
|
||||||
// 处理每条数据,确保字段正确映射
|
|
||||||
items.forEach((item, index) => {
|
|
||||||
// 确保item是对象类型
|
|
||||||
if (typeof item === 'object' && item !== null) {
|
|
||||||
console.log(`处理记录 ${index + 1} 原始数据:`, item);
|
|
||||||
|
|
||||||
// 创建格式化后的对象,确保字段存在
|
|
||||||
// 根据网络响应截图更正字段映射关系
|
|
||||||
const formattedItem = {
|
|
||||||
id: item.id || `temp_${Date.now()}_${index}`, // 确保有ID
|
|
||||||
// 更正字段映射:hospital -> healthInstitution
|
|
||||||
healthInstitution: item.hospital || item.org || item.healthInstitution || '',
|
|
||||||
// 优先使用date字段
|
|
||||||
date: item.date || item.createTime || item.createDate || '',
|
|
||||||
// 更正字段映射:groupName -> lisGroupName
|
|
||||||
lisGroupName: item.groupName || item.name || item.lisGroupName || '',
|
|
||||||
// 更正字段映射:tube -> bloodCollectionTube
|
|
||||||
bloodCollectionTube: item.tube || item.property || item.bloodCollectionTube || item.bloodTube || '',
|
|
||||||
remark: item.remark || item.note || '',
|
|
||||||
editing: false,
|
|
||||||
// 保留原始对象的所有其他属性
|
|
||||||
...item
|
|
||||||
};
|
|
||||||
|
|
||||||
tableData.push(formattedItem);
|
|
||||||
console.log(`处理记录 ${index + 1} 格式化后数据:`, {
|
|
||||||
id: formattedItem.id,
|
|
||||||
healthInstitution: formattedItem.healthInstitution,
|
|
||||||
date: formattedItem.date,
|
|
||||||
lisGroupName: formattedItem.lisGroupName,
|
|
||||||
bloodCollectionTube: formattedItem.bloodCollectionTube,
|
|
||||||
remark: formattedItem.remark
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.warn(`记录 ${index + 1} 不是有效对象,跳过处理:`, item);
|
totalItems.value = 0;
|
||||||
}
|
}
|
||||||
});
|
} else {
|
||||||
|
totalItems.value = 0;
|
||||||
totalItems.value = total;
|
}
|
||||||
console.log('数据加载完成,表格显示', tableData.length, '条记录,总数:', totalItems.value);
|
|
||||||
} else {
|
} else {
|
||||||
console.log('未获取到有效数据,表格为空');
|
// 非成功状态码
|
||||||
|
const errorMsg = response.msg || response.message || `请求失败,状态码: ${response.code}`
|
||||||
|
showMessage(errorMsg, 'error')
|
||||||
|
totalItems.value = 0;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 详细的错误信息记录
|
// 提取错误信息
|
||||||
console.error('加载LIS分组数据异常:', error)
|
|
||||||
|
|
||||||
// 提取更详细的错误信息
|
|
||||||
let errorMessage = '加载LIS分组数据失败,请稍后重试'
|
let errorMessage = '加载LIS分组数据失败,请稍后重试'
|
||||||
|
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
// 服务器响应了,但状态码不是2xx
|
// 服务器响应了,但状态码不是2xx
|
||||||
console.error('HTTP错误状态:', error.response.status)
|
|
||||||
console.error('HTTP错误响应体:', error.response.data)
|
|
||||||
|
|
||||||
if (error.response.data) {
|
if (error.response.data) {
|
||||||
errorMessage = error.response.data.msg ||
|
errorMessage = error.response.data.msg ||
|
||||||
error.response.data.message ||
|
error.response.data.message ||
|
||||||
error.response.data.error ||
|
error.response.data.error ||
|
||||||
`服务器错误 (${error.response.status})`
|
`服务器错误 (${error.response.status})`
|
||||||
} else {
|
} else {
|
||||||
errorMessage = `服务器错误 (${error.response.status})`
|
errorMessage = `服务器错误 (${error.response.status})`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 额外记录响应体详情便于调试
|
|
||||||
if (typeof error.response.data === 'object') {
|
|
||||||
console.error('响应体详细结构:', JSON.stringify(error.response.data, null, 2))
|
|
||||||
}
|
|
||||||
} else if (error.request) {
|
} else if (error.request) {
|
||||||
// 请求已发出,但未收到响应
|
// 请求已发出,但未收到响应
|
||||||
console.error('请求已发送但未收到响应:', error.request)
|
|
||||||
errorMessage = '网络错误,服务器未响应,请检查网络连接'
|
errorMessage = '网络错误,服务器未响应,请检查网络连接'
|
||||||
} else if (error.message) {
|
} else if (error.message) {
|
||||||
// 请求配置出错
|
// 请求配置出错
|
||||||
console.error('请求配置错误:', error.message)
|
|
||||||
errorMessage = error.message
|
errorMessage = error.message
|
||||||
} else {
|
|
||||||
console.error('未知错误类型:', typeof error)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 显示错误信息
|
// 显示错误信息
|
||||||
showMessage(errorMessage, 'error')
|
showMessage(errorMessage, 'error')
|
||||||
|
|
||||||
// 确保表格状态正确
|
|
||||||
console.log('异常处理后表格状态:', {
|
|
||||||
tableDataLength: tableData.length,
|
|
||||||
totalItems: totalItems.value,
|
|
||||||
currentPage: currentPage.value
|
|
||||||
})
|
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
console.log('数据加载操作完成,loading状态已更新为false')
|
|
||||||
console.log('最终表格数据量:', tableData.length, ',总数:', totalItems.value)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,53 +273,42 @@ export default {
|
|||||||
// 验证数据
|
// 验证数据
|
||||||
const validateData = (item) => {
|
const validateData = (item) => {
|
||||||
const errors = {}
|
const errors = {}
|
||||||
|
|
||||||
// 清除之前的错误信息
|
// 清除之前的错误信息
|
||||||
delete item.errors
|
delete item.errors
|
||||||
|
|
||||||
// 验证卫生机构
|
|
||||||
if (!item.healthInstitution || item.healthInstitution.trim() === '') {
|
|
||||||
errors.healthInstitution = '卫生机构不能为空'
|
|
||||||
} else if (item.healthInstitution.length > 100) {
|
|
||||||
errors.healthInstitution = '卫生机构名称不能超过100个字符'
|
|
||||||
}
|
|
||||||
|
|
||||||
// 验证LIS分组名称
|
// 验证LIS分组名称
|
||||||
if (!item.lisGroupName || item.lisGroupName.trim() === '') {
|
if (!item.lisGroupName || item.lisGroupName.trim() === '') {
|
||||||
errors.lisGroupName = 'LIS分组名称不能为空'
|
errors.lisGroupName = 'LIS分组名称不能为空'
|
||||||
} else if (item.lisGroupName.length > 50) {
|
} else if (item.lisGroupName.length > 50) {
|
||||||
errors.lisGroupName = 'LIS分组名称不能超过50个字符'
|
errors.lisGroupName = 'LIS分组名称不能超过50个字符'
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证采血管
|
// 验证采血管
|
||||||
if (!item.bloodCollectionTube) {
|
if (!item.bloodCollectionTube) {
|
||||||
errors.bloodCollectionTube = '请选择采血管'
|
errors.bloodCollectionTube = '请选择采血管'
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证备注长度
|
// 验证备注长度
|
||||||
if (item.remark && item.remark.length > 200) {
|
if (item.remark && item.remark.length > 200) {
|
||||||
errors.remark = '备注信息不能超过200个字符'
|
errors.remark = '备注信息不能超过200个字符'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Object.keys(errors).length > 0) {
|
if (Object.keys(errors).length > 0) {
|
||||||
item.errors = errors
|
item.errors = errors
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 显示提示信息
|
// 显示提示信息
|
||||||
const showMessage = (message, type = 'success') => {
|
const showMessage = (message, type = 'success') => {
|
||||||
// 在实际项目中,这里可以使用Element Plus或其他UI库的消息组件
|
// 使用Element Plus的消息组件
|
||||||
// 这里为了简单起见,使用浏览器的alert,但添加了类型标识
|
|
||||||
if (type === 'error') {
|
if (type === 'error') {
|
||||||
console.error(message)
|
ElMessage.error(message)
|
||||||
alert(`错误: ${message}`)
|
|
||||||
} else {
|
} else {
|
||||||
console.log(message)
|
ElMessage.success(message)
|
||||||
// 可以使用更友好的提示方式,这里暂时注释掉alert以避免频繁弹窗
|
|
||||||
// alert(message)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,24 +319,24 @@ export default {
|
|||||||
showMessage('请检查并修正错误信息', 'error')
|
showMessage('请检查并修正错误信息', 'error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查是否有重复的分组名称(在同一个卫生机构内)
|
// 检查是否有重复的分组名称(在同一个卫生机构内)
|
||||||
const duplicate = tableData.find(data =>
|
const duplicate = tableData.find(data =>
|
||||||
data.id !== item.id &&
|
data.id !== item.id &&
|
||||||
data.healthInstitution === item.healthInstitution &&
|
data.healthInstitution === item.healthInstitution &&
|
||||||
data.lisGroupName === item.lisGroupName
|
data.lisGroupName === item.lisGroupName
|
||||||
)
|
)
|
||||||
|
|
||||||
if (duplicate) {
|
if (duplicate) {
|
||||||
if (!item.errors) item.errors = {}
|
if (!item.errors) item.errors = {}
|
||||||
item.errors.lisGroupName = '该分组名称已存在'
|
item.errors.lisGroupName = '该分组名称已存在'
|
||||||
showMessage('分组名称重复,请修改', 'error')
|
showMessage('分组名称重复,请修改', 'error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
|
||||||
// 准备提交数据(使用后端期望的字段名)
|
// 准备提交数据(使用后端期望的字段名)
|
||||||
const submitData = {
|
const submitData = {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
@@ -482,7 +346,7 @@ export default {
|
|||||||
tube: item.bloodCollectionTube, // 前端字段映射到后端字段
|
tube: item.bloodCollectionTube, // 前端字段映射到后端字段
|
||||||
remark: item.remark
|
remark: item.remark
|
||||||
}
|
}
|
||||||
|
|
||||||
let response
|
let response
|
||||||
// 判断是新增还是修改
|
// 判断是新增还是修改
|
||||||
if (item.isNew) {
|
if (item.isNew) {
|
||||||
@@ -492,29 +356,35 @@ export default {
|
|||||||
// 修改
|
// 修改
|
||||||
response = await updateLisGroup(submitData)
|
response = await updateLisGroup(submitData)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理响应
|
// 处理响应
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
// 保存编辑
|
// 保存编辑
|
||||||
item.editing = false
|
item.editing = false
|
||||||
delete item.originalData
|
delete item.originalData
|
||||||
delete item.errors
|
delete item.errors
|
||||||
|
|
||||||
// 先检查是否是新增记录,再删除isNew属性
|
// 先检查是否是新增记录,再删除isNew属性
|
||||||
const isNewRecord = item.isNew
|
const isNewRecord = item.isNew
|
||||||
delete item.isNew
|
delete item.isNew
|
||||||
|
|
||||||
|
// 添加保存成功样式,包括新增记录
|
||||||
|
item.success = true
|
||||||
|
// 0.5秒后移除成功样式
|
||||||
|
setTimeout(() => {
|
||||||
|
item.success = false
|
||||||
|
}, 500)
|
||||||
|
|
||||||
showMessage('保存成功')
|
showMessage('保存成功')
|
||||||
|
|
||||||
// 如果是新增,重新加载数据以确保数据一致性
|
// 修改完成后重新请求后端本页数据,确保数据准确性
|
||||||
if (isNewRecord) {
|
setTimeout(() => {
|
||||||
loadLisGroups()
|
loadLisGroups()
|
||||||
}
|
}, 500)
|
||||||
} else {
|
} else {
|
||||||
showMessage(`保存失败: ${response.msg || '未知错误'}`, 'error')
|
showMessage(`保存失败: ${response.msg || '未知错误'}`, 'error')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('保存LIS分组数据失败:', error)
|
|
||||||
showMessage(`保存失败: ${error.message || '未知错误'}`, 'error')
|
showMessage(`保存失败: ${error.message || '未知错误'}`, 'error')
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
@@ -543,24 +413,25 @@ export default {
|
|||||||
item.editing = false
|
item.editing = false
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('取消编辑失败:', error)
|
|
||||||
showMessage('取消编辑失败', 'error')
|
showMessage('取消编辑失败', 'error')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加新行
|
// 添加新行
|
||||||
const addRow = () => {
|
const addRow = async () => {
|
||||||
// 检查是否已有正在编辑的行
|
// 检查是否已有正在编辑的行
|
||||||
const editingRow = tableData.find(item => item.editing)
|
const editingRow = tableData.find(item => item.editing)
|
||||||
if (editingRow) {
|
if (editingRow) {
|
||||||
showMessage('请先完成当前行的编辑', 'error')
|
showMessage('请先完成当前行的编辑', 'error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const newId = String(Math.max(...tableData.map(item => parseInt(item.id) || 0), 0) + 1)
|
const newId = String(Math.max(...tableData.map(item => parseInt(item.id) || 0), 0) + 1)
|
||||||
|
// 从用户信息中获取当前卫生机构
|
||||||
|
const currentHospital = getCurrentHospital()
|
||||||
tableData.push({
|
tableData.push({
|
||||||
id: newId,
|
id: '',
|
||||||
healthInstitution: '', // 空默认值
|
healthInstitution: currentHospital, // 默认当前操作工号的卫生机构
|
||||||
date: getCurrentDate(), // 默认当前系统时间
|
date: getCurrentDate(), // 默认当前系统时间
|
||||||
lisGroupName: '',
|
lisGroupName: '',
|
||||||
bloodCollectionTube: '',
|
bloodCollectionTube: '',
|
||||||
@@ -569,8 +440,15 @@ export default {
|
|||||||
errors: null,
|
errors: null,
|
||||||
isNew: true // 标记为新记录
|
isNew: true // 标记为新记录
|
||||||
})
|
})
|
||||||
|
|
||||||
showMessage('请填写新记录信息')
|
// 等待DOM更新后聚焦到第一个输入框
|
||||||
|
await nextTick()
|
||||||
|
const focusElement = document.querySelector('.focus-target')
|
||||||
|
if (focusElement) {
|
||||||
|
focusElement.focus()
|
||||||
|
// 清除focus-target类,避免下次添加行时影响
|
||||||
|
focusElement.classList.remove('focus-target')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除行
|
// 删除行
|
||||||
@@ -581,36 +459,66 @@ export default {
|
|||||||
showMessage('请先完成或取消编辑', 'error')
|
showMessage('请先完成或取消编辑', 'error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (confirm(`确定要删除"${item.lisGroupName}"这条记录吗?`)) {
|
try {
|
||||||
try {
|
// 使用Element Plus的确认对话框
|
||||||
loading.value = true
|
await ElMessageBox.confirm(
|
||||||
|
`确定要删除"${item.lisGroupName}"这条记录吗?`,
|
||||||
// 如果是新添加的记录,直接从数组中移除
|
'删除确认',
|
||||||
if (item.isNew) {
|
{
|
||||||
tableData.splice(index, 1)
|
confirmButtonText: '确定',
|
||||||
showMessage('删除成功')
|
cancelButtonText: '取消',
|
||||||
totalItems.value--
|
type: 'warning'
|
||||||
} else {
|
}
|
||||||
// 调用API删除
|
)
|
||||||
const response = await delLisGroup(item.id)
|
|
||||||
|
loading.value = true
|
||||||
if (response.code === 200) {
|
|
||||||
tableData.splice(index, 1)
|
// 添加删除行标记,触发渐隐效果
|
||||||
showMessage('删除成功')
|
item.deleting = true
|
||||||
|
|
||||||
// 更新总数
|
// 等待300ms,让渐隐效果完成
|
||||||
totalItems.value--
|
await new Promise(resolve => setTimeout(resolve, 300))
|
||||||
} else {
|
|
||||||
showMessage(`删除失败: ${response.msg || '未知错误'}`, 'error')
|
// 如果是新添加的记录,直接从数组中移除
|
||||||
}
|
if (item.isNew) {
|
||||||
|
tableData.splice(index, 1)
|
||||||
|
showMessage('删除成功')
|
||||||
|
totalItems.value--
|
||||||
|
} else {
|
||||||
|
// 调用API删除
|
||||||
|
const response = await delLisGroup(item.id)
|
||||||
|
|
||||||
|
if (response.code === 200) {
|
||||||
|
// 更新总数
|
||||||
|
totalItems.value--
|
||||||
|
|
||||||
|
// 检查当前页码是否仍然有效
|
||||||
|
const newTotalPages = Math.ceil(totalItems.value / pageSize.value)
|
||||||
|
if (currentPage.value > newTotalPages && newTotalPages > 0) {
|
||||||
|
// 如果当前页码大于总页数且总页数大于0,调整为最后一页
|
||||||
|
currentPage.value = newTotalPages
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重新加载当前页数据,保持页码不变
|
||||||
|
loadLisGroups()
|
||||||
|
showMessage('删除成功')
|
||||||
|
} else {
|
||||||
|
showMessage(`删除失败: ${response.msg || '未知错误'}`, 'error')
|
||||||
|
// 如果删除失败,移除删除标记
|
||||||
|
item.deleting = false
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
console.error('删除LIS分组数据失败:', error)
|
|
||||||
showMessage(`删除失败: ${error.message || '未知错误'}`, 'error')
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error !== 'cancel') {
|
||||||
|
showMessage(`删除失败: ${error.message || '未知错误'}`, 'error')
|
||||||
|
// 如果删除失败,移除删除标记
|
||||||
|
if (tableData[index]) {
|
||||||
|
tableData[index].deleting = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -638,7 +546,7 @@ export default {
|
|||||||
loadLisGroups()
|
loadLisGroups()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 组件挂载时加载数据
|
// 组件挂载时加载数据
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 加载采血管字典数据
|
// 加载采血管字典数据
|
||||||
@@ -680,7 +588,7 @@ export default {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header h1 {
|
.header h2 {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #333;
|
color: #333;
|
||||||
@@ -718,6 +626,12 @@ export default {
|
|||||||
background-color: #f0f8ff;
|
background-color: #f0f8ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 保存成功行样式 */
|
||||||
|
.success-row {
|
||||||
|
background-color: #f6ffed !important;
|
||||||
|
transition: background-color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
.actions {
|
.actions {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
@@ -732,7 +646,7 @@ export default {
|
|||||||
/* 分页样式 */
|
/* 分页样式 */
|
||||||
.pagination {
|
.pagination {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 16px 0;
|
padding: 16px 0;
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
@@ -741,6 +655,14 @@ export default {
|
|||||||
.pagination span {
|
.pagination span {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin: 0 16px;
|
margin: 0 16px;
|
||||||
|
background-color: #1890FF;
|
||||||
|
color: white;
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pagination-btn {
|
.pagination-btn {
|
||||||
@@ -946,33 +868,34 @@ input:disabled {
|
|||||||
.lis-group-maintain {
|
.lis-group-maintain {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header h1 {
|
.header h1 {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-container {
|
.table-container {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.data-table {
|
.data-table {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
min-width: 600px; /* 确保表格在小屏幕上可以横向滚动 */
|
border-collapse: collapse;
|
||||||
|
min-width: 768px; /* 确保表格在小屏幕上可以横向滚动 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.data-table th,
|
.data-table th,
|
||||||
.data-table td {
|
.data-table td {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
margin-right: 2px;
|
margin-right: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pagination-btn {
|
.pagination-btn {
|
||||||
width: 28px;
|
width: 28px;
|
||||||
height: 28px;
|
height: 28px;
|
||||||
@@ -984,7 +907,16 @@ input:disabled {
|
|||||||
/* 平滑过渡效果 */
|
/* 平滑过渡效果 */
|
||||||
.btn,
|
.btn,
|
||||||
.pagination-btn,
|
.pagination-btn,
|
||||||
.editing-row {
|
.editing-row,
|
||||||
|
tr {
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 删除行渐隐效果 */
|
||||||
|
.deleting-row {
|
||||||
|
opacity: 0;
|
||||||
|
height: 0;
|
||||||
|
overflow: hidden;
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,20 +31,22 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<template v-for="(group, doctorName) in groupedPatients" :key="doctorName">
|
<template v-for="doctorName in paginatedDoctors" :key="doctorName">
|
||||||
<!-- 医生分组标题 -->
|
<template v-if="groupedPatients[doctorName]">
|
||||||
<tr class="doctor-header">
|
<!-- 医生分组标题 -->
|
||||||
<td colspan="4">{{ doctorName }} 医生 (诊室: {{ getDoctorRoom(doctorName) }})</td>
|
<tr class="doctor-header">
|
||||||
</tr>
|
<td colspan="4">{{ doctorName }} 医生 (诊室: {{ getDoctorRoom(doctorName) }})</td>
|
||||||
<!-- 患者列表 -->
|
</tr>
|
||||||
<tr v-for="(patient, index) in group" :key="patient.id">
|
<!-- 患者列表 -->
|
||||||
<td>{{ index + 1 }}</td>
|
<tr v-for="(patient, index) in groupedPatients[doctorName]" :key="patient.id">
|
||||||
<td>{{ formatPatientName(patient.name) }}</td>
|
<td>{{ index + 1 }}</td>
|
||||||
<td>{{ getDoctorRoom(doctorName) }}</td>
|
<td>{{ formatPatientName(patient.name) }}</td>
|
||||||
<td :style="{ color: index === 0 ? '#e74c3c' : '#27ae60' }">
|
<td>{{ getDoctorRoom(doctorName) }}</td>
|
||||||
{{ index === 0 ? '就诊中' : '等待' }}
|
<td :style="{ color: index === 0 ? '#e74c3c' : '#27ae60' }">
|
||||||
</td>
|
{{ index === 0 ? '就诊中' : '等待' }}
|
||||||
</tr>
|
</td>
|
||||||
|
</tr>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -126,9 +128,29 @@ const waitingCount = computed(() => {
|
|||||||
return count
|
return count
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 获取排序后的医生列表
|
||||||
|
const sortedDoctors = computed(() => {
|
||||||
|
return Object.keys(groupedPatients.value).sort()
|
||||||
|
})
|
||||||
|
|
||||||
|
// 按医生分组的分页逻辑
|
||||||
|
const paginatedDoctors = computed(() => {
|
||||||
|
const startIndex = (currentPage.value - 1) * 1 // 每页显示1个医生组
|
||||||
|
const endIndex = startIndex + 1
|
||||||
|
return sortedDoctors.value.slice(startIndex, endIndex)
|
||||||
|
})
|
||||||
|
|
||||||
|
// 获取当前页的患者
|
||||||
|
const currentPatients = computed(() => {
|
||||||
|
const result = {}
|
||||||
|
paginatedDoctors.value.forEach(doctor => {
|
||||||
|
result[doctor] = groupedPatients.value[doctor]
|
||||||
|
})
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
|
||||||
const totalPages = computed(() => {
|
const totalPages = computed(() => {
|
||||||
const totalPatients = patients.value.length
|
return Math.ceil(sortedDoctors.value.length) || 1
|
||||||
return Math.ceil(totalPatients / patientsPerPage) || 1
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// 方法
|
// 方法
|
||||||
|
|||||||
@@ -0,0 +1,378 @@
|
|||||||
|
<template>
|
||||||
|
<div class="cardiology-queue">
|
||||||
|
<div class="app-container">
|
||||||
|
<el-card>
|
||||||
|
<template #header>
|
||||||
|
<div class="card-header">
|
||||||
|
<span class="title">心内科分诊排队管理</span>
|
||||||
|
<div class="header-actions">
|
||||||
|
<el-button type="primary" @click="refreshData" :loading="loading">
|
||||||
|
<el-icon><Refresh /></el-icon>
|
||||||
|
刷新
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 当前呼叫区 -->
|
||||||
|
<div class="current-call-section">
|
||||||
|
<div class="call-box">
|
||||||
|
<div class="call-text">
|
||||||
|
请 <span class="highlight">{{ currentCall?.number || '-' }}</span> 号
|
||||||
|
<span class="highlight">{{ currentCall?.name || '-' }}</span>
|
||||||
|
到 <span class="highlight">{{ currentCall?.room || '-' }}</span> 诊室就诊
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 候诊队列 -->
|
||||||
|
<div class="queue-section">
|
||||||
|
<h3 class="section-title">候诊队列</h3>
|
||||||
|
<el-table
|
||||||
|
:data="queueList"
|
||||||
|
v-loading="loading"
|
||||||
|
stripe
|
||||||
|
border
|
||||||
|
style="width: 100%"
|
||||||
|
:default-sort="{ prop: 'displayOrder', order: 'ascending' }"
|
||||||
|
>
|
||||||
|
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||||
|
<el-table-column prop="patientName" label="患者姓名" width="120" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ formatPatientName(scope.row.patientName) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="practitionerName" label="医生" width="120" align="center" />
|
||||||
|
<el-table-column prop="room" label="诊室" width="100" align="center" />
|
||||||
|
<el-table-column prop="displayOrder" label="流水号" width="120" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ formatSerialNo(scope.row) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="status" label="状态" width="100" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag :type="getStatusType(scope.row.status)">
|
||||||
|
{{ getStatusText(scope.row.status) }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="registerTime" label="挂号时间" width="180" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ formatTime(scope.row.registerTime) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="150" align="center" fixed="right">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="handleCall(scope.row)"
|
||||||
|
:disabled="scope.row.status === 'CALLED'"
|
||||||
|
>
|
||||||
|
叫号
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 分页 -->
|
||||||
|
<div class="pagination-wrapper">
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="queryParams.pageNo"
|
||||||
|
v-model:page-size="queryParams.pageSize"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
:total="total"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handlePageChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
import { Refresh } from '@element-plus/icons-vue'
|
||||||
|
import { parseTime } from '@/utils/his'
|
||||||
|
import { getOutpatientRegistrationCurrent } from '@/views/charge/outpatientregistration/components/outpatientregistration'
|
||||||
|
|
||||||
|
// 响应式数据
|
||||||
|
const loading = ref(false)
|
||||||
|
const queueList = ref([])
|
||||||
|
const total = ref(0)
|
||||||
|
const currentCall = ref({
|
||||||
|
number: '-',
|
||||||
|
name: '-',
|
||||||
|
room: '-'
|
||||||
|
})
|
||||||
|
|
||||||
|
// 查询参数
|
||||||
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
searchKey: '',
|
||||||
|
organizationId: null // 心内科科室ID,可以从路由参数或配置中获取
|
||||||
|
})
|
||||||
|
|
||||||
|
// 计算流水号:直接使用挂号记录表的主键ID(encounterId)
|
||||||
|
function formatSerialNo(row) {
|
||||||
|
if (!row) return '-'
|
||||||
|
|
||||||
|
// 直接使用主键ID作为流水号
|
||||||
|
if (row.encounterId != null && row.encounterId !== undefined) {
|
||||||
|
return String(row.encounterId)
|
||||||
|
} else if (row.id != null && row.id !== undefined) {
|
||||||
|
// 兼容其他可能的ID字段名
|
||||||
|
return String(row.id)
|
||||||
|
} else {
|
||||||
|
return '-'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 格式化患者姓名(脱敏)
|
||||||
|
function formatPatientName(name) {
|
||||||
|
if (!name || typeof name !== 'string') return '-'
|
||||||
|
if (name.length <= 2) return name.charAt(0) + '*'
|
||||||
|
return name.charAt(0) + '*' + name.slice(-1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 格式化时间
|
||||||
|
function formatTime(time) {
|
||||||
|
if (!time) return '-'
|
||||||
|
return parseTime(time, '{y}-{m}-{d} {h}:{i}:{s}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取状态类型
|
||||||
|
function getStatusType(status) {
|
||||||
|
const statusMap = {
|
||||||
|
'WAITING': 'info',
|
||||||
|
'CALLED': 'warning',
|
||||||
|
'IN_PROGRESS': 'success',
|
||||||
|
'COMPLETED': ''
|
||||||
|
}
|
||||||
|
return statusMap[status] || ''
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取状态文本
|
||||||
|
function getStatusText(status) {
|
||||||
|
const statusMap = {
|
||||||
|
'WAITING': '等待',
|
||||||
|
'CALLED': '已叫号',
|
||||||
|
'IN_PROGRESS': '就诊中',
|
||||||
|
'COMPLETED': '已完成'
|
||||||
|
}
|
||||||
|
return statusMap[status] || '未知'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取队列数据
|
||||||
|
async function fetchQueueData() {
|
||||||
|
try {
|
||||||
|
loading.value = true
|
||||||
|
|
||||||
|
// 调用API获取当日就诊数据
|
||||||
|
const response = await getOutpatientRegistrationCurrent({
|
||||||
|
searchKey: queryParams.searchKey,
|
||||||
|
pageNo: queryParams.pageNo,
|
||||||
|
pageSize: queryParams.pageSize
|
||||||
|
})
|
||||||
|
|
||||||
|
if (response && response.code === 200) {
|
||||||
|
// 获取记录数据
|
||||||
|
const records = response.data?.records || response.data || []
|
||||||
|
|
||||||
|
// 过滤心内科的数据(如果有organizationId)
|
||||||
|
let filteredData = records
|
||||||
|
if (queryParams.organizationId) {
|
||||||
|
filteredData = records.filter(item => item.organizationId === queryParams.organizationId)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换为队列数据格式
|
||||||
|
queueList.value = filteredData.map(item => ({
|
||||||
|
id: item.encounterId,
|
||||||
|
patientName: item.patientName,
|
||||||
|
practitionerName: item.practitionerName || '-',
|
||||||
|
organizationName: item.organizationName,
|
||||||
|
room: item.organizationName || '-', // 使用科室名称作为诊室
|
||||||
|
displayOrder: item.displayOrder,
|
||||||
|
registerTime: item.registerTime,
|
||||||
|
status: 'WAITING' // 默认状态,实际应该从后端获取
|
||||||
|
}))
|
||||||
|
|
||||||
|
total.value = response.data?.total || filteredData.length || 0
|
||||||
|
} else {
|
||||||
|
queueList.value = []
|
||||||
|
total.value = 0
|
||||||
|
if (response && response.msg) {
|
||||||
|
ElMessage.warning('获取数据失败: ' + response.msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取队列数据失败:', error)
|
||||||
|
ElMessage.error('获取队列数据失败: ' + (error.message || '未知错误'))
|
||||||
|
queueList.value = []
|
||||||
|
total.value = 0
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 刷新数据
|
||||||
|
function refreshData() {
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
fetchQueueData()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 叫号
|
||||||
|
async function handleCall(row) {
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm(
|
||||||
|
`确认叫号:${formatPatientName(row.patientName)}(${formatSerialNo(row)})?`,
|
||||||
|
'确认叫号',
|
||||||
|
{
|
||||||
|
confirmButtonText: '确认',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// TODO: 调用叫号API
|
||||||
|
// await callPatient(row.id)
|
||||||
|
|
||||||
|
// 更新当前呼叫信息
|
||||||
|
currentCall.value = {
|
||||||
|
number: row.displayOrder || '-',
|
||||||
|
name: formatPatientName(row.patientName),
|
||||||
|
room: row.room
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新状态
|
||||||
|
row.status = 'CALLED'
|
||||||
|
|
||||||
|
ElMessage.success('叫号成功')
|
||||||
|
|
||||||
|
// 刷新数据
|
||||||
|
await fetchQueueData()
|
||||||
|
} catch (error) {
|
||||||
|
if (error !== 'cancel') {
|
||||||
|
console.error('叫号失败:', error)
|
||||||
|
ElMessage.error('叫号失败: ' + (error.message || '未知错误'))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分页大小改变
|
||||||
|
function handleSizeChange(val) {
|
||||||
|
queryParams.pageSize = val
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
fetchQueueData()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 页码改变
|
||||||
|
function handlePageChange(val) {
|
||||||
|
queryParams.pageNo = val
|
||||||
|
fetchQueueData()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 组件挂载时获取数据
|
||||||
|
onMounted(() => {
|
||||||
|
fetchQueueData()
|
||||||
|
|
||||||
|
// 定时刷新数据(每30秒)
|
||||||
|
const refreshInterval = setInterval(() => {
|
||||||
|
fetchQueueData()
|
||||||
|
}, 30000)
|
||||||
|
|
||||||
|
// 组件卸载时清理定时器
|
||||||
|
return () => {
|
||||||
|
clearInterval(refreshInterval)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.cardiology-queue {
|
||||||
|
.app-container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.current-call-section {
|
||||||
|
margin: 20px 0;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.call-box {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 20px 40px;
|
||||||
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
|
border-radius: 12px;
|
||||||
|
box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
|
||||||
|
animation: pulse 2s infinite;
|
||||||
|
|
||||||
|
.call-text {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: white;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
|
||||||
|
.highlight {
|
||||||
|
color: #ffd700;
|
||||||
|
font-size: 28px;
|
||||||
|
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.queue-section {
|
||||||
|
margin-top: 20px;
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
padding-left: 10px;
|
||||||
|
border-left: 4px solid #667eea;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination-wrapper {
|
||||||
|
margin-top: 20px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulse {
|
||||||
|
0% {
|
||||||
|
box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
|
||||||
|
}
|
||||||
|
70% {
|
||||||
|
box-shadow: 0 0 0 15px rgba(102, 126, 234, 0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
212
query_patient_by_serial_no.sql
Normal file
212
query_patient_by_serial_no.sql
Normal file
@@ -0,0 +1,212 @@
|
|||||||
|
-- 根据流水号查询病人信息
|
||||||
|
--
|
||||||
|
-- 流水号格式:YYYYMMDD-XXX(例如:20260109-001)
|
||||||
|
-- - 前面8位是日期(YYYYMMDD)
|
||||||
|
-- - 后面3位是序号(XXX),对应数据库的 display_order
|
||||||
|
--
|
||||||
|
-- 说明:
|
||||||
|
-- display_order 是按"科室+医生+当天"自增的,所以同一天不同科室/不同医生可能有相同的序号
|
||||||
|
-- 如果只知道序号(如 001),建议配合科室、医生、日期范围一起查询
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 方案1:知道完整流水号(如:20260109-001)
|
||||||
|
-- ========================================
|
||||||
|
-- 参数说明:
|
||||||
|
-- :serial_no = '20260109-001' -- 完整流水号
|
||||||
|
--
|
||||||
|
-- 解析逻辑:
|
||||||
|
-- 日期:20260109 -> 2026-01-09
|
||||||
|
-- 序号:001 -> 1
|
||||||
|
|
||||||
|
WITH parsed AS (
|
||||||
|
SELECT
|
||||||
|
-- 提取日期部分(前8位)并转换为日期格式
|
||||||
|
TO_DATE(SUBSTRING(:serial_no FROM 1 FOR 8), 'YYYYMMDD') AS target_date,
|
||||||
|
-- 提取序号部分(最后3位)并转换为整数
|
||||||
|
CAST(SUBSTRING(:serial_no FROM 10) AS INTEGER) AS target_order
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
e.id AS 就诊ID,
|
||||||
|
e.bus_no AS 就诊编码,
|
||||||
|
DATE(e.start_time) AS 挂号日期,
|
||||||
|
e.start_time AS 挂号时间,
|
||||||
|
e.organization_id AS 科室ID,
|
||||||
|
e.registrar_id AS 医生ID,
|
||||||
|
e.display_order AS 流水号序号,
|
||||||
|
-- 计算完整流水号(用于验证)
|
||||||
|
TO_CHAR(e.start_time, 'YYYYMMDD') || '-' || LPAD(e.display_order::text, 3, '0') AS 完整流水号,
|
||||||
|
p.id AS 患者ID,
|
||||||
|
p.name AS 患者姓名,
|
||||||
|
p.bus_no AS 患者业务号,
|
||||||
|
p.gender AS 性别,
|
||||||
|
p.birth_date AS 出生日期,
|
||||||
|
p.phone AS 电话,
|
||||||
|
e.status_enum AS 状态
|
||||||
|
FROM adm_encounter e
|
||||||
|
INNER JOIN adm_patient p ON e.patient_id = p.id AND p.delete_flag = '0'
|
||||||
|
CROSS JOIN parsed
|
||||||
|
WHERE e.delete_flag = '0'
|
||||||
|
AND DATE(e.start_time) = parsed.target_date
|
||||||
|
AND e.display_order = parsed.target_order
|
||||||
|
ORDER BY e.start_time DESC
|
||||||
|
LIMIT 10;
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 方案2:只知道序号(如:001),配合其他条件查询
|
||||||
|
-- ========================================
|
||||||
|
-- 参数说明:
|
||||||
|
-- :order_no = '001' -- 序号(不带日期)
|
||||||
|
-- :start_date = '2026-01-01' -- 开始日期(可选,缩小范围)
|
||||||
|
-- :end_date = '2026-01-31' -- 结束日期(可选,缩小范围)
|
||||||
|
-- :organization_id = 123 -- 科室ID(可选,精确匹配)
|
||||||
|
-- :registrar_id = 456 -- 医生ID(可选,精确匹配)
|
||||||
|
-- :patient_name = '张三' -- 患者姓名(可选,模糊匹配)
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
e.id AS 就诊ID,
|
||||||
|
e.bus_no AS 就诊编码,
|
||||||
|
DATE(e.start_time) AS 挂号日期,
|
||||||
|
e.start_time AS 挂号时间,
|
||||||
|
TO_CHAR(e.start_time, 'YYYYMMDD') || '-' || LPAD(e.display_order::text, 3, '0') AS 完整流水号,
|
||||||
|
e.organization_id AS 科室ID,
|
||||||
|
e.registrar_id AS 医生ID,
|
||||||
|
e.display_order AS 流水号序号,
|
||||||
|
p.id AS 患者ID,
|
||||||
|
p.name AS 患者姓名,
|
||||||
|
p.bus_no AS 患者业务号,
|
||||||
|
p.phone AS 电话,
|
||||||
|
e.status_enum AS 状态
|
||||||
|
FROM adm_encounter e
|
||||||
|
INNER JOIN adm_patient p ON e.patient_id = p.id AND p.delete_flag = '0'
|
||||||
|
WHERE e.delete_flag = '0'
|
||||||
|
AND e.display_order = CAST(:order_no AS INTEGER) -- 序号匹配
|
||||||
|
-- 以下条件可选,去掉注释并根据需要填入值
|
||||||
|
-- AND DATE(e.start_time) >= CAST(:start_date AS DATE) -- 日期范围:开始
|
||||||
|
-- AND DATE(e.start_time) <= CAST(:end_date AS DATE) -- 日期范围:结束
|
||||||
|
-- AND e.organization_id = CAST(:organization_id AS BIGINT) -- 科室匹配
|
||||||
|
-- AND e.registrar_id = CAST(:registrar_id AS BIGINT) -- 医生匹配
|
||||||
|
-- AND p.name LIKE '%' || :patient_name || '%' -- 患者姓名模糊匹配
|
||||||
|
ORDER BY e.start_time DESC
|
||||||
|
LIMIT 50;
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 方案3:按患者姓名 + 大概日期范围查询(最常用)
|
||||||
|
-- ========================================
|
||||||
|
-- 参数说明:
|
||||||
|
-- :patient_name = '张三' -- 患者姓名(模糊匹配)
|
||||||
|
-- :start_date = '2026-01-01' -- 开始日期
|
||||||
|
-- :end_date = '2026-01-31' -- 结束日期
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
e.id AS 就诊ID,
|
||||||
|
e.bus_no AS 就诊编码,
|
||||||
|
DATE(e.start_time) AS 挂号日期,
|
||||||
|
e.start_time AS 挂号时间,
|
||||||
|
TO_CHAR(e.start_time, 'YYYYMMDD') || '-' || LPAD(e.display_order::text, 3, '0') AS 完整流水号,
|
||||||
|
e.organization_id AS 科室ID,
|
||||||
|
e.registrar_id AS 医生ID,
|
||||||
|
e.display_order AS 流水号序号,
|
||||||
|
p.id AS 患者ID,
|
||||||
|
p.name AS 患者姓名,
|
||||||
|
p.bus_no AS 患者业务号,
|
||||||
|
p.phone AS 电话,
|
||||||
|
e.status_enum AS 状态
|
||||||
|
FROM adm_encounter e
|
||||||
|
INNER JOIN adm_patient p ON e.patient_id = p.id AND p.delete_flag = '0'
|
||||||
|
WHERE e.delete_flag = '0'
|
||||||
|
AND p.name LIKE '%' || :patient_name || '%'
|
||||||
|
AND DATE(e.start_time) >= CAST(:start_date AS DATE)
|
||||||
|
AND DATE(e.start_time) <= CAST(:end_date AS DATE)
|
||||||
|
ORDER BY e.start_time DESC;
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 方案4:按就诊卡号查询(最准确)
|
||||||
|
-- ========================================
|
||||||
|
-- 参数说明:
|
||||||
|
-- :card_no = '12345678' -- 就诊卡号
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
e.id AS 就诊ID,
|
||||||
|
e.bus_no AS 就诊编码,
|
||||||
|
DATE(e.start_time) AS 挂号日期,
|
||||||
|
e.start_time AS 挂号时间,
|
||||||
|
TO_CHAR(e.start_time, 'YYYYMMDD') || '-' || LPAD(e.display_order::text, 3, '0') AS 完整流水号,
|
||||||
|
e.organization_id AS 科室ID,
|
||||||
|
e.registrar_id AS 医生ID,
|
||||||
|
e.display_order AS 流水号序号,
|
||||||
|
p.id AS 患者ID,
|
||||||
|
p.name AS 患者姓名,
|
||||||
|
p.bus_no AS 患者业务号,
|
||||||
|
COALESCE(
|
||||||
|
(SELECT identifier_no
|
||||||
|
FROM adm_patient_identifier
|
||||||
|
WHERE patient_id = p.id
|
||||||
|
AND delete_flag = '0'
|
||||||
|
AND identifier_no IS NOT NULL
|
||||||
|
AND identifier_no != ''
|
||||||
|
ORDER BY create_time ASC
|
||||||
|
LIMIT 1),
|
||||||
|
p.bus_no,
|
||||||
|
''
|
||||||
|
) AS 就诊卡号,
|
||||||
|
p.phone AS 电话,
|
||||||
|
e.status_enum AS 状态
|
||||||
|
FROM adm_encounter e
|
||||||
|
INNER JOIN adm_patient p ON e.patient_id = p.id AND p.delete_flag = '0'
|
||||||
|
WHERE e.delete_flag = '0'
|
||||||
|
AND (
|
||||||
|
-- 优先匹配 identifier_no
|
||||||
|
EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM adm_patient_identifier api
|
||||||
|
WHERE api.patient_id = p.id
|
||||||
|
AND api.delete_flag = '0'
|
||||||
|
AND api.identifier_no = :card_no
|
||||||
|
)
|
||||||
|
OR
|
||||||
|
-- 备用:匹配 patient.bus_no
|
||||||
|
p.bus_no = :card_no
|
||||||
|
)
|
||||||
|
ORDER BY e.start_time DESC
|
||||||
|
LIMIT 20;
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 方案5:模糊查询流水号(部分匹配)
|
||||||
|
-- ========================================
|
||||||
|
-- 参数说明:
|
||||||
|
-- :serial_part = '20260109' -- 只输入日期部分
|
||||||
|
-- 或
|
||||||
|
-- :serial_part = '001' -- 只输入序号部分
|
||||||
|
-- 或
|
||||||
|
-- :serial_part = '20260109-00' -- 输入部分(前缀匹配)
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
e.id AS 就诊ID,
|
||||||
|
e.bus_no AS 就诊编码,
|
||||||
|
DATE(e.start_time) AS 挂号日期,
|
||||||
|
e.start_time AS 挂号时间,
|
||||||
|
TO_CHAR(e.start_time, 'YYYYMMDD') || '-' || LPAD(e.display_order::text, 3, '0') AS 完整流水号,
|
||||||
|
e.organization_id AS 科室ID,
|
||||||
|
e.registrar_id AS 医生ID,
|
||||||
|
e.display_order AS 流水号序号,
|
||||||
|
p.id AS 患者ID,
|
||||||
|
p.name AS 患者姓名,
|
||||||
|
p.bus_no AS 患者业务号,
|
||||||
|
p.phone AS 电话,
|
||||||
|
e.status_enum AS 状态
|
||||||
|
FROM adm_encounter e
|
||||||
|
INNER JOIN adm_patient p ON e.patient_id = p.id AND p.delete_flag = '0'
|
||||||
|
WHERE e.delete_flag = '0'
|
||||||
|
AND (
|
||||||
|
-- 匹配日期部分(如输入:20260109)
|
||||||
|
TO_CHAR(e.start_time, 'YYYYMMDD') LIKE :serial_part || '%'
|
||||||
|
OR
|
||||||
|
-- 匹配序号部分(如输入:001)
|
||||||
|
LPAD(e.display_order::text, 3, '0') LIKE '%' || :serial_part || '%'
|
||||||
|
OR
|
||||||
|
-- 匹配完整流水号前缀(如输入:20260109-00)
|
||||||
|
(TO_CHAR(e.start_time, 'YYYYMMDD') || '-' || LPAD(e.display_order::text, 3, '0')) LIKE :serial_part || '%'
|
||||||
|
)
|
||||||
|
ORDER BY e.start_time DESC
|
||||||
|
LIMIT 50;
|
||||||
|
|
||||||
116
sql/query_encounter_id.sql
Normal file
116
sql/query_encounter_id.sql
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
-- 查询挂号记录表主键的SQL语句
|
||||||
|
-- 表名:adm_encounter
|
||||||
|
-- 主键字段:id (bigint,雪花算法生成)
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 1. 查询所有挂号记录的主键(简单查询)
|
||||||
|
-- ========================================
|
||||||
|
SELECT id
|
||||||
|
FROM adm_encounter
|
||||||
|
WHERE delete_flag = '0'
|
||||||
|
ORDER BY id DESC;
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 2. 查询最近N条挂号记录的主键
|
||||||
|
-- ========================================
|
||||||
|
SELECT id
|
||||||
|
FROM adm_encounter
|
||||||
|
WHERE delete_flag = '0'
|
||||||
|
ORDER BY start_time DESC
|
||||||
|
LIMIT 10;
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 3. 查询指定日期范围内的挂号记录主键
|
||||||
|
-- ========================================
|
||||||
|
SELECT id
|
||||||
|
FROM adm_encounter
|
||||||
|
WHERE delete_flag = '0'
|
||||||
|
AND DATE(start_time) >= '2026-01-01'
|
||||||
|
AND DATE(start_time) <= '2026-01-31'
|
||||||
|
ORDER BY start_time DESC;
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 4. 查询指定科室的挂号记录主键
|
||||||
|
-- ========================================
|
||||||
|
SELECT id
|
||||||
|
FROM adm_encounter
|
||||||
|
WHERE delete_flag = '0'
|
||||||
|
AND organization_id = 123 -- 替换为实际的科室ID
|
||||||
|
ORDER BY start_time DESC;
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 5. 查询指定患者的挂号记录主键
|
||||||
|
-- ========================================
|
||||||
|
SELECT id
|
||||||
|
FROM adm_encounter
|
||||||
|
WHERE delete_flag = '0'
|
||||||
|
AND patient_id = 456 -- 替换为实际的患者ID
|
||||||
|
ORDER BY start_time DESC;
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 6. 查询主键及基本信息(常用)
|
||||||
|
-- ========================================
|
||||||
|
SELECT
|
||||||
|
id AS 主键ID,
|
||||||
|
bus_no AS 就诊编码,
|
||||||
|
patient_id AS 患者ID,
|
||||||
|
organization_id AS 科室ID,
|
||||||
|
registrar_id AS 医生ID,
|
||||||
|
display_order AS 流水号序号,
|
||||||
|
start_time AS 挂号时间,
|
||||||
|
status_enum AS 状态
|
||||||
|
FROM adm_encounter
|
||||||
|
WHERE delete_flag = '0'
|
||||||
|
ORDER BY start_time DESC
|
||||||
|
LIMIT 20;
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 7. 统计主键数量(按日期分组)
|
||||||
|
-- ========================================
|
||||||
|
SELECT
|
||||||
|
DATE(start_time) AS 日期,
|
||||||
|
COUNT(id) AS 挂号记录数,
|
||||||
|
MIN(id) AS 最小主键ID,
|
||||||
|
MAX(id) AS 最大主键ID
|
||||||
|
FROM adm_encounter
|
||||||
|
WHERE delete_flag = '0'
|
||||||
|
GROUP BY DATE(start_time)
|
||||||
|
ORDER BY 日期 DESC
|
||||||
|
LIMIT 30;
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 8. 查询主键的最大值、最小值、总数
|
||||||
|
-- ========================================
|
||||||
|
SELECT
|
||||||
|
COUNT(*) AS 总记录数,
|
||||||
|
MIN(id) AS 最小主键ID,
|
||||||
|
MAX(id) AS 最大主键ID,
|
||||||
|
MAX(id) - MIN(id) AS 主键ID范围
|
||||||
|
FROM adm_encounter
|
||||||
|
WHERE delete_flag = '0';
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 9. 根据主键查询单条记录(精确查询)
|
||||||
|
-- ========================================
|
||||||
|
SELECT *
|
||||||
|
FROM adm_encounter
|
||||||
|
WHERE id = 1996923066055286785 -- 替换为实际的主键ID
|
||||||
|
AND delete_flag = '0';
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 10. 查询主键及关联的患者信息
|
||||||
|
-- ========================================
|
||||||
|
SELECT
|
||||||
|
e.id AS 挂号记录主键ID,
|
||||||
|
e.bus_no AS 就诊编码,
|
||||||
|
e.display_order AS 流水号序号,
|
||||||
|
e.start_time AS 挂号时间,
|
||||||
|
p.id AS 患者ID,
|
||||||
|
p.name AS 患者姓名,
|
||||||
|
p.bus_no AS 患者业务号
|
||||||
|
FROM adm_encounter e
|
||||||
|
INNER JOIN adm_patient p ON e.patient_id = p.id AND p.delete_flag = '0'
|
||||||
|
WHERE e.delete_flag = '0'
|
||||||
|
ORDER BY e.start_time DESC
|
||||||
|
LIMIT 20;
|
||||||
|
|
||||||
161
sql/sequence_explanation.md
Normal file
161
sql/sequence_explanation.md
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
# PostgreSQL SEQUENCE(序列)详解
|
||||||
|
|
||||||
|
## 语句解析
|
||||||
|
|
||||||
|
```sql
|
||||||
|
DROP SEQUENCE IF EXISTS "public"."adm_encounter_id_seq";
|
||||||
|
CREATE SEQUENCE "public"."adm_encounter_id_seq"
|
||||||
|
INCREMENT 1
|
||||||
|
MINVALUE 1
|
||||||
|
MAXVALUE 99999999
|
||||||
|
START 200
|
||||||
|
CACHE 1;
|
||||||
|
```
|
||||||
|
|
||||||
|
## 逐行解释
|
||||||
|
|
||||||
|
### 1. `DROP SEQUENCE IF EXISTS "public"."adm_encounter_id_seq";`
|
||||||
|
- **作用**:如果序列已存在,先删除它
|
||||||
|
- **`IF EXISTS`**:如果序列不存在,不会报错,直接跳过
|
||||||
|
- **`"public"."adm_encounter_id_seq"`**:序列的完整名称
|
||||||
|
- `public`:模式(schema)名,默认模式
|
||||||
|
- `adm_encounter_id_seq`:序列名称
|
||||||
|
|
||||||
|
### 2. `CREATE SEQUENCE "public"."adm_encounter_id_seq"`
|
||||||
|
- **作用**:创建一个新的序列
|
||||||
|
- **序列名称**:`adm_encounter_id_seq`(用于 `adm_encounter` 表的主键自增)
|
||||||
|
|
||||||
|
### 3. `INCREMENT 1`
|
||||||
|
- **作用**:每次递增的步长
|
||||||
|
- **含义**:每次调用 `nextval()` 时,序列值增加 1
|
||||||
|
- **示例**:如果当前值是 200,下次调用 `nextval()` 返回 201
|
||||||
|
|
||||||
|
### 4. `MINVALUE 1`
|
||||||
|
- **作用**:序列的最小值
|
||||||
|
- **含义**:序列值不能小于 1
|
||||||
|
- **注意**:如果序列达到最小值后继续递减,会报错(除非设置了 `CYCLE`)
|
||||||
|
|
||||||
|
### 5. `MAXVALUE 99999999`
|
||||||
|
- **作用**:序列的最大值
|
||||||
|
- **含义**:序列值不能超过 99999999(8位数)
|
||||||
|
- **注意**:如果序列达到最大值后继续递增,会报错(除非设置了 `CYCLE`)
|
||||||
|
|
||||||
|
### 6. `START 200`
|
||||||
|
- **作用**:序列的起始值
|
||||||
|
- **含义**:序列从 200 开始
|
||||||
|
- **示例**:第一次调用 `nextval()` 返回 200,第二次返回 201,以此类推
|
||||||
|
|
||||||
|
### 7. `CACHE 1`
|
||||||
|
- **作用**:缓存大小
|
||||||
|
- **含义**:每次从数据库获取序列值时,预分配 1 个值到内存
|
||||||
|
- **说明**:
|
||||||
|
- `CACHE 1`:每次只缓存 1 个值(最安全,但性能较低)
|
||||||
|
- `CACHE 20`:每次缓存 20 个值(性能更好,但可能跳号)
|
||||||
|
- **注意**:如果数据库重启,缓存中未使用的序列值会丢失,导致跳号
|
||||||
|
|
||||||
|
## 使用示例
|
||||||
|
|
||||||
|
### 1. 在表定义中使用(自动自增)
|
||||||
|
```sql
|
||||||
|
CREATE TABLE "adm_encounter" (
|
||||||
|
"id" int8 NOT NULL DEFAULT nextval('adm_encounter_id_seq'::regclass),
|
||||||
|
...
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 手动获取下一个值
|
||||||
|
```sql
|
||||||
|
-- 获取下一个序列值
|
||||||
|
SELECT nextval('adm_encounter_id_seq');
|
||||||
|
-- 返回:200(第一次调用)
|
||||||
|
|
||||||
|
SELECT nextval('adm_encounter_id_seq');
|
||||||
|
-- 返回:201(第二次调用)
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 查看当前值(不递增)
|
||||||
|
```sql
|
||||||
|
SELECT currval('adm_encounter_id_seq');
|
||||||
|
-- 返回:当前序列值(不会增加)
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. 重置序列
|
||||||
|
```sql
|
||||||
|
-- 将序列重置为指定值
|
||||||
|
SELECT setval('adm_encounter_id_seq', 200);
|
||||||
|
```
|
||||||
|
|
||||||
|
## 实际应用场景
|
||||||
|
|
||||||
|
### 场景1:插入数据时自动生成ID
|
||||||
|
```sql
|
||||||
|
INSERT INTO adm_encounter (patient_id, organization_id, ...)
|
||||||
|
VALUES (123, 456, ...);
|
||||||
|
-- id 字段会自动使用序列的下一个值(如 200, 201, 202...)
|
||||||
|
```
|
||||||
|
|
||||||
|
### 场景2:手动指定ID(不推荐)
|
||||||
|
```sql
|
||||||
|
INSERT INTO adm_encounter (id, patient_id, ...)
|
||||||
|
VALUES (999, 123, ...);
|
||||||
|
-- 注意:如果手动插入的ID与序列值冲突,可能导致问题
|
||||||
|
```
|
||||||
|
|
||||||
|
## 注意事项
|
||||||
|
|
||||||
|
### 1. 序列与雪花算法的区别
|
||||||
|
- **序列**:简单的数字递增(1, 2, 3...)
|
||||||
|
- **雪花算法**:分布式ID生成算法(如:1996923066055286785)
|
||||||
|
- **当前项目**:虽然定义了序列,但实际使用的是雪花算法(`IdType.ASSIGN_ID`)
|
||||||
|
|
||||||
|
### 2. 序列跳号的原因
|
||||||
|
- 事务回滚:如果事务回滚,序列值不会回退
|
||||||
|
- 缓存:`CACHE > 1` 时,数据库重启可能导致跳号
|
||||||
|
- 手动插入:手动插入ID后,序列不会自动调整
|
||||||
|
|
||||||
|
### 3. 序列的优缺点
|
||||||
|
**优点**:
|
||||||
|
- 简单易用
|
||||||
|
- 性能好(预分配)
|
||||||
|
- 保证唯一性
|
||||||
|
|
||||||
|
**缺点**:
|
||||||
|
- 可能跳号
|
||||||
|
- 不适合分布式环境
|
||||||
|
- 最大值有限制
|
||||||
|
|
||||||
|
## 相关查询语句
|
||||||
|
|
||||||
|
### 查看序列信息
|
||||||
|
```sql
|
||||||
|
-- 查看序列的详细信息
|
||||||
|
SELECT
|
||||||
|
sequence_name AS 序列名称,
|
||||||
|
last_value AS 当前值,
|
||||||
|
start_value AS 起始值,
|
||||||
|
increment_by AS 递增步长,
|
||||||
|
max_value AS 最大值,
|
||||||
|
min_value AS 最小值,
|
||||||
|
cache_size AS 缓存大小
|
||||||
|
FROM information_schema.sequences
|
||||||
|
WHERE sequence_name = 'adm_encounter_id_seq';
|
||||||
|
```
|
||||||
|
|
||||||
|
### 查看序列的下一个值(不实际使用)
|
||||||
|
```sql
|
||||||
|
SELECT last_value, is_called
|
||||||
|
FROM adm_encounter_id_seq;
|
||||||
|
```
|
||||||
|
|
||||||
|
### 修改序列
|
||||||
|
```sql
|
||||||
|
-- 修改序列的起始值
|
||||||
|
ALTER SEQUENCE adm_encounter_id_seq RESTART WITH 1000;
|
||||||
|
|
||||||
|
-- 修改序列的最大值
|
||||||
|
ALTER SEQUENCE adm_encounter_id_seq MAXVALUE 999999999;
|
||||||
|
|
||||||
|
-- 修改序列的缓存大小
|
||||||
|
ALTER SEQUENCE adm_encounter_id_seq CACHE 20;
|
||||||
|
```
|
||||||
|
|
||||||
Reference in New Issue
Block a user