Compare commits
22 Commits
47a7a945bc
...
test
| Author | SHA1 | Date | |
|---|---|---|---|
| 700e353b79 | |||
| 0b2c19d2c5 | |||
| 47394de43c | |||
| f0f1dde6b6 | |||
| 1ab1165697 | |||
| a8f1b1fdfa | |||
| 3b94d19199 | |||
| db1139a14f | |||
|
|
bea74aeac2 | ||
|
|
634a1f45f9 | ||
| 8f1ad3307c | |||
| d8080fa22d | |||
|
|
e8783d9f8f | ||
| d8c4348341 | |||
|
|
8e61490005 | ||
| f5f4e3c48e | |||
| 0f013715b8 | |||
| fb9722d328 | |||
| 6f9192d30d | |||
| f2b5b90f34 | |||
| a2cbd5e583 | |||
| d3df46858b |
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>
|
||||
@@ -64,6 +64,11 @@
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
</dependency>
|
||||
<!-- rabbitMQ -->
|
||||
<!-- <dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -401,6 +401,20 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
|
||||
// 删除
|
||||
List<AdviceSaveDto> deleteList = medicineList.stream()
|
||||
.filter(e -> DbOpType.DELETE.getCode().equals(e.getDbOpType())).collect(Collectors.toList());
|
||||
|
||||
// 校验删除的医嘱是否已经收费
|
||||
List<Long> delRequestIdList = deleteList.stream().map(AdviceSaveDto::getRequestId).collect(Collectors.toList());
|
||||
if (!delRequestIdList.isEmpty()) {
|
||||
List<ChargeItem> chargeItemList = iChargeItemService.getChargeItemInfoByReqId(delRequestIdList);
|
||||
if (chargeItemList != null && !chargeItemList.isEmpty()) {
|
||||
for (ChargeItem ci : chargeItemList) {
|
||||
if (ChargeItemStatus.BILLED.getValue().equals(ci.getStatusEnum())) {
|
||||
return R.fail("已收费的项目无法删除,请刷新页面后重试");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (AdviceSaveDto adviceSaveDto : deleteList) {
|
||||
iMedicationRequestService.removeById(adviceSaveDto.getRequestId());
|
||||
// 删除已经产生的药品发放信息
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,13 @@ public interface IEleInvoiceService {
|
||||
*/
|
||||
R<?> invoiceWriteoff(Long paymentId, String reason);
|
||||
|
||||
/**
|
||||
* 获取发票HTML
|
||||
* @param busNo 业务流水号
|
||||
* @return HTML字符串
|
||||
*/
|
||||
String getInvoiceHtml(String busNo);
|
||||
|
||||
/**
|
||||
* 查询已开发票
|
||||
* @param invoiceId 主键id
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.openhis.financial.domain.PaymentRecDetail;
|
||||
import com.openhis.financial.domain.PaymentReconciliation;
|
||||
import com.openhis.financial.service.IPaymentRecDetailService;
|
||||
import com.openhis.financial.service.IPaymentReconciliationService;
|
||||
import com.openhis.web.paymentmanage.appservice.IChargeBillService;
|
||||
import com.openhis.web.paymentmanage.appservice.IEleInvoiceService;
|
||||
import com.openhis.web.paymentmanage.dto.*;
|
||||
import com.openhis.web.paymentmanage.mapper.EleInvoiceMapper;
|
||||
@@ -38,6 +39,11 @@ import com.openhis.yb.service.IClinicSettleService;
|
||||
import com.openhis.yb.service.IRegService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.velocity.Template;
|
||||
import org.apache.velocity.VelocityContext;
|
||||
import org.apache.velocity.app.Velocity;
|
||||
import org.apache.velocity.runtime.RuntimeConstants;
|
||||
import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
@@ -56,6 +62,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.nio.charset.Charset;
|
||||
@@ -64,6 +71,7 @@ import java.text.DecimalFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -97,153 +105,180 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
@Resource
|
||||
IEncounterService encounterService;
|
||||
@Resource
|
||||
IChargeBillService chargeBillService;
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Autowired
|
||||
private HttpConfig httpConfig;
|
||||
|
||||
public static JSONObject PreInvoicePostForward(JSONObject bill, String endpoint) {
|
||||
String resultString = "";
|
||||
// JSONObject result = new JSONObject();
|
||||
// 获取当前租户的option信息
|
||||
static {
|
||||
Properties p = new Properties();
|
||||
p.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
|
||||
p.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
|
||||
p.setProperty(Velocity.INPUT_ENCODING, "UTF-8");
|
||||
Velocity.init(p);
|
||||
}
|
||||
|
||||
private static final Map<String, JSONObject> invoiceDataMap = new ConcurrentHashMap<>();
|
||||
|
||||
private JSONObject internalRegistration(JSONObject bill) {
|
||||
return createInternalSuccessResponse(bill, "REG");
|
||||
}
|
||||
|
||||
private JSONObject internalOutpatient(JSONObject bill) {
|
||||
return createInternalSuccessResponse(bill, "OUT");
|
||||
}
|
||||
|
||||
private JSONObject internalHospitalized(JSONObject bill) {
|
||||
return createInternalSuccessResponse(bill, "HOS");
|
||||
}
|
||||
|
||||
private JSONObject internalWriteOff(JSONObject bill) {
|
||||
JSONObject message = new JSONObject();
|
||||
message.put("eScarletBillBatchCode", "SC" + System.currentTimeMillis());
|
||||
message.put("eScarletBillNo", UUID.randomUUID().toString().substring(0, 8));
|
||||
message.put("eScarletRandom", "666888");
|
||||
message.put("createTime", "20251101143028");
|
||||
message.put("billQRCode", "QR_DATA_SCARLET");
|
||||
|
||||
JSONObject optionJson = SecurityUtils.getLoginUser().getOptionJson();
|
||||
String baseUrl = optionJson.getString(CommonConstants.Option.URL);
|
||||
String appID = optionJson.getString(CommonConstants.Option.APP_ID);
|
||||
String appKey = optionJson.getString(CommonConstants.Option.KEY);
|
||||
message.put("pictureUrl", baseUrl + "/invoice/view?busNo=scarlet");
|
||||
message.put("pictureNetUrl", baseUrl + "/invoice/view?busNo=scarlet");
|
||||
|
||||
EleInvioceBillDto eleInvioceBillDto = new EleInvioceBillDto();
|
||||
eleInvioceBillDto.setBaseUrl(baseUrl);
|
||||
eleInvioceBillDto.setEndpoint(endpoint);
|
||||
eleInvioceBillDto.setAppKey(appKey);
|
||||
eleInvioceBillDto.setAppID(appID);
|
||||
eleInvioceBillDto.setJsonObject(bill);
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("result", "S0000");
|
||||
result.put("message", Base64.getEncoder().encodeToString(message.toJSONString().getBytes(StandardCharsets.UTF_8)));
|
||||
return result;
|
||||
}
|
||||
|
||||
// 创建Http请求
|
||||
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(30000).setConnectionRequestTimeout(30000)
|
||||
.setSocketTimeout(30000).build();
|
||||
CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build();
|
||||
CloseableHttpResponse response = null;
|
||||
// 发送请求
|
||||
try {
|
||||
HttpPost httpPost = new HttpPost(optionJson.getString("invoiceUrl") + "/eleInvoice/forward");
|
||||
System.out.println(optionJson.getString("invoiceUrl") + "/eleInvoice/forward");
|
||||
StringEntity stringEntity = new StringEntity(com.alibaba.fastjson2.JSON.toJSONString(eleInvioceBillDto),
|
||||
ContentType.APPLICATION_JSON);
|
||||
httpPost.setEntity(stringEntity);
|
||||
// 执行http请求
|
||||
response = httpClient.execute(httpPost);
|
||||
if (response == null) {
|
||||
throw new ServiceException("Http请求异常,未接受返回参数");
|
||||
private JSONObject createInternalSuccessResponse(JSONObject bill, String prefix) {
|
||||
String busNo = bill.getString("busNo");
|
||||
JSONObject optionJson = SecurityUtils.getLoginUser().getOptionJson();
|
||||
String baseUrl = optionJson.getString(CommonConstants.Option.URL);
|
||||
|
||||
JSONObject message = new JSONObject();
|
||||
message.put("billBatchCode", prefix + "BC" + System.currentTimeMillis());
|
||||
message.put("billNo", UUID.randomUUID().toString().substring(0, 8));
|
||||
message.put("random", "123456");
|
||||
message.put("createTime", new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
|
||||
message.put("billQRCode", "QR_" + busNo);
|
||||
message.put("pictureUrl", baseUrl + "/invoice/view?busNo=" + busNo);
|
||||
message.put("pictureNetUrl", baseUrl + "/invoice/view?busNo=" + busNo);
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("result", "S0000");
|
||||
result.put("message", Base64.getEncoder().encodeToString(message.toJSONString().getBytes(StandardCharsets.UTF_8)));
|
||||
return result;
|
||||
}
|
||||
|
||||
private JSONObject createInternalErrorResponse(String msg) {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("result", "E0001");
|
||||
result.put("message", Base64.getEncoder().encodeToString(msg.getBytes(StandardCharsets.UTF_8)));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInvoiceHtml(String busNo) {
|
||||
JSONObject bill = invoiceDataMap.get(busNo);
|
||||
if (bill == null) {
|
||||
return "<html><body><h2>未找到流水号为 " + busNo + " 的发票数据</h2></body></html>";
|
||||
}
|
||||
|
||||
JSONObject receiptData = bill.getJSONObject("receiptData");
|
||||
|
||||
VelocityContext context = new VelocityContext();
|
||||
context.put("hospitalName", receiptData != null ? receiptData.getString("fixmedinsName") : "HIS 医疗机构");
|
||||
context.put("patientName", bill.getString("payer"));
|
||||
context.put("outpatientNo", receiptData != null ? receiptData.getString("regNo") : bill.getString("busNo"));
|
||||
context.put("idCard", bill.getString("cardNo"));
|
||||
context.put("tel", bill.getString("tel"));
|
||||
context.put("deptName", bill.getString("patientCategory"));
|
||||
context.put("doctorName", receiptData != null ? receiptData.getString("doctor") : "-");
|
||||
context.put("appointmentTime", bill.getString("consultationDate"));
|
||||
context.put("totalAmt", bill.getString("totalAmt"));
|
||||
context.put("busNo", busNo);
|
||||
context.put("printTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
||||
|
||||
List<Map<String, Object>> items = new ArrayList<>();
|
||||
if (receiptData != null && receiptData.containsKey("chargeItem")) {
|
||||
com.alibaba.fastjson2.JSONArray chargeItems = receiptData.getJSONArray("chargeItem");
|
||||
for (int i = 0; i < chargeItems.size(); i++) {
|
||||
JSONObject item = chargeItems.getJSONObject(i);
|
||||
Map<String, Object> itemMap = new HashMap<>();
|
||||
itemMap.put("chargeItemName", item.getString("chargeItemName"));
|
||||
itemMap.put("quantityValue", item.getString("quantityValue"));
|
||||
itemMap.put("totalPrice", item.getString("totalPrice"));
|
||||
items.add(itemMap);
|
||||
}
|
||||
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
|
||||
} else {
|
||||
Map<String, Object> itemMap = new HashMap<>();
|
||||
itemMap.put("chargeItemName", "挂号费");
|
||||
itemMap.put("quantityValue", "1");
|
||||
itemMap.put("totalPrice", bill.getString("totalAmt"));
|
||||
items.add(itemMap);
|
||||
}
|
||||
context.put("items", items);
|
||||
|
||||
try {
|
||||
Template template = Velocity.getTemplate("vm/invoice/invoice.vm");
|
||||
StringWriter writer = new StringWriter();
|
||||
template.merge(context, writer);
|
||||
return writer.toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("Http请求异常,请稍后再试。");
|
||||
} finally {
|
||||
if (response != null) {
|
||||
try {
|
||||
response.close();
|
||||
} catch (IOException e) {
|
||||
// logger.error("关闭响应异常", e);
|
||||
throw new ServiceException("未关闭系统资源:" + e.getStackTrace());
|
||||
}
|
||||
log.error("渲染发票模板失败", e);
|
||||
return "<html><body><h2>渲染发票凭条失败:" + e.getMessage() + "</h2></body></html>";
|
||||
}
|
||||
}
|
||||
|
||||
public JSONObject PreInvoicePostForward(JSONObject bill, String endpoint) {
|
||||
// 参考补打小票逻辑,动态获取小票详细信息
|
||||
Long paymentId = bill.getLong("paymentId");
|
||||
if (paymentId != null) {
|
||||
try {
|
||||
Map<String, Object> receiptDetail = chargeBillService.getDetail(paymentId);
|
||||
bill.put("receiptData", receiptDetail);
|
||||
log.info("已成功获取并注入小票动态数据,paymentId: {}", paymentId);
|
||||
} catch (Exception e) {
|
||||
log.error("获取小票数据失败,paymentId: {}", paymentId, e);
|
||||
}
|
||||
}
|
||||
return JSONObject.parseObject(resultString);
|
||||
|
||||
// 内部调用逻辑:不再使用 Http 客户端,直接分发到本地逻辑
|
||||
String busNo = bill.getString("busNo");
|
||||
if (busNo != null) {
|
||||
invoiceDataMap.put(busNo, bill);
|
||||
}
|
||||
|
||||
JSONObject internalResult;
|
||||
if (endpoint.contains("invEBillRegistration")) {
|
||||
internalResult = internalRegistration(bill);
|
||||
} else if (endpoint.contains("invoiceEBillOutpatient")) {
|
||||
internalResult = internalOutpatient(bill);
|
||||
} else if (endpoint.contains("invEBillHospitalized")) {
|
||||
internalResult = internalHospitalized(bill);
|
||||
} else if (endpoint.contains("writeOffEBill")) {
|
||||
internalResult = internalWriteOff(bill);
|
||||
} else {
|
||||
internalResult = createInternalErrorResponse("未知接口: " + endpoint);
|
||||
}
|
||||
|
||||
JSONObject finalResponse = new JSONObject();
|
||||
finalResponse.put("success", true);
|
||||
finalResponse.put("result", internalResult);
|
||||
return finalResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送请求
|
||||
* 发送请求 (内部调用版本)
|
||||
*
|
||||
* @param bill 请求参数
|
||||
* @param endpoint 请求后缀url
|
||||
* @return 返回值
|
||||
*/
|
||||
public static JSONObject PreInvoicePost(JSONObject bill, String endpoint) {
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
// 获取当前租户的option信息
|
||||
JSONObject optionJson = SecurityUtils.getLoginUser().getOptionJson();
|
||||
|
||||
String baseUrl = optionJson.getString(CommonConstants.Option.URL);
|
||||
// 拼接成完整 URL(作为路径)
|
||||
String cleanUrl = baseUrl + "/" + endpoint; // 确保用 "/" 分隔
|
||||
String url = cleanUrl.trim().replaceAll("^\"|\"$", "") // 去除首尾引号
|
||||
.replaceAll("\\s+", "")// 去除首尾引号
|
||||
.replaceAll("\"", ""); // 去除中间引号
|
||||
|
||||
String appID = optionJson.getString(CommonConstants.Option.APP_ID);
|
||||
String appKey = optionJson.getString(CommonConstants.Option.KEY);
|
||||
String data = bill.toJSONString();
|
||||
String version = "1.0";
|
||||
// 请求随机标识 noise
|
||||
String noise = UUID.randomUUID().toString();
|
||||
|
||||
data = Base64.getEncoder().encodeToString(data.getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
StringBuilder str = new StringBuilder();
|
||||
str.append("appid=").append(appID);
|
||||
str.append("&data=").append(data);
|
||||
str.append("&noise=").append(noise);
|
||||
str.append("&key=").append(appKey);
|
||||
str.append("&version=").append(version);
|
||||
String sign = DigestUtils.md5Hex(str.toString().getBytes(Charset.forName("UTF-8"))).toUpperCase();
|
||||
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("appid", appID);
|
||||
map.put("data", data);
|
||||
map.put("noise", noise);
|
||||
map.put("sign", sign);
|
||||
map.put("version", version);
|
||||
|
||||
try {
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
CloseableHttpClient client = HttpClients.createDefault();
|
||||
String respContent = null;
|
||||
// 请求参数转JOSN字符串
|
||||
StringEntity entity = new StringEntity(new ObjectMapper().writeValueAsString(map), "utf-8");
|
||||
entity.setContentEncoding("UTF-8");
|
||||
entity.setContentType("application/json");
|
||||
httpPost.setEntity(entity);
|
||||
HttpResponse resp = client.execute(httpPost);
|
||||
|
||||
if (resp.getStatusLine().getStatusCode() == 200) {
|
||||
String rev = EntityUtils.toString(resp.getEntity());
|
||||
// System.out.println("返回串--》"+rev);
|
||||
Map resultData = new ObjectMapper().readValue(rev, Map.class);
|
||||
String rdata = resultData.get("data").toString();
|
||||
String rnoise = resultData.get("noise").toString();
|
||||
// 1、拼接返回验签参数
|
||||
StringBuilder str1 = new StringBuilder();
|
||||
str1.append("appid=").append(appID);
|
||||
str1.append("&data=").append(rdata);
|
||||
str1.append("&noise=").append(rnoise);
|
||||
str1.append("&key=").append(appKey);
|
||||
str1.append("&version=").append(version);
|
||||
// 3.MD5加密 生成sign
|
||||
String rmd5 = DigestUtils.md5Hex(str1.toString().getBytes(Charset.forName("UTF-8"))).toUpperCase();
|
||||
String rsign = resultData.get("sign").toString();
|
||||
System.out.println("验签-》" + (StringUtils.equals(rsign, rmd5)));
|
||||
String busData
|
||||
= new String(Base64.getDecoder().decode(resultData.get("data").toString()), StandardCharsets.UTF_8);
|
||||
System.out.println("返回业务数据--》" + busData);
|
||||
Map busDataMap = new ObjectMapper().readValue(busData, Map.class);
|
||||
System.out
|
||||
.println("业务信息解密--》" + new String(Base64.getDecoder().decode(busDataMap.get("message").toString()),
|
||||
StandardCharsets.UTF_8));
|
||||
|
||||
JSONObject resobj = JSONObject.parseObject(busData);
|
||||
result.put("success", true);
|
||||
result.put("result", resobj);
|
||||
} else {
|
||||
result.put("msg", "web响应失败!");
|
||||
result.put("success", false);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result.put("msg", e.getMessage());
|
||||
result.put("success", false);
|
||||
}
|
||||
return result;
|
||||
|
||||
public JSONObject PreInvoicePost(JSONObject bill, String endpoint) {
|
||||
return PreInvoicePostForward(bill, endpoint);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -339,6 +374,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
|
||||
// --------------------请求业务参数 data--------------------START
|
||||
JSONObject bill = commomSet(patientInfo, paymentInfo, clinicSettle);
|
||||
bill.put("paymentId", paymentId);
|
||||
|
||||
// ------票据信息------
|
||||
// busType 业务标识 String 20 是 06,标识挂号
|
||||
@@ -580,6 +616,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
|
||||
// --------------------请求业务参数 data--------------------START
|
||||
JSONObject bill = commomSet(patientInfo, paymentInfo, clinicSettle);
|
||||
bill.put("paymentId", paymentId);
|
||||
|
||||
// ------票据信息------
|
||||
// busType 业务标识 String 20 是 直接填写业务系统内部编码值,由医疗平台配置对照,例如:附录5 业务标识列表
|
||||
@@ -890,6 +927,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
|
||||
// --------------------请求业务参数 data--------------------START
|
||||
JSONObject bill = commomSet(patientInfo, paymentInfo, clinicSettle);
|
||||
bill.put("paymentId", paymentId);
|
||||
|
||||
// ------票据信息------
|
||||
// busType 业务标识 String 20 是 直接填写业务系统内部编码值,由医疗平台配置对照,例如:附录5 业务标识列表
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -41,22 +41,23 @@ public class EleInvoiceController {
|
||||
public R<?> invoiceReissue(@RequestBody MakeInvoiceDto makeInvoiceDto) {
|
||||
// 付款成功后,开具发票
|
||||
R<?> result = eleInvoiceService.invoiceReissue(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId());
|
||||
R<?> eleResult = null;
|
||||
if (result.getCode() == 200) {
|
||||
if (result.getData() == YbEncounterClass.REG.getValue()) {
|
||||
// 付款成功后,开具发票
|
||||
R<?> eleResult = eleInvoiceService.invoiceRegMake(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId());
|
||||
eleResult = eleInvoiceService.invoiceRegMake(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId());
|
||||
if (eleResult.getCode() != 200) {
|
||||
return R.ok(" 挂号电子发票开具失败 :" + eleResult.getMsg());
|
||||
}
|
||||
} else if (result.getData() == YbEncounterClass.AMB.getValue()) {
|
||||
// 付款成功后,开具发票
|
||||
R<?> eleResult = eleInvoiceService.invoiceMZMake(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId());
|
||||
eleResult = eleInvoiceService.invoiceMZMake(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId());
|
||||
if (eleResult.getCode() != 200) {
|
||||
return R.ok(" 门诊电子发票开具失败 :" + eleResult.getMsg());
|
||||
}
|
||||
} else if (result.getData() == YbEncounterClass.IMP.getValue()) {
|
||||
// 付款成功后,开具发票
|
||||
R<?> eleResult = eleInvoiceService.invoiceZYMake(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId());
|
||||
eleResult = eleInvoiceService.invoiceZYMake(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId());
|
||||
if (eleResult.getCode() != 200) {
|
||||
return R.ok(" 住院电子发票开具失败 :" + eleResult.getMsg());
|
||||
}
|
||||
@@ -64,7 +65,11 @@ public class EleInvoiceController {
|
||||
return R.ok("电子发票类型不明确!");
|
||||
}
|
||||
}
|
||||
Map detail = iChargeBillService.getDetail(makeInvoiceDto.getPaymentId());
|
||||
Map<String, Object> detail = iChargeBillService.getDetail(makeInvoiceDto.getPaymentId());
|
||||
if (eleResult != null && eleResult.getCode() == 200 && eleResult.getData() instanceof Invoice) {
|
||||
Invoice invoice = (Invoice) eleResult.getData();
|
||||
detail.put("pictureUrl", invoice.getPictureUrl());
|
||||
}
|
||||
return R.ok(detail);
|
||||
}
|
||||
|
||||
@@ -95,10 +100,18 @@ public class EleInvoiceController {
|
||||
public R<?> invoiceOpen(@RequestParam("invoiceId") String invoiceId) {
|
||||
// 退款成功后,开具发票
|
||||
Invoice invoice = eleInvoiceService.getInvoiceById(Long.parseLong(invoiceId));
|
||||
if(invoice ==null){
|
||||
if (invoice == null) {
|
||||
throw new ServiceException("未查询到发票信息");
|
||||
}
|
||||
return R.ok(invoice.getPictureUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发票HTML凭条预览
|
||||
*/
|
||||
@GetMapping(value = "/view", produces = "text/html;charset=UTF-8")
|
||||
@ResponseBody
|
||||
public String viewInvoice(@RequestParam("busNo") String busNo) {
|
||||
return eleInvoiceService.getInvoiceHtml(busNo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ package com.openhis.web.paymentmanage.controller;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.enums.TenantOptionDict;
|
||||
import com.core.web.util.TenantOptionUtil;
|
||||
import com.openhis.administration.domain.Invoice;
|
||||
import com.openhis.financial.domain.PaymentReconciliation;
|
||||
import com.openhis.web.chargemanage.dto.OutpatientRegistrationAddParam;
|
||||
import com.openhis.web.chargemanage.dto.OutpatientRegistrationSettleParam;
|
||||
@@ -92,10 +93,12 @@ public class PaymentReconciliationController {
|
||||
if (eleResult.getCode() != 200) {
|
||||
// 因收费成功前端需要关闭弹窗,此处信息仅用于提示所以返回ok
|
||||
return R.ok(detail, " 收费成功,电子发票开具失败 :" + eleResult.getMsg());
|
||||
} else if (eleResult.getData() instanceof Invoice) {
|
||||
Invoice invoice = (Invoice) eleResult.getData();
|
||||
detail.put("pictureUrl", invoice.getPictureUrl());
|
||||
}
|
||||
return R.ok(detail);
|
||||
}
|
||||
|
||||
// Map detail = iChargeBillService.getDetail(paymentRecon.getId());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -194,7 +197,11 @@ public class PaymentReconciliationController {
|
||||
if (eleResult.getCode() != 200) {
|
||||
// 因收费成功前端需要关闭弹窗,此处信息仅用于提示所以返回ok
|
||||
return R.ok(detail, " 收费成功,电子发票开具失败 :" + eleResult.getMsg());
|
||||
} else if (eleResult.getData() instanceof Invoice) {
|
||||
Invoice invoice = (Invoice) eleResult.getData();
|
||||
detail.put("pictureUrl", invoice.getPictureUrl());
|
||||
}
|
||||
return R.ok(detail);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -233,6 +240,9 @@ public class PaymentReconciliationController {
|
||||
if (eleResult.getCode() != 200) {
|
||||
// 因收费成功前端需要关闭弹窗,此处信息仅用于提示所以返回ok
|
||||
return R.ok(detail, " 收费成功,电子发票开具失败 :" + eleResult.getMsg());
|
||||
} else if (eleResult.getData() instanceof Invoice) {
|
||||
Invoice invoice = (Invoice) eleResult.getData();
|
||||
detail.put("pictureUrl", invoice.getPictureUrl());
|
||||
}
|
||||
return R.ok(detail);
|
||||
}
|
||||
@@ -260,8 +270,9 @@ public class PaymentReconciliationController {
|
||||
// 因取消付款成功前端需要关闭弹窗,此处信息仅用于提示所以返回ok
|
||||
return R.ok(null, " 取消付款成功,电子发票开具失败 :" + eleResult.getMsg());
|
||||
}
|
||||
return R.ok("取消结算成功");
|
||||
}
|
||||
return R.ok("取消结算失败,请确认");
|
||||
return R.fail("取消结算失败,请确认");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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,207 +43,247 @@
|
||||
abi.restricted_scope,
|
||||
abi.dosage_instruction,
|
||||
abi.chrgitm_lv
|
||||
from (
|
||||
<if test="adviceTypes == null or adviceTypes.contains(1)">
|
||||
(SELECT
|
||||
DISTINCT ON (T1.ID)
|
||||
T1.tenant_id,
|
||||
1 AS advice_type,
|
||||
T1.bus_no AS bus_no,
|
||||
T1.category_code AS category_code,
|
||||
T1.pharmacology_category_code AS pharmacology_category_code,
|
||||
T1.part_percent AS part_percent,
|
||||
T1.unit_conversion_ratio AS unit_conversion_ratio,
|
||||
T1.part_attribute_enum AS part_attribute_enum,
|
||||
T1.tho_part_attribute_enum AS tho_part_attribute_enum,
|
||||
T1.skin_test_flag AS skin_test_flag,
|
||||
T1.inject_flag AS inject_flag,
|
||||
T1.ID AS advice_definition_id,
|
||||
T1.NAME AS advice_name,
|
||||
T1.bus_no AS advice_bus_no,
|
||||
T1.py_str AS py_str,
|
||||
T1.wb_str AS wb_str,
|
||||
T1.yb_no AS yb_no,
|
||||
T1.merchandise_name AS product_name,
|
||||
0 AS activity_type,
|
||||
T1.unit_code AS unit_code,
|
||||
T1.min_unit_code AS min_unit_code,
|
||||
T2.total_volume AS volume,
|
||||
T2.method_code AS method_code,
|
||||
T2.rate_code AS rate_code,
|
||||
T2.org_id AS org_id,
|
||||
T2.location_id AS location_id,
|
||||
CAST(T2.dose AS TEXT) AS dose,
|
||||
T2.dose_unit_code AS dose_unit_code,
|
||||
T3.NAME AS supplier,
|
||||
T3.id AS supplier_id,
|
||||
T1.manufacturer_text AS manufacturer,
|
||||
T5.id AS charge_item_definition_id,
|
||||
T5.instance_table AS advice_table_name,
|
||||
T6.def_location_id AS position_id,
|
||||
t1.restricted_flag AS restricted_flag,
|
||||
t1.restricted_scope AS restricted_scope,
|
||||
T1.dosage_instruction AS dosage_instruction,
|
||||
T1.chrgitm_lv as chrgitm_lv
|
||||
FROM med_medication_definition AS t1
|
||||
INNER JOIN med_medication AS T2 ON T2.medication_def_id = T1.ID
|
||||
AND T2.delete_flag = '0' AND T2.status_enum = #{statusEnum}
|
||||
LEFT JOIN adm_supplier AS T3
|
||||
ON T3.ID = T1.supply_id
|
||||
AND T3.delete_flag = '0'
|
||||
LEFT JOIN adm_charge_item_definition AS T5 ON T5.instance_id = T1.ID
|
||||
AND T5.delete_flag = '0' AND T5.status_enum = #{statusEnum}
|
||||
LEFT JOIN adm_organization_location AS T6
|
||||
ON T6.distribution_category_code = T1.category_code
|
||||
AND T6.delete_flag = '0' AND T6.item_code = '1' AND T6.organization_id = #{organizationId} AND
|
||||
(CURRENT_TIME :: time (6) BETWEEN T6.start_time AND T6.end_time)
|
||||
WHERE T1.delete_flag = '0'
|
||||
AND T2.status_enum = #{statusEnum}
|
||||
<if test="pricingFlag ==1">
|
||||
AND 1 = 2
|
||||
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,
|
||||
1 AS advice_type,
|
||||
T1.bus_no AS bus_no,
|
||||
T1.category_code AS category_code,
|
||||
T1.pharmacology_category_code AS pharmacology_category_code,
|
||||
T1.part_percent AS part_percent,
|
||||
T1.unit_conversion_ratio AS unit_conversion_ratio,
|
||||
T1.part_attribute_enum AS part_attribute_enum,
|
||||
T1.tho_part_attribute_enum AS tho_part_attribute_enum,
|
||||
T1.skin_test_flag AS skin_test_flag,
|
||||
T1.inject_flag AS inject_flag,
|
||||
T1.ID AS advice_definition_id,
|
||||
T1.NAME AS advice_name,
|
||||
T1.bus_no AS advice_bus_no,
|
||||
T1.py_str AS py_str,
|
||||
T1.wb_str AS wb_str,
|
||||
T1.yb_no AS yb_no,
|
||||
T1.merchandise_name AS product_name,
|
||||
0 AS activity_type,
|
||||
T1.unit_code AS unit_code,
|
||||
T1.min_unit_code AS min_unit_code,
|
||||
T2.total_volume AS volume,
|
||||
T2.method_code AS method_code,
|
||||
T2.rate_code AS rate_code,
|
||||
T2.org_id AS org_id,
|
||||
T2.location_id AS location_id,
|
||||
CAST(T2.dose AS TEXT) AS dose,
|
||||
T2.dose_unit_code AS dose_unit_code,
|
||||
T3.NAME AS supplier,
|
||||
T3.id AS supplier_id,
|
||||
T1.manufacturer_text AS manufacturer,
|
||||
T5.id AS charge_item_definition_id,
|
||||
T5.instance_table AS advice_table_name,
|
||||
T6.def_location_id AS position_id,
|
||||
t1.restricted_flag AS restricted_flag,
|
||||
t1.restricted_scope AS restricted_scope,
|
||||
T1.dosage_instruction AS dosage_instruction,
|
||||
T1.chrgitm_lv as chrgitm_lv
|
||||
FROM med_medication_definition AS t1
|
||||
INNER JOIN med_medication AS T2 ON T2.medication_def_id = T1.ID
|
||||
AND T2.delete_flag = '0' AND T2.status_enum = #{statusEnum}
|
||||
LEFT JOIN adm_supplier AS T3
|
||||
ON T3.ID = T1.supply_id
|
||||
AND T3.delete_flag = '0'
|
||||
LEFT JOIN adm_charge_item_definition AS T5 ON T5.instance_id = T1.ID
|
||||
AND T5.delete_flag = '0' AND T5.status_enum = #{statusEnum}
|
||||
LEFT JOIN adm_organization_location AS T6
|
||||
ON T6.distribution_category_code = T1.category_code
|
||||
AND T6.delete_flag = '0' AND T6.item_code = '1' AND T6.organization_id = #{organizationId} AND
|
||||
(CURRENT_TIME :: time (6) BETWEEN T6.start_time AND T6.end_time)
|
||||
WHERE T1.delete_flag = '0'
|
||||
AND T2.status_enum = #{statusEnum}
|
||||
<if test="pricingFlag ==1">
|
||||
AND 1 = 2
|
||||
</if>
|
||||
<if test="adviceDefinitionIdParamList != null and !adviceDefinitionIdParamList.isEmpty()">
|
||||
AND T1.id IN
|
||||
<foreach collection="adviceDefinitionIdParamList" item="itemId" open="(" separator="," close=")">
|
||||
#{itemId}
|
||||
</foreach>
|
||||
</if>
|
||||
AND T5.instance_table = #{medicationTableName}
|
||||
)
|
||||
<if test="adviceTypes.contains(2) or adviceTypes.contains(3)">UNION ALL</if>
|
||||
</if>
|
||||
<if test="adviceDefinitionIdParamList != null and !adviceDefinitionIdParamList.isEmpty()">
|
||||
AND T1.id IN
|
||||
<foreach collection="adviceDefinitionIdParamList" item="itemId" open="(" separator="," close=")">
|
||||
#{itemId}
|
||||
</foreach>
|
||||
|
||||
<if test="adviceTypes.contains(2)">
|
||||
(SELECT
|
||||
DISTINCT ON (T1.ID)
|
||||
T1.tenant_id,
|
||||
2 AS advice_type,
|
||||
T1.bus_no AS bus_no,
|
||||
T1.category_code AS category_code,
|
||||
'' AS pharmacology_category_code,
|
||||
T1.part_percent AS part_percent,
|
||||
0 AS unit_conversion_ratio,
|
||||
null AS part_attribute_enum,
|
||||
null AS tho_part_attribute_enum,
|
||||
null AS skin_test_flag,
|
||||
null AS inject_flag,
|
||||
T1.ID AS advice_definition_id,
|
||||
T1.NAME AS advice_name,
|
||||
T1.bus_no AS advice_bus_no,
|
||||
T1.py_str AS py_str,
|
||||
T1.wb_str AS wb_str,
|
||||
T1.yb_no AS yb_no,
|
||||
'' AS product_name,
|
||||
0 AS activity_type,
|
||||
T1.unit_code AS unit_code,
|
||||
T1.min_unit_code AS min_unit_code,
|
||||
T1.SIZE AS volume,
|
||||
'' AS method_code,
|
||||
'' AS rate_code,
|
||||
T1.org_id AS org_id,
|
||||
T1.location_id AS location_id,
|
||||
'' AS dose,
|
||||
'' AS dose_unit_code,
|
||||
T2.NAME AS supplier,
|
||||
T2.id AS supplier_id,
|
||||
T1.manufacturer_text AS manufacturer,
|
||||
T4.id AS charge_item_definition_id,
|
||||
T4.instance_table AS advice_table_name,
|
||||
T5.def_location_id AS position_id,
|
||||
0 AS restricted_flag,
|
||||
'' AS restricted_scope,
|
||||
'' AS dosage_instruction,
|
||||
T1.chrgitm_lv as chrgitm_lv
|
||||
FROM adm_device_definition AS T1
|
||||
LEFT JOIN adm_supplier AS T2
|
||||
ON T2.ID = T1.supply_id
|
||||
AND T2.delete_flag = '0'
|
||||
LEFT JOIN adm_charge_item_definition AS T4 ON T4.instance_id = T1.ID
|
||||
AND T4.delete_flag = '0' AND T4.status_enum = #{statusEnum}
|
||||
LEFT JOIN adm_organization_location AS T5 ON T5.distribution_category_code = T1.category_code
|
||||
AND T5.delete_flag = '0' AND T5.item_code = '2' AND T5.organization_id = #{organizationId} AND
|
||||
(CURRENT_TIME :: time (6) BETWEEN T5.start_time AND T5.end_time)
|
||||
WHERE T1.delete_flag = '0'
|
||||
<if test="adviceDefinitionIdParamList != null and !adviceDefinitionIdParamList.isEmpty()">
|
||||
AND T1.id IN
|
||||
<foreach collection="adviceDefinitionIdParamList" item="itemId" open="(" separator="," close=")">
|
||||
#{itemId}
|
||||
</foreach>
|
||||
</if>
|
||||
AND T4.instance_table = #{deviceTableName}
|
||||
AND T1.status_enum = #{statusEnum}
|
||||
)
|
||||
<if test="adviceTypes.contains(3)">UNION ALL</if>
|
||||
</if>
|
||||
|
||||
<if test="adviceTypes.contains(3)">
|
||||
(SELECT
|
||||
DISTINCT ON (T1.ID)
|
||||
T1.tenant_id,
|
||||
3 AS advice_type,
|
||||
T1.bus_no AS bus_no,
|
||||
T1.category_code AS category_code,
|
||||
'' AS pharmacology_category_code,
|
||||
1 AS part_percent,
|
||||
0 AS unit_conversion_ratio,
|
||||
null AS part_attribute_enum,
|
||||
null AS tho_part_attribute_enum,
|
||||
null AS skin_test_flag,
|
||||
null AS inject_flag,
|
||||
T1.ID AS advice_definition_id,
|
||||
T1.NAME AS advice_name,
|
||||
T1.bus_no AS advice_bus_no,
|
||||
T1.py_str AS py_str,
|
||||
T1.wb_str AS wb_str,
|
||||
T1.yb_no AS yb_no,
|
||||
'' AS product_name,
|
||||
T1.type_enum AS activity_type,
|
||||
'' AS unit_code,
|
||||
'' AS min_unit_code,
|
||||
'' AS volume,
|
||||
'' AS method_code,
|
||||
'' AS rate_code,
|
||||
T1.org_id AS org_id,
|
||||
T1.location_id AS location_id,
|
||||
'' AS dose,
|
||||
'' AS dose_unit_code,
|
||||
'' AS supplier,
|
||||
null AS supplier_id,
|
||||
'' AS manufacturer,
|
||||
T2.ID AS charge_item_definition_id,
|
||||
T2.instance_table AS advice_table_name,
|
||||
T3.organization_id AS position_id,
|
||||
0 AS restricted_flag,
|
||||
'' AS restricted_scope,
|
||||
'' AS dosage_instruction,
|
||||
T1.chrgitm_lv as chrgitm_lv
|
||||
FROM wor_activity_definition AS T1
|
||||
LEFT JOIN adm_charge_item_definition AS T2
|
||||
ON T2.instance_id = T1.ID
|
||||
AND T2.delete_flag = '0' AND T2.status_enum = #{statusEnum}
|
||||
AND T2.instance_table = #{activityTableName}
|
||||
LEFT JOIN adm_organization_location AS T3 ON T3.activity_definition_id = T1.ID
|
||||
AND T3.delete_flag = '0' AND (CURRENT_TIME :: time (6) BETWEEN T3.start_time AND T3.end_time)
|
||||
WHERE T1.delete_flag = '0'
|
||||
<if test="pricingFlag ==1">
|
||||
AND (T1.pricing_flag = #{pricingFlag} OR T1.pricing_flag IS NULL)
|
||||
</if>
|
||||
<if test="adviceDefinitionIdParamList != null and !adviceDefinitionIdParamList.isEmpty()">
|
||||
AND T1.id IN
|
||||
<foreach collection="adviceDefinitionIdParamList" item="itemId" open="(" separator="," close=")">
|
||||
#{itemId}
|
||||
</foreach>
|
||||
</if>
|
||||
AND T1.status_enum = #{statusEnum}
|
||||
)
|
||||
</if>
|
||||
AND T5.instance_table = #{medicationTableName}
|
||||
)
|
||||
</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)">
|
||||
(SELECT
|
||||
DISTINCT ON (T1.ID)
|
||||
T1.tenant_id,
|
||||
2 AS advice_type,
|
||||
T1.bus_no AS bus_no,
|
||||
T1.category_code AS category_code,
|
||||
'' AS pharmacology_category_code,
|
||||
T1.part_percent AS part_percent,
|
||||
0 AS unit_conversion_ratio,
|
||||
null AS part_attribute_enum,
|
||||
null AS tho_part_attribute_enum,
|
||||
null AS skin_test_flag,
|
||||
null AS inject_flag,
|
||||
T1.ID AS advice_definition_id,
|
||||
T1.NAME AS advice_name,
|
||||
T1.bus_no AS advice_bus_no,
|
||||
T1.py_str AS py_str,
|
||||
T1.wb_str AS wb_str,
|
||||
T1.yb_no AS yb_no,
|
||||
'' AS product_name,
|
||||
0 AS activity_type,
|
||||
T1.unit_code AS unit_code,
|
||||
T1.min_unit_code AS min_unit_code,
|
||||
T1.SIZE AS volume,
|
||||
'' AS method_code,
|
||||
'' AS rate_code,
|
||||
T1.org_id AS org_id,
|
||||
T1.location_id AS location_id,
|
||||
'' AS dose,
|
||||
'' AS dose_unit_code,
|
||||
T2.NAME AS supplier,
|
||||
T2.id AS supplier_id,
|
||||
T1.manufacturer_text AS manufacturer,
|
||||
T4.id AS charge_item_definition_id,
|
||||
T4.instance_table AS advice_table_name,
|
||||
T5.def_location_id AS position_id,
|
||||
0 AS restricted_flag,
|
||||
'' AS restricted_scope,
|
||||
'' AS dosage_instruction,
|
||||
T1.chrgitm_lv as chrgitm_lv
|
||||
FROM adm_device_definition AS T1
|
||||
LEFT JOIN adm_supplier AS T2
|
||||
ON T2.ID = T1.supply_id
|
||||
AND T2.delete_flag = '0'
|
||||
LEFT JOIN adm_charge_item_definition AS T4 ON T4.instance_id = T1.ID
|
||||
AND T4.delete_flag = '0' AND T4.status_enum = #{statusEnum}
|
||||
LEFT JOIN adm_organization_location AS T5 ON T5.distribution_category_code = T1.category_code
|
||||
AND T5.delete_flag = '0' AND T5.item_code = '2' AND T5.organization_id = #{organizationId} AND
|
||||
(CURRENT_TIME :: time (6) BETWEEN T5.start_time AND T5.end_time)
|
||||
WHERE T1.delete_flag = '0'
|
||||
<if test="adviceDefinitionIdParamList != null and !adviceDefinitionIdParamList.isEmpty()">
|
||||
AND T1.id IN
|
||||
<foreach collection="adviceDefinitionIdParamList" item="itemId" open="(" separator="," close=")">
|
||||
#{itemId}
|
||||
</foreach>
|
||||
</if>
|
||||
AND T4.instance_table = #{deviceTableName}
|
||||
AND T1.status_enum = #{statusEnum}
|
||||
)
|
||||
</if>
|
||||
|
||||
|
||||
<if test="adviceTypes == null or adviceTypes.contains(2)">
|
||||
<if test="adviceTypes == null or adviceTypes.contains(3)">UNION ALL</if>
|
||||
</if>
|
||||
|
||||
<if test="adviceTypes == null or adviceTypes.contains(3)">
|
||||
(SELECT
|
||||
DISTINCT ON (T1.ID)
|
||||
T1.tenant_id,
|
||||
3 AS advice_type,
|
||||
T1.bus_no AS bus_no,
|
||||
T1.category_code AS category_code,
|
||||
'' AS pharmacology_category_code,
|
||||
1 AS part_percent,
|
||||
0 AS unit_conversion_ratio,
|
||||
null AS part_attribute_enum,
|
||||
null AS tho_part_attribute_enum,
|
||||
null AS skin_test_flag,
|
||||
null AS inject_flag,
|
||||
T1.ID AS advice_definition_id,
|
||||
T1.NAME AS advice_name,
|
||||
T1.bus_no AS advice_bus_no,
|
||||
T1.py_str AS py_str,
|
||||
T1.wb_str AS wb_str,
|
||||
T1.yb_no AS yb_no,
|
||||
'' AS product_name,
|
||||
T1.type_enum AS activity_type,
|
||||
'' AS unit_code,
|
||||
'' AS min_unit_code,
|
||||
'' AS volume,
|
||||
'' AS method_code,
|
||||
'' AS rate_code,
|
||||
T1.org_id AS org_id,
|
||||
T1.location_id AS location_id,
|
||||
'' AS dose,
|
||||
'' AS dose_unit_code,
|
||||
'' AS supplier,
|
||||
null AS supplier_id,
|
||||
'' AS manufacturer,
|
||||
T2.ID AS charge_item_definition_id,
|
||||
T2.instance_table AS advice_table_name,
|
||||
T3.organization_id AS position_id,
|
||||
0 AS restricted_flag,
|
||||
'' AS restricted_scope,
|
||||
'' AS dosage_instruction,
|
||||
T1.chrgitm_lv as chrgitm_lv
|
||||
FROM wor_activity_definition AS T1
|
||||
LEFT JOIN adm_charge_item_definition AS T2
|
||||
ON T2.instance_id = T1.ID
|
||||
AND T2.delete_flag = '0' AND T2.status_enum = #{statusEnum}
|
||||
AND T2.instance_table = #{activityTableName}
|
||||
LEFT JOIN adm_organization_location AS T3 ON T3.activity_definition_id = T1.ID
|
||||
AND T3.delete_flag = '0' AND (CURRENT_TIME :: time (6) BETWEEN T3.start_time AND T3.end_time)
|
||||
WHERE T1.delete_flag = '0'
|
||||
<if test="pricingFlag ==1">
|
||||
AND (T1.pricing_flag = #{pricingFlag} OR T1.pricing_flag IS NULL)
|
||||
</if>
|
||||
<if test="adviceDefinitionIdParamList != null and !adviceDefinitionIdParamList.isEmpty()">
|
||||
AND T1.id IN
|
||||
<foreach collection="adviceDefinitionIdParamList" item="itemId" open="(" separator="," close=")">
|
||||
#{itemId}
|
||||
</foreach>
|
||||
</if>
|
||||
AND T1.status_enum = #{statusEnum}
|
||||
)
|
||||
<!-- 如果没有有效的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}
|
||||
|
||||
@@ -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 用于控制数据权限 -->
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body { font-family: 'Microsoft YaHei', sans-serif; width: 350px; margin: 0 auto; padding: 20px; border: 1px solid #ccc; background: #fff; }
|
||||
.header { text-align: center; }
|
||||
.hospital-name { font-size: 20px; font-weight: bold; margin-bottom: 5px; }
|
||||
.title { font-size: 16px; margin-bottom: 10px; }
|
||||
.time { font-size: 12px; color: #666; margin-bottom: 15px; }
|
||||
.section { border-top: 1px solid #000; padding-top: 10px; margin-top: 10px; }
|
||||
.section-title { font-weight: bold; text-decoration: underline; margin-bottom: 10px; font-size: 14px; }
|
||||
.item { display: flex; font-size: 13px; margin-bottom: 5px; }
|
||||
.label { width: 90px; color: #333; }
|
||||
.value { flex: 1; font-weight: 500; }
|
||||
table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
|
||||
th { text-align: left; border-bottom: 1px dashed #ccc; padding-bottom: 5px; color: #666; }
|
||||
td { padding: 5px 0; }
|
||||
.total { text-align: right; font-weight: bold; border-top: 1px solid #000; padding-top: 10px; margin-top: 10px; font-size: 15px; }
|
||||
.footer { margin-top: 20px; font-size: 11px; color: #666; line-height: 1.5; }
|
||||
.qr-code { text-align: center; margin-top: 15px; }
|
||||
.serial-no { text-align: left; margin-top: 10px; font-size: 12px; font-weight: bold; border-top: 1px dashed #ccc; padding-top: 10px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='header'>
|
||||
<div class='hospital-name'>$hospitalName</div>
|
||||
<div class='title'>门诊预约挂号凭条</div>
|
||||
<div class='time'>打印时间:$printTime</div>
|
||||
</div>
|
||||
<div class='section'>
|
||||
<div class='section-title'>患者基本信息</div>
|
||||
<div class='item'><div class='label'>患者姓名:</div><div class='value'>$patientName</div></div>
|
||||
<div class='item'><div class='label'>门诊号:</div><div class='value'>$outpatientNo</div></div>
|
||||
<div class='item'><div class='label'>身份证号:</div><div class='value'>#if($idCard)$idCard#else-#end</div></div>
|
||||
<div class='item'><div class='label'>联系电话:</div><div class='value'>#if($tel)$tel#else-#end</div></div>
|
||||
</div>
|
||||
<div class='section'>
|
||||
<div class='section-title'>预约详情</div>
|
||||
<div class='item'><div class='label'>就诊科室:</div><div class='value'>#if($deptName)$deptName#else-#end</div></div>
|
||||
<div class='item'><div class='label'>医生姓名:</div><div class='value'>$doctorName</div></div>
|
||||
<div class='item'><div class='label'>预约时间:</div><div class='value'>#if($appointmentTime)$appointmentTime#else-#end</div></div>
|
||||
<div class='item'><div class='label'>就诊地点:</div><div class='value'>门诊大楼内</div></div>
|
||||
<div class='item'><div class='label'>预约状态:</div><div class='value'><span style='color:green;'>☑ 已 预</span></div></div>
|
||||
</div>
|
||||
<div class='section'>
|
||||
<div class='section-title'>费用信息</div>
|
||||
<table>
|
||||
<tr><th>项目</th><th>数量</th><th>单价</th><th>金额</th></tr>
|
||||
#foreach($item in $items)
|
||||
<tr>
|
||||
<td>$item.chargeItemName</td>
|
||||
<td>$item.quantityValue</td>
|
||||
<td>¥$item.totalPrice</td>
|
||||
<td>¥$item.totalPrice</td>
|
||||
</tr>
|
||||
#end
|
||||
</table>
|
||||
<div class='total'>合计:¥$totalAmt</div>
|
||||
<div class='item' style='margin-top:10px;'><div class='label'>支付方式:</div><div class='value'>线上支付 (已支付)</div></div>
|
||||
</div>
|
||||
<div class='footer'>
|
||||
温馨提示:请至少提前30分钟到达取号,过时自动取消。服务时间:8:00-17:00
|
||||
</div>
|
||||
<div class='qr-code'>
|
||||
<img src='https://api.qrserver.com/v1/create-qr-code/?size=100x100&data=$busNo' width='100' height='100' />
|
||||
</div>
|
||||
<div class='serial-no'>流水号:$busNo</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -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();
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>openhis-server</artifactId>
|
||||
<groupId>com.openhis</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>openhis-einvoiceapp</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- 领域-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.openhis</groupId>-->
|
||||
<!-- <artifactId>openhis-domain</artifactId>-->
|
||||
<!-- <version>0.0.1-SNAPSHOT</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
</dependency>
|
||||
<!-- 共通-->
|
||||
<dependency>
|
||||
<groupId>com.openhis</groupId>
|
||||
<artifactId>openhis-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- liteflow-->
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.itextpdf</groupId>
|
||||
<artifactId>kernel</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpmime</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- pdf依赖-->
|
||||
<dependency>
|
||||
<groupId>com.itextpdf</groupId>
|
||||
<artifactId>itextpdf</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.itextpdf</groupId>
|
||||
<artifactId>itext-asian</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<!-- <build>-->
|
||||
<!-- <plugins>-->
|
||||
<!-- <plugin>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
|
||||
<!-- <configuration>-->
|
||||
<!-- <fork>true</fork> <!– 如果没有该配置,devtools不会生效 –>-->
|
||||
<!-- </configuration>-->
|
||||
<!-- <executions>-->
|
||||
<!-- <execution>-->
|
||||
<!-- <goals>-->
|
||||
<!-- <goal>repackage</goal>-->
|
||||
<!-- </goals>-->
|
||||
<!-- </execution>-->
|
||||
<!-- </executions>-->
|
||||
<!-- </plugin>-->
|
||||
<!-- <plugin>-->
|
||||
<!-- <groupId>org.apache.maven.plugins</groupId>-->
|
||||
<!-- <artifactId>maven-war-plugin</artifactId>-->
|
||||
<!-- <version>${maven-war-plugin.version}</version>-->
|
||||
<!-- <configuration>-->
|
||||
<!-- <failOnMissingWebXml>false</failOnMissingWebXml>-->
|
||||
<!-- <warName>${project.artifactId}</warName>-->
|
||||
<!-- </configuration>-->
|
||||
<!-- </plugin>-->
|
||||
<!-- </plugins>-->
|
||||
<!-- <finalName>${project.artifactId}</finalName>-->
|
||||
<!-- </build>-->
|
||||
|
||||
</project>
|
||||
@@ -299,236 +299,236 @@ async function printReceipt(param) {
|
||||
|
||||
// 金额大于0时显示金额和单位,等于0时不显示单位
|
||||
YB_FUND_PAY: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 100000)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 100000)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 基金支付总额
|
||||
SELF_PAY: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 200000)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 200000)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 个人负担总金额
|
||||
OTHER_PAY: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 300000)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 300000)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 其他(如医院负担金额)
|
||||
|
||||
// 基本医保统筹基金支出
|
||||
YB_TC_FUND_AMOUNT: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 110000)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 110000)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 基本医保统筹基金支出
|
||||
YB_BC_FUND_AMOUNT: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 120000)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 120000)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 补充医疗保险基金支出
|
||||
YB_JZ_FUND_AMOUNT: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 130000)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 130000)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 医疗救助基金支出
|
||||
YB_OTHER_AMOUNT: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 140000)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 140000)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 其他支出
|
||||
|
||||
// 职工基本医疗保险
|
||||
YB_TC_ZG_FUND_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 110100)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 110100)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 职工基本医疗保险
|
||||
YB_TC_JM_FUND_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 110200)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 110200)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 居民基本医疗保险
|
||||
|
||||
// 补充医疗保险基金支出细分
|
||||
YB_BC_JM_DB_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 120100)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 120100)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 全体参保人的居民大病保险
|
||||
YB_BC_DE_BZ_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 120200)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 120200)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 大额医疗费用补助
|
||||
YB_BC_ZG_DE_BZ_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 120300)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 120300)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 企业职工大额医疗费用补助
|
||||
YB_BC_GWY_BZ_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 120400)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 120400)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 公务员医疗补助
|
||||
|
||||
// 其他支出细分
|
||||
OTHER_PAY_DD_FUND_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 300001)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 300001)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 兜底基金支出
|
||||
OTHER_PAY_YW_SH_FUND_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 300002)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 300002)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 意外伤害基金支出
|
||||
OTHER_PAY_LX_YL_FUND_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 300003)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 300003)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 离休人员医疗保障金支出
|
||||
OTHER_PAY_LX_YH_FUND_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 300004)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 300004)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 离休人员优惠金支出
|
||||
OTHER_PAY_CZ_FUND_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 300005)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 300005)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 财政基金支出
|
||||
OTHER_PAY_CZ_YZ_FUND_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 300006)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 300006)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 财政预支支出
|
||||
OTHER_PAY_ZG_DB_FUND_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 300007)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 300007)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 职工大病基金支出
|
||||
OTHER_PAY_EY_FUND_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 300008)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 300008)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 二乙基金支出
|
||||
OTHER_PAY_QX_JZ_FUND_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 300009)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 300009)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 倾斜救助支出
|
||||
OTHER_PAY_YL_JZ_FUND_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 300010)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 300010)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 医疗救助再救助基金
|
||||
HOSP_PART_AMT: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 300011)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 300011)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 医院负担金额
|
||||
|
||||
// 医保结算返回值
|
||||
FULAMT_OWNPAY_AMT: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 1)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 1)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 全自费金额
|
||||
OVERLMT_SELFPAY: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 3)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 3)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 超限价自费费用
|
||||
PRESELFPAY_AMT: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 4)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 4)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 先行自付金额
|
||||
INSCP_SCP_AMT: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 5)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 5)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 符合政策范围金额
|
||||
ACT_PAY_DEDC: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 6)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 6)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 实际支付起付线
|
||||
POOL_PROP_SELFPAY: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 7)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 7)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 基本医疗保险统筹基金支付比例
|
||||
BALC: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 8)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 8)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 余额
|
||||
|
||||
// 特殊支付方式
|
||||
SELF_YB_ZH_PAY: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 210000)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 210000)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 个人医保账户支付
|
||||
SELF_YB_ZH_GJ_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 210100)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 210100)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 账户共济支付金额
|
||||
SELF_CASH_PAY: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 220000)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 220000)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 个人现金支付金额
|
||||
SELF_VX_PAY: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 230000)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 230000)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 微信支付金额
|
||||
SELF_ALI_PAY: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 240000)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 240000)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 阿里支付金额
|
||||
|
||||
// 现金支付细分
|
||||
SELF_CASH_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 220400)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 220400)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 个人现金支付金额(现金)
|
||||
SELF_CASH_VX_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 220100)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 220100)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 个人现金支付金额(微信)
|
||||
SELF_CASH_ALI_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 220200)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 220200)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 个人现金支付金额(支付宝)
|
||||
SELF_CASH_UNION_VALUE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 220300)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 220300)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 个人现金支付金额(银联)
|
||||
|
||||
// 基金类型(扩展)
|
||||
BIRTH_FUND: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 510100)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 510100)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 生育基金
|
||||
RETIREE_MEDICAL: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 340100)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 340100)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 离休人员医疗保障基金
|
||||
URBAN_BASIC_MEDICAL: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 390100)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 390100)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 城乡居民基本医疗保险基金
|
||||
URBAN_SERIOUS_ILLNESS: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 390200)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 390200)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 城乡居民大病医疗保险基金
|
||||
MEDICAL_ASSISTANCE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 610100)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 610100)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 医疗救助基金
|
||||
GOVERNMENT_SUBSIDY: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 640100)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 640100)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 政府兜底基金
|
||||
ACCIDENT_INSURANCE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 390400)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 390400)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 意外伤害基金
|
||||
CARE_INSURANCE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 620100)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 620100)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 照护保险基金
|
||||
FINANCIAL_FUND: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 360100)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 360100)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 财政基金
|
||||
HOSPITAL_ADVANCE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 999900)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 999900)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 医院垫付
|
||||
SUPPLEMENTARY_INSURANCE: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 390300)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 390300)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 城乡居民大病补充保险基金
|
||||
HEALTHCARE_PREPAYMENT: (() => {
|
||||
const amount = param.detail.find((t) => t.payEnum === 360300)?.amount ?? 0;
|
||||
const amount = param.detail?.find((t) => t.payEnum === 360300)?.amount ?? 0;
|
||||
return amount > 0 ? amount + ' 元' : amount;
|
||||
})(), // 保健预支基金
|
||||
//微信刷卡支付
|
||||
SELF_CASH_VX_VALUE: (() => {
|
||||
// const cashValue = param.detail.find((t) => t.payEnum === 220400)?.amount ?? 0;
|
||||
const vxValue = param.detail.find((t) => t.payEnum === 220100)?.amount ?? 0;
|
||||
const unionValue = param.detail.find((t) => t.payEnum === 220300)?.amount ?? 0;
|
||||
const aliValue = param.detail.find((t) => t.payEnum === 220200)?.amount ?? 0;
|
||||
return vxValue + unionValue + aliValue + ' 元';
|
||||
// const cashValue = param.detail?.find((t) => t.payEnum === 220400)?.amount ?? 0;
|
||||
const vxValue = param.detail?.find((t) => t.payEnum === 220100)?.amount ?? 0;
|
||||
const unionValue = param.detail?.find((t) => t.payEnum === 220300)?.amount ?? 0;
|
||||
const aliValue = param.detail?.find((t) => t.payEnum === 220200)?.amount ?? 0;
|
||||
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 '';
|
||||
});
|
||||
@@ -214,38 +214,38 @@ async function printReceipt(param) {
|
||||
{
|
||||
...param,
|
||||
// 基础支付类型
|
||||
YB_FUND_PAY: param.detail.find((t) => t.payEnum === 100000)?.amount ?? 0, // 基金支付总额
|
||||
SELF_PAY: param.detail.find((t) => t.payEnum === 200000)?.amount ?? 0, // 个人负担总金额
|
||||
OTHER_PAY: param.detail.find((t) => t.payEnum === 300000)?.amount ?? 0, // 其他(如医院负担金额)
|
||||
YB_FUND_PAY: param.detail?.find((t) => t.payEnum === 100000)?.amount ?? 0, // 基金支付总额
|
||||
SELF_PAY: param.detail?.find((t) => t.payEnum === 200000)?.amount ?? 0, // 个人负担总金额
|
||||
OTHER_PAY: param.detail?.find((t) => t.payEnum === 300000)?.amount ?? 0, // 其他(如医院负担金额)
|
||||
|
||||
// 基本医保统筹基金支出
|
||||
YB_TC_FUND_AMOUNT: param.detail.find((t) => t.payEnum === 110000)?.amount ?? 0, // 基本医保统筹基金支出
|
||||
YB_BC_FUND_AMOUNT: param.detail.find((t) => t.payEnum === 120000)?.amount ?? 0, // 补充医疗保险基金支出
|
||||
YB_JZ_FUND_AMOUNT: param.detail.find((t) => t.payEnum === 130000)?.amount ?? 0, // 医疗救助基金支出
|
||||
YB_OTHER_AMOUNT: param.detail.find((t) => t.payEnum === 140000)?.amount ?? 0, // 其他支出
|
||||
YB_TC_FUND_AMOUNT: param.detail?.find((t) => t.payEnum === 110000)?.amount ?? 0, // 基本医保统筹基金支出
|
||||
YB_BC_FUND_AMOUNT: param.detail?.find((t) => t.payEnum === 120000)?.amount ?? 0, // 补充医疗保险基金支出
|
||||
YB_JZ_FUND_AMOUNT: param.detail?.find((t) => t.payEnum === 130000)?.amount ?? 0, // 医疗救助基金支出
|
||||
YB_OTHER_AMOUNT: param.detail?.find((t) => t.payEnum === 140000)?.amount ?? 0, // 其他支出
|
||||
|
||||
// 职工基本医疗保险
|
||||
YB_TC_ZG_FUND_VALUE: param.detail.find((t) => t.payEnum === 110100)?.amount ?? 0, // 职工基本医疗保险
|
||||
YB_TC_JM_FUND_VALUE: param.detail.find((t) => t.payEnum === 110200)?.amount ?? 0, // 居民基本医疗保险
|
||||
YB_TC_ZG_FUND_VALUE: param.detail?.find((t) => t.payEnum === 110100)?.amount ?? 0, // 职工基本医疗保险
|
||||
YB_TC_JM_FUND_VALUE: param.detail?.find((t) => t.payEnum === 110200)?.amount ?? 0, // 居民基本医疗保险
|
||||
|
||||
// 补充医疗保险基金支出细分
|
||||
YB_BC_JM_DB_VALUE: param.detail.find((t) => t.payEnum === 120100)?.amount ?? 0, // 全体参保人的居民大病保险
|
||||
YB_BC_DE_BZ_VALUE: param.detail.find((t) => t.payEnum === 120200)?.amount ?? 0, // 大额医疗费用补助
|
||||
YB_BC_ZG_DE_BZ_VALUE: param.detail.find((t) => t.payEnum === 120300)?.amount ?? 0, // 企业职工大额医疗费用补助
|
||||
YB_BC_GWY_BZ_VALUE: param.detail.find((t) => t.payEnum === 120400)?.amount ?? 0, // 公务员医疗补助
|
||||
YB_BC_JM_DB_VALUE: param.detail?.find((t) => t.payEnum === 120100)?.amount ?? 0, // 全体参保人的居民大病保险
|
||||
YB_BC_DE_BZ_VALUE: param.detail?.find((t) => t.payEnum === 120200)?.amount ?? 0, // 大额医疗费用补助
|
||||
YB_BC_ZG_DE_BZ_VALUE: param.detail?.find((t) => t.payEnum === 120300)?.amount ?? 0, // 企业职工大额医疗费用补助
|
||||
YB_BC_GWY_BZ_VALUE: param.detail?.find((t) => t.payEnum === 120400)?.amount ?? 0, // 公务员医疗补助
|
||||
|
||||
// 其他支出细分
|
||||
OTHER_PAY_DD_FUND_VALUE: param.detail.find((t) => t.payEnum === 300001)?.amount ?? 0, // 兜底基金支出
|
||||
OTHER_PAY_YW_SH_FUND_VALUE: param.detail.find((t) => t.payEnum === 300002)?.amount ?? 0, // 意外伤害基金支出
|
||||
OTHER_PAY_LX_YL_FUND_VALUE: param.detail.find((t) => t.payEnum === 300003)?.amount ?? 0, // 离休人员医疗保障金支出
|
||||
OTHER_PAY_LX_YH_FUND_VALUE: param.detail.find((t) => t.payEnum === 300004)?.amount ?? 0, // 离休人员优惠金支出
|
||||
OTHER_PAY_CZ_FUND_VALUE: param.detail.find((t) => t.payEnum === 300005)?.amount ?? 0, // 财政基金支出
|
||||
OTHER_PAY_CZ_YZ_FUND_VALUE: param.detail.find((t) => t.payEnum === 300006)?.amount ?? 0, // 财政预支支出
|
||||
OTHER_PAY_ZG_DB_FUND_VALUE: param.detail.find((t) => t.payEnum === 300007)?.amount ?? 0, // 职工大病基金支出
|
||||
OTHER_PAY_EY_FUND_VALUE: param.detail.find((t) => t.payEnum === 300008)?.amount ?? 0, // 二乙基金支出
|
||||
OTHER_PAY_QX_JZ_FUND_VALUE: param.detail.find((t) => t.payEnum === 300009)?.amount ?? 0, // 倾斜救助支出
|
||||
OTHER_PAY_YL_JZ_FUND_VALUE: param.detail.find((t) => t.payEnum === 300010)?.amount ?? 0, // 医疗救助再救助基金
|
||||
HOSP_PART_AMT: param.detail.find((t) => t.payEnum === 300011)?.amount ?? 0, // 医院负担金额
|
||||
OTHER_PAY_DD_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300001)?.amount ?? 0, // 兜底基金支出
|
||||
OTHER_PAY_YW_SH_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300002)?.amount ?? 0, // 意外伤害基金支出
|
||||
OTHER_PAY_LX_YL_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300003)?.amount ?? 0, // 离休人员医疗保障金支出
|
||||
OTHER_PAY_LX_YH_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300004)?.amount ?? 0, // 离休人员优惠金支出
|
||||
OTHER_PAY_CZ_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300005)?.amount ?? 0, // 财政基金支出
|
||||
OTHER_PAY_CZ_YZ_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300006)?.amount ?? 0, // 财政预支支出
|
||||
OTHER_PAY_ZG_DB_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300007)?.amount ?? 0, // 职工大病基金支出
|
||||
OTHER_PAY_EY_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300008)?.amount ?? 0, // 二乙基金支出
|
||||
OTHER_PAY_QX_JZ_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300009)?.amount ?? 0, // 倾斜救助支出
|
||||
OTHER_PAY_YL_JZ_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300010)?.amount ?? 0, // 医疗救助再救助基金
|
||||
HOSP_PART_AMT: param.detail?.find((t) => t.payEnum === 300011)?.amount ?? 0, // 医院负担金额
|
||||
|
||||
// 医保结算返回值 - 修复运算符优先级问题,添加括号确保正确拼接'元'
|
||||
FULAMT_OWNPAY_AMT: (param.detail?.find((t) => t.payEnum === 1)?.amount ?? 0) + '元', // 全自费金额
|
||||
@@ -347,11 +347,11 @@ async function printReceipt(param) {
|
||||
: '', // 保健预支基金
|
||||
//微信刷卡支付
|
||||
SELF_CASH_VX_VALUE: (() => {
|
||||
// const cashValue = param.detail.find((t) => t.payEnum === 220400)?.amount ?? 0;
|
||||
const vxValue = param.detail.find((t) => t.payEnum === 220100)?.amount ?? 0;
|
||||
const unionValue = param.detail.find((t) => t.payEnum === 220300)?.amount ?? 0;
|
||||
const aliValue = param.detail.find((t) => t.payEnum === 220200)?.amount ?? 0;
|
||||
return vxValue + unionValue + aliValue + '元';
|
||||
// const cashValue = param.detail?.find((t) => t.payEnum === 220400)?.amount ?? 0;
|
||||
const vxValue = param.detail?.find((t) => t.payEnum === 220100)?.amount ?? 0;
|
||||
const unionValue = param.detail?.find((t) => t.payEnum === 220300)?.amount ?? 0;
|
||||
const aliValue = param.detail?.find((t) => t.payEnum === 220200)?.amount ?? 0;
|
||||
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
|
||||
);
|
||||
|
||||
@@ -1349,7 +1349,7 @@ function handleAdd() {
|
||||
genderEnum_enumText: form.value.genderEnum_enumText,
|
||||
age: form.value.age,
|
||||
contractName: form.value.contractNo
|
||||
? contractList.value.find((item) => item.busNo === form.value.contractNo)?.contractName ||
|
||||
? contractList.value?.find((item) => item.busNo === form.value.contractNo)?.contractName ||
|
||||
'自费'
|
||||
: '自费',
|
||||
idCard: form.value.idCard,
|
||||
|
||||
@@ -197,7 +197,10 @@ watch(
|
||||
|
||||
// 直接更新查询参数
|
||||
queryParams.value.searchKey = newValue.searchKey || '';
|
||||
|
||||
|
||||
// 更新categoryCode
|
||||
queryParams.value.categoryCode = newValue.categoryCode || '';
|
||||
|
||||
// 处理类型筛选
|
||||
if (newValue.adviceType !== undefined && newValue.adviceType !== null && newValue.adviceType !== '') {
|
||||
// 单个类型
|
||||
@@ -215,8 +218,18 @@ getList();
|
||||
// 从priceList列表中获取价格
|
||||
function getPriceFromInventory(row) {
|
||||
if (row.priceList && row.priceList.length > 0) {
|
||||
const price = row.priceList[0].price || 0;
|
||||
return Number(price).toFixed(2) + ' 元';
|
||||
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 '-';
|
||||
}
|
||||
|
||||
@@ -127,8 +127,8 @@
|
||||
<div style="display:flex;flex-direction:column;align-items:center;gap:5px;">
|
||||
<el-checkbox
|
||||
label="主诊断"
|
||||
:trueLabel="1"
|
||||
:falseLabel="0"
|
||||
:true-value="1"
|
||||
:false-value="0"
|
||||
v-model="scope.row.maindiseFlag"
|
||||
border
|
||||
size="small"
|
||||
@@ -409,10 +409,10 @@ function getTree() {
|
||||
function handleAddDiagnosis() {
|
||||
proxy.$refs.formRef.validate((valid) => {
|
||||
if (valid) {
|
||||
// if (!allowAdd.value) {
|
||||
// proxy.$modal.msgWarning('请先填写病历');
|
||||
// return;
|
||||
// }
|
||||
const maxSortNo = form.value.diagnosisList.length > 0
|
||||
? Math.max(...form.value.diagnosisList.map(item => item.diagSrtNo || 0))
|
||||
: 0;
|
||||
|
||||
form.value.diagnosisList.push({
|
||||
showPopover: false,
|
||||
name: undefined,
|
||||
@@ -491,6 +491,7 @@ function handleSaveDiagnosis() {
|
||||
return false;
|
||||
} else if (!form.value.diagnosisList.some((diagnosis) => diagnosis.maindiseFlag === 1)) {
|
||||
proxy.$modal.msgWarning('至少添加一条主诊断');
|
||||
return false;
|
||||
} else {
|
||||
// 保存前按排序号排序
|
||||
form.value.diagnosisList.sort((a, b) => (a.diagSrtNo || 0) - (b.diagSrtNo || 0));
|
||||
|
||||
@@ -38,7 +38,7 @@ watch(
|
||||
queryParams.value.searchKey = newValue;
|
||||
getList();
|
||||
},
|
||||
{ immdiate: true }
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
getList();
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--检验信息-->
|
||||
<el-table
|
||||
ref="inspectionTableRef"
|
||||
:data="inspectionList"
|
||||
@@ -79,7 +79,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 下方:申请单和检验项目选择器 -->
|
||||
<!-- 下方:申请单和检验项目选择器 -->
|
||||
<div style="display: flex; gap: 20px">
|
||||
<!-- 左侧:申请单和检验信息 -->
|
||||
<div style="width: 55%">
|
||||
@@ -88,18 +88,18 @@
|
||||
<div class="application-form" style="padding: 20px; height: 700px; overflow-y: auto; border: 1px solid #e4e7ed; border-radius: 4px; margin: 10px;">
|
||||
<div 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>
|
||||
@@ -2472,8 +2485,8 @@ function setValue(row) {
|
||||
? (typeof row.skinTestFlag === 'number' ? row.skinTestFlag : (row.skinTestFlag ? 1 : 0))
|
||||
: 0;
|
||||
|
||||
prescriptionList.value[targetIndex] = {
|
||||
...prescriptionList.value[targetIndex],
|
||||
prescriptionList.value[rowIndex.value] = {
|
||||
...prescriptionList.value[rowIndex.value],
|
||||
...JSON.parse(JSON.stringify(row)),
|
||||
// 确保adviceType为数字类型,避免类型不匹配导致的显示问题
|
||||
adviceType: Number(row.adviceType),
|
||||
@@ -2852,12 +2865,25 @@ function getGroupMarkers() {
|
||||
function calculateTotalPrice(row, index) {
|
||||
nextTick(() => {
|
||||
if (row.adviceType == 3) {
|
||||
row.totalPrice = (row.unitPrice * row.quantity).toFixed(6);
|
||||
// 检查价格是否为有效数字
|
||||
if (row.unitPrice !== undefined && row.unitPrice !== null && !isNaN(row.unitPrice) && isFinite(row.unitPrice)) {
|
||||
row.totalPrice = (row.unitPrice * row.quantity).toFixed(6);
|
||||
} else {
|
||||
row.totalPrice = '0.000000'; // 或者设置为 0
|
||||
}
|
||||
} else {
|
||||
if (row.unitCode == row.minUnitCode) {
|
||||
row.totalPrice = (row.minUnitPrice * row.quantity).toFixed(6);
|
||||
if (row.minUnitPrice !== undefined && row.minUnitPrice !== null && !isNaN(row.minUnitPrice) && isFinite(row.minUnitPrice)) {
|
||||
row.totalPrice = (row.minUnitPrice * row.quantity).toFixed(6);
|
||||
} else {
|
||||
row.totalPrice = '0.000000';
|
||||
}
|
||||
} else {
|
||||
row.totalPrice = (row.unitPrice * row.quantity).toFixed(6);
|
||||
if (row.unitPrice !== undefined && row.unitPrice !== null && !isNaN(row.unitPrice) && isFinite(row.unitPrice)) {
|
||||
row.totalPrice = (row.unitPrice * row.quantity).toFixed(6);
|
||||
} else {
|
||||
row.totalPrice = '0.000000';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -775,6 +775,19 @@ function deletePrescription(prescription) {
|
||||
|
||||
const index = tcmPrescriptionList.value.findIndex((p) => p.id === prescription.id);
|
||||
if (index !== -1) {
|
||||
const prescriptionData = tcmPrescriptionList.value[index];
|
||||
|
||||
if (prescriptionData.prescriptionList && prescriptionData.prescriptionList.length > 0) {
|
||||
proxy.$modal.msgWarning('该处方单还有药品,请先删除所有药品后再删除处方单');
|
||||
return;
|
||||
}
|
||||
|
||||
const hasChargedItems = prescriptionData.prescriptionList && prescriptionData.prescriptionList.some(item => item.statusEnum === 2);
|
||||
if (hasChargedItems) {
|
||||
proxy.$modal.msgWarning('该处方单已收费,不能删除');
|
||||
return;
|
||||
}
|
||||
|
||||
tcmPrescriptionList.value.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,10 +291,13 @@ 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';
|
||||
|
||||
const userStore = useUserStore();
|
||||
const { proxy } = getCurrentInstance();
|
||||
const showSearch = ref(true);
|
||||
const total = ref(0);
|
||||
@@ -444,7 +447,9 @@ async function printPrescription() {
|
||||
}).then((res) => {
|
||||
if (projectTypeCode.value == '3') {
|
||||
const result = res.data;
|
||||
const printElements = disposalTemplate;
|
||||
const printElements = JSON.parse(
|
||||
JSON.stringify(disposalTemplate).replace(/{{HOSPITAL_NAME}}/g, userStore.hospitalName)
|
||||
);
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
|
||||
hiprintTemplate.print2(result, {
|
||||
height: 210,
|
||||
@@ -474,7 +479,9 @@ async function printPrescription() {
|
||||
prescriptionList: item,
|
||||
});
|
||||
});
|
||||
const printElements = templateJson;
|
||||
const printElements = JSON.parse(
|
||||
JSON.stringify(templateJson).replace(/{{HOSPITAL_NAME}}/g, userStore.hospitalName)
|
||||
);
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
|
||||
hiprintTemplate.print2(result, {
|
||||
height: 210,
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1754,7 +1754,11 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {ref} from 'vue';
|
||||
import {ref, reactive, getCurrentInstance} from 'vue';
|
||||
import useUserStore from '@/store/modules/user';
|
||||
|
||||
const userStore = useUserStore();
|
||||
const { proxy } = getCurrentInstance();
|
||||
import formDataJs from '../../doctorstation/components/store/medicalpage';
|
||||
import {patientInfo} from '../../inpatientDoctor/home/store/patient';
|
||||
|
||||
|
||||
@@ -260,17 +260,17 @@ function printReceipt(param) {
|
||||
...param,
|
||||
// 基础支付类型
|
||||
YB_FUND_PAY:
|
||||
param.detail?.find((t) => t.payEnum === 100000)?.amount.toFixed(2) + ' 元' ?? 0, // 基金支付总额
|
||||
SELF_PAY: param.detail?.find((t) => t.payEnum === 200000)?.amount.toFixed(2) + ' 元' ?? 0, // 个人负担总金额
|
||||
(param.detail?.find((t) => t.payEnum === 100000)?.amount?.toFixed(2) || '0.00') + ' 元',
|
||||
SELF_PAY: (param.detail?.find((t) => t.payEnum === 200000)?.amount?.toFixed(2) || '0.00') + ' 元',
|
||||
OTHER_PAY: param.detail?.find((t) => t.payEnum === 300000)?.amount ?? 0, // 其他(如医院负担金额)
|
||||
|
||||
// 基本医保统筹基金支出
|
||||
YB_TC_FUND_AMOUNT:
|
||||
param.detail?.find((t) => t.payEnum === 110000)?.amount.toFixed(2) + ' 元' ?? 0, // 基本医保统筹基金支出
|
||||
(param.detail?.find((t) => t.payEnum === 110000)?.amount?.toFixed(2) || '0.00') + ' 元',
|
||||
YB_BC_FUND_AMOUNT:
|
||||
param.detail?.find((t) => t.payEnum === 120000)?.amount.toFixed(2) + ' 元' ?? 0, // 补充医疗保险基金支出
|
||||
(param.detail?.find((t) => t.payEnum === 120000)?.amount?.toFixed(2) || '0.00') + ' 元',
|
||||
YB_JZ_FUND_AMOUNT:
|
||||
param.detail?.find((t) => t.payEnum === 130000)?.amount.toFixed(2) + ' 元' ?? 0, // 医疗救助基金支出
|
||||
(param.detail?.find((t) => t.payEnum === 130000)?.amount?.toFixed(2) || '0.00') + ' 元',
|
||||
// YB_OTHER_AMOUNT: param.detail.find((t) => t.payEnum === 140000)?.amount ?? 0, // 其他支出
|
||||
|
||||
// 职工基本医疗保险
|
||||
@@ -298,17 +298,17 @@ function printReceipt(param) {
|
||||
|
||||
// 医保结算返回值
|
||||
FULAMT_OWNPAY_AMT:
|
||||
param.detail?.find((t) => t.payEnum === 1)?.amount.toFixed(2) + ' 元' ?? 0, // 全自费金额
|
||||
(param.detail?.find((t) => t.payEnum === 1)?.amount?.toFixed(2) || '0.00') + ' 元',
|
||||
// OVERLMT_SELFPAY: param.detail.find((t) => t.payEnum === 3)?.amount ?? 0, // 超限价自费费用
|
||||
// PRESELFPAY_AMT: param.detail.find((t) => t.payEnum === 4)?.amount ?? 0, // 先行自付金额
|
||||
INSCP_SCP_AMT: param.detail?.find((t) => t.payEnum === 5)?.amount.toFixed(2) + ' 元' ?? 0, // 符合政策范围金额
|
||||
INSCP_SCP_AMT: (param.detail?.find((t) => t.payEnum === 5)?.amount?.toFixed(2) || '0.00') + ' 元',
|
||||
// ACT_PAY_DEDC: param.detail.find((t) => t.payEnum === 6)?.amount ?? 0, // 实际支付起付线
|
||||
// POOL_PROP_SELFPAY: param.detail.find((t) => t.payEnum === 7)?.amount ?? 0, // 基本医疗保险统筹基金支付比例
|
||||
// BALC: param.detail.find((t) => t.payEnum === 8)?.amount ?? 0, // 余额
|
||||
|
||||
// 特殊支付方式
|
||||
SELF_YB_ZH_PAY:
|
||||
param.detail?.find((t) => t.payEnum === 210000)?.amount.toFixed(2) + ' 元' ?? 0, // 个人医保账户支付
|
||||
(param.detail?.find((t) => t.payEnum === 210000)?.amount?.toFixed(2) || '0.00') + ' 元',
|
||||
// SELF_YB_ZH_GJ_VALUE: param.detail.find((t) => t.payEnum === 210100)?.amount ?? 0, // 账户共济支付金额
|
||||
// SELF_CASH_PAY: param.detail.find((t) => t.payEnum === 220000)?.amount ?? 0, // 个人现金支付金额
|
||||
// SELF_VX_PAY: param.detail.find((t) => t.payEnum === 230000)?.amount ?? 0, // 微信支付金额
|
||||
@@ -334,14 +334,14 @@ function printReceipt(param) {
|
||||
// SUPPLEMENTARY_INSURANCE: param.detail.find((t) => t.payEnum === 390300)?.amount ?? 0, // 城乡居民大病补充保险基金
|
||||
// HEALTHCARE_PREPAYMENT: param.detail.find((t) => t.payEnum === 360300)?.amount ?? 0, // 保健预支基金
|
||||
Mr_QR_Code: param.regNo,
|
||||
sex: props.patientInfo.genderEnum_enumText,
|
||||
age: props.patientInfo.age,
|
||||
sex: props.patientInfo?.genderEnum_enumText || '',
|
||||
age: props.patientInfo?.age || '',
|
||||
personType: '职工医保',
|
||||
fixmedinsName: param.fixmedinsName + '门诊收费明细',
|
||||
name: props.patientInfo.patientName, // 姓名
|
||||
gender: props.patientInfo.genderEnum_enumText, // 性别
|
||||
age: props.patientInfo.age, // 年龄
|
||||
encounterBusNo: props.patientInfo.encounterBusNo, // 病例号
|
||||
fixmedinsName: (param.fixmedinsName || '') + '门诊收费明细',
|
||||
name: props.patientInfo?.patientName || '', // 姓名
|
||||
gender: props.patientInfo?.genderEnum_enumText || '', // 性别
|
||||
age: props.patientInfo?.age || '', // 年龄
|
||||
encounterBusNo: props.patientInfo?.encounterBusNo || '', // 病例号
|
||||
currentDate: currentDate.value, // 收费日期
|
||||
chargedItems: props.chargedItems, // 收费项目
|
||||
totalAmount: props.totalAmount.toFixed(2) + ' 元', // 应收金额
|
||||
|
||||
@@ -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 || '预结算失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="lis-group-maintain">
|
||||
|
||||
|
||||
<!-- 标题区域 -->
|
||||
<div class="header">
|
||||
<h2>LIS分组维护</h2>
|
||||
@@ -10,125 +10,128 @@
|
||||
<div class="table-container">
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 50px;">行</th>
|
||||
<th style="width: 150px;">卫生机构</th>
|
||||
<th style="width: 150px;">日期</th>
|
||||
<th style="width: 200px;">LIS分组名称</th>
|
||||
<th style="width: 120px;">采血管</th>
|
||||
<th style="width: 300px;">备注</th>
|
||||
<th style="width: 150px;">操作</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50px;">行</th>
|
||||
<th style="width: 150px;">卫生机构</th>
|
||||
<th style="width: 150px;">日期</th>
|
||||
<th style="width: 200px;">LIS分组名称</th>
|
||||
<th style="width: 120px;">采血管</th>
|
||||
<th style="width: 300px;">备注</th>
|
||||
<th style="width: 150px;">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="(item, index) in tableData"
|
||||
<tr
|
||||
v-for="(item, index) in tableData"
|
||||
:key="item.id || index"
|
||||
:class="{ 'editing-row': item.editing }"
|
||||
>
|
||||
<td>{{ index + 1 }}</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input
|
||||
type="text"
|
||||
v-model="item.healthInstitution"
|
||||
placeholder="请输入卫生机构"
|
||||
:class="{ 'error-input': item.errors?.healthInstitution }"
|
||||
>
|
||||
<span v-if="item.errors?.healthInstitution" class="error-message">{{ item.errors.healthInstitution }}</span>
|
||||
:class="{ 'editing-row': item.editing, 'success-row': item.success, 'deleting-row': item.deleting }"
|
||||
>
|
||||
<td>{{ index + 1 }}</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input
|
||||
type="text"
|
||||
v-model="item.healthInstitution"
|
||||
disabled
|
||||
>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.healthInstitution }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" v-model="item.date" disabled>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.date }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input
|
||||
type="text"
|
||||
v-model="item.lisGroupName"
|
||||
placeholder="请输入分组名称"
|
||||
:class="{ 'error-input': item.errors?.lisGroupName, 'focus-target': item.isNew }"
|
||||
>
|
||||
<span v-if="item.errors?.lisGroupName" class="error-message">{{ item.errors.lisGroupName }}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.lisGroupName }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<select
|
||||
v-model="item.bloodCollectionTube"
|
||||
:class="{ 'error-input': item.errors?.bloodCollectionTube }"
|
||||
>
|
||||
<option value="">请选择采血管</option>
|
||||
<option v-for="tube in bloodTubeOptions" :key="tube" :value="tube">
|
||||
{{ tube }}
|
||||
</option>
|
||||
</select>
|
||||
<span v-if="item.errors?.bloodCollectionTube" class="error-message">{{ item.errors.bloodCollectionTube }}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.bloodCollectionTube }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" v-model="item.remark" placeholder="请输入备注信息">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.remark || '' }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<div class="actions">
|
||||
<template v-if="!item.editing">
|
||||
<button class="btn btn-edit" @click="startEdit(item)">✏️</button>
|
||||
<button class="btn btn-primary" @click="addRow">+</button>
|
||||
<button class="btn btn-delete" @click="deleteRow(index)">🗑</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.healthInstitution }}
|
||||
<button class="btn btn-confirm" @click="confirmEdit(item)">√</button>
|
||||
<button class="btn btn-cancel" @click="cancelEdit(item)">×</button>
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" v-model="item.date" disabled>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.date }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input
|
||||
type="text"
|
||||
v-model="item.lisGroupName"
|
||||
placeholder="请输入分组名称"
|
||||
:class="{ 'error-input': item.errors?.lisGroupName }"
|
||||
>
|
||||
<span v-if="item.errors?.lisGroupName" class="error-message">{{ item.errors.lisGroupName }}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.lisGroupName }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<select
|
||||
v-model="item.bloodCollectionTube"
|
||||
:class="{ 'error-input': item.errors?.bloodCollectionTube }"
|
||||
>
|
||||
<option value="">请选择采血管</option>
|
||||
<option v-for="tube in bloodTubeOptions" :key="tube" :value="tube">
|
||||
{{ tube }}
|
||||
</option>
|
||||
</select>
|
||||
<span v-if="item.errors?.bloodCollectionTube" class="error-message">{{ item.errors.bloodCollectionTube }}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.bloodCollectionTube }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" v-model="item.remark" placeholder="请输入备注信息">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.remark || '' }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<div class="actions">
|
||||
<template v-if="!item.editing">
|
||||
<button class="btn btn-edit" @click="startEdit(item)">✏️</button>
|
||||
<button class="btn btn-primary" @click="addRow">+</button>
|
||||
<button class="btn btn-delete" @click="deleteRow(index)">🗑</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<button class="btn btn-confirm" @click="confirmEdit(item)">√</button>
|
||||
<button class="btn btn-cancel" @click="cancelEdit(item)">×</button>
|
||||
</template>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- 分页区域 -->
|
||||
<div class="pagination">
|
||||
<button class="pagination-btn">‹</button>
|
||||
<span>1</span>
|
||||
<button class="pagination-btn">›</button>
|
||||
</div>
|
||||
<div class="pagination">
|
||||
<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)
|
||||
|
||||
// 采血管选项
|
||||
const bloodTubeOptions = ref([]);
|
||||
|
||||
|
||||
// 加载采血管颜色字典数据
|
||||
const loadBloodTubeDict = async () => {
|
||||
try {
|
||||
@@ -138,22 +141,26 @@ export default {
|
||||
bloodTubeOptions.value = response.data.map(item => item.label || item.dictLabel);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取采血管颜色字典失败:', error);
|
||||
// 如果字典获取失败,使用默认选项作为备选
|
||||
bloodTubeOptions.value = ['黄管', '紫管', '蓝管'];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 分页相关数据
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(10)
|
||||
const totalItems = ref(2) // 总数据量,实际应用中应该从后端获取
|
||||
|
||||
|
||||
// 总页数
|
||||
const totalPages = computed(() => {
|
||||
return Math.ceil(totalItems.value / pageSize.value)
|
||||
})
|
||||
|
||||
|
||||
// 获取当前用户的卫生机构名称
|
||||
const getCurrentHospital = () => {
|
||||
return userStore.hospitalName || userStore.orgName || '演示医院';
|
||||
};
|
||||
|
||||
// 表格数据
|
||||
const tableData = reactive([])
|
||||
|
||||
@@ -165,7 +172,7 @@ export default {
|
||||
const day = String(date.getDate()).padStart(2, '0')
|
||||
return `${year}-${month}-${day}`
|
||||
}
|
||||
|
||||
|
||||
// 加载LIS分组数据
|
||||
const loadLisGroups = async () => {
|
||||
// 确保采血管字典数据已加载
|
||||
@@ -174,217 +181,85 @@ export default {
|
||||
}
|
||||
try {
|
||||
loading.value = true
|
||||
|
||||
|
||||
// 构建查询参数
|
||||
const query = {
|
||||
pageNum: currentPage.value,
|
||||
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) {
|
||||
// 处理标准响应格式
|
||||
if (typeof response === 'object') {
|
||||
// 检查是否是标准API响应格式 {code, data, msg}
|
||||
if ('code' in response) {
|
||||
console.log('响应包含code字段:', response.code)
|
||||
|
||||
// 成功状态码处理
|
||||
if (response.code === 200 || response.code === '200' || response.code === 0) {
|
||||
console.log('响应状态码为成功状态')
|
||||
|
||||
// 检查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对象作为单个条目处理')
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log('响应不包含data字段')
|
||||
}
|
||||
} else {
|
||||
// 非成功状态码
|
||||
const errorMsg = response.msg || response.message || `请求失败,状态码: ${response.code}`
|
||||
console.error('请求失败:', errorMsg)
|
||||
showMessage(errorMsg, 'error')
|
||||
}
|
||||
}
|
||||
// 格式3: 响应本身是一个对象但没有code字段,可能是单个记录
|
||||
else if (!Array.isArray(response)) {
|
||||
console.log('响应是对象但没有code字段,尝试作为单个记录处理')
|
||||
items = [response]
|
||||
total = 1
|
||||
}
|
||||
}
|
||||
|
||||
// 格式4: 响应本身是数组
|
||||
if (Array.isArray(response)) {
|
||||
items = response
|
||||
total = items.length
|
||||
console.log('匹配到格式4: 响应本身是数组,数据量:', items.length)
|
||||
}
|
||||
|
||||
// 记录最终解析到的数据量
|
||||
console.log('最终解析到的数据量:', items.length, ',总数:', total)
|
||||
} else {
|
||||
console.error('接口返回空数据')
|
||||
showMessage('获取LIS分组数据失败:服务器返回空响应', 'error')
|
||||
}
|
||||
|
||||
// 处理获取到的数据
|
||||
if (items && items.length > 0) {
|
||||
// 处理每条数据,确保字段正确映射
|
||||
items.forEach((item, index) => {
|
||||
// 确保item是对象类型
|
||||
if (typeof item === 'object' && item !== null) {
|
||||
console.log(`处理记录 ${index + 1} 原始数据:`, item);
|
||||
|
||||
// 创建格式化后的对象,确保字段存在
|
||||
// 根据网络响应截图更正字段映射关系
|
||||
const formattedItem = {
|
||||
id: item.id || `temp_${Date.now()}_${index}`, // 确保有ID
|
||||
// 更正字段映射:hospital -> healthInstitution
|
||||
healthInstitution: item.hospital || item.org || item.healthInstitution || '',
|
||||
// 优先使用date字段
|
||||
date: item.date || item.createTime || item.createDate || '',
|
||||
// 更正字段映射:groupName -> lisGroupName
|
||||
lisGroupName: item.groupName || item.name || item.lisGroupName || '',
|
||||
// 更正字段映射:tube -> bloodCollectionTube
|
||||
bloodCollectionTube: item.tube || item.property || item.bloodCollectionTube || item.bloodTube || '',
|
||||
remark: item.remark || item.note || '',
|
||||
editing: false,
|
||||
// 保留原始对象的所有其他属性
|
||||
...item
|
||||
};
|
||||
|
||||
tableData.push(formattedItem);
|
||||
console.log(`处理记录 ${index + 1} 格式化后数据:`, {
|
||||
id: formattedItem.id,
|
||||
healthInstitution: formattedItem.healthInstitution,
|
||||
date: formattedItem.date,
|
||||
lisGroupName: formattedItem.lisGroupName,
|
||||
bloodCollectionTube: formattedItem.bloodCollectionTube,
|
||||
remark: formattedItem.remark
|
||||
|
||||
// 处理明确的数据结构
|
||||
if (response && response.code === 200) {
|
||||
// 清空现有数据
|
||||
tableData.splice(0, tableData.length);
|
||||
|
||||
// 获取最内层的数据结构
|
||||
const innerResponse = response.data;
|
||||
if (innerResponse && innerResponse.code === 200) {
|
||||
const data = innerResponse.data;
|
||||
if (data && Array.isArray(data.records)) {
|
||||
// 更新总记录数
|
||||
totalItems.value = data.total || 0;
|
||||
|
||||
// 处理每条记录
|
||||
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
|
||||
};
|
||||
|
||||
tableData.push(formattedItem);
|
||||
});
|
||||
} else {
|
||||
console.warn(`记录 ${index + 1} 不是有效对象,跳过处理:`, item);
|
||||
totalItems.value = 0;
|
||||
}
|
||||
});
|
||||
|
||||
totalItems.value = total;
|
||||
console.log('数据加载完成,表格显示', tableData.length, '条记录,总数:', totalItems.value);
|
||||
} else {
|
||||
totalItems.value = 0;
|
||||
}
|
||||
} else {
|
||||
console.log('未获取到有效数据,表格为空');
|
||||
// 非成功状态码
|
||||
const errorMsg = response.msg || response.message || `请求失败,状态码: ${response.code}`
|
||||
showMessage(errorMsg, 'error')
|
||||
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 ||
|
||||
error.response.data.error ||
|
||||
`服务器错误 (${error.response.status})`
|
||||
errorMessage = error.response.data.msg ||
|
||||
error.response.data.message ||
|
||||
error.response.data.error ||
|
||||
`服务器错误 (${error.response.status})`
|
||||
} 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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,53 +273,42 @@ export default {
|
||||
// 验证数据
|
||||
const validateData = (item) => {
|
||||
const errors = {}
|
||||
|
||||
|
||||
// 清除之前的错误信息
|
||||
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分组名称不能为空'
|
||||
} else if (item.lisGroupName.length > 50) {
|
||||
errors.lisGroupName = 'LIS分组名称不能超过50个字符'
|
||||
}
|
||||
|
||||
|
||||
// 验证采血管
|
||||
if (!item.bloodCollectionTube) {
|
||||
errors.bloodCollectionTube = '请选择采血管'
|
||||
}
|
||||
|
||||
|
||||
// 验证备注长度
|
||||
if (item.remark && item.remark.length > 200) {
|
||||
errors.remark = '备注信息不能超过200个字符'
|
||||
}
|
||||
|
||||
|
||||
if (Object.keys(errors).length > 0) {
|
||||
item.errors = errors
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// 显示提示信息
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,24 +319,24 @@ export default {
|
||||
showMessage('请检查并修正错误信息', 'error')
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
// 检查是否有重复的分组名称(在同一个卫生机构内)
|
||||
const duplicate = tableData.find(data =>
|
||||
data.id !== item.id &&
|
||||
data.healthInstitution === item.healthInstitution &&
|
||||
data.lisGroupName === item.lisGroupName
|
||||
const duplicate = tableData.find(data =>
|
||||
data.id !== item.id &&
|
||||
data.healthInstitution === item.healthInstitution &&
|
||||
data.lisGroupName === item.lisGroupName
|
||||
)
|
||||
|
||||
|
||||
if (duplicate) {
|
||||
if (!item.errors) item.errors = {}
|
||||
item.errors.lisGroupName = '该分组名称已存在'
|
||||
showMessage('分组名称重复,请修改', 'error')
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
|
||||
|
||||
// 准备提交数据(使用后端期望的字段名)
|
||||
const submitData = {
|
||||
id: item.id,
|
||||
@@ -482,7 +346,7 @@ export default {
|
||||
tube: item.bloodCollectionTube, // 前端字段映射到后端字段
|
||||
remark: item.remark
|
||||
}
|
||||
|
||||
|
||||
let response
|
||||
// 判断是新增还是修改
|
||||
if (item.isNew) {
|
||||
@@ -492,29 +356,35 @@ export default {
|
||||
// 修改
|
||||
response = await updateLisGroup(submitData)
|
||||
}
|
||||
|
||||
|
||||
// 处理响应
|
||||
if (response.code === 200) {
|
||||
// 保存编辑
|
||||
item.editing = false
|
||||
delete item.originalData
|
||||
delete item.errors
|
||||
|
||||
|
||||
// 先检查是否是新增记录,再删除isNew属性
|
||||
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,24 +413,25 @@ 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) {
|
||||
showMessage('请先完成当前行的编辑', 'error')
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
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: '',
|
||||
@@ -569,8 +440,15 @@ export default {
|
||||
errors: null,
|
||||
isNew: true // 标记为新记录
|
||||
})
|
||||
|
||||
showMessage('请填写新记录信息')
|
||||
|
||||
// 等待DOM更新后聚焦到第一个输入框
|
||||
await nextTick()
|
||||
const focusElement = document.querySelector('.focus-target')
|
||||
if (focusElement) {
|
||||
focusElement.focus()
|
||||
// 清除focus-target类,避免下次添加行时影响
|
||||
focusElement.classList.remove('focus-target')
|
||||
}
|
||||
}
|
||||
|
||||
// 删除行
|
||||
@@ -581,36 +459,66 @@ export default {
|
||||
showMessage('请先完成或取消编辑', 'error')
|
||||
return
|
||||
}
|
||||
|
||||
if (confirm(`确定要删除"${item.lisGroupName}"这条记录吗?`)) {
|
||||
try {
|
||||
loading.value = true
|
||||
|
||||
// 如果是新添加的记录,直接从数组中移除
|
||||
if (item.isNew) {
|
||||
tableData.splice(index, 1)
|
||||
showMessage('删除成功')
|
||||
totalItems.value--
|
||||
} else {
|
||||
// 调用API删除
|
||||
const response = await delLisGroup(item.id)
|
||||
|
||||
if (response.code === 200) {
|
||||
tableData.splice(index, 1)
|
||||
showMessage('删除成功')
|
||||
|
||||
// 更新总数
|
||||
totalItems.value--
|
||||
} else {
|
||||
showMessage(`删除失败: ${response.msg || '未知错误'}`, 'error')
|
||||
}
|
||||
|
||||
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)
|
||||
showMessage('删除成功')
|
||||
totalItems.value--
|
||||
} else {
|
||||
// 调用API删除
|
||||
const response = await delLisGroup(item.id)
|
||||
|
||||
if (response.code === 200) {
|
||||
// 更新总数
|
||||
totalItems.value--
|
||||
|
||||
// 检查当前页码是否仍然有效
|
||||
const newTotalPages = Math.ceil(totalItems.value / pageSize.value)
|
||||
if (currentPage.value > newTotalPages && newTotalPages > 0) {
|
||||
// 如果当前页码大于总页数且总页数大于0,调整为最后一页
|
||||
currentPage.value = newTotalPages
|
||||
}
|
||||
|
||||
// 重新加载当前页数据,保持页码不变
|
||||
loadLisGroups()
|
||||
showMessage('删除成功')
|
||||
} else {
|
||||
showMessage(`删除失败: ${response.msg || '未知错误'}`, 'error')
|
||||
// 如果删除失败,移除删除标记
|
||||
item.deleting = false
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('删除LIS分组数据失败:', error)
|
||||
showMessage(`删除失败: ${error.message || '未知错误'}`, 'error')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
} catch (error) {
|
||||
if (error !== 'cancel') {
|
||||
showMessage(`删除失败: ${error.message || '未知错误'}`, 'error')
|
||||
// 如果删除失败,移除删除标记
|
||||
if (tableData[index]) {
|
||||
tableData[index].deleting = false
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -638,7 +546,7 @@ export default {
|
||||
loadLisGroups()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 组件挂载时加载数据
|
||||
onMounted(() => {
|
||||
// 加载采血管字典数据
|
||||
@@ -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 {
|
||||
@@ -946,33 +868,34 @@ input:disabled {
|
||||
.lis-group-maintain {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
|
||||
.header h1 {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
|
||||
.table-container {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
|
||||
.data-table {
|
||||
font-size: 12px;
|
||||
min-width: 600px; /* 确保表格在小屏幕上可以横向滚动 */
|
||||
border-collapse: collapse;
|
||||
min-width: 768px; /* 确保表格在小屏幕上可以横向滚动 */
|
||||
}
|
||||
|
||||
|
||||
.data-table th,
|
||||
.data-table td {
|
||||
padding: 8px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.data-table td {
|
||||
padding: 8px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
font-size: 11px;
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
|
||||
.pagination-btn {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1046,7 +1046,9 @@ function handlePrint() {
|
||||
purchaseinventoryList: form.purchaseinventoryList,
|
||||
});
|
||||
console.log(result, '345678987654');
|
||||
const printElements = templateJson;
|
||||
const printElements = JSON.parse(
|
||||
JSON.stringify(templateJson).replace(/{{HOSPITAL_NAME}}/g, userStore.hospitalName)
|
||||
);
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
|
||||
hiprintTemplate.print2(result, {
|
||||
// printer: 'EPSON LQ-80KFII',
|
||||
|
||||
@@ -244,7 +244,9 @@ function handlePrint() {
|
||||
purposeLocationName: printList[0].purposeLocationName,
|
||||
purchaseinventoryList: printList,
|
||||
});
|
||||
const printElements = templateJson;
|
||||
const printElements = JSON.parse(
|
||||
JSON.stringify(templateJson).replace(/{{HOSPITAL_NAME}}/g, userStore.hospitalName)
|
||||
);
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
|
||||
hiprintTemplate.print2(result, {
|
||||
// printer: 'EPSON LQ-80KFII',
|
||||
|
||||
@@ -1436,8 +1436,11 @@ function handlePrintPreview() {
|
||||
console.log("打印数据:", printData);
|
||||
|
||||
// 创建打印模板实例
|
||||
const printElements = JSON.parse(
|
||||
JSON.stringify(templateJson).replace(/{{HOSPITAL_NAME}}/g, userUserStore.hospitalName)
|
||||
);
|
||||
const hiprintTemplate = new hiprint.PrintTemplate({
|
||||
template: templateJson,
|
||||
template: printElements,
|
||||
});
|
||||
|
||||
// 打开预览窗口(推荐)
|
||||
@@ -1515,8 +1518,11 @@ function handleDirectPrint() {
|
||||
console.log("打印数据:", printData);
|
||||
|
||||
// 创建打印模板实例
|
||||
const printElements = JSON.parse(
|
||||
JSON.stringify(templateJson).replace(/{{HOSPITAL_NAME}}/g, userUserStore.hospitalName)
|
||||
);
|
||||
const hiprintTemplate = new hiprint.PrintTemplate({
|
||||
template: templateJson,
|
||||
template: printElements,
|
||||
});
|
||||
|
||||
// 直接打印到指定打印机
|
||||
@@ -1591,8 +1597,11 @@ function handlePrintWithSelectPrinter() {
|
||||
console.log("打印数据:", printData);
|
||||
|
||||
// 创建打印模板实例
|
||||
const printElements = JSON.parse(
|
||||
JSON.stringify(templateJson).replace(/{{HOSPITAL_NAME}}/g, userUserStore.hospitalName)
|
||||
);
|
||||
const hiprintTemplate = new hiprint.PrintTemplate({
|
||||
template: templateJson,
|
||||
template: printElements,
|
||||
});
|
||||
|
||||
// 获取打印机列表并选择
|
||||
|
||||
@@ -243,7 +243,9 @@ function handlePrint() {
|
||||
busNo: printList[0].busNo,
|
||||
detailsList: printList,
|
||||
});
|
||||
const printElements = templateJson;
|
||||
const printElements = JSON.parse(
|
||||
JSON.stringify(templateJson).replace(/{{HOSPITAL_NAME}}/g, userStore.hospitalName)
|
||||
);
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
|
||||
hiprintTemplate.print2(result, {
|
||||
title: '打印标题',
|
||||
|
||||
@@ -696,7 +696,10 @@ async function printPrescription() {
|
||||
|
||||
console.log('药房result', result);
|
||||
// 根据药品分类选择对应的打印模板
|
||||
const printElements = tcmFlag.value === '1' ? chineseMedicineTemplateJson : templateJson;
|
||||
const template = tcmFlag.value === '1' ? chineseMedicineTemplateJson : templateJson;
|
||||
const printElements = JSON.parse(
|
||||
JSON.stringify(template).replace(/{{HOSPITAL_NAME}}/g, proxy.$store.useUserStore().hospitalName)
|
||||
);
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({template: printElements}); // 定义模板
|
||||
hiprintTemplate.print2(result, {
|
||||
height: 210,
|
||||
|
||||
@@ -31,20 +31,22 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-for="(group, doctorName) in groupedPatients" :key="doctorName">
|
||||
<!-- 医生分组标题 -->
|
||||
<tr class="doctor-header">
|
||||
<td colspan="4">{{ doctorName }} 医生 (诊室: {{ getDoctorRoom(doctorName) }})</td>
|
||||
</tr>
|
||||
<!-- 患者列表 -->
|
||||
<tr v-for="(patient, index) in group" :key="patient.id">
|
||||
<td>{{ index + 1 }}</td>
|
||||
<td>{{ formatPatientName(patient.name) }}</td>
|
||||
<td>{{ getDoctorRoom(doctorName) }}</td>
|
||||
<td :style="{ color: index === 0 ? '#e74c3c' : '#27ae60' }">
|
||||
{{ index === 0 ? '就诊中' : '等待' }}
|
||||
</td>
|
||||
</tr>
|
||||
<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 groupedPatients[doctorName]" :key="patient.id">
|
||||
<td>{{ index + 1 }}</td>
|
||||
<td>{{ formatPatientName(patient.name) }}</td>
|
||||
<td>{{ getDoctorRoom(doctorName) }}</td>
|
||||
<td :style="{ color: index === 0 ? '#e74c3c' : '#27ae60' }">
|
||||
{{ index === 0 ? '就诊中' : '等待' }}
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -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