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 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;
|
||||
|
||||
public interface ILisGroupInfoAppService {
|
||||
R<?> getLisGroupInfoList();
|
||||
R<?> getLisGroupInfoList(Integer pageNum, Integer pageSize);
|
||||
|
||||
R<?> add(LisGroupInfo lisGroupInfo);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.openhis.web.check.appservice.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.check.domain.LisGroupInfo;
|
||||
import com.openhis.check.service.ILisGroupInfoService;
|
||||
@@ -17,11 +18,14 @@ public class LisGroupInfoAppServiceImpl implements ILisGroupInfoAppService {
|
||||
@Resource
|
||||
private ILisGroupInfoService lisGroupInfoService;
|
||||
@Override
|
||||
public R<?> getLisGroupInfoList() {
|
||||
List<LisGroupInfo> list = lisGroupInfoService.list();
|
||||
public R<?> getLisGroupInfoList(Integer pageNum, Integer pageSize) {
|
||||
Page<LisGroupInfo> page = new Page<>(pageNum, pageSize);
|
||||
Page<LisGroupInfo> list = lisGroupInfoService.page(page);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public R<?> add(LisGroupInfo lisGroupInfo) {
|
||||
if (ObjectUtil.isEmpty(lisGroupInfo)) {
|
||||
|
||||
@@ -19,8 +19,8 @@ public class LisGroupInfoController {
|
||||
*
|
||||
* */
|
||||
@GetMapping("/list")
|
||||
public R<?> getLisGroupInfoList(){
|
||||
return R.ok(lisGroupInfoAppService.getLisGroupInfoList());
|
||||
public R<?> getLisGroupInfoList(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize){
|
||||
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.ReceptionStatisticsDto;
|
||||
import com.openhis.web.doctorstation.mapper.DoctorStationMainAppMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -32,6 +33,7 @@ import java.util.stream.Collectors;
|
||||
/**
|
||||
* 医生站-主页面 应用实现类
|
||||
*/
|
||||
//@Slf4j
|
||||
@Service
|
||||
public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppService {
|
||||
|
||||
@@ -95,6 +97,9 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
|
||||
ParticipantType.REGISTRATION_DOCTOR.getCode(), ParticipantType.ADMITTER.getCode(), userId,
|
||||
currentUserOrganizationId, pricingFlag, EncounterStatus.PLANNED.getValue(),
|
||||
EncounterActivityStatus.ACTIVE.getValue(), queryWrapper);
|
||||
//日志输出就诊患者信息,patientInfo
|
||||
// log.debug("就诊患者信息: 总数={}, 记录数={}, 数据={}",
|
||||
// patientInfo.getTotal(), patientInfo.getRecords().size(), patientInfo.getRecords());
|
||||
patientInfo.getRecords().forEach(e -> {
|
||||
// 性别
|
||||
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||
|
||||
@@ -123,4 +123,8 @@ public class PatientInfoDto {
|
||||
* 病历号
|
||||
*/
|
||||
private String busNo;
|
||||
/**
|
||||
* 就诊卡号
|
||||
*/
|
||||
private String identifierNo;
|
||||
}
|
||||
|
||||
@@ -1818,6 +1818,10 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
// 保存就诊信息
|
||||
Encounter encounter = new Encounter();
|
||||
BeanUtils.copyProperties(encounterFormData, encounter);
|
||||
// 将挂号医生ID提前塞入 encounter 的 registrarId,便于生成“科室+医生+当日”序号
|
||||
if (encounterParticipantFormData.getPractitionerId() != null) {
|
||||
encounter.setRegistrarId(encounterParticipantFormData.getPractitionerId());
|
||||
}
|
||||
encounter.setBusNo(outpatientRegistrationSettleParam.getBusNo());
|
||||
// 就诊ID
|
||||
Long encounterId = iEncounterService.saveEncounterByRegister(encounter);
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
<select id="getCurrentDayEncounter" resultType="com.openhis.web.chargemanage.dto.CurrentDayEncounterDto">
|
||||
SELECT T9.tenant_id AS tenantId,
|
||||
T9.encounter_id AS encounterId,
|
||||
T9.display_order AS displayOrder,
|
||||
T9.organization_id AS organizationId,
|
||||
T9.organization_name AS organizationName,
|
||||
T9.healthcare_name AS healthcareName,
|
||||
@@ -70,6 +71,7 @@
|
||||
from (
|
||||
SELECT T1.tenant_id AS tenant_id,
|
||||
T1.id AS encounter_id,
|
||||
T1.display_order AS display_order,
|
||||
T1.organization_id AS organization_id,
|
||||
T2.NAME AS organization_name,
|
||||
T3.NAME AS healthcare_name,
|
||||
|
||||
@@ -43,8 +43,11 @@
|
||||
abi.restricted_scope,
|
||||
abi.dosage_instruction,
|
||||
abi.chrgitm_lv
|
||||
from (
|
||||
<if test="adviceTypes == null or adviceTypes.contains(1)">
|
||||
FROM (
|
||||
<!-- 确保至少有一个查询被执行以避免语法错误 -->
|
||||
<if test="adviceTypes != null and !adviceTypes.isEmpty() and (adviceTypes.contains(1) or adviceTypes.contains(2) or adviceTypes.contains(3))">
|
||||
<!-- 如果有有效的adviceTypes,则执行对应的查询 -->
|
||||
<if test="adviceTypes.contains(1)">
|
||||
(SELECT
|
||||
DISTINCT ON (T1.ID)
|
||||
T1.tenant_id,
|
||||
@@ -110,14 +113,10 @@
|
||||
</if>
|
||||
AND T5.instance_table = #{medicationTableName}
|
||||
)
|
||||
<if test="adviceTypes.contains(2) or adviceTypes.contains(3)">UNION ALL</if>
|
||||
</if>
|
||||
|
||||
|
||||
<if test="adviceTypes == null or adviceTypes.contains(1)">
|
||||
<if test="adviceTypes == null or adviceTypes.contains(2) or adviceTypes.contains(3)">UNION ALL</if>
|
||||
</if>
|
||||
|
||||
<if test="adviceTypes == null or adviceTypes.contains(2)">
|
||||
<if test="adviceTypes.contains(2)">
|
||||
(SELECT
|
||||
DISTINCT ON (T1.ID)
|
||||
T1.tenant_id,
|
||||
@@ -177,14 +176,10 @@
|
||||
AND T4.instance_table = #{deviceTableName}
|
||||
AND T1.status_enum = #{statusEnum}
|
||||
)
|
||||
<if test="adviceTypes.contains(3)">UNION ALL</if>
|
||||
</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)">
|
||||
<if test="adviceTypes.contains(3)">
|
||||
(SELECT
|
||||
DISTINCT ON (T1.ID)
|
||||
T1.tenant_id,
|
||||
@@ -245,6 +240,51 @@
|
||||
AND T1.status_enum = #{statusEnum}
|
||||
)
|
||||
</if>
|
||||
</if>
|
||||
<!-- 如果没有有效的adviceTypes,提供一个空的默认查询以避免语法错误 -->
|
||||
<if test="adviceTypes == null or adviceTypes.isEmpty() or (!adviceTypes.contains(1) and !adviceTypes.contains(2) and !adviceTypes.contains(3))">
|
||||
SELECT
|
||||
mmd.tenant_id,
|
||||
CAST(0 AS INTEGER) AS advice_type,
|
||||
CAST('' AS VARCHAR) AS bus_no,
|
||||
CAST('' AS VARCHAR) AS category_code,
|
||||
CAST('' AS VARCHAR) AS pharmacology_category_code,
|
||||
CAST(0 AS NUMERIC) AS part_percent,
|
||||
CAST(0 AS NUMERIC) AS unit_conversion_ratio,
|
||||
CAST(0 AS INTEGER) AS part_attribute_enum,
|
||||
CAST(0 AS INTEGER) AS tho_part_attribute_enum,
|
||||
CAST(0 AS INTEGER) AS skin_test_flag,
|
||||
CAST(0 AS INTEGER) AS inject_flag,
|
||||
CAST(0 AS BIGINT) AS advice_definition_id,
|
||||
CAST('' AS VARCHAR) AS advice_name,
|
||||
CAST('' AS VARCHAR) AS advice_bus_no,
|
||||
CAST('' AS VARCHAR) AS py_str,
|
||||
CAST('' AS VARCHAR) AS wb_str,
|
||||
CAST('' AS VARCHAR) AS yb_no,
|
||||
CAST('' AS VARCHAR) AS product_name,
|
||||
CAST(0 AS INTEGER) AS activity_type,
|
||||
CAST('' AS VARCHAR) AS unit_code,
|
||||
CAST('' AS VARCHAR) AS min_unit_code,
|
||||
CAST(0 AS NUMERIC) AS volume,
|
||||
CAST('' AS VARCHAR) AS method_code,
|
||||
CAST('' AS VARCHAR) AS rate_code,
|
||||
CAST(0 AS BIGINT) AS org_id,
|
||||
CAST(0 AS BIGINT) AS location_id,
|
||||
CAST('' AS VARCHAR) AS dose,
|
||||
CAST('' AS VARCHAR) AS dose_unit_code,
|
||||
CAST('' AS VARCHAR) AS supplier,
|
||||
CAST(0 AS BIGINT) AS supplier_id,
|
||||
CAST('' AS VARCHAR) AS manufacturer,
|
||||
CAST(0 AS BIGINT) AS charge_item_definition_id,
|
||||
CAST('' AS VARCHAR) AS advice_table_name,
|
||||
CAST(0 AS BIGINT) AS position_id,
|
||||
CAST(0 AS INTEGER) AS restricted_flag,
|
||||
CAST('' AS VARCHAR) AS restricted_scope,
|
||||
CAST('' AS VARCHAR) AS dosage_instruction,
|
||||
CAST(0 AS INTEGER) AS chrgitm_lv
|
||||
FROM med_medication_definition mmd
|
||||
WHERE 1 = 0 -- 仍然确保不返回任何行,但使用真实表确保类型正确
|
||||
</if>
|
||||
) AS abi
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
T10.reception_time,
|
||||
T10.practitioner_user_id,
|
||||
T10.jz_practitioner_user_id,
|
||||
T10.bus_no
|
||||
T10.bus_no,
|
||||
T10.identifier_no
|
||||
from
|
||||
(
|
||||
SELECT T1.tenant_id AS tenant_id,
|
||||
@@ -48,7 +49,8 @@
|
||||
T1.create_time AS register_time,
|
||||
T1.reception_time AS reception_time,
|
||||
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
|
||||
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'
|
||||
@@ -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 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 (
|
||||
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
|
||||
T1.delete_flag = '0'
|
||||
<!-- 当前登录账号ID 和 当前登录账号所属的科室ID 用于控制数据权限 -->
|
||||
|
||||
@@ -44,8 +44,16 @@ public class EncounterServiceImpl extends ServiceImpl<EncounterMapper, Encounter
|
||||
// 生成就诊编码 医保挂号时是先生成码后生成实体
|
||||
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));
|
||||
// 患者ID
|
||||
Long patientId = encounter.getPatientId();
|
||||
|
||||
@@ -528,7 +528,7 @@ async function printReceipt(param) {
|
||||
const vxValue = param.detail?.find((t) => t.payEnum === 220100)?.amount ?? 0;
|
||||
const unionValue = param.detail?.find((t) => t.payEnum === 220300)?.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,
|
||||
|
||||
@@ -287,7 +287,7 @@ function getPatientList() {
|
||||
queryParams.value.receptionTimeETime = undefined;
|
||||
}
|
||||
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,
|
||||
chargeItemIds: chargeItemIdList.value,
|
||||
}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
if (res.code == 200 && res.data) {
|
||||
// totalAmount.value = res.data.psnCashPay;
|
||||
paymentId.value = res.data.paymentId;
|
||||
chrgBchnoList.value = res.data.chrgBchnoList;
|
||||
totalAmount.value = res.data.details.find((item) => item.payEnum == 220000).amount;
|
||||
details.value = res.data.details.filter((item) => {
|
||||
totalAmount.value = res.data.details?.find((item) => item.payEnum == 220000)?.amount ?? 0;
|
||||
details.value = res.data.details?.filter((item) => {
|
||||
return item.amount > 0;
|
||||
});
|
||||
}) || [];
|
||||
openDialog.value = true;
|
||||
} else {
|
||||
proxy.$modal.msgError(res.msg);
|
||||
proxy.$modal.msgError(res?.msg || '预结算失败');
|
||||
}
|
||||
});
|
||||
// console.log(patientInfo)
|
||||
@@ -517,11 +517,11 @@ async function handleReadCard(value) {
|
||||
ybMdtrtCertType: userCardInfo.psnCertType,
|
||||
busiCardInfo: userCardInfo.busiCardInfo,
|
||||
}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
if (res.code == 200 && res.data) {
|
||||
// totalAmount.value = res.data.psnCashPay;
|
||||
paymentId.value = res.data.paymentId;
|
||||
totalAmount.value = res.data.details.find((item) => item.payEnum == 220000).amount;
|
||||
details.value = res.data.details;
|
||||
totalAmount.value = res.data.details?.find((item) => item.payEnum == 220000)?.amount ?? 0;
|
||||
details.value = res.data.details || [];
|
||||
// chrgBchnoList.value = res.data.chrgBchnoList;
|
||||
chargeItemIdList.value = selectRows.map((item) => {
|
||||
return item.id;
|
||||
@@ -537,7 +537,7 @@ async function handleReadCard(value) {
|
||||
});
|
||||
openDialog.value = true;
|
||||
} else {
|
||||
proxy.$modal.msgError(res.msg);
|
||||
proxy.$modal.msgError(res?.msg || '预结算失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -648,9 +648,9 @@ function printCharge(row) {
|
||||
getChargeInfo({ paymentId: row.paymentId }).then((res) => {
|
||||
// 设置实收金额
|
||||
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) {
|
||||
totalAmount.value = amountDetail.amount;
|
||||
totalAmount.value = amountDetail.amount || 0;
|
||||
|
||||
// 为合并的行设置金额相关字段值
|
||||
rows.forEach((item) => {
|
||||
|
||||
@@ -302,14 +302,14 @@ function handleRefund(row) {
|
||||
// return new Decimal(accumulator).add(new Decimal(currentRow.totalPrice || 0));
|
||||
// }, 0);
|
||||
getReturnDetail({ id: row.paymentId }).then((res) => {
|
||||
if (res.data.length > 0) {
|
||||
if (res.data?.length > 0) {
|
||||
totalAmount.value =
|
||||
res.data.find((item) => item.payEnum === 220000).amount -
|
||||
(res.data.find((item) => item.payEnum === 220500)?.amount || 0);
|
||||
(res.data.find((item) => item.payEnum === 220000)?.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;
|
||||
});
|
||||
}) || [];
|
||||
});
|
||||
paymentId.value = row.paymentId;
|
||||
patientInfo.value.patientId = row.patientId;
|
||||
|
||||
@@ -128,7 +128,7 @@ const getFeeTypeText = computed(() => {
|
||||
}
|
||||
// 如果只有一个选项,直接返回第一个选项的文本
|
||||
if (props.medfee_paymtd_code.length === 1) {
|
||||
return props.medfee_paymtd_code[0].label || '';
|
||||
return props.medfee_paymtd_code[0]?.label || '';
|
||||
}
|
||||
return '';
|
||||
});
|
||||
@@ -351,7 +351,7 @@ async function printReceipt(param) {
|
||||
const vxValue = param.detail?.find((t) => t.payEnum === 220100)?.amount ?? 0;
|
||||
const unionValue = param.detail?.find((t) => t.payEnum === 220300)?.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 sum = res.data
|
||||
.filter((item) => targetPayEnums.includes(item.payEnum))
|
||||
?.filter((item) => targetPayEnums.includes(item.payEnum))
|
||||
.reduce((total, item) => total + (Number(item.amount) || 0), 0);
|
||||
if (sum > 0) {
|
||||
formData.totalAmount = sum;
|
||||
@@ -313,9 +313,9 @@ const displayAmount = computed(() => {
|
||||
}
|
||||
const targetPayEnums = [220500, 220400, 220100, 220200, 220300];
|
||||
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);
|
||||
return sum.toFixed(2);
|
||||
return sum?.toFixed(2) ?? '0.00';
|
||||
});
|
||||
|
||||
const returnedAmount = computed(() => {
|
||||
@@ -334,7 +334,7 @@ const calculatedTotalAmount = computed(() => {
|
||||
const targetPayEnums = [220500, 220400, 220100, 220200, 220300];
|
||||
// 应退金额 = (amount - returnAmount) 的总和,即剩余应退金额
|
||||
const sum = preCancelData.value
|
||||
.filter((item) => targetPayEnums.includes(item.payEnum))
|
||||
?.filter((item) => targetPayEnums.includes(item.payEnum))
|
||||
.reduce(
|
||||
(total, item) => total + ((Number(item.amount) || 0) - (Number(item.returnAmount) || 0)),
|
||||
0
|
||||
@@ -348,7 +348,7 @@ const calculatedReturnAmount = computed(() => {
|
||||
}
|
||||
const targetPayEnums = [220500, 220400, 220100, 220200, 220300];
|
||||
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);
|
||||
return sum || 0;
|
||||
});
|
||||
@@ -359,12 +359,12 @@ const refundMethodsFromApi = computed(() => {
|
||||
return [];
|
||||
}
|
||||
const targetPayEnums = [220500, 220400, 220100, 220200, 220300];
|
||||
return preCancelData.value.filter(
|
||||
return preCancelData.value?.filter(
|
||||
(item) =>
|
||||
targetPayEnums.includes(item.payEnum) &&
|
||||
item.payEnum_dictText &&
|
||||
item.payEnum_dictText.trim() !== ''
|
||||
);
|
||||
) || [];
|
||||
});
|
||||
|
||||
// 根据 payEnum 获取支付方式标签
|
||||
@@ -380,7 +380,7 @@ const getPayMethodLabel = (payEnum) => {
|
||||
|
||||
// 计算所有退费方式的总和
|
||||
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="value">{{ form.name || '-' }}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="label">门诊号:</span>
|
||||
<span class="value">{{ form.serialNo || '-' }}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="label">就诊卡号:</span>
|
||||
<span class="value">{{ form.cardNo || '-' }}</span>
|
||||
@@ -233,6 +229,12 @@
|
||||
</table>
|
||||
</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="reminder">温馨提示: 请妥善保管此凭条,就诊时请携带。</div>
|
||||
</div>
|
||||
@@ -545,29 +547,21 @@ function formatDateTime(date) {
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
|
||||
// 计算流水号(与 fillForm 中的逻辑一致)
|
||||
// 计算流水号:直接使用挂号记录表的主键ID(encounterId)
|
||||
function calculateSerialNo(row) {
|
||||
if (!row) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
// 优先使用已有的 serialNo(如果存在)
|
||||
if (row.serialNo) {
|
||||
return row.serialNo;
|
||||
// 直接使用主键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 '-';
|
||||
}
|
||||
|
||||
// 使用 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;
|
||||
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 {
|
||||
margin-top: 20px;
|
||||
font-size: 12px;
|
||||
@@ -1052,6 +1066,31 @@ async function handleConfirmSelect() {
|
||||
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 {
|
||||
margin-top: 20px;
|
||||
font-size: 12px;
|
||||
|
||||
@@ -801,10 +801,10 @@ const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 根据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 '';
|
||||
}
|
||||
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 : '';
|
||||
}
|
||||
|
||||
@@ -1185,7 +1185,7 @@ function filterDoctorsByHealthcare() {
|
||||
}
|
||||
|
||||
// 获取选中的挂号类型信息
|
||||
const selectedHealthcare = healthcareList.value.find(
|
||||
const selectedHealthcare = healthcareList.value?.find(
|
||||
(healthcare) => healthcare.id === form.value.serviceTypeId
|
||||
);
|
||||
|
||||
|
||||
@@ -198,6 +198,9 @@ watch(
|
||||
// 直接更新查询参数
|
||||
queryParams.value.searchKey = newValue.searchKey || '';
|
||||
|
||||
// 更新categoryCode
|
||||
queryParams.value.categoryCode = newValue.categoryCode || '';
|
||||
|
||||
// 处理类型筛选
|
||||
if (newValue.adviceType !== undefined && newValue.adviceType !== null && newValue.adviceType !== '') {
|
||||
// 单个类型
|
||||
@@ -215,9 +218,19 @@ getList();
|
||||
// 从priceList列表中获取价格
|
||||
function getPriceFromInventory(row) {
|
||||
if (row.priceList && row.priceList.length > 0) {
|
||||
const price = row.priceList[0].price || 0;
|
||||
const price = row.priceList[0].price;
|
||||
// 检查价格是否为有效数字
|
||||
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 '-';
|
||||
}
|
||||
function getList() {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--检验信息-->
|
||||
<el-table
|
||||
ref="inspectionTableRef"
|
||||
:data="inspectionList"
|
||||
@@ -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 style="margin-bottom: 20px">
|
||||
<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 style="display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; margin-bottom: 20px">
|
||||
<div>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">申请日期</label>
|
||||
<el-date-picker
|
||||
@@ -127,6 +128,7 @@
|
||||
style="width: 100%"
|
||||
/>
|
||||
</div>
|
||||
<!--申请科室-->
|
||||
<div>
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">申请科室</label>
|
||||
<el-select v-model="formData.departmentName" placeholder="请选择申请科室" size="small" style="width: 100%" disabled>
|
||||
@@ -135,9 +137,11 @@
|
||||
<el-option label="儿科" value="pediatrics" />
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<!--申请医生-->
|
||||
<div>
|
||||
<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_li" />
|
||||
<el-option label="王医生" value="doctor_wang" />
|
||||
@@ -164,7 +168,7 @@
|
||||
<div v-if="validationErrors.executeDepartment" class="error-message">请选择执行科室</div>
|
||||
</div>
|
||||
|
||||
<!-- 诊断相关字段 -->
|
||||
<!-- 诊断描述 -->
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px">
|
||||
<div :class="{ 'form-item-error': validationErrors.diagnosisDesc }">
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">诊断描述 <span style="color: #f56c6c">*</span></label>
|
||||
@@ -248,7 +252,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<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="display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px">
|
||||
@@ -458,7 +461,7 @@ const formData = reactive({
|
||||
applicationId: null,
|
||||
applicationNo: '202511210001',
|
||||
patientName: '',
|
||||
cardNo: '',
|
||||
identifierNo: '',
|
||||
feeType: 'self',
|
||||
applicationDate: new Date(),
|
||||
departmentName: '',
|
||||
@@ -579,11 +582,11 @@ const getFilteredItems = (categoryKey) => {
|
||||
|
||||
// 初始化数据
|
||||
function initData() {
|
||||
console.log('检验组件初始化,patientInfo:', props.patientInfo)
|
||||
// console.log('检验组件初始化,patientInfo:', props.patientInfo)
|
||||
if (props.patientInfo) {
|
||||
queryParams.encounterId = props.patientInfo.encounterId
|
||||
formData.patientName = props.patientInfo.patientName || ''
|
||||
formData.cardNo = props.patientInfo.cardNo || ''
|
||||
formData.identifierNo = props.patientInfo.identifierNo || ''
|
||||
formData.departmentName = props.patientInfo.departmentName || ''
|
||||
formData.doctorName = props.patientInfo.doctorName || ''
|
||||
}
|
||||
@@ -597,26 +600,26 @@ function initData() {
|
||||
function getInspectionList() {
|
||||
// 如果没有encounterId,不调用接口
|
||||
if (!queryParams.encounterId) {
|
||||
console.warn('【检验】encounterId为空,不调用接口')
|
||||
// console.warn('【检验】encounterId为空,不调用接口')
|
||||
return
|
||||
}
|
||||
|
||||
loading.value = true
|
||||
|
||||
// 调用真实的API,只传递 encounterId 参数
|
||||
console.log('【检验】调用API,encounterId:', queryParams.encounterId)
|
||||
// console.log('【检验】调用API,encounterId:', queryParams.encounterId)
|
||||
getInspectionApplicationList({ encounterId: queryParams.encounterId }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
inspectionList.value = res.data || []
|
||||
total.value = res.data?.length || 0
|
||||
console.log('【检验】获取数据成功,数量:', inspectionList.value.length)
|
||||
// console.log('【检验】获取数据成功,数量:', inspectionList.value.length)
|
||||
} else {
|
||||
inspectionList.value = []
|
||||
total.value = 0
|
||||
ElMessage.error('获取检验申请单列表失败')
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.error('获取检验申请单列表异常:', error)
|
||||
// console.error('获取检验申请单列表异常:', error)
|
||||
inspectionList.value = []
|
||||
total.value = 0
|
||||
ElMessage.error('获取检验申请单列表异常')
|
||||
@@ -627,7 +630,7 @@ function getInspectionList() {
|
||||
|
||||
// 新增申请单
|
||||
function handleNewApplication() {
|
||||
console.log('点击新增按钮')
|
||||
// console.log('点击新增按钮')
|
||||
resetForm()
|
||||
// 生成申请单号
|
||||
formData.applicationNo = generateApplicationNo()
|
||||
@@ -737,7 +740,7 @@ function handleSave() {
|
||||
totalAmount: selectedInspectionItems.value.reduce((sum, item) => sum + item.price + (item.serviceFee || 0), 0)
|
||||
}
|
||||
|
||||
console.log('保存检验申请单数据:', saveData)
|
||||
// console.log('保存检验申请单数据:', saveData)
|
||||
|
||||
// 调用真实的API保存
|
||||
saveInspectionApplication(saveData).then((res) => {
|
||||
@@ -751,7 +754,7 @@ function handleSave() {
|
||||
ElMessage.error(res.message || '保存失败')
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.error('保存检验申请单异常:', error)
|
||||
// console.error('保存检验申请单异常:', error)
|
||||
ElMessage.error('保存异常')
|
||||
})
|
||||
}
|
||||
@@ -761,7 +764,7 @@ function handleFormSave() {
|
||||
formRef.value?.validate((valid) => {
|
||||
if (valid) {
|
||||
formData.inspectionItems = selectedInspectionItems.value.map(item => item.id)
|
||||
console.log('保存检验申请单表单数据:', formData)
|
||||
// console.log('保存检验申请单表单数据:', formData)
|
||||
ElMessage.success('保存成功')
|
||||
showForm.value = false
|
||||
getInspectionList()
|
||||
@@ -771,7 +774,7 @@ function handleFormSave() {
|
||||
|
||||
// 查看详情
|
||||
function handleView(row) {
|
||||
console.log('点击查看按钮,数据:', row)
|
||||
// console.log('点击查看按钮,数据:', row)
|
||||
// 加载表单数据
|
||||
Object.assign(formData, row)
|
||||
|
||||
@@ -811,7 +814,7 @@ function switchCategory(category) {
|
||||
// 处理搜索
|
||||
function handleSearch() {
|
||||
// 搜索逻辑已在getFilteredItems中实现,这里可以添加额外的搜索逻辑
|
||||
console.log('搜索关键词:', searchKeyword.value)
|
||||
// console.log('搜索关键词:', searchKeyword.value)
|
||||
}
|
||||
|
||||
// 处理项目项点击(排除勾选框点击)
|
||||
@@ -866,7 +869,7 @@ function handleSelectionChange(selection) {
|
||||
|
||||
// 打印申请单
|
||||
function handlePrint(row) {
|
||||
console.log('打印申请单:', row)
|
||||
// console.log('打印申请单:', row)
|
||||
|
||||
// 切换到申请单TAB
|
||||
leftActiveTab.value = 'application'
|
||||
@@ -949,7 +952,7 @@ function handleDelete(row) {
|
||||
confirmButtonClass: 'el-button--danger'
|
||||
}
|
||||
).then(() => {
|
||||
console.log('删除申请单:', row)
|
||||
// console.log('删除申请单:', row)
|
||||
// 调用真实的API删除
|
||||
deleteInspectionApplication(row.applicationId).then((res) => {
|
||||
if (res.code === 200) {
|
||||
@@ -960,7 +963,7 @@ function handleDelete(row) {
|
||||
ElMessage.error(res.message || '删除失败')
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.error('删除检验申请单异常:', error)
|
||||
// console.error('删除检验申请单异常:', error)
|
||||
ElMessage.error('删除异常')
|
||||
})
|
||||
}).catch(() => {
|
||||
@@ -987,10 +990,11 @@ watch(() => props.activeTab, (newVal) => {
|
||||
|
||||
// 监听patientInfo变化,确保encounterId及时更新
|
||||
watch(() => props.patientInfo, (newVal) => {
|
||||
console.log('【检验】patientInfo变化:', newVal)
|
||||
// console.log('【检验】patientInfo变化:', newVal)
|
||||
console.log('【检验】接收到的完整patientInfo:', JSON.stringify(newVal, null, 2))
|
||||
if (newVal && newVal.encounterId) {
|
||||
queryParams.encounterId = newVal.encounterId
|
||||
console.log('【检验】更新encounterId:', queryParams.encounterId)
|
||||
// console.log('【检验】更新encounterId:', queryParams.encounterId)
|
||||
}
|
||||
}, { deep: true, immediate: true })
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
' ' +
|
||||
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 +
|
||||
@@ -145,7 +145,7 @@
|
||||
<span class="medicine-info"> 注射药品:{{ scope.row.injectFlag_enumText }} </span>
|
||||
<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) + ' 元'
|
||||
: '0.00 元'
|
||||
}}
|
||||
@@ -631,7 +631,7 @@
|
||||
" " +
|
||||
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 +
|
||||
@@ -687,7 +687,7 @@
|
||||
</el-form-item>
|
||||
<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) + ' 元'
|
||||
: '0.00 元'
|
||||
}}
|
||||
@@ -702,7 +702,7 @@
|
||||
<span style="font-size: 16px; font-weight: 600">
|
||||
{{ 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) + '/次'
|
||||
: '-' + '元'
|
||||
}}
|
||||
@@ -748,7 +748,7 @@
|
||||
<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) + ' 元'
|
||||
: '0.00 元'
|
||||
}}
|
||||
@@ -782,6 +782,19 @@
|
||||
// 当医嘱类型改变时,清空当前选择的项目名称,因为不同类型项目的数据结构可能不兼容
|
||||
prescriptionList[scope.$index].adviceName = undefined;
|
||||
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="
|
||||
@@ -907,7 +920,7 @@
|
||||
<el-table-column label="总金额" align="right" prop="" header-align="center" width="100">
|
||||
<template #default="scope">
|
||||
<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>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -2852,12 +2865,25 @@ function getGroupMarkers() {
|
||||
function calculateTotalPrice(row, index) {
|
||||
nextTick(() => {
|
||||
if (row.adviceType == 3) {
|
||||
// 检查价格是否为有效数字
|
||||
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 {
|
||||
if (row.unitCode == row.minUnitCode) {
|
||||
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 {
|
||||
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() {
|
||||
queryParams.value.statusEnum = 2;
|
||||
getList(queryParams.value).then((res) => {
|
||||
// console.log('API返回的完整数据:', res); // 添加这行来查看完整返回
|
||||
// console.log('API返回的数据记录:', res.data.records); // 查看具体数据记录
|
||||
patientList.value = res.data.records.map((item) => {
|
||||
// console.log('处理的单个患者数据:', item); // 查看处理的单个患者数据
|
||||
return {
|
||||
...item,
|
||||
active: currentEncounterId.value ? item.encounterId == currentEncounterId.value : false,
|
||||
@@ -431,7 +434,7 @@ function handleClick(tab) {
|
||||
// 查看本次就诊处方单(从医嘱Tab页获取已开立的处方单信息)
|
||||
function getEnPrescription(encounterId) {
|
||||
getEnPrescriptionInfo({ encounterId: encounterId }).then((res) => {
|
||||
console.log('处方单 res', res);
|
||||
// console.log('处方单 res', res);
|
||||
let dataArr = res.data.records || [];
|
||||
if (dataArr.length <= 0) {
|
||||
ElMessage({
|
||||
@@ -461,6 +464,7 @@ function handleCardClick(item, index) {
|
||||
patient.active = patient.encounterId === item.encounterId;
|
||||
});
|
||||
patientInfo.value = item;
|
||||
// console.log('patientInfo.value.cardNo:', patientInfo.value.cardNo)
|
||||
// 将患者信息保存到store中,供hospitalizationEmr组件使用
|
||||
updatePatientInfo(item);
|
||||
activeTab.value = 'hospitalizationEmr';
|
||||
|
||||
@@ -291,8 +291,8 @@ import {advicePrint, getAdjustPriceSwitchState, lotNumberMatch} from '@/api/publ
|
||||
import {debounce} from 'lodash-es';
|
||||
import TraceNoDialog from '@/components/OpenHis/TraceNoDialog/index.vue';
|
||||
import {hiprint} from 'vue-plugin-hiprint';
|
||||
import templateJson from './components/templateJson.json';
|
||||
import disposalTemplate from './components/disposalTemplate.json';
|
||||
import templateJson from './templateJson.json';
|
||||
import disposalTemplate from './disposalTemplate.json';
|
||||
import {formatInventory} from '@/utils/his.js';
|
||||
|
||||
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,
|
||||
chargeItemIds: chargeItemIdList.value,
|
||||
}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
const item = res.data.paymentRecDetailDtoList.find((i) => {
|
||||
if (res.code == 200 && res.data) {
|
||||
const item = res.data.paymentRecDetailDtoList?.find((i) => {
|
||||
return i.payEnum == 220000;
|
||||
});
|
||||
totalAmount.value = item?.amount;
|
||||
totalAmount.value = item?.amount ?? 0;
|
||||
paymentId.value = res.data.id;
|
||||
newId.value = res.data.newId;
|
||||
oldId.value = res.data.oldId;
|
||||
chrgBchnoList.value = res.data.chrgBchnoList;
|
||||
details.value = res.data.paymentRecDetailDtoList?.filter((item) => {
|
||||
return item.amount > 0;
|
||||
});
|
||||
}) || [];
|
||||
openDialog.value = true;
|
||||
} else {
|
||||
proxy.$modal.msgError(res.msg);
|
||||
proxy.$modal.msgError(res?.msg || '预结算失败');
|
||||
}
|
||||
});
|
||||
// console.log(patientInfo)
|
||||
@@ -656,12 +656,12 @@ async function handleReadCard(value) {
|
||||
ybMdtrtCertType: userCardInfo.psnCertType,
|
||||
busiCardInfo: userCardInfo.busiCardInfo,
|
||||
}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
if (res.code == 200 && res.data) {
|
||||
paymentId.value = res.data.id;
|
||||
totalAmount.value = res.data.paymentRecDetailDtoList.find(
|
||||
totalAmount.value = res.data.paymentRecDetailDtoList?.find(
|
||||
(item) => item.payEnum == 220000
|
||||
).amount;
|
||||
details.value = res.data.paymentRecDetailDtoList;
|
||||
)?.amount ?? 0;
|
||||
details.value = res.data.paymentRecDetailDtoList || [];
|
||||
// chrgBchnoList.value = res.data.chrgBchnoList;
|
||||
chargeItemIdList.value = selectRows.map((item) => {
|
||||
return item.id;
|
||||
@@ -680,7 +680,7 @@ async function handleReadCard(value) {
|
||||
|
||||
openDialog.value = true;
|
||||
} else {
|
||||
proxy.$modal.msgError(res.msg);
|
||||
proxy.$modal.msgError(res?.msg || '预结算失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<tr
|
||||
v-for="(item, index) in tableData"
|
||||
: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>
|
||||
@@ -32,10 +32,8 @@
|
||||
<input
|
||||
type="text"
|
||||
v-model="item.healthInstitution"
|
||||
placeholder="请输入卫生机构"
|
||||
:class="{ 'error-input': item.errors?.healthInstitution }"
|
||||
disabled
|
||||
>
|
||||
<span v-if="item.errors?.healthInstitution" class="error-message">{{ item.errors.healthInstitution }}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.healthInstitution }}
|
||||
@@ -55,7 +53,7 @@
|
||||
type="text"
|
||||
v-model="item.lisGroupName"
|
||||
placeholder="请输入分组名称"
|
||||
:class="{ 'error-input': item.errors?.lisGroupName }"
|
||||
:class="{ 'error-input': item.errors?.lisGroupName, 'focus-target': item.isNew }"
|
||||
>
|
||||
<span v-if="item.errors?.lisGroupName" class="error-message">{{ item.errors.lisGroupName }}</span>
|
||||
</template>
|
||||
@@ -108,21 +106,26 @@
|
||||
|
||||
<!-- 分页区域 -->
|
||||
<div class="pagination">
|
||||
<button class="pagination-btn">‹</button>
|
||||
<span>1</span>
|
||||
<button class="pagination-btn">›</button>
|
||||
<button class="pagination-btn" @click="prevPage" :disabled="currentPage <= 1">‹</button>
|
||||
<span>{{ currentPage }}</span>
|
||||
<button class="pagination-btn" @click="nextPage" :disabled="currentPage >= totalPages">›</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<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 {getDicts} from "@/api/system/dict/data";
|
||||
import useUserStore from '@/store/modules/user';
|
||||
import {ElMessage, ElMessageBox} from 'element-plus';
|
||||
|
||||
export default {
|
||||
name: 'LisGroupMaintain',
|
||||
setup() {
|
||||
// 获取用户store
|
||||
const userStore = useUserStore();
|
||||
|
||||
// 加载状态
|
||||
const loading = ref(false)
|
||||
|
||||
@@ -138,7 +141,6 @@ export default {
|
||||
bloodTubeOptions.value = response.data.map(item => item.label || item.dictLabel);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取采血管颜色字典失败:', error);
|
||||
// 如果字典获取失败,使用默认选项作为备选
|
||||
bloodTubeOptions.value = ['黄管', '紫管', '蓝管'];
|
||||
}
|
||||
@@ -154,6 +156,11 @@ export default {
|
||||
return Math.ceil(totalItems.value / pageSize.value)
|
||||
})
|
||||
|
||||
// 获取当前用户的卫生机构名称
|
||||
const getCurrentHospital = () => {
|
||||
return userStore.hospitalName || userStore.orgName || '演示医院';
|
||||
};
|
||||
|
||||
// 表格数据
|
||||
const tableData = reactive([])
|
||||
|
||||
@@ -181,172 +188,58 @@ export default {
|
||||
pageSize: pageSize.value
|
||||
}
|
||||
|
||||
console.log('准备调用接口,查询参数:', query)
|
||||
|
||||
// 调用接口获取数据
|
||||
// 注意:根据checkType.js中的定义,这个接口使用GET方法和params参数
|
||||
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)
|
||||
totalItems.value = 0
|
||||
|
||||
// 适配可能的不同响应格式
|
||||
let items = []
|
||||
let total = 0
|
||||
// 处理明确的数据结构
|
||||
if (response && response.code === 200) {
|
||||
// 清空现有数据
|
||||
tableData.splice(0, tableData.length);
|
||||
|
||||
// 检查响应是否存在
|
||||
if (response) {
|
||||
// 处理标准响应格式
|
||||
if (typeof response === 'object') {
|
||||
// 检查是否是标准API响应格式 {code, data, msg}
|
||||
if ('code' in response) {
|
||||
console.log('响应包含code字段:', response.code)
|
||||
// 获取最内层的数据结构
|
||||
const innerResponse = response.data;
|
||||
if (innerResponse && innerResponse.code === 200) {
|
||||
const data = innerResponse.data;
|
||||
if (data && Array.isArray(data.records)) {
|
||||
// 更新总记录数
|
||||
totalItems.value = data.total || 0;
|
||||
|
||||
// 成功状态码处理
|
||||
if (response.code === 200 || response.code === '200' || response.code === 0) {
|
||||
console.log('响应状态码为成功状态')
|
||||
// 处理每条记录
|
||||
data.records.forEach((item, index) => {
|
||||
const formattedItem = {
|
||||
id: item.id,
|
||||
healthInstitution: item.hospital,
|
||||
date: item.date,
|
||||
lisGroupName: item.groupName,
|
||||
bloodCollectionTube: item.tube,
|
||||
remark: item.remark || '',
|
||||
editing: false
|
||||
};
|
||||
|
||||
// 检查data字段
|
||||
if ('data' in response) {
|
||||
console.log('响应包含data字段,数据类型:', typeof response.data)
|
||||
|
||||
// 格式1: {data: {rows: [], total: number}}
|
||||
if (response.data && typeof response.data === 'object') {
|
||||
// 处理双重嵌套格式 {data: {code, msg, data: []}}
|
||||
if (response.data.data && (Array.isArray(response.data.data) || typeof response.data.data === 'object')) {
|
||||
console.log('匹配到格式: 双重嵌套 data.data');
|
||||
|
||||
// 如果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对象作为单个条目处理')
|
||||
}
|
||||
}
|
||||
tableData.push(formattedItem);
|
||||
});
|
||||
} else {
|
||||
totalItems.value = 0;
|
||||
}
|
||||
} else {
|
||||
console.log('响应不包含data字段')
|
||||
totalItems.value = 0;
|
||||
}
|
||||
} 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 {
|
||||
console.warn(`记录 ${index + 1} 不是有效对象,跳过处理:`, item);
|
||||
}
|
||||
});
|
||||
|
||||
totalItems.value = total;
|
||||
console.log('数据加载完成,表格显示', tableData.length, '条记录,总数:', totalItems.value);
|
||||
} else {
|
||||
console.log('未获取到有效数据,表格为空');
|
||||
totalItems.value = 0;
|
||||
}
|
||||
} catch (error) {
|
||||
// 详细的错误信息记录
|
||||
console.error('加载LIS分组数据异常:', error)
|
||||
|
||||
// 提取更详细的错误信息
|
||||
// 提取错误信息
|
||||
let errorMessage = '加载LIS分组数据失败,请稍后重试'
|
||||
|
||||
if (error.response) {
|
||||
// 服务器响应了,但状态码不是2xx
|
||||
console.error('HTTP错误状态:', error.response.status)
|
||||
console.error('HTTP错误响应体:', error.response.data)
|
||||
|
||||
if (error.response.data) {
|
||||
errorMessage = error.response.data.msg ||
|
||||
error.response.data.message ||
|
||||
@@ -355,36 +248,18 @@ export default {
|
||||
} else {
|
||||
errorMessage = `服务器错误 (${error.response.status})`
|
||||
}
|
||||
|
||||
// 额外记录响应体详情便于调试
|
||||
if (typeof error.response.data === 'object') {
|
||||
console.error('响应体详细结构:', JSON.stringify(error.response.data, null, 2))
|
||||
}
|
||||
} else if (error.request) {
|
||||
// 请求已发出,但未收到响应
|
||||
console.error('请求已发送但未收到响应:', error.request)
|
||||
errorMessage = '网络错误,服务器未响应,请检查网络连接'
|
||||
} else if (error.message) {
|
||||
// 请求配置出错
|
||||
console.error('请求配置错误:', error.message)
|
||||
errorMessage = error.message
|
||||
} else {
|
||||
console.error('未知错误类型:', typeof error)
|
||||
}
|
||||
|
||||
// 显示错误信息
|
||||
showMessage(errorMessage, 'error')
|
||||
|
||||
// 确保表格状态正确
|
||||
console.log('异常处理后表格状态:', {
|
||||
tableDataLength: tableData.length,
|
||||
totalItems: totalItems.value,
|
||||
currentPage: currentPage.value
|
||||
})
|
||||
} finally {
|
||||
loading.value = false
|
||||
console.log('数据加载操作完成,loading状态已更新为false')
|
||||
console.log('最终表格数据量:', tableData.length, ',总数:', totalItems.value)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,13 +277,6 @@ export default {
|
||||
// 清除之前的错误信息
|
||||
delete item.errors
|
||||
|
||||
// 验证卫生机构
|
||||
if (!item.healthInstitution || item.healthInstitution.trim() === '') {
|
||||
errors.healthInstitution = '卫生机构不能为空'
|
||||
} else if (item.healthInstitution.length > 100) {
|
||||
errors.healthInstitution = '卫生机构名称不能超过100个字符'
|
||||
}
|
||||
|
||||
// 验证LIS分组名称
|
||||
if (!item.lisGroupName || item.lisGroupName.trim() === '') {
|
||||
errors.lisGroupName = 'LIS分组名称不能为空'
|
||||
@@ -436,15 +304,11 @@ export default {
|
||||
|
||||
// 显示提示信息
|
||||
const showMessage = (message, type = 'success') => {
|
||||
// 在实际项目中,这里可以使用Element Plus或其他UI库的消息组件
|
||||
// 这里为了简单起见,使用浏览器的alert,但添加了类型标识
|
||||
// 使用Element Plus的消息组件
|
||||
if (type === 'error') {
|
||||
console.error(message)
|
||||
alert(`错误: ${message}`)
|
||||
ElMessage.error(message)
|
||||
} else {
|
||||
console.log(message)
|
||||
// 可以使用更友好的提示方式,这里暂时注释掉alert以避免频繁弹窗
|
||||
// alert(message)
|
||||
ElMessage.success(message)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -504,17 +368,23 @@ export default {
|
||||
const isNewRecord = item.isNew
|
||||
delete item.isNew
|
||||
|
||||
// 添加保存成功样式,包括新增记录
|
||||
item.success = true
|
||||
// 0.5秒后移除成功样式
|
||||
setTimeout(() => {
|
||||
item.success = false
|
||||
}, 500)
|
||||
|
||||
showMessage('保存成功')
|
||||
|
||||
// 如果是新增,重新加载数据以确保数据一致性
|
||||
if (isNewRecord) {
|
||||
// 修改完成后重新请求后端本页数据,确保数据准确性
|
||||
setTimeout(() => {
|
||||
loadLisGroups()
|
||||
}
|
||||
}, 500)
|
||||
} else {
|
||||
showMessage(`保存失败: ${response.msg || '未知错误'}`, 'error')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('保存LIS分组数据失败:', error)
|
||||
showMessage(`保存失败: ${error.message || '未知错误'}`, 'error')
|
||||
} finally {
|
||||
loading.value = false
|
||||
@@ -543,13 +413,12 @@ export default {
|
||||
item.editing = false
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('取消编辑失败:', error)
|
||||
showMessage('取消编辑失败', 'error')
|
||||
}
|
||||
}
|
||||
|
||||
// 添加新行
|
||||
const addRow = () => {
|
||||
const addRow = async () => {
|
||||
// 检查是否已有正在编辑的行
|
||||
const editingRow = tableData.find(item => item.editing)
|
||||
if (editingRow) {
|
||||
@@ -558,9 +427,11 @@ export default {
|
||||
}
|
||||
|
||||
const newId = String(Math.max(...tableData.map(item => parseInt(item.id) || 0), 0) + 1)
|
||||
// 从用户信息中获取当前卫生机构
|
||||
const currentHospital = getCurrentHospital()
|
||||
tableData.push({
|
||||
id: newId,
|
||||
healthInstitution: '', // 空默认值
|
||||
id: '',
|
||||
healthInstitution: currentHospital, // 默认当前操作工号的卫生机构
|
||||
date: getCurrentDate(), // 默认当前系统时间
|
||||
lisGroupName: '',
|
||||
bloodCollectionTube: '',
|
||||
@@ -570,7 +441,14 @@ export default {
|
||||
isNew: true // 标记为新记录
|
||||
})
|
||||
|
||||
showMessage('请填写新记录信息')
|
||||
// 等待DOM更新后聚焦到第一个输入框
|
||||
await nextTick()
|
||||
const focusElement = document.querySelector('.focus-target')
|
||||
if (focusElement) {
|
||||
focusElement.focus()
|
||||
// 清除focus-target类,避免下次添加行时影响
|
||||
focusElement.classList.remove('focus-target')
|
||||
}
|
||||
}
|
||||
|
||||
// 删除行
|
||||
@@ -582,10 +460,26 @@ export default {
|
||||
return
|
||||
}
|
||||
|
||||
if (confirm(`确定要删除"${item.lisGroupName}"这条记录吗?`)) {
|
||||
try {
|
||||
// 使用Element Plus的确认对话框
|
||||
await ElMessageBox.confirm(
|
||||
`确定要删除"${item.lisGroupName}"这条记录吗?`,
|
||||
'删除确认',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
|
||||
loading.value = true
|
||||
|
||||
// 添加删除行标记,触发渐隐效果
|
||||
item.deleting = true
|
||||
|
||||
// 等待300ms,让渐隐效果完成
|
||||
await new Promise(resolve => setTimeout(resolve, 300))
|
||||
|
||||
// 如果是新添加的记录,直接从数组中移除
|
||||
if (item.isNew) {
|
||||
tableData.splice(index, 1)
|
||||
@@ -596,23 +490,37 @@ export default {
|
||||
const response = await delLisGroup(item.id)
|
||||
|
||||
if (response.code === 200) {
|
||||
tableData.splice(index, 1)
|
||||
showMessage('删除成功')
|
||||
|
||||
// 更新总数
|
||||
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)
|
||||
if (error !== 'cancel') {
|
||||
showMessage(`删除失败: ${error.message || '未知错误'}`, 'error')
|
||||
// 如果删除失败,移除删除标记
|
||||
if (tableData[index]) {
|
||||
tableData[index].deleting = false
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 分页方法
|
||||
const prevPage = () => {
|
||||
@@ -680,7 +588,7 @@ export default {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.header h1 {
|
||||
.header h2 {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
@@ -718,6 +626,12 @@ export default {
|
||||
background-color: #f0f8ff;
|
||||
}
|
||||
|
||||
/* 保存成功行样式 */
|
||||
.success-row {
|
||||
background-color: #f6ffed !important;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.actions {
|
||||
white-space: nowrap;
|
||||
}
|
||||
@@ -732,7 +646,7 @@ export default {
|
||||
/* 分页样式 */
|
||||
.pagination {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 16px 0;
|
||||
margin-top: 8px;
|
||||
@@ -741,6 +655,14 @@ export default {
|
||||
.pagination span {
|
||||
font-size: 14px;
|
||||
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 {
|
||||
@@ -957,7 +879,8 @@ input:disabled {
|
||||
|
||||
.data-table {
|
||||
font-size: 12px;
|
||||
min-width: 600px; /* 确保表格在小屏幕上可以横向滚动 */
|
||||
border-collapse: collapse;
|
||||
min-width: 768px; /* 确保表格在小屏幕上可以横向滚动 */
|
||||
}
|
||||
|
||||
.data-table th,
|
||||
@@ -984,7 +907,16 @@ input:disabled {
|
||||
/* 平滑过渡效果 */
|
||||
.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;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,13 +31,14 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<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>
|
||||
<!-- 患者列表 -->
|
||||
<tr v-for="(patient, index) in group" :key="patient.id">
|
||||
<tr v-for="(patient, index) in groupedPatients[doctorName]" :key="patient.id">
|
||||
<td>{{ index + 1 }}</td>
|
||||
<td>{{ formatPatientName(patient.name) }}</td>
|
||||
<td>{{ getDoctorRoom(doctorName) }}</td>
|
||||
@@ -46,6 +47,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -126,9 +128,29 @@ const waitingCount = computed(() => {
|
||||
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 totalPatients = patients.value.length
|
||||
return Math.ceil(totalPatients / patientsPerPage) || 1
|
||||
return Math.ceil(sortedDoctors.value.length) || 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