Compare commits

45 Commits

Author SHA1 Message Date
46c9787216 修改套餐管理页面操作图标设置 2025-12-05 16:50:37 +08:00
e0a768de2e 新增套餐设置页面中的套餐管理页面并增加相应跳转逻辑 2025-12-05 16:37:34 +08:00
fc7f931728 新增套餐设置页面中的套餐管理页面并增加相应跳转逻辑 2025-12-05 16:34:12 +08:00
qk123
3ccb970a09 维护系统->检查方法、部位导出表格功能OK 2025-12-05 15:54:57 +08:00
ljj
8a9a622aeb 72.系统管理--》基础数据-》科室管理 2025-12-05 13:39:23 +08:00
qk123
29e7f0937b 维护系统->检查方法、部位条件搜索前后端实现 2025-12-04 14:47:39 +08:00
029d534b3c 新增检验项目设置中的检验类型页面并实现相关逻辑 2025-12-04 09:47:34 +08:00
qk123
213723b220 维护系统->检查方法后端接口数据校验修改 2025-12-04 09:33:44 +08:00
qk123
c636e77fd0 维护系统->检查部位前端接口缺少导入。 2025-12-04 09:21:35 +08:00
qk123
7407562ec5 维护系统->检查部位后端接口优化。 2025-12-03 17:15:35 +08:00
qk123
b3c27ec789 维护系统->检查方法前端页面优化、接口功能完善(搜索栏和导出表格未处理),后端接口优化。 2025-12-03 16:00:24 +08:00
qk123
601ae40666 维护系统->LIS分组前端页面开发,基础功能实现 2025-12-03 14:24:19 +08:00
3dda5ce72d 修改配置7 2025-12-03 13:48:25 +08:00
qk123
99d4c28b95 检查项目维护->Lis分组前端接口、后端实体优化。 2025-12-02 16:46:19 +08:00
qk123
0e70de6de7 Merge branch 'develop' of https://gitea.gentronhealth.com/Yajentine/his into develop 2025-12-02 16:44:57 +08:00
72eb1088df 修正前端PROD 2025-12-02 15:03:40 +08:00
a853c16854 修正prd 2025-12-02 14:43:35 +08:00
73a349f98a 冗余prod 2025-12-02 14:25:10 +08:00
5fb7a3f488 production 2025-12-02 14:12:06 +08:00
a8eb7d5697 prd->production 2025-12-02 14:08:09 +08:00
eb3b142ce4 修改配置 2025-12-02 14:03:49 +08:00
9f6a39ba30 修改配置文件 2025-12-02 14:02:25 +08:00
f7f2f98bbe 修改统一前端的PRD的标识 2025-12-02 13:52:18 +08:00
79e68ee14e 修改前端VUE的DEV环境配置 2025-12-02 12:53:01 +08:00
bc8987c463 配置3 2025-12-02 11:51:07 +08:00
3f7174fcd1 修复重复 2025-12-02 10:31:18 +08:00
080008f447 Merge branch 'develop' of https://gitea.gentronhealth.com/Yajentine/his into develop 2025-12-02 10:29:50 +08:00
5c3d935615 前端加上相关test的配置 2025-12-02 10:29:39 +08:00
a0845127c6 配置2 2025-12-02 10:28:02 +08:00
ba65ab303b 多环境配置 2025-12-02 09:25:35 +08:00
qk123
6fbdddf0ee 检查项目维护->Lis分组后端接口 2025-12-01 16:13:30 +08:00
py
173cbc7f87 门诊挂号-》完善新增患者字典信息 2025-12-01 14:45:27 +08:00
qk123
2e341a123e 检查项目维护检查方法、部位前端表格数据映射ok 2025-12-01 13:42:15 +08:00
qk123
8beff2ee14 检查方法、检查部位前端页面、完善后端接口逻辑 2025-11-28 17:03:08 +08:00
wzk
1b939ba5b7 刷新 2025-11-28 16:48:14 +08:00
wzk
577daabe1c 医嘱诊断和费用性质没有自动引入 2025-11-28 16:35:41 +08:00
wzk
327e88e6d4 检查项目设置-套餐设置-套餐管理界面放大或缩小数据显示不全 2025-11-28 15:24:52 +08:00
叶锦涛
548fabcffe 新建检验项目设置的检验类型页面 2025-11-28 13:56:27 +08:00
263e21e157 换卡bug 2025-11-28 10:41:14 +08:00
d7955aa628 配置 2025-11-28 09:58:52 +08:00
叶锦涛
d197f7555f 修复发票管理界面管理员和普通操作人员的筛选规则 2025-11-27 13:36:17 +08:00
wzk
a0e52da437 门诊号码管理维护界面前后端 2025-11-27 13:08:42 +08:00
qk123
88d79729fe 库房管理->采购管理->采购管理点击《详情》按钮跳转后无数据显示 2025-11-27 12:00:21 +08:00
6dc6480e64 Merge remote-tracking branch 'origin/develop' into develop 2025-11-27 10:40:12 +08:00
98c263a72b 患者档案和进货单bug 2025-11-27 10:39:56 +08:00
73 changed files with 7471 additions and 1521 deletions

76
.github/copilot-instructions.md vendored Normal file
View File

@@ -0,0 +1,76 @@
# OpenHIS — AI 编码助手 指南
目的:帮助自动化/AI 编码代理快速上手本仓库,包含架构要点、关键文件、常用构建/运行命令以及项目约定。请只按照仓库内真实可见的内容提出修改建议或补充说明。
- **代码组织**: 本项目是一个 Java 后端(多模块 Maven+ Vue3 前端Vite的大型应用。
- 后端主模块目录:`openhis-server-new/`(顶层为 `pom`,包含多个子模块)。关键子模块示例:`openhis-application`, `openhis-domain`, `openhis-common`, `core-*` 系列。
- 前端目录:`openhis-ui-vue3/`Vite + Vue 3使用 Pinia、Element Plus 等)。
- **大局观Big Picture**: 后端以 Spring BootJava 17实现使用多模块 Maven 管理公共库与业务模块;前端由单独仓库目录通过 Vite 构建并以环境变量(`VITE_APP_BASE_API`)与后端交互。后端扫描 `com.core``com.openhis` 包(见 `OpenHisApplication.java`),启动类位于:`openhis-server-new/openhis-application/src/main/java/com/openhis/OpenHisApplication.java`
- **运行/构建Windows PowerShell 示例)**:
- 构建后端(从仓库根执行):
```powershell
cd openhis-server-new
mvn clean package -DskipTests
```
- 仅运行后端模块(开发时常用):
```powershell
cd openhis-server-new/openhis-application
mvn spring-boot:run
# 或在 IDE 中运行 `com.openhis.OpenHisApplication` 的 main()
```
- 前端启动与构建(需要 Node.js v16.x仓库 README 建议 v16.15
```powershell
cd openhis-ui-vue3
npm install
npm run dev # 本地开发(热重载)
npm run build:prod # 生产构建
```
- **环境与配置**:
- 后端配置:`openhis-server-new/openhis-application/src/main/resources/application.yml`数据库、端口、profile 等。README 还提及 `application-druid.yml`(若存在请优先查看)。
- 前端配置:多个 `.env.*` 文件(例如 `.env.development`, `.env.staging`, `.env.production`),关键变量:`VITE_APP_BASE_API`(例如 `/dev-api`),前端通过 `import.meta.env.VITE_APP_BASE_API` 拼接后端 URL`src/utils/request.js`、多个视图与组件)。
- **重要约定 / 模式**:
- 后端采用 Java 17、Spring Boot 2.5.x 家族,父 POM在 `openhis-server-new/pom.xml` 定义。常用依赖版本在该 POM 的 `<properties>` 中集中维护。
- 模块间以 Maven 模块依赖与 `com.core` / `com.openhis` 包名分层(见 `pom.xml``<modules>``dependencyManagement`)。
- 前端通过 Vite 插件配置(`openhis-ui-vue3/vite/plugins`)管理 svg、自动导入等。UI 框架为 Element Plus状态管理为 Pinia。
- **集成点 & 外部依赖**:
- 数据库PostgreSQLREADME 建议 v16.2),仓库根含一个大型初始化 SQL`数据库初始话脚本请使用navicat16版本导入.sql`,用于初始化表与演示数据。
- 缓存/会话Redis需自行配置
- 其他Flowable工作流Druid连接池监控第三方服务通过特定配置类例如 `YbServiceConfig``OpenHisApplication` 中启用)。
- **调试与常见位置**:
- 启动类:`openhis-server-new/openhis-application/src/main/java/com/openhis/OpenHisApplication.java`
- 全局配置:`openhis-server-new/openhis-application/src/main/resources/``application.yml`、profile 文件等)。
- 前端入口:`openhis-ui-vue3/src/main.js`、路由在 `openhis-ui-vue3/src/router/index.js`
- API 文档与监控路径(通常由后端暴露并被前端访问):
- Swagger UI: `<VITE_APP_BASE_API>/swagger-ui/index.html`(前端视图在 `src/views/tool/swagger/index.vue`)。
- Druid: `<VITE_APP_BASE_API>/druid/login.html`(见前端相关视图引用)。
- **为 AI 代理的具体建议(如何安全、有效地修改代码)**:
- 修改后端时:优先在子模块(例如 `openhis-application`)本地运行 `mvn spring-boot:run` 验证启动与基础 API大量改动前先执行 `mvn -T1C -DskipTests clean package` 在 CI 环境上验证构建(本地机器也可用)。
- 修改前端时:检查/调整对应 `.env.*` 文件中的 `VITE_APP_BASE_API`,使用 `npm run dev` 本地联调后端接口(可通过代理或将 `VITE_APP_BASE_API` 指向后端地址)。
- 修改数据库结构或 seed请参考仓库根的 SQL 初始化脚本,任何 DDL/数据变更需同步该脚本并通知数据库管理员/运维。
- **举例(常见任务示例)**:
- 本地联调前端 + 后端PowerShell:
```powershell
# 启动后端
cd openhis-server-new/openhis-application
mvn spring-boot:run
# 启动前端(另开终端)
cd openhis-ui-vue3
npm run dev
```
如需我把这些内容合并为更短或更详细的版本,或把其中某部分(例如后端模块依赖关系图、关键 Java 包说明)展开,请告诉我要增强哪一节。

View File

@@ -0,0 +1,39 @@
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
public class TestDeleteInspectionType {
public static void main(String[] args) {
try {
// 测试删除ID为1的检验类型
long inspectionTypeId = 1;
URL url = new URL("http://localhost:8080/system/inspection-type/" + inspectionTypeId);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("DELETE");
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Accept", "application/json");
// 发送请求
int responseCode = connection.getResponseCode();
System.out.println("响应代码: " + responseCode);
// 读取响应
Scanner scanner;
if (responseCode >= 200 && responseCode < 300) {
scanner = new Scanner(connection.getInputStream());
} else {
scanner = new Scanner(connection.getErrorStream());
}
String response = scanner.useDelimiter("\\A").next();
System.out.println("响应内容: " + response);
scanner.close();
connection.disconnect();
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,27 @@
-- 向adm_organization表添加缺失字段的SQL脚本
-- 添加register_flag字段对应registerFlag属性
ALTER TABLE "adm_organization"
ADD COLUMN "register_flag" int4;
-- 添加location字段
ALTER TABLE "adm_organization"
ADD COLUMN "location" varchar(255);
-- 添加intro字段
ALTER TABLE "adm_organization"
ADD COLUMN "intro" varchar(1000);
-- 添加remark字段
ALTER TABLE "adm_organization"
ADD COLUMN "remark" varchar(1000);
-- 添加字段注释
COMMENT ON COLUMN "adm_organization"."register_flag" IS '挂号标志';
COMMENT ON COLUMN "adm_organization"."location" IS '科室位置';
COMMENT ON COLUMN "adm_organization"."intro" IS '科室简介';
COMMENT ON COLUMN "adm_organization"."remark" IS '备注';
-- 设置register_flag默认值为0不允许挂号
ALTER TABLE "adm_organization"
ALTER COLUMN "register_flag" SET DEFAULT 0;

View File

@@ -100,7 +100,18 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
@Override
public R<?> getOrgInfo(Long orgId) {
Organization organization = organizationService.getById(orgId);
return R.ok(organization, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"机构信息查询"}));
if (organization == null) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00006, new Object[] {"机构信息"}));
}
// 转换为DTO对象确保数据格式一致
OrganizationDto organizationDto = new OrganizationDto();
BeanUtils.copyProperties(organization, organizationDto);
organizationDto.setTypeEnum_dictText(EnumUtils.getInfoByValue(OrganizationType.class, organizationDto.getTypeEnum()));
organizationDto.setClassEnum_dictText(EnumUtils.getInfoByValue(OrganizationClass.class, organizationDto.getClassEnum()));
organizationDto.setActiveFlag_dictText(EnumUtils.getInfoByValue(AccountStatus.class, organizationDto.getActiveFlag()));
return R.ok(organizationDto, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"机构信息查询"}));
}
/**

View File

@@ -60,4 +60,16 @@ public class OrganizationDto {
/** 子集合 */
private List<OrganizationDto> children = new ArrayList<>();
/** 挂号科室标记 */
private Integer registerFlag;
/** 科室位置 */
private String location;
/** 科室简介 */
private String intro;
/** 备注 */
private String remark;
}

View File

@@ -0,0 +1,219 @@
package com.openhis.web.basicmanage.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.annotation.Log;
import com.core.common.core.domain.R;
import com.core.common.enums.BusinessType;
import com.core.common.utils.SecurityUtils;
import com.core.common.utils.StringUtils;
import com.openhis.administration.domain.OutpatientNoSegment;
import com.openhis.administration.service.IOutpatientNoSegmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
/**
* 门诊号码段管理控制器
*
* @author system
* @date 2025-01-XX
*/
@RestController
@RequestMapping("/business-rule/outpatient-no")
public class OutpatientNoSegmentController {
@Autowired
private IOutpatientNoSegmentService outpatientNoSegmentService;
/**
* 分页查询门诊号码段列表
*
* @param pageNo 页码
* @param pageSize 每页条数
* @param onlySelf 是否只查询自己的true=只查询自己的false=查询所有)
* @return 门诊号码段列表
*/
@GetMapping("/page")
public R<?> selectOutpatientNoSegmentPage(
@RequestParam(defaultValue = "1") Integer pageNo,
@RequestParam(defaultValue = "10") Integer pageSize,
@RequestParam(required = false) Boolean onlySelf) {
// 获取当前用户ID
Long userId = SecurityUtils.getUserId();
// 如果onlySelf为null默认只查询自己的
boolean onlySelfFlag = onlySelf != null ? onlySelf : true;
// 分页查询门诊号码段列表
Page<OutpatientNoSegment> page = new Page<>(pageNo, pageSize);
Page<OutpatientNoSegment> result = outpatientNoSegmentService.selectOutpatientNoSegmentPage(page, onlySelfFlag, userId);
return R.ok(result);
}
/**
* 新增门诊号码段
*
* @param outpatientNoSegment 门诊号码段信息
* @return 操作结果
*/
@Log(title = "门诊号码管理", businessType = BusinessType.INSERT)
@PostMapping
public R<?> addOutpatientNoSegment(@RequestBody OutpatientNoSegment outpatientNoSegment) {
// 校验必填字段
if (StringUtils.isEmpty(outpatientNoSegment.getStartNo()) ||
StringUtils.isEmpty(outpatientNoSegment.getEndNo()) ||
StringUtils.isEmpty(outpatientNoSegment.getUsedNo())) {
return R.fail("起始号码、终止号码和使用号码不能为空");
}
// 校验号码段是否重复
if (outpatientNoSegmentService.checkNumberSegmentOverlap(
outpatientNoSegment.getStartNo(),
outpatientNoSegment.getEndNo(),
null)) {
return R.fail("门诊号码设置重复");
}
// 设置创建人信息
outpatientNoSegment.setOperatorId(SecurityUtils.getUserId());
if (StringUtils.isEmpty(outpatientNoSegment.getOperatorName())) {
outpatientNoSegment.setOperatorName(SecurityUtils.getUsername());
}
outpatientNoSegment.setCreateBy(SecurityUtils.getUsername());
int result = outpatientNoSegmentService.insertOutpatientNoSegment(outpatientNoSegment);
return result > 0 ? R.ok("保存成功") : R.fail("保存失败");
}
/**
* 修改门诊号码段
*
* @param outpatientNoSegment 门诊号码段信息
* @return 操作结果
*/
@Log(title = "门诊号码管理", businessType = BusinessType.UPDATE)
@PutMapping
public R<?> updateOutpatientNoSegment(@RequestBody OutpatientNoSegment outpatientNoSegment) {
// 校验必填字段
if (StringUtils.isEmpty(outpatientNoSegment.getStartNo()) ||
StringUtils.isEmpty(outpatientNoSegment.getEndNo()) ||
StringUtils.isEmpty(outpatientNoSegment.getUsedNo())) {
return R.fail("起始号码、终止号码和使用号码不能为空");
}
// 校验号码段是否重复(排除自身)
if (outpatientNoSegmentService.checkNumberSegmentOverlap(
outpatientNoSegment.getStartNo(),
outpatientNoSegment.getEndNo(),
outpatientNoSegment.getId())) {
return R.fail("门诊号码设置重复");
}
// 设置更新人信息
outpatientNoSegment.setUpdateBy(SecurityUtils.getUsername());
int result = outpatientNoSegmentService.updateOutpatientNoSegment(outpatientNoSegment);
return result > 0 ? R.ok("保存成功") : R.fail("保存失败");
}
/**
* 删除门诊号码段
*
* @param request 包含ids数组的请求对象
* @return 操作结果
*/
@Log(title = "门诊号码管理", businessType = BusinessType.DELETE)
@DeleteMapping
public R<?> deleteOutpatientNoSegment(@RequestBody java.util.Map<String, Object> request) {
// 支持接收 Long[] 或 String[] 或混合类型处理大整数ID
Object idsObj = request.get("ids");
System.out.println("删除请求 - 接收到的ids原始数据: " + idsObj);
System.out.println("删除请求 - 接收到的ids类型: " + (idsObj != null ? idsObj.getClass().getName() : "null"));
if (idsObj == null) {
return R.fail("请选择要删除的数据");
}
// 转换为 Long[] 数组
Long[] ids = null;
if (idsObj instanceof java.util.List) {
java.util.List<?> idList = (java.util.List<?>) idsObj;
ids = new Long[idList.size()];
for (int i = 0; i < idList.size(); i++) {
Object idObj = idList.get(i);
if (idObj instanceof Long) {
ids[i] = (Long) idObj;
} else if (idObj instanceof Integer) {
ids[i] = ((Integer) idObj).longValue();
} else if (idObj instanceof String) {
try {
String idStr = (String) idObj;
System.out.println("删除请求 - 转换字符串ID: " + idStr);
ids[i] = Long.parseLong(idStr);
System.out.println("删除请求 - 转换后的Long ID: " + ids[i]);
// 验证转换是否正确
if (!String.valueOf(ids[i]).equals(idStr)) {
System.out.println("删除请求 - 警告ID转换后值不匹配原始: " + idStr + ", 转换后: " + ids[i]);
}
} catch (NumberFormatException e) {
System.out.println("删除请求 - ID转换失败: " + idObj + ", 错误: " + e.getMessage());
return R.fail("无效的ID格式: " + idObj);
}
} else if (idObj instanceof Number) {
ids[i] = ((Number) idObj).longValue();
} else {
return R.fail("无效的ID类型: " + (idObj != null ? idObj.getClass().getName() : "null"));
}
}
} else if (idsObj instanceof Long[]) {
ids = (Long[]) idsObj;
} else {
return R.fail("无效的ID数组格式");
}
System.out.println("删除请求 - 转换后的ids: " + java.util.Arrays.toString(ids));
if (ids == null || ids.length == 0) {
return R.fail("请选择要删除的数据");
}
// 获取当前用户ID
Long userId = SecurityUtils.getUserId();
System.out.println("删除请求 - 当前用户ID: " + userId);
// 校验删除权限和使用状态
for (Long id : ids) {
System.out.println("删除验证 - 检查ID: " + id);
OutpatientNoSegment segment = outpatientNoSegmentService.getById(id);
if (segment == null) {
// 记录日志以便调试
System.out.println("删除失败记录不存在ID=" + id + ",可能已被软删除或不存在");
return R.fail("数据不存在ID: " + id);
}
System.out.println("删除验证 - 找到记录: ID=" + segment.getId() + ", operatorId=" + segment.getOperatorId() + ", usedNo=" + segment.getUsedNo() + ", startNo=" + segment.getStartNo());
// 校验归属权
if (!segment.getOperatorId().equals(userId)) {
System.out.println("删除验证 - 权限检查失败: segment.operatorId=" + segment.getOperatorId() + ", userId=" + userId);
return R.fail("只能删除自己维护的门诊号码段");
}
// 校验使用状态(使用号码=起始号码表示未使用)
if (!segment.getUsedNo().equals(segment.getStartNo())) {
System.out.println("删除验证 - 使用状态检查失败: usedNo=" + segment.getUsedNo() + ", startNo=" + segment.getStartNo());
return R.fail("已有门诊号码段已有使用的门诊号码,请核对!");
}
}
System.out.println("删除验证 - 所有检查通过,开始执行删除");
int rows = outpatientNoSegmentService.deleteOutpatientNoSegmentByIds(ids);
System.out.println("删除执行 - 影响行数: " + rows);
return rows > 0 ? R.ok("删除成功") : R.fail("删除失败");
}
}

View File

@@ -2,7 +2,10 @@ package com.openhis.web.check.appservice;
import com.core.common.core.domain.R;
import com.openhis.web.check.dto.CheckMethodDto;
import com.openhis.check.domain.CheckMethod;
import io.swagger.models.auth.In;
import javax.servlet.http.HttpServletResponse;
/**
* 检查方法Service接口
@@ -14,11 +17,13 @@ public interface ICheckMethodAppService{
R<?> getCheckMethodList();
R<?> addCheckMethod(CheckMethodDto checkMethodDto);
R<?> addCheckMethod(CheckMethod checkMethod);
R<?> updateCheckMethod(CheckMethodDto checkPartDto);
R<?> updateCheckMethod(CheckMethod checkPart);
R<?> removeCheckMethod(Long code);
R<?> removeCheckMethod(Integer checkMethodId);
R<?> searchCheckMethodList(Integer pageNo, Integer pageSize, String checkType, String name, String packageName);
R<?> exportCheckMethod(String checkType, String name, String packageName, HttpServletResponse response);
}

View File

@@ -1,14 +1,20 @@
package com.openhis.web.check.appservice;
import com.core.common.core.domain.R;
import com.openhis.web.check.dto.CheckPartDto;
import com.openhis.check.domain.CheckPart;
import javax.servlet.http.HttpServletResponse;
public interface ICheckPartAppService {
R<?> getCheckPartList();
R<?> addCheckPart(CheckPartDto checkPartDto);
R<?> addCheckPart(CheckPart checkPart);
R<?> removeCheckPart(Long code);
R<?> removeCheckPart(Integer checkPartId);
R<?> updateCheckPart(CheckPartDto checkMethodDto);
R<?> updateCheckPart(CheckPart checkPart);
R<?> searchCheckPartList(Integer pageNo, Integer pageSize, String checkType, String name, String packageName);
R<?> exportCheckPart(String checkType, String name, String packageName, HttpServletResponse response);
}

View File

@@ -0,0 +1,14 @@
package com.openhis.web.check.appservice;
import com.core.common.core.domain.R;
import com.openhis.check.domain.LisGroupInfo;
public interface ILisGroupInfoAppService {
R<?> getLisGroupInfoList();
R<?> add(LisGroupInfo lisGroupInfo);
R<?> update(LisGroupInfo lisGroupInfo);
R<?> delete(Integer lisGroupInfoId);
}

View File

@@ -6,12 +6,16 @@ import com.core.common.core.domain.R;
import com.openhis.check.domain.CheckMethod;
import com.openhis.check.service.ICheckMethodService;
import com.openhis.web.check.appservice.ICheckMethodAppService;
import com.openhis.web.check.dto.CheckMethodDto;
import com.openhis.web.reportmanage.utils.ExcelFillerUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
@@ -27,58 +31,99 @@ public class CheckMethodAppServiceImpl implements ICheckMethodAppService {
}
@Override
public R<?> addCheckMethod(CheckMethodDto checkMethodDto) {
//1.参数校验
if(ObjectUtil.isEmpty(checkMethodDto.getName())){
return R.fail("检查方法名称不能为空");
public R<?> searchCheckMethodList(Integer pageNo, Integer pageSize, String checkType, String name, String packageName) {
LambdaQueryWrapper<CheckMethod> wrapper = new LambdaQueryWrapper<>();
if (checkType != null && ObjectUtil.isNotEmpty(checkType)) {
wrapper.eq(CheckMethod::getCheckType, checkType);
}
if(ObjectUtil.isEmpty(checkMethodDto.getCheckType())){
return R.fail("检查类型不能为空");
if (name != null && ObjectUtil.isNotEmpty(name)) {
wrapper.like(CheckMethod::getName, name);
}
if(ObjectUtil.isEmpty(checkMethodDto.getCode())){
return R.fail("代码不能为空");
if (packageName != null && ObjectUtil.isNotEmpty(packageName)) {
wrapper.eq(CheckMethod::getPackageName, packageName);
}
//2.判断是否有重复
LambdaQueryWrapper<CheckMethod> wrapper = new LambdaQueryWrapper<CheckMethod>()
.eq(CheckMethod::getName, checkMethodDto.getName())
.eq(CheckMethod::getCheckType, checkMethodDto.getCheckType())
.eq(CheckMethod::getCode, checkMethodDto.getCode());
if (checkMethodService.getOne(wrapper) != null){
return R.fail("检查方法已存在");
List<CheckMethod> list = checkMethodService.list(wrapper);
return R.ok(list);
}
@Override
public R<?> addCheckMethod(CheckMethod checkMethod) {
//1.数据校验
if (ObjectUtil.isEmpty(checkMethod.getName())) {
return R.fail("检查方法名称不能为空!");
}
//3.封装实体检查方法
CheckMethod checkMethod = new CheckMethod();
checkMethod.setName(checkMethodDto.getName());
//4.保存添加
if (ObjectUtil.isEmpty(checkMethod.getCode())) {
return R.fail("检查方法代码不能为空!");
}
if (ObjectUtil.isEmpty(checkMethod.getCheckType())) {
return R.fail("检查方法的检查类型不能为空!");
}
//2.保存
boolean save = checkMethodService.save(checkMethod);
return R.ok();
return R.ok(save);
}
@Override
public R<?> updateCheckMethod(CheckMethodDto checkMethodDto) {
//1.数校验
if(ObjectUtil.isEmpty(checkMethodDto.getName())){
return R.fail("检查方法名称不能为空");
public R<?> updateCheckMethod(CheckMethod checkMethod) {
//1.数校验
if (ObjectUtil.isEmpty(checkMethod.getName())) {
return R.fail("检查方法名称不能为空");
}
if(ObjectUtil.isEmpty(checkMethodDto.getCheckType())){
return R.fail("检查类型不能为空");
if (ObjectUtil.isEmpty(checkMethod.getCode())) {
return R.fail("检查方法代码不能为空");
}
if(ObjectUtil.isEmpty(checkMethodDto.getCode())){
return R.fail("代码不能为空");
if (ObjectUtil.isEmpty(checkMethod.getCheckType())) {
return R.fail("检查方法的检查类型不能为空");
}
//2.
return R.ok();
//2.更新
boolean b = checkMethodService.updateById(checkMethod);
return R.ok(b);
}
@Override
public R<?> removeCheckMethod(Long code) {
if (ObjectUtil.isEmpty(code)){
return R.fail("检查方法代码不能为空");
}
LambdaQueryWrapper<CheckMethod> wrapper = new LambdaQueryWrapper<CheckMethod>().eq(CheckMethod::getCode, code);
boolean remove = checkMethodService.remove(wrapper);
public R<?> removeCheckMethod(Integer checkMethodId) {
boolean remove = checkMethodService.removeById(checkMethodId);
return R.ok(remove);
}
@Override
public R<?> exportCheckMethod(String checkType, String name, String packageName, HttpServletResponse response) {
LambdaQueryWrapper<CheckMethod> wrapper = new LambdaQueryWrapper<>();
if (checkType != null && ObjectUtil.isNotEmpty(checkType)) {
wrapper.eq(CheckMethod::getCheckType, checkType);
}
if (name != null && ObjectUtil.isNotEmpty(name)) {
wrapper.like(CheckMethod::getName, name);
}
if (packageName != null && ObjectUtil.isNotEmpty(packageName)) {
wrapper.eq(CheckMethod::getPackageName, packageName);
}
List<CheckMethod> list = checkMethodService.list(wrapper);
if (list.isEmpty()) {
return R.fail("导出Excel失败,无数据。");
}
try {
// 准备表头key对应实体的字段名
Map<String, String> headers = new LinkedHashMap<>();
headers.put("checkType", "检查类型");
headers.put("code", "方法代码");
headers.put("name", "方法名称");
headers.put("packageName", "套餐名称");
headers.put("exposureNum", "曝光次数");
headers.put("orderNum", "序号");
headers.put("remark", "备注");
// 文件名,只传文字部分
String excelName = "检查方法列表";
// 导出到Excel
ExcelFillerUtil.makeExcelFile(response, list, headers, excelName, null);
} catch (IOException | IllegalAccessException e) {
e.printStackTrace();
return R.fail("导出Excel失败" + e.getMessage());
}
return R.ok(null, "导出Excel成功");
}
}

View File

@@ -1,15 +1,21 @@
package com.openhis.web.check.appservice.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.core.common.core.domain.R;
import com.openhis.check.domain.CheckPart;
import com.openhis.check.service.ICheckPartService;
import com.openhis.web.check.appservice.ICheckPartAppService;
import com.openhis.web.check.dto.CheckPartDto;
import com.openhis.web.reportmanage.utils.ExcelFillerUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
public class CheckPartAppServiceImpl implements ICheckPartAppService {
@@ -22,17 +28,82 @@ public class CheckPartAppServiceImpl implements ICheckPartAppService {
}
@Override
public R<?> addCheckPart(CheckPartDto checkPartDto) {
return R.ok();
public R<?> searchCheckPartList(Integer pageNo, Integer pageSize, String checkType, String name, String packageName) {
LambdaQueryWrapper<CheckPart> wrapper = new LambdaQueryWrapper<>();
if (checkType != null && ObjectUtil.isNotEmpty(checkType)) {
wrapper.eq(CheckPart::getCheckType, checkType);
}
if (name != null && ObjectUtil.isNotEmpty(name)) {
wrapper.like(CheckPart::getName, name);
}
if (packageName != null && ObjectUtil.isNotEmpty(packageName)) {
wrapper.eq(CheckPart::getPackageName, packageName);
}
List<CheckPart> list = checkPartService.list(wrapper);
return R.ok(list);
}
@Override
public R<?> removeCheckPart(Long code) {
return R.ok();
public R<?> addCheckPart(CheckPart checkPart) {
//数据检验
//保存
boolean save = checkPartService.save(checkPart);
return R.ok(save);
}
@Override
public R<?> updateCheckPart(CheckPartDto checkPartDto) {
return R.ok();
public R<?> removeCheckPart(Integer checkPartId) {
boolean remove = checkPartService.removeById(checkPartId);
return R.ok(remove);
}
@Override
public R<?> updateCheckPart(CheckPart checkPart) {
boolean b = checkPartService.updateById(checkPart);
return R.ok(b);
}
@Override
public R<?> exportCheckPart(String checkType, String name, String packageName, HttpServletResponse response) {
LambdaQueryWrapper<CheckPart> wrapper = new LambdaQueryWrapper<>();
if (checkType != null && ObjectUtil.isNotEmpty(checkType)) {
wrapper.eq(CheckPart::getCheckType, checkType);
}
if (name != null && ObjectUtil.isNotEmpty(name)) {
wrapper.like(CheckPart::getName, name);
}
if (packageName != null && ObjectUtil.isNotEmpty(packageName)) {
wrapper.eq(CheckPart::getPackageName, packageName);
}
List<CheckPart> list = checkPartService.list(wrapper);
if (list.isEmpty()) {
return R.fail("导出Excel失败,无数据。");
}
try {
// 准备表头key对应实体的字段名
Map<String, String> headers = new LinkedHashMap<>();
headers.put("checkType", "检查类型");
headers.put("code", "部位代码");
headers.put("name", "部位名称");
headers.put("packageName", "套餐名称");
headers.put("exposureNum", "曝光次数");
headers.put("price", "金额");
headers.put("number", "序号");
headers.put("serviceScope", "服务范围");
headers.put("subType", "下级医技类型");
headers.put("remark", "备注");
// 文件名,只传文字部分
String excelName = "检查部位列表";
// 导出到Excel
ExcelFillerUtil.makeExcelFile(response, list, headers, excelName, null);
} catch (IOException | IllegalAccessException e) {
e.printStackTrace();
return R.fail("导出Excel失败" + e.getMessage());
}
return R.ok(null, "导出Excel成功");
}
}

View File

@@ -0,0 +1,48 @@
package com.openhis.web.check.appservice.impl;
import cn.hutool.core.util.ObjectUtil;
import com.core.common.core.domain.R;
import com.openhis.check.domain.LisGroupInfo;
import com.openhis.check.service.ILisGroupInfoService;
import com.openhis.web.check.appservice.ILisGroupInfoAppService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
@Slf4j
public class LisGroupInfoAppServiceImpl implements ILisGroupInfoAppService {
@Resource
private ILisGroupInfoService lisGroupInfoService;
@Override
public R<?> getLisGroupInfoList() {
List<LisGroupInfo> list = lisGroupInfoService.list();
return R.ok(list);
}
@Override
public R<?> add(LisGroupInfo lisGroupInfo) {
if (ObjectUtil.isEmpty(lisGroupInfo)) {
return R.fail("信息不能为空");
}
boolean save = lisGroupInfoService.save(lisGroupInfo);
return R.ok(save);
}
@Override
public R<?> update(LisGroupInfo lisGroupInfo) {
if (ObjectUtil.isEmpty(lisGroupInfo)) {
return R.fail("信息不能为空");
}
boolean update = lisGroupInfoService.updateById(lisGroupInfo);
return R.ok( update);
}
@Override
public R<?> delete(Integer lisGroupInfoId) {
boolean b = lisGroupInfoService.removeById(lisGroupInfoId);
return R.ok(b);
}
}

View File

@@ -1,12 +1,13 @@
package com.openhis.web.check.controller;
import com.core.common.core.domain.R;
import com.openhis.check.domain.CheckMethod;
import com.openhis.web.check.appservice.ICheckMethodAppService;
import com.openhis.web.check.dto.CheckMethodDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
@RestController
@@ -18,29 +19,43 @@ public class CheckMethodController {
/*
* 获取检查方法
* @Param检查方法 此处参数注释有问题,完全是按照需求给的图来注释的
* @Param 此处参数注释有问题,完全是按照需求给的图来注释的
*/
@GetMapping("/list")
public R<?> getCheckMethodList(){
return R.ok(checkMethodAppService.getCheckMethodList());
}
/*
* 条件查询检查方法
* @Para
* */
@GetMapping("/search")
public R<?> searchCheckMethodList(
@RequestParam(required = false) Integer pageNo,
@RequestParam(required = false) Integer pageSize,
@RequestParam(required = false) String checkType,
@RequestParam(required = false) String name,
@RequestParam(required = false) String packageName) {
return R.ok(checkMethodAppService.searchCheckMethodList(pageNo,pageSize,checkType,name,packageName));
}
/*
* 新增检查方法
* @Param
*/
@PostMapping("/add")
public R<?> addCheckMethod(@RequestBody CheckMethodDto checkMethodDto){
return R.ok(checkMethodAppService.addCheckMethod(checkMethodDto));
public R<?> addCheckMethod(@RequestBody CheckMethod checkMethod){
return R.ok(checkMethodAppService.addCheckMethod(checkMethod));
}
/*
* 删除检查方法
* @Param code代码
*/
@DeleteMapping("/delete/{code}")
public R<?> deleteCheckMethod(@PathVariable Long code){
return R.ok(checkMethodAppService.removeCheckMethod(code));
@DeleteMapping("/delete/{checkMethodId}")
public R<?> deleteCheckMethod(@PathVariable Integer checkMethodId){
return R.ok(checkMethodAppService.removeCheckMethod(checkMethodId));
}
/*
@@ -48,7 +63,20 @@ public class CheckMethodController {
* @Param
*/
@PutMapping("/update")
public R<?> updateCheckMethod(@RequestBody CheckMethodDto checkMethodDto){
return R.ok(checkMethodAppService.updateCheckMethod(checkMethodDto));
public R<?> updateCheckMethod(@RequestBody CheckMethod checkMethod){
return R.ok(checkMethodAppService.updateCheckMethod(checkMethod));
}
/*
* 导出检查方法列表
* @Param
*/
@GetMapping("/export")
public void exportCheckMethod(
@RequestParam(required = false) String checkType,
@RequestParam(required = false) String name,
@RequestParam(required = false) String packageName,
HttpServletResponse response) {
checkMethodAppService.exportCheckMethod(checkType, name, packageName, response);
}
}

View File

@@ -1,12 +1,13 @@
package com.openhis.web.check.controller;
import com.core.common.core.domain.R;
import com.openhis.check.domain.CheckPart;
import com.openhis.web.check.appservice.ICheckPartAppService;
import com.openhis.web.check.dto.CheckPartDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
@RestController
@Slf4j
@@ -24,22 +25,35 @@ public class CheckPartController {
return R.ok(checkPartAppService.getCheckPartList());
}
/*
* 条件搜索检查部位
* @Param
* */
@GetMapping("/search")
public R<?> searchCheckPartList(@RequestParam(required = false) Integer pageNo,
@RequestParam(required = false) Integer pageSize,
@RequestParam(required = false) String checkType,
@RequestParam(required = false) String name,
@RequestParam(required = false) String packageName){
return R.ok(checkPartAppService.searchCheckPartList(pageNo,pageSize,checkType,name,packageName));
}
/*
* 新增检查部位
* @Param
*/
@PostMapping("/add")
public R<?> addCheckPart(@RequestBody CheckPartDto checkPartDto){
return R.ok(checkPartAppService.addCheckPart(checkPartDto));
public R<?> addCheckPart(@RequestBody CheckPart checkPart){
return R.ok(checkPartAppService.addCheckPart(checkPart));
}
/*
* 删除检查部位
* @Param code代码
*/
@DeleteMapping("/delete/{code}")
public R<?> deleteCheckPart(@PathVariable Long code){
return R.ok(checkPartAppService.removeCheckPart(code));
@DeleteMapping("/delete/{checkPartId}")
public R<?> deleteCheckPart(@PathVariable Integer checkPartId){
return R.ok(checkPartAppService.removeCheckPart(checkPartId));
}
/*
@@ -47,7 +61,20 @@ public class CheckPartController {
* @Param
*/
@PutMapping("/update")
public R<?> updateCheckPart(@RequestBody CheckPartDto checkPartDto){
return R.ok(checkPartAppService.updateCheckPart(checkPartDto));
public R<?> updateCheckPart(@RequestBody CheckPart checkPart){
return R.ok(checkPartAppService.updateCheckPart(checkPart));
}
/*
* 导出检查部位列表
* @Param
*/
@GetMapping("/export")
public void exportCheckPart(
@RequestParam(required = false) String checkType,
@RequestParam(required = false) String name,
@RequestParam(required = false) String packageName,
HttpServletResponse response) {
checkPartAppService.exportCheckPart(checkType, name, packageName, response);
}
}

View File

@@ -0,0 +1,56 @@
package com.openhis.web.check.controller;
import com.core.common.core.domain.R;
import com.openhis.web.check.appservice.ILisGroupInfoAppService;
import org.springframework.web.bind.annotation.*;
import com.openhis.check.domain.LisGroupInfo;
import javax.annotation.Resource;
@RestController
@RequestMapping("/check/lisGroupInfo")
public class LisGroupInfoController {
@Resource
private ILisGroupInfoAppService lisGroupInfoAppService;
/*
*
* 获取Lis分组信息
*
* */
@GetMapping("/list")
public R<?> getLisGroupInfoList(){
return R.ok(lisGroupInfoAppService.getLisGroupInfoList());
}
/*
*
* 新增Lis分组信息
*
* */
@PostMapping("/add")
public R<?> addLisGroupInfo(@RequestBody LisGroupInfo lisGroupInfo){
return R.ok(lisGroupInfoAppService.add(lisGroupInfo));
}
/*
*
* 修改Lis分组信息
*
* */
@PutMapping("/update")
public R<?> updateLisGroupInfo(@RequestBody LisGroupInfo lisGroupInfo){
return R.ok(lisGroupInfoAppService.update(lisGroupInfo));
}
/*
*
* 删除Lis分组信息
*
* */
@DeleteMapping("/{lisGroupInfoId}")
public R<?> deleteLisGroupInfo(@PathVariable Integer lisGroupInfoId){
return R.ok(lisGroupInfoAppService.delete(lisGroupInfoId));
}
}

View File

@@ -2,10 +2,7 @@ package com.openhis.web.check.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;

View File

@@ -6,5 +6,36 @@ import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class CheckPartDto {
/** 检查部位id */
private Long id;
/** 检查部位名称 */
private String name;
/** 检查部位编码 */
private String code;
/** 检查部位检查类型 */
private String checkType;
/** 曝光次数 */
private Integer exposureNum;
/** 费用套餐 */
private String packageName;
/** 金额 */
private Double price;
/** 序号 */
private Integer number;
/** 服务范围 */
private String serviceScope;
/** 下级医技类型 */
private String subType;
/** 备注 */
private String remark;
}

View File

@@ -0,0 +1,7 @@
package com.openhis.web.check.mapper;
import org.springframework.stereotype.Repository;
@Repository
public interface LisGroupInfoAppMapper {
}

View File

@@ -0,0 +1,190 @@
package com.openhis.web.lab.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.core.common.core.controller.BaseController;
import com.core.common.core.domain.AjaxResult;
import com.openhis.lab.domain.InspectionType;
import com.openhis.lab.service.IInspectionTypeService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.support.TransactionTemplate;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 检验类型管理Controller
*
* @author system
* @date 2025-12-09
*/
@RestController
@RequestMapping("/system/inspection-type")
@Slf4j
@AllArgsConstructor
public class InspectionTypeController extends BaseController {
// 辅助方法:将字节数组转换为十六进制字符串
private static String bytesToHex(byte[] bytes) {
StringBuilder sb = new StringBuilder();
for (byte b : bytes) {
sb.append(String.format("%02X ", b));
}
return sb.toString().trim();
}
private final IInspectionTypeService inspectionTypeService;
private final TransactionTemplate transactionTemplate;
/**
* 获取检验类型列表
*/
@GetMapping("/list")
public AjaxResult list(InspectionType inspectionType) {
// 使用Wrapper构建查询条件确保order字段被正确处理
QueryWrapper<InspectionType> queryWrapper = new QueryWrapper<>(inspectionType);
List<InspectionType> list = inspectionTypeService.list(queryWrapper);
return AjaxResult.success(list);
}
/**
* 获取检验类型详细
*/
@GetMapping("/{inspectionTypeId}")
public AjaxResult getInfo(@PathVariable Long inspectionTypeId) {
return AjaxResult.success(inspectionTypeService.getById(inspectionTypeId));
}
/**
* 新增检验类型
*/
@PostMapping
public AjaxResult add(@RequestBody InspectionType inspectionType) {
// 确保新增时ID为null强制使用数据库自增序列
inspectionType.setId(null);
// 去除code字段的前后空格确保唯一性验证准确
if (inspectionType.getCode() != null) {
inspectionType.setCode(inspectionType.getCode().trim());
}
// 验证code字段是否唯一
QueryWrapper<InspectionType> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("code", inspectionType.getCode());
// 输出调试信息
System.out.println("检查编码唯一性code=" + inspectionType.getCode() + ", 长度=" + inspectionType.getCode().length());
System.out.println("code的十六进制表示" + bytesToHex(inspectionType.getCode().getBytes()));
// 直接查询具体记录,而不仅仅是计数
List<InspectionType> existingRecords = inspectionTypeService.list(queryWrapper);
System.out.println("数据库中存在的记录数:" + existingRecords.size());
for (InspectionType record : existingRecords) {
System.out.println("已存在记录id=" + record.getId() + ", code=" + record.getCode() + ", code长度=" + record.getCode().length() + ", code十六进制=" + bytesToHex(record.getCode().getBytes()));
}
if (!existingRecords.isEmpty()) {
return AjaxResult.error("检验类型编码已存在");
}
// 保存前再次验证
System.out.println("准备保存数据:" + inspectionType);
try {
// 使用事务确保一致性
return transactionTemplate.execute(status -> {
// 再次检查,防止并发问题
QueryWrapper<InspectionType> checkWrapper = new QueryWrapper<>();
checkWrapper.eq("code", inspectionType.getCode());
List<InspectionType> finalCheck = inspectionTypeService.list(checkWrapper);
if (!finalCheck.isEmpty()) {
return AjaxResult.error("检验类型编码已存在");
}
boolean result = inspectionTypeService.save(inspectionType);
System.out.println("保存结果:" + result);
return toAjax(result);
});
} catch (Exception e) {
System.out.println("保存失败,错误信息:" + e.getMessage());
// 捕获唯一性约束冲突异常
if (e.getMessage().contains("uk_inspection_type_code") ||
e.getMessage().contains("duplicate key value") ||
e.getMessage().contains("检验类型编码已存在")) {
return AjaxResult.error("检验类型编码已存在");
}
return AjaxResult.error("保存失败:" + e.getMessage());
}
}
/**
* 修改检验类型
*/
@PutMapping
public AjaxResult edit(@RequestBody InspectionType inspectionType) {
// 去除code字段的前后空格确保唯一性验证准确
if (inspectionType.getCode() != null) {
inspectionType.setCode(inspectionType.getCode().trim());
}
// 验证code字段是否唯一排除自身
QueryWrapper<InspectionType> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("code", inspectionType.getCode())
.ne("id", inspectionType.getId());
if (inspectionTypeService.count(queryWrapper) > 0) {
return AjaxResult.error("检验类型编码已存在");
}
try {
boolean result = inspectionTypeService.updateById(inspectionType);
return toAjax(result);
} catch (Exception e) {
// 捕获唯一性约束冲突异常
if (e.getMessage().contains("uk_inspection_type_code") ||
e.getMessage().contains("duplicate key value") ||
e.getMessage().contains("检验类型编码已存在")) {
return AjaxResult.error("检验类型编码已存在");
}
return AjaxResult.error("更新失败:" + e.getMessage());
}
}
/**
* 删除检验类型
*/
@DeleteMapping("/{inspectionTypeId}")
public AjaxResult remove(@PathVariable Long inspectionTypeId) {
log.info("删除检验类型ID: {}", inspectionTypeId);
try {
// 检查记录是否存在
InspectionType existing = inspectionTypeService.getById(inspectionTypeId);
log.info("删除前检查记录是否存在: {}", existing != null);
if (existing == null) {
log.warn("删除失败检验类型ID: {} 不存在", inspectionTypeId);
return AjaxResult.error("删除失败: 记录不存在");
}
// 使用MyBatis Plus的removeById方法执行逻辑删除
boolean result = inspectionTypeService.removeById(inspectionTypeId);
log.info("逻辑删除检验类型结果: {}", result);
AjaxResult response = toAjax(result);
log.info("删除响应: {}", response);
return response;
} catch (Exception e) {
log.error("删除检验类型失败ID: {}, 错误: {}", inspectionTypeId, e.getMessage(), e);
return AjaxResult.error("删除失败: " + e.getMessage());
}
}
// 测试删除接口,直接返回成功
@DeleteMapping("/test-delete/{id}")
public AjaxResult testDelete(@PathVariable Long id) {
log.info("测试删除接口ID: {}", id);
return AjaxResult.success("测试删除成功");
}
}

View File

@@ -6,7 +6,7 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:postgresql://192.168.110.252:15432/postgresql?currentSchema=public&characterEncoding=UTF-8&client_encoding=UTF-8
url: jdbc:postgresql://192.168.110.252:15432/postgresql?currentSchema=hisdev&characterEncoding=UTF-8&client_encoding=UTF-8
username: postgresql
password: Jchl1528
# 从库数据源
@@ -59,6 +59,8 @@ spring:
wall:
config:
multi-statement-allow: true
# redis 配置
redis:
# 地址
@@ -84,4 +86,10 @@ spring:
# 文言
messages:
basename: i18n/general_message/messages
encoding: utf-8
encoding: utf-8
server:
# 服务器的HTTP端口默认为18080
port: 18080
servlet:
# 应用的访问路径
context-path: /openhis

View File

@@ -6,7 +6,7 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:postgresql://192.168.110.252:15432/postgresql?currentSchema=public&characterEncoding=UTF-8&client_encoding=UTF-8
url: jdbc:postgresql://192.168.110.252:15432/postgresql?currentSchema=hisprd&characterEncoding=UTF-8&client_encoding=UTF-8
username: postgresql
password: Jchl1528
# 从库数据源
@@ -84,4 +84,10 @@ spring:
# 文言
messages:
basename: i18n/general_message/messages
encoding: utf-8
encoding: utf-8
server:
# 服务器的HTTP端口默认为18080
port: 18082
servlet:
# 应用的访问路径
context-path: /openhis

View File

@@ -0,0 +1,93 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: org.postgresql.Driver
druid:
# 主库数据源
master:
url: jdbc:postgresql://192.168.110.252:15432/postgresql?currentSchema=histest&characterEncoding=UTF-8&client_encoding=UTF-8
username: postgresql
password: Jchl1528
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled:
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置连接超时时间
connectTimeout: 30000
# 配置网络超时时间
socketTimeout: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 # FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: openhis
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# redis 配置
redis:
# 地址
host: 192.168.110.252
# 端口默认为6379
port: 6379
# 数据库索引
database: 1
# 密码
password: Jchl1528
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
# 文言
messages:
basename: i18n/general_message/messages
encoding: utf-8
server:
# 服务器的HTTP端口默认为18080
port: 18081
servlet:
# 应用的访问路径
context-path: /openhis

View File

@@ -15,11 +15,6 @@ core:
# 开发环境配置
server:
# 服务器的HTTP端口默认为18080
port: 18080
servlet:
# 应用的访问路径
context-path: /openhis
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
@@ -54,7 +49,7 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: local #本地local 生产prod (农大)
active: dev
# 文件上传
servlet:
multipart:
@@ -85,6 +80,11 @@ mybatis-plus:
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
global-config:
db-config:
logic-delete-field: validFlag # 全局逻辑删除的实体字段名
logic-delete-value: 0 # 逻辑已删除值(默认为 1)
logic-not-delete-value: 1 # 逻辑未删除值(默认为 0)
# PageHelper分页插件
pagehelper:

View File

@@ -77,4 +77,16 @@ public class Organization extends HisBaseEntity {
/** 默认挂号医生 */
private Long defDoctorId;
/** 挂号科室标记 */
private Integer registerFlag;
/** 科室位置 */
private String location;
/** 科室简介 */
private String intro;
/** 备注 */
private String remark;
}

View File

@@ -0,0 +1,56 @@
package com.openhis.administration.domain;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.core.common.core.domain.HisBaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 门诊号码段管理Entity实体
*
* @author system
* @date 2025-01-XX
*/
@Data
@TableName("adm_outpatient_no_segment")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class OutpatientNoSegment extends HisBaseEntity {
/** ID */
@TableId(type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** 操作员ID */
private Long operatorId;
/** 操作员姓名 */
private String operatorName;
/** 员工工号 */
private String staffNo;
/** 领用日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date receiveDate;
/** 起始号码 */
private String startNo;
/** 终止号码 */
private String endNo;
/** 使用号码 */
private String usedNo;
}

View File

@@ -0,0 +1,18 @@
package com.openhis.administration.mapper;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.openhis.administration.domain.OutpatientNoSegment;
/**
* 门诊号码段管理Mapper接口
*
* @author system
* @date 2025-01-XX
*/
@Repository
public interface OutpatientNoSegmentMapper extends BaseMapper<OutpatientNoSegment> {
}

View File

@@ -0,0 +1,66 @@
package com.openhis.administration.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.openhis.administration.domain.OutpatientNoSegment;
/**
* 门诊号码段管理Service接口
*
* @author system
* @date 2025-01-XX
*/
public interface IOutpatientNoSegmentService {
/**
* 分页查询门诊号码段列表
*
* @param page 分页对象
* @param onlySelf 是否只查询自己的true=只查询自己的false=查询所有)
* @param userId 用户ID
* @return 分页结果
*/
Page<OutpatientNoSegment> selectOutpatientNoSegmentPage(Page<OutpatientNoSegment> page, boolean onlySelf, Long userId);
/**
* 新增门诊号码段
*
* @param outpatientNoSegment 门诊号码段信息
* @return 结果
*/
int insertOutpatientNoSegment(OutpatientNoSegment outpatientNoSegment);
/**
* 修改门诊号码段
*
* @param outpatientNoSegment 门诊号码段信息
* @return 结果
*/
int updateOutpatientNoSegment(OutpatientNoSegment outpatientNoSegment);
/**
* 删除门诊号码段
*
* @param ids 门诊号码段ID列表
* @return 结果
*/
int deleteOutpatientNoSegmentByIds(Long[] ids);
/**
* 根据ID查询门诊号码段
*
* @param id 门诊号码段ID
* @return 门诊号码段信息
*/
OutpatientNoSegment getById(Long id);
/**
* 检查号码段是否重复(全系统范围)
*
* @param startNo 起始号码
* @param endNo 终止号码
* @param excludeId 排除的ID用于更新时排除自身
* @return true=重复false=不重复
*/
boolean checkNumberSegmentOverlap(String startNo, String endNo, Long excludeId);
}

View File

@@ -0,0 +1,241 @@
package com.openhis.administration.service.impl;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.openhis.administration.domain.OutpatientNoSegment;
import com.openhis.administration.mapper.OutpatientNoSegmentMapper;
import com.openhis.administration.service.IOutpatientNoSegmentService;
/**
* 门诊号码段管理Service实现
*
* @author system
* @date 2025-01-XX
*/
@Service
public class OutpatientNoSegmentServiceImpl implements IOutpatientNoSegmentService {
@Autowired
private OutpatientNoSegmentMapper outpatientNoSegmentMapper;
/**
* 分页查询门诊号码段列表
*/
@Override
public Page<OutpatientNoSegment> selectOutpatientNoSegmentPage(Page<OutpatientNoSegment> page, boolean onlySelf, Long userId) {
LambdaQueryWrapper<OutpatientNoSegment> queryWrapper = new LambdaQueryWrapper<>();
// 如果不是管理员,只查询自己的号码段
if (onlySelf && userId != null) {
queryWrapper.eq(OutpatientNoSegment::getOperatorId, userId);
}
// 按创建时间正序排列(新记录排在后面)
queryWrapper.orderByAsc(OutpatientNoSegment::getCreateTime);
return outpatientNoSegmentMapper.selectPage(page, queryWrapper);
}
/**
* 新增门诊号码段
*/
@Override
public int insertOutpatientNoSegment(OutpatientNoSegment outpatientNoSegment) {
return outpatientNoSegmentMapper.insert(outpatientNoSegment);
}
/**
* 修改门诊号码段
*/
@Override
public int updateOutpatientNoSegment(OutpatientNoSegment outpatientNoSegment) {
return outpatientNoSegmentMapper.updateById(outpatientNoSegment);
}
/**
* 删除门诊号码段
*/
@Override
public int deleteOutpatientNoSegmentByIds(Long[] ids) {
if (ids == null || ids.length == 0) {
return 0;
}
return outpatientNoSegmentMapper.deleteBatchIds(java.util.Arrays.asList(ids));
}
/**
* 根据ID查询门诊号码段
* 注意:由于 @TableLogic 注解selectById 会自动过滤已删除的记录delete_flag = '1'
* 这意味着如果记录已经被软删除,此方法会返回 null
*/
@Override
public OutpatientNoSegment getById(Long id) {
System.out.println("=== 查询门诊号码段开始 ===");
System.out.println("查询ID: " + id);
System.out.println("ID类型: " + (id != null ? id.getClass().getName() : "null"));
System.out.println("ID值字符串: " + String.valueOf(id));
// 使用 selectById 查询(会自动过滤 delete_flag = '1' 的记录)
OutpatientNoSegment segment = outpatientNoSegmentMapper.selectById(id);
if (segment != null) {
System.out.println("查询成功 - 找到记录:");
System.out.println(" - 记录ID: " + segment.getId());
System.out.println(" - 操作员ID: " + segment.getOperatorId());
System.out.println(" - 起始号码: " + segment.getStartNo());
System.out.println(" - 终止号码: " + segment.getEndNo());
System.out.println(" - 使用号码: " + segment.getUsedNo());
} else {
System.out.println("查询失败 - 未找到记录");
System.out.println("可能原因:");
System.out.println(" 1. 记录不存在");
System.out.println(" 2. 记录已被软删除delete_flag = '1'");
System.out.println(" 3. ID 不匹配");
// 尝试直接查询数据库(包括已删除的记录)来验证记录是否存在
try {
LambdaQueryWrapper<OutpatientNoSegment> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OutpatientNoSegment::getId, id);
// 注意:这里仍然会受到 @TableLogic 的影响,无法查询已删除的记录
// 如果需要查询已删除的记录,需要使用原生 SQL 或禁用逻辑删除
OutpatientNoSegment segmentWithDeleted = outpatientNoSegmentMapper.selectOne(queryWrapper);
if (segmentWithDeleted != null) {
System.out.println("使用 LambdaQueryWrapper 查询结果: 找到记录ID=" + segmentWithDeleted.getId());
} else {
System.out.println("使用 LambdaQueryWrapper 查询结果: 未找到记录");
}
} catch (Exception e) {
System.out.println("使用 LambdaQueryWrapper 查询时出错: " + e.getMessage());
}
// 尝试查询所有记录(不限制 delete_flag来验证 ID 是否存在
// 注意:由于 @TableLogic无法直接查询已删除的记录
// 但我们可以查询所有未删除的记录,看看是否有类似的 ID
try {
LambdaQueryWrapper<OutpatientNoSegment> allQuery = new LambdaQueryWrapper<>();
// 查询所有未删除的记录
List<OutpatientNoSegment> allSegments = outpatientNoSegmentMapper.selectList(allQuery);
System.out.println("数据库中所有未删除的记录数: " + allSegments.size());
System.out.println("所有记录的 ID 列表:");
for (OutpatientNoSegment seg : allSegments) {
System.out.println(" - ID: " + seg.getId() + " (类型: " + seg.getId().getClass().getName() + ")");
// 检查是否有接近的 ID可能是精度问题
if (seg.getId() != null) {
String segIdStr = String.valueOf(seg.getId());
String searchIdStr = String.valueOf(id);
if (segIdStr.length() == searchIdStr.length() &&
segIdStr.substring(0, Math.min(10, segIdStr.length())).equals(
searchIdStr.substring(0, Math.min(10, searchIdStr.length())))) {
System.out.println(" 警告:发现相似的 ID");
}
}
}
} catch (Exception e) {
System.out.println("查询所有记录时出错: " + e.getMessage());
}
}
System.out.println("=== 查询门诊号码段结束 ===");
return segment;
}
/**
* 检查号码段是否重复(全系统范围)
* 规则:从末位往前找到第一个字母作为前缀,比较前缀和数字范围
*/
@Override
public boolean checkNumberSegmentOverlap(String startNo, String endNo, Long excludeId) {
if (startNo == null || endNo == null) {
return false;
}
// 提取前缀(从末位往前找到第一个字母)
String prefix1 = extractPrefix(startNo);
String prefix2 = extractPrefix(endNo);
// 前缀必须一致
if (!prefix1.equals(prefix2)) {
return false;
}
// 提取尾部数字
Long num1 = extractTailNumber(startNo);
Long num2 = extractTailNumber(endNo);
if (num1 == null || num2 == null || num1 > num2) {
return false;
}
// 查询所有相同前缀的号码段
LambdaQueryWrapper<OutpatientNoSegment> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.likeRight(OutpatientNoSegment::getStartNo, prefix1);
if (excludeId != null) {
queryWrapper.ne(OutpatientNoSegment::getId, excludeId);
}
List<OutpatientNoSegment> segments = outpatientNoSegmentMapper.selectList(queryWrapper);
// 检查是否有重叠
for (OutpatientNoSegment segment : segments) {
String otherPrefix = extractPrefix(segment.getStartNo());
if (!prefix1.equals(otherPrefix)) {
continue;
}
Long otherNum1 = extractTailNumber(segment.getStartNo());
Long otherNum2 = extractTailNumber(segment.getEndNo());
if (otherNum1 != null && otherNum2 != null) {
// 检查范围是否重叠
if (Math.max(num1, otherNum1) <= Math.min(num2, otherNum2)) {
return true;
}
}
}
return false;
}
/**
* 从末位往前找到第一个字母,返回前缀(包含该字母)
*/
private String extractPrefix(String value) {
if (value == null || value.isEmpty()) {
return "";
}
char[] chars = value.toCharArray();
for (int i = chars.length - 1; i >= 0; i--) {
if (Character.isLetter(chars[i])) {
return value.substring(0, i + 1);
}
}
return "";
}
/**
* 提取尾部数字
*/
private Long extractTailNumber(String value) {
if (value == null || value.isEmpty()) {
return null;
}
Pattern pattern = Pattern.compile("(\\d+)$");
Matcher matcher = pattern.matcher(value);
if (matcher.find()) {
try {
return Long.parseLong(matcher.group(1));
} catch (NumberFormatException e) {
return null;
}
}
return null;
}
}

View File

@@ -3,7 +3,6 @@ package com.openhis.check.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.experimental.Accessors;
@@ -26,7 +25,7 @@ public class CheckMethod {
* 检查方法ID
*/
@TableId(type = IdType.AUTO)
private Long id;
private Integer id;
/* 检查类型 */
private String checkType;

View File

@@ -3,7 +3,6 @@ package com.openhis.check.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.experimental.Accessors;
@@ -24,7 +23,7 @@ public class CheckPart {
/** 检查部位ID */
@TableId(type = IdType.AUTO)
private Long id;
private Integer id;
/** 检查部位名称 */
private String name;

View File

@@ -0,0 +1,40 @@
package com.openhis.check.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Data
@Accessors(chain = true)
@TableName(value = "lis_group_info",autoResultMap = true)
public class LisGroupInfo {
/** id */
@TableId(type = IdType.AUTO)
private Integer id;
/** 卫生机构 */
private String hospital;
/** 创建日期 */
private LocalDate date;
/** LIS分组名称 */
private String groupName;
/** 采血管类型 */
private String tube;
/** 备注 */
private String remark;
/** 创建时间 */
private LocalDateTime createTime;
/** 更新时间 */
private LocalDateTime updateTime;
}

View File

@@ -0,0 +1,9 @@
package com.openhis.check.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.openhis.check.domain.LisGroupInfo;
import org.springframework.stereotype.Repository;
@Repository
public interface LisGroupInfoMapper extends BaseMapper<LisGroupInfo> {
}

View File

@@ -0,0 +1,6 @@
package com.openhis.check.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.openhis.check.domain.LisGroupInfo;
public interface ILisGroupInfoService extends IService<LisGroupInfo>{
}

View File

@@ -0,0 +1,12 @@
package com.openhis.check.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.openhis.check.mapper.LisGroupInfoMapper;
import com.openhis.check.domain.LisGroupInfo;
import com.openhis.check.service.ILisGroupInfoService;
import org.springframework.stereotype.Service;
@Service
public class LisGroupInfoServiceImpl extends ServiceImpl<LisGroupInfoMapper,LisGroupInfo> implements ILisGroupInfoService{
}

View File

@@ -0,0 +1,72 @@
package com.openhis.lab.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
/**
* 检验类型
*
* @author system
* @date 2025-12-09
*/
@Data
@Accessors(chain = true)
@TableName(value = "inspection_type", autoResultMap = true)
public class InspectionType {
private static final long serialVersionUID = 1L;
/** 主键ID */
@TableId(type = IdType.AUTO)
private Long id;
/** 检验类型编码 */
private String code;
/** 检验类型名称 */
private String name;
/** 所属科室 */
private String department;
/** 排序 */
@TableField("\"order\"")
private Integer sortOrder;
/** 备注 */
private String remark;
/** 有效标志1有效0无效 */
@TableField("valid_flag")
@TableLogic(value = "1", delval = "0")
private Integer validFlag;
/** 创建时间 */
@TableField("created_at")
private LocalDateTime createdAt;
/** 更新时间 */
@TableField("updated_at")
private LocalDateTime updatedAt;
/** 版本号 */
private Integer version;
/**
* 以下字段数据库表中不存在用于禁用MyBatis Plus自动添加的字段
*/
@TableField(exist = false)
private String createBy;
@TableField(exist = false)
private String updateBy;
@TableField(exist = false)
private Integer tenantId;
}

View File

@@ -0,0 +1,16 @@
package com.openhis.lab.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.openhis.lab.domain.InspectionType;
import org.springframework.stereotype.Repository;
/**
* 检验类型Mapper接口
*
* @author system
* @date 2025-12-09
*/
@Repository
public interface InspectionTypeMapper extends BaseMapper<InspectionType> {
}

View File

@@ -0,0 +1,14 @@
package com.openhis.lab.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.openhis.lab.domain.InspectionType;
/**
* 检验类型Service接口
*
* @author system
* @date 2025-12-09
*/
public interface IInspectionTypeService extends IService<InspectionType> {
}

View File

@@ -0,0 +1,18 @@
package com.openhis.lab.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.openhis.lab.domain.InspectionType;
import com.openhis.lab.mapper.InspectionTypeMapper;
import com.openhis.lab.service.IInspectionTypeService;
import org.springframework.stereotype.Service;
/**
* 检验类型Service实现类
*
* @author system
* @date 2025-12-09
*/
@Service
public class InspectionTypeServiceImpl extends ServiceImpl<InspectionTypeMapper, InspectionType> implements IInspectionTypeService {
}

View File

@@ -3,5 +3,15 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.OrganizationMapper">
<!-- 自定义selectById方法确保包含所有字段包括新增字段 -->
<select id="selectById" parameterType="java.lang.Long" resultType="com.openhis.administration.domain.Organization">
SELECT id, bus_no, name, active_flag, type_enum, class_enum, py_str, wb_str,
yb_no, yb_name, caty, display_order, medins_id, medins_admdvs,
medins_type, medins_lv, def_doctor_id, create_by, create_time,
update_by, update_time, tenant_id, delete_flag,
register_flag, location, intro, remark
FROM adm_organization
WHERE id = #{id} AND delete_flag = '0'
</select>
</mapper>

View File

@@ -2,7 +2,10 @@
VITE_APP_TITLE = 医院信息管理系统
# 开发环境配置
VITE_APP_ENV = 'development'
VITE_APP_ENV = 'dev'
# OpenHIS管理系统/开发环境
VITE_APP_BASE_API = '/dev-api'
# 租户ID配置
VITE_APP_TENANT_ID = '1'

View File

@@ -2,10 +2,13 @@
VITE_APP_TITLE=医院信息管理系统
# 生产环境配置
VITE_APP_ENV=production
VITE_APP_ENV= 'prod'
# OpenHIS管理系统/生产环境
VITE_APP_BASE_API=/prod-api
VITE_APP_BASE_API= '/prd-api'
# 租户ID配置
VITE_APP_TENANT_ID= '1'
# 是否在打包时开启压缩,支持 gzip 和 brotli
VITE_BUILD_COMPRESS=gzip
VITE_BUILD_COMPRESS = gzip

View File

@@ -13,6 +13,9 @@ VITE_UPLOAD_TYPE=server
# OpenHIS管理系统/SPUG环境
VITE_APP_BASE_API = '/admin-api'
# 租户ID配置
VITE_APP_TENANT_ID=1
# 是否删除debugger
VITE_DROP_DEBUGGER=false

View File

@@ -7,5 +7,8 @@ VITE_APP_ENV = 'staging'
# OpenHIS管理系统/生产环境
VITE_APP_BASE_API = '/stage-api'
# 租户ID配置
VITE_APP_TENANT_ID=1
# 是否在打包时开启压缩,支持 gzip 和 brotli
VITE_BUILD_COMPRESS = gzip

12
openhis-ui-vue3/.env.test Normal file
View File

@@ -0,0 +1,12 @@
# 页面标题
VITE_APP_TITLE = 医院信息管理系统
# 测试环境配置
VITE_APP_ENV = 'test'
# OpenHIS管理系统/测试环境
VITE_APP_BASE_API = '/test-api'
# 租户ID配置
VITE_APP_TENANT_ID = '1'

View File

@@ -1,4 +1,4 @@
/*
/*
* @Author: yangbo@bjgoodwill.com
* @Date: 2024-10-14 09:52:54
* @Description:

View File

@@ -44,7 +44,7 @@
"sass": "1.69.5",
"unplugin-auto-import": "0.17.1",
"unplugin-vue-setup-extend-plus": "1.0.0",
"vite": "5.0.4",
"vite": "^5.0.4",
"vite-plugin-compression": "0.5.1",
"vite-plugin-svg-icons": "2.0.1"
}
@@ -7020,7 +7020,7 @@
},
"node_modules/vite": {
"version": "5.0.4",
"resolved": "https://registry.npmmirror.com/vite/-/vite-5.0.4.tgz",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.0.4.tgz",
"integrity": "sha512-RzAr8LSvM8lmhB4tQ5OPcBhpjOZRZjuxv9zO5UcxeoY2bd3kP3Ticd40Qma9/BqZ8JS96Ll/jeBX9u+LJZrhVg==",
"dev": true,
"dependencies": {
@@ -12419,7 +12419,7 @@
},
"vite": {
"version": "5.0.4",
"resolved": "https://registry.npmmirror.com/vite/-/vite-5.0.4.tgz",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.0.4.tgz",
"integrity": "sha512-RzAr8LSvM8lmhB4tQ5OPcBhpjOZRZjuxv9zO5UcxeoY2bd3kP3Ticd40Qma9/BqZ8JS96Ll/jeBX9u+LJZrhVg==",
"dev": true,
"requires": {

View File

@@ -6,9 +6,11 @@
"license": "MIT",
"type": "module",
"scripts": {
"dev": "vite",
"build:prod": "vite build --mode production",
"dev": "vite --mode dev",
"build:prod": "vite build --mode prod",
"build:stage": "vite build --mode staging",
"build:test": "vite build --mode test",
"build:dev": "vite build --mode dev",
"preview": "vite preview",
"build:spug": "vite build --mode spug"
},
@@ -52,7 +54,7 @@
"sass": "1.69.5",
"unplugin-auto-import": "0.17.1",
"unplugin-vue-setup-extend-plus": "1.0.0",
"vite": "5.0.4",
"vite": "^5.0.4",
"vite-plugin-compression": "0.5.1",
"vite-plugin-svg-icons": "2.0.1"
}

View File

@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询检验类型列表
export function listInspectionType(query) {
return request({
url: '/system/inspection-type/list',
method: 'get',
params: query
})
}
// 查询检验类型详细
export function getInspectionType(inspectionTypeId) {
return request({
url: `/system/inspection-type/${inspectionTypeId}`,
method: 'get'
})
}
// 新增检验类型
export function addInspectionType(data) {
return request({
url: '/system/inspection-type',
method: 'post',
data: data
})
}
// 修改检验类型
export function updateInspectionType(data) {
return request({
url: '/system/inspection-type',
method: 'put',
data: data
})
}
// 删除检验类型
export function delInspectionType(inspectionTypeId) {
return request({
url: `/system/inspection-type/${inspectionTypeId}`,
method: 'delete'
})
}

View File

@@ -46,21 +46,112 @@ export function delCheckType(checkTypeId) {
// 查询检查方法列表
export function listCheckMethod(query) {
return request({
url: '/system/check-method/list',
url: '/check/method/list',
method: 'get',
params: query
})
}
// 搜索检查方法列表
export function searchCheckMethod(query) {
return request({
url: '/check/method/search',
method: 'get',
params: query
})
}
// 新增检查方法
export function addCheckMethod(data) {
return request({
url: '/check/method/add',
method: 'post',
data: data
})
}
// 修改检查方法
export function updateCheckMethod(data) {
return request({
url: '/check/method/update',
method: 'put',
data: data
})
}
// 删除检查方法
export function delCheckMethod(checkMethodId) {
return request({
url: '/check/method/delete/' + checkMethodId,
method: 'delete'
})
}
// 导出检查方法
export function exportCheckMethod(query) {
return request({
url: '/check/method/export',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 导出检查部位
export function exportCheckPart(query) {
return request({
url: '/check/part/export',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 查询检查部位列表
export function listCheckPart(query) {
return request({
url: '/system/check-part/list',
url: '/check/part/list',
method: 'get',
params: query
})
}
// 搜索检查部位列表
export function searchCheckPart(query) {
return request({
url: '/check/part/search',
method: 'get',
params: query
})
}
// 新增检查部位
export function addCheckPart(data) {
return request({
url: '/check/part/add',
method: 'post',
data: data
})
}
// 删除检查部位
export function delCheckPart(checkPartId) {
return request({
url: '/check/part/delete/' + checkPartId,
method: 'delete'
})
}
// 更新检查部位
export function updateCheckPart(data) {
return request({
url: '/check/part/update',
method: 'put',
data: data
})
}
// 查询检查套餐列表
export function listCheckPackage(query) {
return request({
@@ -102,4 +193,47 @@ export function delCheckPackage(id) {
url: `/system/check-package/${id}`,
method: 'delete'
})
}
// 查询LIS分组列表
export function listLisGroup(query) {
return request({
url: '/check/lisGroupInfo/list',
method: 'get',
params: query
})
}
// 根据ID查询LIS分组详情
export function getLisGroup(id) {
return request({
url: `/check/lisGroupInfo/${id}`,
method: 'get'
})
}
// 新增LIS分组
export function addLisGroup(data) {
return request({
url: '/check/lisGroupInfo/add',
method: 'post',
data: data
})
}
// 修改LIS分组
export function updateLisGroup(data) {
return request({
url: '/check/lisGroupInfo/update',
method: 'put',
data: data
})
}
// 删除LIS分组
export function delLisGroup(id) {
return request({
url: `/check/lisGroupInfo/${id}`,
method: 'delete'
})
}

View File

@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询检验类型列表
export function listInspectionType(query) {
return request({
url: '/system/inspection-type/list',
method: 'get',
params: query
})
}
// 查询检验类型详细
export function getInspectionType(inspectionTypeId) {
return request({
url: '/system/inspection-type/' + inspectionTypeId,
method: 'get'
})
}
// 新增检验类型
export function addInspectionType(data) {
return request({
url: '/system/inspection-type',
method: 'post',
data: data
})
}
// 修改检验类型
export function updateInspectionType(data) {
return request({
url: '/system/inspection-type',
method: 'put',
data: data
})
}
// 删除检验类型
export function delInspectionType(inspectionTypeId) {
return request({
url: '/system/inspection-type/' + inspectionTypeId,
method: 'delete'
})
}

View File

@@ -47,11 +47,6 @@ export const constantRoutes = [
component: () => import('@/views/register'),
hidden: true
},
{
path: "/:pathMatch(.*)*",
component: () => import('@/views/error/404'),
hidden: true
},
{
path: '/401',
component: () => import('@/views/error/401'),
@@ -83,6 +78,20 @@ export const constantRoutes = [
meta: { title: '个人中心', icon: 'user' }
}
]
},
// 添加套餐管理相关路由到公共路由,确保始终可用
{
path: '/maintainSystem/Inspection/PackageManagement',
component: Layout,
hidden: true,
children: [
{
path: '',
component: () => import('@/views/maintainSystem/Inspection/PackageManagement.vue'),
name: 'DirectPackageManagement',
meta: { title: '套餐管理' }
}
]
}
]
@@ -134,6 +143,20 @@ export const constantRoutes = [
component: () => import('@/views/maintainSystem/chargeConfig/index.vue'),
name: 'ChargeConfig',
meta: { title: '挂号收费系统参数维护', icon: 'config', permissions: ['maintainSystem:chargeConfig:list'] }
},
{
path: 'Inspection',
component: () => import('@/views/maintainSystem/Inspection/index.vue'),
name: 'Inspection',
meta: { title: '检验管理', icon: 'inspection' },
children: [
{
path: 'PackageManagement',
component: () => import('@/views/maintainSystem/Inspection/PackageManagement.vue'),
name: 'PackageManagement',
meta: { title: '套餐管理' }
}
]
}
]
},
@@ -345,6 +368,13 @@ export const constantRoutes = [
// 合并常量路由和动态路由,确保所有路由都能被访问
const allRoutes = [...constantRoutes, ...dynamicRoutes];
// 添加404路由到所有路由的最后
allRoutes.push({
path: "/:pathMatch(.*)*",
component: () => import('@/views/error/404'),
hidden: true
});
const router = createRouter({
history: createWebHistory(),
routes: allRoutes,

View File

@@ -123,6 +123,9 @@ export function filterDynamicRoutes(routes) {
if (auth.hasRoleOr(route.roles)) {
res.push(route)
}
} else {
// 如果没有权限设置,默认允许访问
res.push(route)
}
})
return res

View File

@@ -18,7 +18,8 @@ const useUserStore = defineStore(
fixmedinsCode: '', // 医疗机构编码
roles: [],
permissions: [],
tenantId: ''
tenantId: '',
status: '' // 用户状态0-启用(管理员), 1-禁用(普通人员)
}),
actions: {
// 登录
@@ -60,6 +61,7 @@ const useUserStore = defineStore(
this.practitionerId = res.practitionerId
this.fixmedinsCode = res.optionJson.fixmedinsCode
this.avatar = avatar
this.status = user.status // 保存用户状态
resolve(res)
}).catch(error => {
reject(error)

View File

@@ -12,7 +12,8 @@ let downloadLoadingInstance;
export let isRelogin = { show: false };
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
axios.defaults.headers['X-Tenant-ID'] = '1'
// 从环境变量读取租户ID如果没有则使用默认值'1'
axios.defaults.headers['X-Tenant-ID'] = import.meta.env.VITE_APP_TENANT_ID || '1'
axios.defaults.headers['Request-Method-Name'] = 'login'
// 创建axios实例
const service = axios.create({

View File

@@ -180,7 +180,7 @@ export default {
name: '',
nickName: '',
employeeId: '',
role: '' // operator: 普通操作员, admin: 管理员
status: '' // 0: 启用(管理员), 1: 禁用(普通人员)
},
// 用户列表用于操作员下拉选择将在created中从后端获取
userList: [],
@@ -197,7 +197,8 @@ export default {
computed: {
// 计算属性:判断是否为管理员
isAdmin() {
return this.currentUser.role === 'admin';
// 管理员是指在用户管理界面中状态为启用的用户
return this.currentUser.status === '0';
}
},
created() {
@@ -209,7 +210,7 @@ export default {
name: userStore.nickName || userStore.name,
nickName: userStore.nickName,
employeeId: userStore.id || userStore.practitionerId,
role: userStore.roles && userStore.roles.length > 0 ? userStore.roles[0] : 'operator'
status: userStore.status || '' // 0: 启用(管理员), 1: 禁用(普通人员)
};
console.log('当前登录用户信息:', this.currentUser);
@@ -248,7 +249,7 @@ export default {
this.userList = res.data.records.map(user => ({
name: user.nickName || user.username || user.name, // 尝试多种可能的名称字段
employeeId: user.userId, // 使用用户ID作为员工工号
role: user.role || 'operator' // 默认为普通操作员
status: user.status // 0: 启用(管理员), 1: 禁用(普通人员)
}));
console.log('获取到的用户列表:', this.userList);
return Promise.resolve();
@@ -401,7 +402,7 @@ export default {
},
// 根据用户权限过滤数据
filterDataByPermission() {
console.log('开始过滤数据,当前用户角色:', this.currentUser.role);
console.log('开始过滤数据,当前用户状态:', this.currentUser.status);
console.log('过滤前数据总量:', this.invoiceData.length);
if (this.isAdmin) {
@@ -496,8 +497,8 @@ export default {
}
// 严格检查权限:只有管理员或记录所有者可以删除
if (this.currentUser.role !== 'admin' && record.employeeId !== this.currentUser.employeeId) {
alert('您没有权限删除此记录!操作员只能删除自己的记录。');
if (this.currentUser.status !== '0' && record.employeeId !== this.currentUser.employeeId) {
alert('您没有权限删除此记录!普通人员只能删除自己的记录。');
return;
}

View File

@@ -33,8 +33,9 @@ export function deleteOrganization(orgIds) {
export function getOrgDetail(id) {
return request({
url: '/base-data-manage/organization/organization?orgId=' + id,
url: '/base-data-manage/organization/organization-getById',
method: 'get',
params: { orgId: id }
})
}

View File

@@ -41,6 +41,14 @@
<el-table-column label="科室分类" align="center" prop="classEnum_dictText" />
<el-table-column label="医保码" align="center" prop="ybNo" />
<el-table-column label="医保名称" align="center" prop="ybName" />
<el-table-column label="挂号科室" align="center">
<template #default="scope">
{{ scope.row.registerFlag ? '是' : '否' }}
</template>
</el-table-column>
<el-table-column label="科室位置" align="center" prop="location" show-overflow-tooltip />
<el-table-column label="科室简介" align="center" prop="intro" show-overflow-tooltip />
<el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip />
<el-table-column label="状态" align="center" prop="activeFlag_dictText" />
<el-table-column label="操作" align="center">
<template #default="scope">
@@ -129,6 +137,35 @@
/>
</el-form-item>
</el-col>
<el-form-item label="挂号科室" prop="registerFlag">
<el-radio-group v-model="form.registerFlag" size="large">
<el-radio :label="true"></el-radio>
<el-radio :label="false"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="科室位置" prop="location">
<el-input v-model="form.location" placeholder="请输入科室位置" maxlength="100" show-word-limit />
</el-form-item>
<el-form-item label="科室简介" prop="intro">
<el-input
v-model="form.intro"
type="textarea"
placeholder="请输入科室简介"
maxlength="500"
show-word-limit
:rows="4"
/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input
v-model="form.remark"
type="textarea"
placeholder="请输入备注信息"
maxlength="1000"
show-word-limit
:rows="3"
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
@@ -141,7 +178,7 @@
</template>
<script setup name="Organization">
import { getList, deleteOrganization, addOrganization, updateOrganization, disableOrg, initOrgTypeOption, enableOrg } from './components/api';
import { getList, deleteOrganization, addOrganization, updateOrganization, disableOrg, initOrgTypeOption, enableOrg, getOrgDetail } from './components/api';
const { proxy } = getCurrentInstance();
const loading = ref(true);
@@ -154,6 +191,10 @@ const form = ref({
name: undefined,
typeEnum: undefined,
busNoParent: undefined,
registerFlag: false, // 挂号科室标记
location: undefined, // 科室位置
intro: undefined, // 科室简介
remark: undefined, // 备注
});
const orgTableRef = ref();
const orgRef = ref();
@@ -169,6 +210,10 @@ const rules = ref({
{ min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'change' },
],
typeEnum: [{ required: true, message: '请选择科室类型', trigger: 'change' }],
// 新增字段验证规则
location: [{ required: false, message: '请输入科室位置', trigger: 'blur' }],
intro: [{ required: false, message: '请输入科室简介', trigger: 'blur' }],
remark: [{ required: false, message: '请输入备注信息', trigger: 'blur' }],
});
getPageList();
@@ -230,6 +275,10 @@ function initOption() {
function reset() {
form.value.id = undefined;
form.value.registerFlag = false;
form.value.location = undefined;
form.value.intro = undefined;
form.value.remark = undefined;
orgRef.value.resetFields();
}
@@ -248,7 +297,7 @@ function getDictLabel(value) {
}
function getPageList() {
loading.value = false;
loading.value = true;
getList(queryParams.value).then((res) => {
// 处理返回的科室数据,确保科室分类显示与系统标准字典一致
const processedData = res.data.records.map(item => {
@@ -269,6 +318,12 @@ function getPageList() {
organization.value = processedData;
total.value = res.data.total;
}).catch(error => {
console.error('获取科室列表失败:', error);
proxy.$modal.msgError('获取科室列表失败,请稍后重试');
organization.value = [];
total.value = 0;
}).finally(() => {
loading.value = false;
});
}
@@ -285,17 +340,29 @@ function handelEdit(row) {
title.value = '编辑科室';
open.value = true;
setTimeout(() => {
form.value.id = row.id;
form.value.busNo = row.busNo;
form.value.name = row.name;
form.value.ybNo = row.ybNo;
form.value.ybName = row.ybName;
form.value.typeEnum = row.typeEnum;
// 确保科室分类值的类型正确,使其能正确匹配下拉选项中的值
form.value.classEnum = row.classEnum !== undefined ? String(row.classEnum) : undefined;
form.value.busNoParent = row.busNo.split('.').length > 1 ? row.busNo.split('.')[0] : undefined;
}, 50);
// 调用后端API获取完整的科室信息确保包含所有字段
getOrgDetail(row.id).then(res => {
if (res.code === 200) {
const orgInfo = res.data;
form.value.id = orgInfo.id;
form.value.busNo = orgInfo.busNo;
form.value.name = orgInfo.name;
form.value.ybNo = orgInfo.ybNo;
form.value.ybName = orgInfo.ybName;
form.value.typeEnum = orgInfo.typeEnum;
// 确保科室分类值的类型正确,使其能正确匹配下拉选项中的值
form.value.classEnum = orgInfo.classEnum !== undefined ? String(orgInfo.classEnum) : undefined;
form.value.busNoParent = orgInfo.busNo.split('.').length > 1 ? orgInfo.busNo.split('.')[0] : undefined;
form.value.registerFlag = !!orgInfo.registerFlag;
form.value.location = orgInfo.location;
form.value.intro = orgInfo.intro;
form.value.remark = orgInfo.remark;
}
}).catch(error => {
console.error('获取科室信息失败:', error);
proxy.$modal.msgError('获取科室信息失败');
});
}
function cancel() {
@@ -308,20 +375,43 @@ function cancel() {
function submitForm() {
proxy.$refs['orgRef'].validate((valid) => {
if (valid) {
// 创建表单数据副本避免直接修改原始form对象
const formData = { ...form.value };
// 确保registerFlag从布尔值转换为整数true=1, false=0
formData.registerFlag = Number(formData.registerFlag ? 1 : 0);
// 确保classEnum字段有值数据库必填
// 如果未定义设置默认值1
if (formData.classEnum === undefined || formData.classEnum === null || formData.classEnum === '') {
formData.classEnum = 1;
}
// 确保classEnum为数字类型
formData.classEnum = Number(formData.classEnum);
// 验证提交数据
console.log('提交的数据:', formData);
if (form.value.id == undefined) {
if (form.value.busNoParent) {
form.value.busNo = form.value.busNoParent;
formData.busNo = form.value.busNoParent;
}
addOrganization(form.value).then((res) => {
addOrganization(formData).then((res) => {
proxy.$modal.msgSuccess('操作成功');
open.value = false;
getPageList();
}).catch(error => {
console.error('添加科室失败:', error);
proxy.$modal.msgError('添加科室失败,请稍后重试');
});
} else {
updateOrganization(form.value).then((res) => {
updateOrganization(formData).then((res) => {
proxy.$modal.msgSuccess('操作成功');
open.value = false;
getPageList();
}).catch(error => {
console.error('更新科室失败:', error);
proxy.$modal.msgError('更新科室失败,请稍后重试');
});
}
}
@@ -340,8 +430,12 @@ function handleDelete() {
loading.value = true;
deleteOrganization(selectRowIds.value.join(',')).then((res) => {
proxy.$modal.msgSuccess('操作成功');
loading.value = false;
getPageList();
}).catch(error => {
console.error('删除科室失败:', error);
proxy.$modal.msgError('删除科室失败,请稍后重试');
}).finally(() => {
loading.value = false;
});
}
// 停用
@@ -349,6 +443,9 @@ function handleDisabled(id) {
disableOrg(id).then((res) => {
proxy.$modal.msgSuccess('操作成功');
getPageList();
}).catch(error => {
console.error('停用科室失败:', error);
proxy.$modal.msgError('停用科室失败,请稍后重试');
});
}
@@ -357,6 +454,9 @@ function handelEnable(id) {
enableOrg(id).then((res) => {
proxy.$modal.msgSuccess('操作成功');
getPageList();
}).catch(error => {
console.error('启用科室失败:', error);
proxy.$modal.msgError('启用科室失败,请稍后重试');
});
}

View File

@@ -7,19 +7,12 @@ import request from '@/utils/request'
/**
* 分页查询门诊号码段列表
* 要求:普通用户只能查看自己的,管理员可以查看所有
* 注意由于后端接口不存在直接返回失败响应让调用方使用localStorage数据避免404错误
*/
export function listOutpatientNo(query) {
// return request({
// url: '/business-rule/outpatient-no/page',
// method: 'get',
// params: query,
// 由于后端接口不存在直接返回失败响应不发送实际请求避免控制台显示404错误
// 调用方会在判断 code !== 200 时使用 localStorage 数据
return Promise.resolve({
code: 404,
msg: '接口不存在,已使用本地数据',
data: null
return request({
url: '/business-rule/outpatient-no/page',
method: 'get',
params: query,
})
}
@@ -50,11 +43,11 @@ export function updateOutpatientNo(data) {
* 删除门诊号码段
*要求:双重校验(归属权+使用状态)
*/
export function deleteOutpatientNo(params) {
export function deleteOutpatientNo(data) {
return request({
url: '/business-rule/outpatient-no',
method: 'delete',
params,
data,
})
}

View File

@@ -1,7 +1,6 @@
<template>
<div>
<!-- Windows XP风格窗口布局600px固定宽度 -->
<div class="outpatient-no-management-wrapper">
<div class="outpatient-no-management-wrapper">
<!-- Windows XP风格窗口布局全屏显示 -->
<div class="outpatient-no-management">
<!--标题栏32px高 -->
<div class="title-bar">
@@ -45,62 +44,25 @@
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" type="index" width="60" align="center" />
<el-table-column label="操作员" prop="operatorName" min-width="120" />
<el-table-column label="员工工号" prop="staffNo" min-width="120">
<template #default="{ row }">
<el-input
v-if="row._editing"
v-model.trim="row.staffNo"
/>
<span v-else>{{ row.staffNo }}</span>
</template>
</el-table-column>
<el-table-column label="员工工号" prop="staffNo" min-width="120" />
<el-table-column label="领用日期" prop="receiveDate" min-width="140">
<template #default="{ row }">
<el-date-picker
v-if="row._editing"
v-model="row.receiveDate"
type="date"
value-format="YYYY-MM-DD"
placeholder="选择日期"
style="width: 100%"
/>
<span v-else>{{ row.receiveDate }}</span>
{{ formatReceiveDate(row.receiveDate) }}
</template>
</el-table-column>
<el-table-column label="起始号码" prop="startNo" min-width="140">
<el-table-column label="起始号码" prop="startNo" min-width="140" />
<el-table-column label="终止号码" prop="endNo" min-width="140" />
<el-table-column label="使用号码" prop="usedNo" min-width="140" />
<el-table-column label="操作" width="120" align="center" fixed="right">
<template #default="{ row }">
<el-input
v-if="row._editing"
v-model.trim="row.startNo"
@input="() => onStartNoChange(row)"
@blur="() => validateNumField(row, 'startNo')"
/>
<span v-else>{{ row.startNo }}</span>
</template>
</el-table-column>
<el-table-column label="终止号码" prop="endNo" min-width="140">
<template #default="{ row }">
<el-input
v-if="row._editing"
v-model.trim="row.endNo"
@blur="() => validateNumField(row, 'endNo')"
/>
<span v-else>{{ row.endNo }}</span>
</template>
</el-table-column>
<el-table-column label="使用号码" prop="usedNo" min-width="140">
<template #default="{ row }">
<el-input
v-if="row._editing"
v-model.trim="row.usedNo"
@blur="() => validateNumField(row, 'usedNo')"
/>
<span v-else>{{ row.usedNo }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="100" fixed="right">
<template #default="scope">
<el-button type="primary" link icon="Edit" @click="() => openEdit(scope.row, scope.$index)">编辑</el-button>
<el-button
type="primary"
link
size="small"
@click="handleEdit(row)"
>
编辑
</el-button>
</template>
</el-table-column>
</el-table>
@@ -113,41 +75,65 @@
/>
</div>
</div>
</div>
<!-- 编辑弹窗 -->
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="600px" append-to-body>
<el-form label-width="100px">
<el-form-item label="操作员">
<el-input v-model="editForm.operatorName" disabled />
</el-form-item>
<el-form-item label="员工工号">
<el-input v-model.trim="editForm.staffNo" />
</el-form-item>
<el-form-item label="领用日期">
<el-date-picker v-model="editForm.receiveDate" type="date" value-format="YYYY-MM-DD" style="width: 100%" />
</el-form-item>
<el-form-item label="起始号码">
<el-input v-model.trim="editForm.startNo" @blur="() => validateNumField(editForm, 'startNo')" />
</el-form-item>
<el-form-item label="终止号码">
<el-input v-model.trim="editForm.endNo" @blur="() => validateNumField(editForm, 'endNo')" />
</el-form-item>
<el-form-item label="使用号码">
<el-input v-model.trim="editForm.usedNo" @blur="() => validateNumField(editForm, 'usedNo')" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="confirmEdit"> </el-button>
</div>
</template>
<el-dialog
v-model="editDialogVisible"
title="编辑门诊号码段"
width="600px"
:close-on-click-modal="false"
>
<el-form
ref="editFormRef"
:model="editForm"
:rules="editFormRules"
label-width="120px"
>
<el-form-item label="操作员" prop="operatorName">
<el-input v-model="editForm.operatorName" disabled />
</el-form-item>
<el-form-item label="员工工号" prop="staffNo">
<el-input v-model.trim="editForm.staffNo" />
</el-form-item>
<el-form-item label="领用日期" prop="receiveDate">
<el-date-picker
v-model="editForm.receiveDate"
type="date"
value-format="YYYY.MM.DD"
placeholder="选择日期"
style="width: 100%"
/>
</el-form-item>
<el-form-item label="起始号码" prop="startNo">
<el-input
v-model.trim="editForm.startNo"
@input="onEditFormStartNoChange"
@blur="validateEditFormField('startNo')"
/>
</el-form-item>
<el-form-item label="终止号码" prop="endNo">
<el-input
v-model.trim="editForm.endNo"
@blur="validateEditFormField('endNo')"
/>
</el-form-item>
<el-form-item label="使用号码" prop="usedNo">
<el-input
v-model.trim="editForm.usedNo"
@blur="validateEditFormField('usedNo')"
/>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="editDialogVisible = false">取消</el-button>
<el-button type="primary" @click="handleSaveEditForm">保存</el-button>
</template>
</el-dialog>
</div>
</template>
<script setup name="outpatientNoManagement">
import { ref, reactive, toRefs, onActivated, getCurrentInstance } from 'vue'
import useUserStore from '@/store/modules/user'
import { getConfigKey } from '@/api/system/config'
import { logQuery, logCreate, logUpdate, logDelete } from './components/operationLog'
@@ -162,6 +148,34 @@ const getUserInfo = () => ({
name: userStore.name || userStore.nickName
})
// 格式化领用日期为 YYYY.MM.DD 格式(用于显示)
function formatReceiveDate(dateStr) {
if (!dateStr) return ''
// 如果是 YYYY-MM-DD 格式,转换为 YYYY.MM.DD
if (dateStr.includes('-')) {
return dateStr.replace(/-/g, '.')
}
// 如果已经是 YYYY.MM.DD 格式,直接返回
if (dateStr.includes('.')) {
return dateStr
}
return dateStr
}
// 将日期格式从 YYYY.MM.DD 转换为 yyyy-MM-dd用于发送到后端
function convertDateForBackend(dateStr) {
if (!dateStr) return null
// 如果是 YYYY.MM.DD 格式,转换为 yyyy-MM-dd
if (dateStr.includes('.')) {
return dateStr.replace(/\./g, '-')
}
// 如果已经是 yyyy-MM-dd 格式,直接返回
if (dateStr.includes('-')) {
return dateStr
}
return dateStr
}
const loading = ref(false)
const tableData = ref([])
const total = ref(0)
@@ -169,18 +183,31 @@ const ids = ref([])
const multiple = ref(true)
const viewAll = ref(false)
const canToggleViewAll = ref(false)
const dialogVisible = ref(false)
const dialogTitle = ref('编辑门诊号码段')
const editIndex = ref(-1)
// 编辑弹窗相关
const editDialogVisible = ref(false)
const editFormRef = ref(null)
const editForm = reactive({
id: null,
operatorId: null,
operatorName: '',
staffNo: '',
receiveDate: '',
startNo: '',
endNo: '',
usedNo: '',
operatorName: '',
staffNo: '',
_originalData: null,
})
// 编辑表单验证规则
const editFormRules = {
staffNo: [{ required: true, message: '请输入员工工号', trigger: 'blur' }],
receiveDate: [{ required: true, message: '请选择领用日期', trigger: 'change' }],
startNo: [{ required: true, message: '请输入起始号码', trigger: 'blur' }],
endNo: [{ required: true, message: '请输入终止号码', trigger: 'blur' }],
usedNo: [{ required: true, message: '请输入使用号码', trigger: 'blur' }],
}
const data = reactive({
queryParams: {
pageNo: 1,
@@ -218,18 +245,146 @@ function onAdd() {
const yyyy = now.getFullYear()
const mm = String(now.getMonth() + 1).padStart(2, '0')
const dd = String(now.getDate()).padStart(2, '0')
tableData.value.push({
id: undefined,
operatorId: userStore.id,
operatorName: userStore.name || userStore.nickName,
staffNo: userStore.id,
receiveDate: `${yyyy}-${mm}-${dd}`,
startNo: '',
endNo: '',
usedNo: '',
_editing: true,
_error: false,
})
// 打开编辑弹窗,用于新增
editForm.id = undefined
editForm.operatorId = userStore.id
editForm.operatorName = userStore.name || userStore.nickName
editForm.staffNo = userStore.id
editForm.receiveDate = `${yyyy}.${mm}.${dd}`
editForm.startNo = ''
editForm.endNo = ''
editForm.usedNo = ''
editForm._originalData = null
editDialogVisible.value = true
}
// 编辑行 - 打开编辑弹窗
function handleEdit(row) {
// 复制行数据到编辑表单
editForm.id = row.id
editForm.operatorId = row.operatorId
editForm.operatorName = row.operatorName
editForm.staffNo = row.staffNo
editForm.receiveDate = formatReceiveDate(row.receiveDate)
editForm.startNo = row.startNo
editForm.endNo = row.endNo
editForm.usedNo = row.usedNo
editForm._originalData = { ...row }
editDialogVisible.value = true
}
// 编辑表单中起始号码变化时自动设置使用号码
function onEditFormStartNoChange() {
if (!editForm.id && editForm.startNo) {
editForm.usedNo = editForm.startNo
}
}
// 验证编辑表单字段
function validateEditFormField(field) {
if (!isTailDigitsValid(editForm[field])) {
const msg = `最大位数为12位且必须以数字结尾`
alertWarn(msg)
return false
}
return true
}
// 保存编辑表单
async function handleSaveEditForm() {
// 表单验证
if (!editFormRef.value) return
try {
const valid = await editFormRef.value.validate()
if (!valid) return
} catch (error) {
return
}
// 字段验证
if (!validateEditFormField('startNo') || !validateEditFormField('endNo') || !validateEditFormField('usedNo')) {
return
}
// 构建验证用的行对象
const validateRowData = {
startNo: editForm.startNo,
endNo: editForm.endNo,
usedNo: editForm.usedNo,
}
// 验证行数据(编辑时排除当前记录的 id避免误判为重复
const rowIndex = editForm.id ? tableData.value.findIndex(r => r.id === editForm.id) : -1
if (!validateRow(validateRowData, rowIndex, editForm.id)) {
return
}
// 准备保存的数据
const saveData = {
id: editForm.id,
operatorId: editForm.operatorId,
operatorName: editForm.operatorName,
staffNo: editForm.staffNo,
receiveDate: convertDateForBackend(editForm.receiveDate),
startNo: editForm.startNo,
endNo: editForm.endNo,
usedNo: editForm.usedNo,
}
try {
let res
if (saveData.id) {
// 更新
res = await updateOutpatientNo(saveData)
} else {
// 新增
res = await addOutpatientNo(saveData)
}
if (res.code === 200) {
proxy.$modal.msgSuccess('保存成功')
editDialogVisible.value = false
getList()
} else {
// 显示后端返回的错误信息
const errorMsg = res.msg || res.message || '保存失败'
proxy.$modal.msgError(errorMsg)
if (saveData.id) {
logUpdate(saveData, false, errorMsg, getUserInfo())
} else {
logCreate(saveData, false, errorMsg, getUserInfo())
}
}
} catch (error) {
console.error('保存失败:', error)
// 从错误对象中提取错误信息
let errorMsg = '保存失败'
// 优先从 response.data.msg 获取
if (error.response?.data?.msg) {
errorMsg = error.response.data.msg
}
// 其次从 error.message 获取request.js 会通过 new Error(msg) 抛出)
else if (error.message) {
// 如果 error.message 包含 "Error: " 前缀,去掉它
errorMsg = error.message.replace(/^Error:\s*/, '')
}
// 最后尝试从 error.msg 获取
else if (error.msg) {
errorMsg = error.msg
}
// 显示错误信息
proxy.$modal.msgError(errorMsg)
// 记录日志
if (saveData.id) {
logUpdate(saveData, false, errorMsg, getUserInfo())
} else {
logCreate(saveData, false, errorMsg, getUserInfo())
}
}
}
// 新增时,起始号码变化时自动设置使用号码为起始号码
@@ -280,29 +435,6 @@ function tableRowClassName({ row }) {
return row._error ? 'error-row' : ''
}
function openEdit(row, index) {
editIndex.value = index
dialogTitle.value = '编辑门诊号码段'
editForm.receiveDate = row.receiveDate
editForm.startNo = row.startNo
editForm.endNo = row.endNo
editForm.usedNo = row.usedNo
editForm.operatorName = row.operatorName
editForm.staffNo = row.staffNo
dialogVisible.value = true
}
function confirmEdit() {
const tmp = { ...tableData.value[editIndex.value], ...editForm }
if (!validateRow(tmp, editIndex.value)) return
tableData.value[editIndex.value] = {
...tableData.value[editIndex.value],
...editForm,
_dirty: true, // 标记为已修改,顶部保存时提交
}
dialogVisible.value = false
}
// 字母前缀识别规则 - 从末位往前找到第一个字母
function extractPrefix(value) {
if (!value) return ''
@@ -350,7 +482,7 @@ function isTailDigitsValid(value) {
function validateNumField(row, field, rowIndex) {
if (!isTailDigitsValid(row[field])) {
const idxInTable = typeof rowIndex === 'number' ? rowIndex : tableData.value.indexOf(row)
const lineNo = idxInTable >= 0 ? idxInTable + 1 : (editIndex.value >= 0 ? editIndex.value + 1 : undefined)
const lineNo = idxInTable >= 0 ? idxInTable + 1 : undefined
const msg = lineNo ? `第【${lineNo}】行数据中最大位数为12位且必须以数字结尾` : '最大位数为12位且必须以数字结尾'
alertWarn(msg)
row._error = true
@@ -376,11 +508,11 @@ function onNumberInput(row, field) {
}
}
function validateRow(row, rowIndex) {
function validateRow(row, rowIndex, excludeId = null) {
row._error = false
if (!lengthWithinLimit(row.startNo) || !lengthWithinLimit(row.endNo) || !lengthWithinLimit(row.usedNo)) {
const idxInTable = typeof rowIndex === 'number' ? rowIndex : tableData.value.indexOf(row)
const lineNo = idxInTable >= 0 ? idxInTable + 1 : (editIndex.value >= 0 ? editIndex.value + 1 : undefined)
const lineNo = idxInTable >= 0 ? idxInTable + 1 : undefined
const msg = lineNo ? `第【${lineNo}】行数据中最大位数为12位且必须以数字结尾` : '最大位数为12位且必须以数字结尾'
alertWarn(msg)
row._error = true
@@ -388,7 +520,7 @@ function validateRow(row, rowIndex) {
}
if ((row.startNo?.length || 0) !== (row.endNo?.length || 0)) {
const idxInTable = typeof rowIndex === 'number' ? rowIndex : tableData.value.indexOf(row)
const lineNo = idxInTable >= 0 ? idxInTable + 1 : (editIndex.value >= 0 ? editIndex.value + 1 : undefined)
const lineNo = idxInTable >= 0 ? idxInTable + 1 : undefined
const msg = lineNo ? `第【${lineNo}】行数据中,起始号码与终止号码长度必须一致,请修改!` : '起始号码与终止号码长度必须一致'
alertWarn(msg)
row._error = true
@@ -399,7 +531,7 @@ function validateRow(row, rowIndex) {
const p3 = extractPrefix(row.usedNo)
if (!(p1 === p2 && p2 === p3)) {
const idxInTable = typeof rowIndex === 'number' ? rowIndex : tableData.value.indexOf(row)
const lineNo = idxInTable >= 0 ? idxInTable + 1 : (editIndex.value >= 0 ? editIndex.value + 1 : undefined)
const lineNo = idxInTable >= 0 ? idxInTable + 1 : undefined
const msg = lineNo ? `第【${lineNo}】行数据中,门诊号码的字母前缀必须相同,请修改!` : '行数据中,门诊号码的字母前缀必须相同,请修改!'
alertWarn(msg)
row._error = true
@@ -409,25 +541,29 @@ function validateRow(row, rowIndex) {
const eNum = extractTailNumber(row.endNo)
if (Number.isNaN(sNum) || Number.isNaN(eNum) || sNum > eNum) {
const idxInTable = typeof rowIndex === 'number' ? rowIndex : tableData.value.indexOf(row)
const lineNo = idxInTable >= 0 ? idxInTable + 1 : (editIndex.value >= 0 ? editIndex.value + 1 : undefined)
const lineNo = idxInTable >= 0 ? idxInTable + 1 : undefined
const msg = lineNo ? `第【${lineNo}】行数据中,起始/终止号码不合法` : '起始/终止号码不合法'
alertWarn(msg)
row._error = true
return false
}
// 放宽:不再强制使用号码必须处于起始与终止范围内
// 放宽:不再强制"使用号码"必须处于起始与终止范围内
const prefix = p1
for (let i = 0; i < tableData.value.length; i++) {
const other = tableData.value[i]
// 跳过自身:当从弹窗校验时 row 为临时对象,需用下标判断
if ((typeof rowIndex === 'number' && i === rowIndex) || other === row || !other.startNo || !other.endNo) continue
// 跳过自身:通过 rowIndex、row 对象比较或 excludeId 排除
if ((typeof rowIndex === 'number' && i === rowIndex) ||
other === row ||
!other.startNo ||
!other.endNo ||
(excludeId && other.id === excludeId)) continue
if (extractPrefix(other.startNo) !== prefix) continue
const os = extractTailNumber(other.startNo)
const oe = extractTailNumber(other.endNo)
if (!Number.isNaN(os) && !Number.isNaN(oe)) {
if (rangesOverlap(sNum, eNum, os, oe)) {
const idxInTable = typeof rowIndex === 'number' ? rowIndex : tableData.value.indexOf(row)
const lineNo = idxInTable >= 0 ? idxInTable + 1 : (editIndex.value >= 0 ? editIndex.value + 1 : undefined)
const lineNo = idxInTable >= 0 ? idxInTable + 1 : undefined
const msg = lineNo ? `第【${lineNo}】行数据中,门诊号码和【${i + 1}】行的门诊号码有冲突,请修改!` : '门诊号码设置重复!'
alertWarn(msg)
row._error = true
@@ -438,90 +574,233 @@ function validateRow(row, rowIndex) {
return true
}
function onSave(row) {
async function onSave(row) {
const rows = row ? [row] : tableData.value.filter(r => ids.value.includes(r.id) || r._dirty || r._editing)
if (!rows.length) return
for (const r of rows) {
const idx = tableData.value.indexOf(r)
if (!validateRow(r, idx)) return
if (!rows.length) {
proxy.$modal.msgWarning('没有可保存的数据')
return
}
// 准备保存的数据
// 前端校验
for (const r of rows) {
const idx = tableData.value.indexOf(r)
if (!validateRow(r, idx, r.id)) return
}
// 准备保存的数据(将日期格式转换为后端需要的格式)
const saveData = rows.map((r) => ({
id: r.id,
operatorId: r.operatorId,
operatorName: r.operatorName,
staffNo: r.staffNo,
receiveDate: r.receiveDate,
receiveDate: convertDateForBackend(r.receiveDate), // 转换为 yyyy-MM-dd 格式
startNo: r.startNo,
endNo: r.endNo,
usedNo: r.usedNo,
}))
const ok = lcUpsertMany(saveData)
if (!ok) {
// 记录失败的操作日志
for (const record of saveData) {
if (record.id) {
logUpdate(record, false, '门诊号码设置重复', getUserInfo())
} else {
logCreate(record, false, '门诊号码设置重复', getUserInfo())
}
}
return
}
// 批量保存
let successCount = 0
let failCount = 0
// 记录成功的操作日志
for (const record of saveData) {
if (record.id) {
logUpdate(record, true, null, getUserInfo())
} else {
logCreate(record, true, null, getUserInfo())
try {
let res
if (record.id) {
// 更新
res = await updateOutpatientNo(record)
if (res.code === 200) {
logUpdate(record, true, null, getUserInfo())
successCount++
} else {
const errorMsg = res.msg || res.message || '保存失败'
proxy.$modal.msgError(errorMsg)
logUpdate(record, false, errorMsg, getUserInfo())
failCount++
}
} else {
// 新增
res = await addOutpatientNo(record)
if (res.code === 200) {
logCreate(record, true, null, getUserInfo())
successCount++
} else {
const errorMsg = res.msg || res.message || '保存失败'
proxy.$modal.msgError(errorMsg)
logCreate(record, false, errorMsg, getUserInfo())
failCount++
}
}
} catch (error) {
console.error('保存失败:', error)
// 从错误对象中提取错误信息
let errorMsg = '保存失败'
if (error.response?.data?.msg) {
errorMsg = error.response.data.msg
} else if (error.message) {
errorMsg = error.message
} else if (error.msg) {
errorMsg = error.msg
}
proxy.$modal.msgError(errorMsg)
if (record.id) {
logUpdate(record, false, errorMsg, getUserInfo())
} else {
logCreate(record, false, errorMsg, getUserInfo())
}
failCount++
}
}
if (proxy.$modal?.alertSuccess) {
proxy.$modal.alertSuccess('保存成功!')
} else {
proxy.$message.success('保存成功')
if (successCount > 0) {
proxy.$modal.msgSuccess(`保存成功${successCount}`)
// 保存成功后,退出编辑状态
rows.forEach(r => {
r._editing = false
r._dirty = false
r._originalData = null // 清除原始数据
})
}
if (failCount > 0) {
proxy.$modal.msgError(`保存失败${failCount}`)
}
getList()
}
function onDelete() {
const rows = tableData.value.filter((r) => ids.value.includes(r.id))
if (!rows.length) return
async function onDelete() {
console.log('删除操作 - 选中的ID列表:', ids.value)
console.log('删除操作 - 表格数据:', tableData.value.map(r => ({ id: r.id, operatorId: r.operatorId })))
// 双重校验(归属权+使用状态)
const rows = tableData.value.filter((r) => ids.value.includes(r.id))
console.log('删除操作 - 筛选后的行数据:', rows.map(r => ({ id: r.id, operatorId: r.operatorId })))
if (!rows.length) {
proxy.$modal.msgWarning('请选择要删除的数据')
return
}
// 前端预校验(归属权+使用状态)
for (const r of rows) {
console.log('检查删除权限 - 行数据:', {
id: r.id,
operatorId: r.operatorId,
operatorIdType: typeof r.operatorId,
userStoreId: userStore.id,
userStoreIdType: typeof userStore.id,
usedNo: r.usedNo,
startNo: r.startNo,
usedNoType: typeof r.usedNo,
startNoType: typeof r.startNo
})
const canDeleteSelf = String(r.operatorId) === String(userStore.id)
const neverUsed = r.usedNo === r.startNo
// 确保字符串比较,避免类型问题
const neverUsed = String(r.usedNo || '') === String(r.startNo || '')
if (!canDeleteSelf) {
// 权限不足提示
console.warn('删除权限检查失败:', {
operatorId: r.operatorId,
userStoreId: userStore.id,
canDeleteSelf
})
alertWarn('只能删除自己维护的门诊号码段')
logDelete(rows, false, '只能删除自己维护的门诊号码段', getUserInfo())
return
}
if (!neverUsed) {
// 已使用提示
console.warn('使用状态检查失败:', {
usedNo: r.usedNo,
startNo: r.startNo,
neverUsed
})
alertWarn('已有门诊号码段已有使用的门诊号码,请核对!')
logDelete(rows, false, '已有门诊号码段已有使用的门诊号码', getUserInfo())
return
}
}
const doRealDelete = () => {
lcDeleteByIds(rows.map((r) => r.id))
//记录成功的删除操作日志
logDelete(rows, true, null, getUserInfo())
if (proxy.$modal?.alertSuccess) {
proxy.$modal.alertSuccess('删除成功')
} else {
proxy.$message.success('删除成功')
const doRealDelete = async () => {
try {
// 处理大整数 ID保持为字符串或使用 BigInt避免精度丢失
// JavaScript 的 Number.MAX_SAFE_INTEGER = 9007199254740991
// 如果 ID 超过这个值,转换为数字会丢失精度
const idsToDelete = rows
.map((r) => r.id)
.filter(id => id != null && id !== undefined)
.map(id => {
// 如果 ID 是字符串,检查是否需要转换为数字
if (typeof id === 'string') {
// 尝试转换为数字,但如果超过安全整数范围,保持为字符串
const numId = parseInt(id, 10)
if (!isNaN(numId) && numId <= Number.MAX_SAFE_INTEGER) {
return numId
}
// 大整数保持为字符串,后端应该能处理
return id
}
// 如果已经是数字,检查是否超过安全范围
if (typeof id === 'number') {
if (id > Number.MAX_SAFE_INTEGER) {
// 超过安全范围,转换为字符串
return String(id)
}
return id
}
// 其他类型,尝试转换
return id
})
.filter(id => id != null && id !== undefined)
if (idsToDelete.length === 0) {
proxy.$modal.msgWarning('没有可删除的数据')
return
}
console.log('准备删除的ID列表:', idsToDelete)
console.log('删除请求数据:', JSON.stringify({ ids: idsToDelete }))
console.log('删除请求数据类型:', idsToDelete.map(id => ({ value: id, type: typeof id, stringValue: String(id) })))
const res = await deleteOutpatientNo({ ids: idsToDelete })
console.log('删除响应:', res)
console.log('删除响应code:', res?.code)
console.log('删除响应msg:', res?.msg)
if (res && (res.code === 200 || res.code === 0)) {
logDelete(rows, true, null, getUserInfo())
proxy.$modal.msgSuccess('删除成功')
getList()
} else {
const errorMsg = res?.msg || res?.message || '删除失败'
logDelete(rows, false, errorMsg, getUserInfo())
proxy.$modal.msgError(errorMsg)
}
} catch (error) {
console.error('删除失败:', error)
// 从错误对象中提取错误信息
let errorMsg = '删除失败'
// 优先从 response.data.msg 获取
if (error.response?.data?.msg) {
errorMsg = error.response.data.msg
}
// 其次从 error.message 获取request.js 会通过 new Error(msg) 抛出)
else if (error.message) {
// 如果 error.message 包含 "Error: " 前缀,去掉它
errorMsg = error.message.replace(/^Error:\s*/, '')
}
// 最后尝试从 error.msg 获取
else if (error.msg) {
errorMsg = error.msg
}
// 显示错误信息(参考 PackageManagement 的实现方式)
proxy.$modal.msgError('删除失败: ' + errorMsg)
// 记录日志
logDelete(rows, false, errorMsg, getUserInfo())
}
getList()
}
if (proxy.$modal?.confirm) {
@@ -537,115 +816,48 @@ function getList() {
loading.value = true
queryParams.value.onlySelf = !viewAll.value
// 先尝试调用后端API
// 调用后端API
listOutpatientNo(queryParams.value).then((res) => {
if (res.code === 200) {
tableData.value = (res.data?.records || res.data || []).map((it) => ({
...it,
_editing: false,
_error: false,
_dirty: false,
}))
tableData.value = (res.data?.records || res.data || []).map((it) => {
// 处理大整数 ID如果 ID 超过 JavaScript 安全整数范围,保持为字符串
let id = it.id
if (typeof id === 'number' && id > Number.MAX_SAFE_INTEGER) {
// 数字超过安全范围,转换为字符串以避免精度丢失
id = String(id)
} else if (typeof id === 'number') {
// 数字在安全范围内,保持为数字
id = id
} else {
// 已经是字符串或其他类型,保持原样
id = id
}
return {
...it,
id: id, // 确保 ID 正确处理
_editing: false,
_error: false,
_dirty: false,
// 确保日期格式正确:后端返回 yyyy-MM-dd转换为 YYYY.MM.DD 用于显示
receiveDate: it.receiveDate ? formatReceiveDate(it.receiveDate) : ''
}
})
total.value = res.data?.total || res.data?.length || 0
// 记录查询操作日志
logQuery(total.value, getUserInfo())
} else {
// API返回错误回退到localStorage
console.warn('后端API返回错误使用localStorage数据')
loadFromLocalStorage()
proxy.$modal.msgError(res.msg || '查询失败')
}
loading.value = false
}).catch((error) => {
// API调用失败如404回退到localStorage
console.warn('后端API调用失败使用localStorage数据:', error)
loadFromLocalStorage()
console.error('查询门诊号码段失败:', error)
proxy.$modal.msgError('查询失败,请稍后重试')
loading.value = false
})
}
// 从localStorage加载数据
function loadFromLocalStorage() {
const res = lcList({ ...queryParams.value })
tableData.value = res.records.map((it) => ({
...it,
_editing: false,
_error: false,
_dirty: false,
}))
total.value = res.total
// 记录查询操作日志
logQuery(total.value, getUserInfo())
loading.value = false
}
// 纯前端本地持久化方法localStorage
const STORAGE_KEY = 'ohis_outpatient_no_segments'
function lcReadAll() {
try {
const raw = localStorage.getItem(STORAGE_KEY)
const arr = raw ? JSON.parse(raw) : []
return Array.isArray(arr) ? arr : []
} catch (e) {
return []
}
}
function lcWriteAll(list) {
localStorage.setItem(STORAGE_KEY, JSON.stringify(list || []))
}
function lcList({ pageNo = 1, pageSize = 10, onlySelf = true }) {
const all = lcReadAll()
const filtered = onlySelf ? all.filter((x) => String(x.operatorId) === String(userStore.id)) : all
const start = (pageNo - 1) * pageSize
const end = start + pageSize
return { records: filtered.slice(start, end), total: filtered.length, all }
}
function checkOverlapAll(row, all) {
const prefix = extractPrefix(row.startNo)
const sNum = extractTailNumber(row.startNo)
const eNum = extractTailNumber(row.endNo)
for (const it of all) {
if (row.id && it.id === row.id) continue
if (!it.startNo || !it.endNo) continue
if (extractPrefix(it.startNo) !== prefix) continue
const os = extractTailNumber(it.startNo)
const oe = extractTailNumber(it.endNo)
if (!Number.isNaN(os) && !Number.isNaN(oe)) {
if (rangesOverlap(sNum, eNum, os, oe)) return true
}
}
return false
}
function lcUpsertMany(rows) {
const all = lcReadAll()
for (const r of rows) {
if (checkOverlapAll(r, all)) {
alertWarn('门诊号码设置重复!')
return false
}
if (!r.id) {
r.id = `${Date.now()}_${Math.random().toString(36).slice(2, 8)}`
}
const idx = all.findIndex((x) => x.id === r.id)
if (idx >= 0) all[idx] = { ...all[idx], ...r }
else all.push({ ...r })
}
lcWriteAll(all)
return true
}
function lcDeleteByIds(idList) {
const all = lcReadAll()
const remain = all.filter((x) => !idList.includes(x.id))
lcWriteAll(remain)
}
</script>
<style scoped>
@@ -653,17 +865,14 @@ function lcDeleteByIds(idList) {
/* 外层容器 - 全屏显示 */
.outpatient-no-management-wrapper {
display: flex;
justify-content: flex-start;
align-items: flex-start;
width: 100%;
height: calc(100vh - 84px);
padding: 0;
background-color: #f0f0f0;
overflow: hidden;
padding: 0;
margin: 0;
}
/* 主容器 - 全屏宽度和高度 */
/* 主容器 - 全屏显示 */
.outpatient-no-management {
width: 100%;
height: 100%;
@@ -865,28 +1074,6 @@ function lcDeleteByIds(idList) {
background: linear-gradient(to bottom, #FFFEF8 0%, #F5F4EF 50%, #E5E4DF 100%);
}
/* 编辑弹窗样式 */
:deep(.el-dialog) {
border-radius: 0;
border: 2px solid #0055E5;
}
:deep(.el-dialog__header) {
background: linear-gradient(to bottom, #0055E5 0%, #0F3D8C 100%);
padding: 10px 15px;
margin: 0;
}
:deep(.el-dialog__title) {
color: #FFFFFF;
font-weight: 700;
font-size: 14px;
}
:deep(.el-dialog__close) {
color: #FFFFFF;
}
/* 表格容器样式调整 */
.table-content :deep(.el-table__body-wrapper) {
flex: 1;

View File

@@ -1,16 +1,16 @@
<template>
<!-- <div class="app-container"> -->
<!-- 添加或修改对话框 -->
<el-dialog :title="title" v-model="visible" width="1020px" append-to-body>
<el-dialog :title="title" v-model="visible" width="1200px" append-to-body>
<el-form ref="patientRef" :model="form" :rules="rules" label-width="120px" label-position="left">
<!-- 第一行姓名民族性别 -->
<!-- 第一行姓名民族文化程度性别 -->
<el-row :gutter="10">
<el-col :span="8">
<el-col :span="6">
<el-form-item label="姓名" prop="name" label-width="80px">
<el-input v-model="form.name" clearable :disabled="isViewMode" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-col :span="6">
<el-form-item label="民族" prop="nationalityCode" label-width="80px">
<el-select v-model="form.nationalityCode" clearable filterable :disabled="isViewMode">
<el-option
@@ -22,12 +22,28 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-col :span="6">
<el-form-item label="文化程度" prop="educationLevel" label-width="80px">
<el-select v-model="form.educationLevel" placeholder="请选择文化程度" clearable :disabled="isViewMode">
<el-option
v-for="item in educationLevelList"
:key="item.value"
:label="item.info"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="性别" prop="genderEnum" label-width="80px">
<el-radio-group v-model="form.genderEnum" :disabled="isViewMode">
<el-radio :label="0">男性</el-radio>
<el-radio :label="1">女性</el-radio>
</el-radio-group>
<el-select v-model="form.genderEnum" placeholder="请选择性别" clearable :disabled="isViewMode">
<el-option
v-for="item in administrativegenderList"
:key="item.value"
:label="item.info"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
@@ -70,11 +86,18 @@
</el-col>
</el-row>
<!-- 第三行家编码*联系方式工作单位 -->
<!-- 第三行*联系方式工作单位 -->
<el-row :gutter="10">
<el-col :span="8">
<el-form-item label="国家编码" prop="countryCode" label-width="80px">
<el-input v-model="form.countryCode" clearable :disabled="isViewMode" />
<el-form-item label="国" prop="countryCode" label-width="80px">
<el-select v-model="form.countryCode" placeholder="请选择国籍" clearable filterable :disabled="isViewMode">
<el-option
v-for="item in countryCodeList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
@@ -97,7 +120,7 @@
</el-col>
</el-row>
<!-- 第三行就诊卡号国家编码出生日期 -->
<!-- 第三行就诊卡号职业邮政编码 -->
<el-row>
<el-col :span="8">
<el-form-item label="就诊卡号" prop="identifierNo">
@@ -116,16 +139,29 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="邮政编码" prop="postalCode">
<el-input v-model="form.postalCode" clearable :disabled="isViewMode" placeholder="请输入邮政编码" />
</el-form-item>
</el-col>
</el-row>
<!-- 第四行工作单位 -->
<el-row>
<el-col :span="8">
<el-form-item label="工作单位" prop="workCompany">
<el-input v-model="form.workCompany" clearable :disabled="isViewMode" />
</el-form-item>
</el-col>
<el-col :span="16">
<el-form-item label="单位地址" prop="companyAddress">
<el-input v-model="form.companyAddress" clearable :disabled="isViewMode" />
</el-form-item>
</el-col>
</el-row>
<!-- 址选择详细地址 -->
<!-- 现住址选择详细地址 -->
<el-row>
<el-col :span="8">
<el-form-item label="地址选择" prop="addressSelect">
<el-form-item label="现住址" prop="addressSelect">
<el-cascader
:options="options"
:props="{ checkStrictly: true, value: 'code', label: 'name' }"
@@ -147,6 +183,31 @@
</el-col>
</el-row>
<!-- 户籍地址选择详细地址 -->
<el-row>
<el-col :span="8">
<el-form-item label="户籍地址" prop="hukouAddressSelect">
<el-cascader
:options="options"
:props="{ checkStrictly: true, value: 'code', label: 'name' }"
v-model="selectedHukouOptions"
@change="handleHukouChange"
:disabled="isViewMode"
>
<template #default="{ node, data }">
<span>{{ data.name }}</span>
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
</template>
</el-cascader>
</el-form-item>
</el-col>
<el-col :span="16">
<el-form-item label="详细地址" prop="hukouAddress">
<el-input v-model="form.hukouAddress" clearable :disabled="isViewMode" />
</el-form-item>
</el-col>
</el-row>
<!-- 第六行血型ABO血型RH -->
<el-row>
<el-col :span="8">
@@ -178,6 +239,18 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="患者来源" prop="patientDerived">
<el-select v-model="form.patientDerived" placeholder="患者来源" clearable :disabled="isViewMode">
<el-option
v-for="item in patientDerivedList"
:key="item.value"
:label="item.info"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<!-- 第七行婚姻状态死亡时间 -->
@@ -307,16 +380,146 @@ const {
);
const selectedOptions = ref([]); // v-model 绑定的选中值
const selectedHukouOptions = ref([]); // 户籍地址v-model 绑定的选中值
const maritalstatusList = ref([]); //婚姻
const occupationtypeList = ref([]); //职业
const administrativegenderList = ref([]); //性别
const bloodtypeaboList = ref([]); //血型abo
const bloodtypearhList = ref([]); //血型RH
const familyrelationshiptypeList = ref([]); //家庭关系
const patientDerivedList = ref([]); //患者来源
// 使用 ref 定义查询所得用户信息数据
const patientInfo = ref(undefined);
const addressCom = ref(''); //地址
const educationLevelList = ref([]); //文化程度
const countryCodeList = ref([]); //国家地区代码
// 从字典管理获取患者来源数据
const getPatientDerivedOptions = async () => {
try {
console.log('开始获取患者来源字典数据...');
// 从字典管理获取患者来源数据字典类型为patient_derived
const patientDerivedDict = await proxy.getDictDataByType('patient_derived');
console.log('获取到的患者来源原始数据:', patientDerivedDict);
// 确保数据是数组
if (!Array.isArray(patientDerivedDict)) {
console.error('患者来源数据格式错误,不是数组:', patientDerivedDict);
return;
}
// 按字典排序字段sort字段升序排序
const sortedPatientDerived = patientDerivedDict.sort((a, b) => {
// 尝试获取排序字段可能的字段名sort, orderNum, dictSort等
const sortA = a.sort || a.orderNum || a.dictSort || 0;
const sortB = b.sort || b.orderNum || b.dictSort || 0;
return sortA - sortB;
});
console.log('按排序字段排序后的患者来源数据:', sortedPatientDerived);
// 转换为组件需要的格式,确保使用正确的字段名称
patientDerivedList.value = sortedPatientDerived.map(item => ({
value: item.value || item.dictValue || item.code || '', // 使用字典键值
info: item.label || item.dictLabel || item.name || '' // 使用info字段作为显示文本与模板中的:label="item.info"匹配)
}));
console.log('处理后的患者来源选项:', patientDerivedList.value);
} catch (error) {
console.error('获取患者来源字典数据失败:', error);
// 改进的降级方案:使用默认的患者来源选项
patientDerivedList.value = [
{ value: '1', info: '熟人介绍' },
{ value: '2', info: '电视广告' },
{ value: '3', info: '公交站牌' },
{ value: '99', info: '其他' }
];
console.warn('使用默认患者来源数据作为降级方案');
}
};
// 从字典管理获取性别数据
const getGenderOptions = async () => {
try {
// 从字典管理获取性别数据
const genderDict = await proxy.getDictDataByType('性别');
// 按字典排序字段排序
const sortedGenders = genderDict.sort((a, b) => {
return (a.sort || 0) - (b.sort || 0);
});
// 转换为组件需要的格式
administrativegenderList.value = sortedGenders.map(item => ({
value: item.value, // 使用字典键值
info: item.label // 使用字典标签
}));
} catch (error) {
console.error('获取性别字典数据失败:', error);
// 降级方案:使用默认的性别选项
administrativegenderList.value = [
{ value: '1', info: '男' },
{ value: '2', info: '女' },
{ value: '9', info: '未说明性别' },
{ value: '0', info: '未知的性别' }
];
}
};
// 从字典管理获取文化程度数据
const getEducationLevelOptions = async () => {
try {
// 从字典管理获取文化程度数据
const educationDict = await proxy.getDictDataByType('文化程度');
console.log('获取到的文化程度数据:', educationDict);
// 确保数据是数组
if (!Array.isArray(educationDict)) {
console.error('文化程度数据格式错误,不是数组:', educationDict);
return;
}
// 按字典编码顺序升序排列(根据截图显示,排序字段为字典编码)
const sortedEducation = educationDict.sort((a, b) => {
// 获取字典编码可能的字段名code, dictCode, 或 value
const codeA = a.code || a.dictCode || a.value || '';
const codeB = b.code || b.dictCode || b.value || '';
// 尝试将编码转换为数字进行升序排序
const numA = parseInt(codeA);
const numB = parseInt(codeB);
// 如果都是有效数字,则按数字排序,否则按字符串排序
if (!isNaN(numA) && !isNaN(numB)) {
return numA - numB;
} else {
return codeA.localeCompare(codeB);
}
});
console.log('按字典编码排序后的文化程度数据:', sortedEducation);
// 转换为组件需要的格式
educationLevelList.value = sortedEducation.map(item => ({
value: item.value || item.dictValue || item.code || '', // 使用字典键值或编码
info: item.label || item.dictLabel || item.name || '' // 使用字典标签
}));
console.log('处理后的文化程度选项:', educationLevelList.value);
} catch (error) {
console.error('获取文化程度字典数据失败:', error);
// 降级方案:使用默认的文化程度选项,按编码顺序排列
educationLevelList.value = [
{ value: '3912', info: '大学本科' },
{ value: '3913', info: '硕士研究生' },
{ value: '3914', info: '博士研究生' },
{ value: '3915', info: '初中毕业' },
{ value: '3916', info: '大学毕业' },
{ value: '3917', info: '技工学校毕业' },
{ value: '3918', info: '职业高中毕业' },
{ value: '3919', info: '小学毕业' },
{ value: '3920', info: '普通高中毕业' },
{ value: '3921', info: '中等专科毕业' }
].sort((a, b) => parseInt(a.value) - parseInt(b.value)); // 确保默认选项也按编码排序
}
};
const options = ref(pcas); // 地区数据
const title = ref('新增患者');
@@ -406,11 +609,25 @@ const data = reactive({
typeCode: '08',
birthDate: undefined,
age: undefined,
genderEnum: '1', // 默认设置为'男'
hukouAddressSelect: undefined,
hukouAddress: undefined,
postalCode: undefined,
companyAddress: undefined,
patientDerived: undefined,
},
rules: {
name: [{ required: true, message: '姓名不能为空', trigger: 'change' },
{ validator: validateUniquePatient, trigger: 'blur' }
],
name: [{ required: true, message: '姓名不能为空', trigger: 'change' },
{ validator: validateUniquePatient, trigger: 'blur' }
],
postalCode: [
{ required: false, message: '邮政编码非必填', trigger: 'change' },
{ pattern: /^\d{6}$/, message: '邮政编码格式应为6位数字', trigger: 'blur' }
],
hukouAddressSelect: [{ required: false, message: '户籍地址选择非必填', trigger: 'change' }],
hukouAddress: [{ required: false, message: '户籍详细地址非必填', trigger: 'change' }],
companyAddress: [{ required: false, message: '单位地址非必填', trigger: 'change' }],
patientDerived: [{ required: false, message: '患者来源非必填', trigger: 'change' }],
genderEnum: [{ required: true, message: '请选择性别', trigger: 'change' }],
age: [{ required: true, message: '年龄不能为空', trigger: 'change' }],
phone: [{ required: true, message: '联系方式不能为空', trigger: 'change' }],
@@ -516,7 +733,7 @@ function getList() {
patientlLists().then((response) => {
console.log(response);
occupationtypeList.value = response.data.occupationType;
administrativegenderList.value = response.data.sex;
// 移除直接从patientlLists设置性别的代码
bloodtypeaboList.value = response.data.bloodTypeABO;
bloodtypearhList.value = response.data.bloodTypeRH;
familyrelationshiptypeList.value = response.data.familyRelationshipType;
@@ -539,7 +756,7 @@ function getPatientInfo(idCard) {
}
});
}
//址选择
//现住址选择
const handleChange = () => {
const checkedNodes = selectedOptions.value.map((code) => {
const node = findNodeByCode(options.value, code);
@@ -552,6 +769,19 @@ const handleChange = () => {
form.value.address = '';
};
//户籍地址选择
const handleHukouChange = () => {
const checkedNodes = selectedHukouOptions.value.map((code) => {
const node = findNodeByCode(options.value, code);
return node ? node.name : null;
});
form.value.hukouAddressProvince = checkedNodes[0] || '';
form.value.hukouAddressCity = checkedNodes[1] || '';
form.value.hukouAddressDistrict = checkedNodes[2] || '';
form.value.hukouAddressStreet = checkedNodes[3] || '';
form.value.hukouAddress = '';
};
// 递归查找节点
const findNodeByCode = (data, code) => {
for (const item of data) {
@@ -563,10 +793,415 @@ const findNodeByCode = (data, code) => {
}
return null;
};
// 从字典管理获取国家地区代码数据
const getCountryCodeOptions = async () => {
try {
console.log('开始获取国家地区代码数据...');
// 确保使用正确的字典名称获取完整数据
let countryDict = [];
// 定义多个可能的字典类型名称优先使用nat_regn_code
const dictTypes = ['nat_regn_code', 'country_code', 'COUNTRY_CODE', '国家地区代码'];
let success = false;
// 尝试使用useDict方法获取数据遍历不同的字典类型
if (proxy.useDict && typeof proxy.useDict === 'function') {
for (const dictType of dictTypes) {
try {
const dictResult = await proxy.useDict(dictType);
if (dictResult && dictResult[dictType] && Array.isArray(dictResult[dictType]) && dictResult[dictType].length > 0) {
countryDict = dictResult[dictType];
console.log(`通过useDict(${dictType})获取到的国家地区代码数据数量:`, countryDict.length);
success = true;
break;
}
} catch (err) {
console.warn(`useDict(${dictType})调用失败,尝试下一种方式:`, err.message);
}
}
}
// 如果useDict失败尝试直接调用API获取字典数据
if (!success && proxy.request && typeof proxy.request === 'function') {
try {
console.log('尝试直接调用API获取国家地区代码数据...');
// 直接调用字典数据API优先使用nat_regn_code接口路径
const response = await proxy.request({
url: '/system/dict/data/type/nat_regn_code',
method: 'get'
});
if (response && response.code === 200 && Array.isArray(response.data)) {
countryDict = response.data;
console.log('通过API直接调用获取到的国家地区代码数据数量:', countryDict.length);
success = true;
} else {
// 如果nat_regn_code接口失败尝试使用country_code
const fallbackResponse = await proxy.request({
url: '/system/dict/data/type/country_code',
method: 'get'
});
if (fallbackResponse && fallbackResponse.code === 200 && Array.isArray(fallbackResponse.data)) {
countryDict = fallbackResponse.data;
console.log('通过备用API获取到的国家地区代码数据数量:', countryDict.length);
success = true;
}
}
} catch (apiError) {
console.error('API直接调用失败:', apiError);
}
}
// 如果仍然未获取到数据使用与nat_regn_code字典一致的模拟数据
if (!Array.isArray(countryDict) || countryDict.length === 0) {
console.warn('未获取到国家地区代码数据或数据格式错误使用与nat_regn_code字典一致的模拟数据');
// 创建与nat_regn_code字典一致的模拟数据基于数据库中的数据格式
const mockCountries = [
{ dictValue: 'CHN', dictLabel: '中国' },
{ dictValue: 'HKG', dictLabel: '香港' },
{ dictValue: 'MAC', dictLabel: '澳门' },
{ dictValue: 'TWN', dictLabel: '台湾' },
{ dictValue: 'AFG', dictLabel: '阿富汗' },
{ dictValue: 'ALB', dictLabel: '阿尔巴尼亚' },
{ dictValue: 'DZA', dictLabel: '阿尔及利亚' },
{ dictValue: 'ASM', dictLabel: '美属萨摩亚' },
{ dictValue: 'AND', dictLabel: '安道尔' },
{ dictValue: 'AGO', dictLabel: '安哥拉' },
{ dictValue: 'AIA', dictLabel: '安圭拉' },
{ dictValue: 'ATA', dictLabel: '南极洲' },
{ dictValue: 'ATG', dictLabel: '安提瓜和巴布达' },
{ dictValue: 'ARG', dictLabel: '阿根廷' },
{ dictValue: 'ARM', dictLabel: '亚美尼亚' },
{ dictValue: 'ABW', dictLabel: '阿鲁巴' },
{ dictValue: 'AUS', dictLabel: '澳大利亚' },
{ dictValue: 'AUT', dictLabel: '奥地利' },
{ dictValue: 'AZE', dictLabel: '阿塞拜疆' },
{ dictValue: 'BHS', dictLabel: '巴哈马' },
{ dictValue: 'BHR', dictLabel: '巴林' },
{ dictValue: 'BGD', dictLabel: '孟加拉国' },
{ dictValue: 'BRB', dictLabel: '巴巴多斯' },
{ dictValue: 'BLR', dictLabel: '白俄罗斯' },
{ dictValue: 'BEL', dictLabel: '比利时' },
{ dictValue: 'BLZ', dictLabel: '伯利兹' },
{ dictValue: 'BEN', dictLabel: '贝宁' },
{ dictValue: 'BMU', dictLabel: '百慕大' },
{ dictValue: 'BTN', dictLabel: '不丹' },
{ dictValue: 'BOL', dictLabel: '玻利维亚' },
{ dictValue: 'BIH', dictLabel: '波黑' },
{ dictValue: 'BWA', dictLabel: '博茨瓦纳' },
{ dictValue: 'BVT', dictLabel: '布维岛' },
{ dictValue: 'BRA', dictLabel: '巴西' },
{ dictValue: 'IOT', dictLabel: '英属印度洋领土' },
{ dictValue: 'BRN', dictLabel: '文莱' },
{ dictValue: 'BGR', dictLabel: '保加利亚' },
{ dictValue: 'BFA', dictLabel: '布基纳法索' },
{ dictValue: 'BDI', dictLabel: '布隆迪' },
{ dictValue: 'KHM', dictLabel: '柬埔寨' },
{ dictValue: 'CMR', dictLabel: '喀麦隆' },
{ dictValue: 'CAN', dictLabel: '加拿大' },
{ dictValue: 'CPV', dictLabel: '佛得角' },
{ dictValue: 'CYM', dictLabel: '开曼群岛' },
{ dictValue: 'CAF', dictLabel: '中非' },
{ dictValue: 'TCD', dictLabel: '乍得' },
{ dictValue: 'CHL', dictLabel: '智利' },
{ dictValue: 'CXR', dictLabel: '圣诞岛' },
{ dictValue: 'CCK', dictLabel: '科科斯(基林)群岛' },
{ dictValue: 'COL', dictLabel: '哥伦比亚' },
{ dictValue: 'COM', dictLabel: '科摩罗' },
{ dictValue: 'COG', dictLabel: '刚果(布)' },
{ dictValue: 'COD', dictLabel: '刚果(金)' },
{ dictValue: 'COK', dictLabel: '库克群岛' },
{ dictValue: 'CRI', dictLabel: '哥斯达黎加' },
{ dictValue: 'CIV', dictLabel: '科特迪瓦' },
{ dictValue: 'HRV', dictLabel: '克罗地亚' },
{ dictValue: 'CUB', dictLabel: '古巴' },
{ dictValue: 'CYP', dictLabel: '塞浦路斯' },
{ dictValue: 'CZE', dictLabel: '捷克' },
{ dictValue: 'DNK', dictLabel: '丹麦' },
{ dictValue: 'DJI', dictLabel: '吉布提' },
{ dictValue: 'DMA', dictLabel: '多米尼克' },
{ dictValue: 'DOM', dictLabel: '多米尼加' },
{ dictValue: 'TLS', dictLabel: '东帝汶' },
{ dictValue: 'ECU', dictLabel: '厄瓜多尔' },
{ dictValue: 'EGY', dictLabel: '埃及' },
{ dictValue: 'SLV', dictLabel: '萨尔瓦多' },
{ dictValue: 'GNQ', dictLabel: '赤道几内亚' },
{ dictValue: 'ERI', dictLabel: '厄立特里亚' },
{ dictValue: 'EST', dictLabel: '爱沙尼亚' },
{ dictValue: 'ETH', dictLabel: '埃塞俄比亚' },
{ dictValue: 'FLK', dictLabel: '福克兰群岛' },
{ dictValue: 'FRO', dictLabel: '法罗群岛' },
{ dictValue: 'FJI', dictLabel: '斐济' },
{ dictValue: 'FIN', dictLabel: '芬兰' },
{ dictValue: 'FRA', dictLabel: '法国' },
{ dictValue: 'GUF', dictLabel: '法属圭亚那' },
{ dictValue: 'PYF', dictLabel: '法属波利尼西亚' },
{ dictValue: 'ATF', dictLabel: '法属南部领地' },
{ dictValue: 'GAB', dictLabel: '加蓬' },
{ dictValue: 'GMB', dictLabel: '冈比亚' },
{ dictValue: 'GEO', dictLabel: '格鲁吉亚' },
{ dictValue: 'DEU', dictLabel: '德国' },
{ dictValue: 'GHA', dictLabel: '加纳' },
{ dictValue: 'GIB', dictLabel: '直布罗陀' },
{ dictValue: 'GRC', dictLabel: '希腊' },
{ dictValue: 'GRL', dictLabel: '格陵兰' },
{ dictValue: 'GRD', dictLabel: '格林纳达' },
{ dictValue: 'GLP', dictLabel: '瓜德罗普' },
{ dictValue: 'GUM', dictLabel: '关岛' },
{ dictValue: 'GTM', dictLabel: '危地马拉' },
{ dictValue: 'GGY', dictLabel: '根西岛' },
{ dictValue: 'GIN', dictLabel: '几内亚' },
{ dictValue: 'GNB', dictLabel: '几内亚比绍' },
{ dictValue: 'GUY', dictLabel: '圭亚那' },
{ dictValue: 'HTI', dictLabel: '海地' },
{ dictValue: 'HMD', dictLabel: '赫德岛和麦克唐纳群岛' },
{ dictValue: 'VAT', dictLabel: '梵蒂冈' },
{ dictValue: 'HND', dictLabel: '洪都拉斯' },
{ dictValue: 'HUN', dictLabel: '匈牙利' },
{ dictValue: 'ISL', dictLabel: '冰岛' },
{ dictValue: 'IND', dictLabel: '印度' },
{ dictValue: 'IDN', dictLabel: '印度尼西亚' },
{ dictValue: 'IRN', dictLabel: '伊朗' },
{ dictValue: 'IRQ', dictLabel: '伊拉克' },
{ dictValue: 'IRL', dictLabel: '爱尔兰' },
{ dictValue: 'IMN', dictLabel: '马恩岛' },
{ dictValue: 'ISR', dictLabel: '以色列' },
{ dictValue: 'ITA', dictLabel: '意大利' },
{ dictValue: 'JAM', dictLabel: '牙买加' },
{ dictValue: 'JPN', dictLabel: '日本' },
{ dictValue: 'JEY', dictLabel: '泽西岛' },
{ dictValue: 'JOR', dictLabel: '约旦' },
{ dictValue: 'KAZ', dictLabel: '哈萨克斯坦' },
{ dictValue: 'KEN', dictLabel: '肯尼亚' },
{ dictValue: 'KIR', dictLabel: '基里巴斯' },
{ dictValue: 'PRK', dictLabel: '朝鲜' },
{ dictValue: 'KOR', dictLabel: '韩国' },
{ dictValue: 'KWT', dictLabel: '科威特' },
{ dictValue: 'KGZ', dictLabel: '吉尔吉斯斯坦' },
{ dictValue: 'LAO', dictLabel: '老挝' },
{ dictValue: 'LVA', dictLabel: '拉脱维亚' },
{ dictValue: 'LBN', dictLabel: '黎巴嫩' },
{ dictValue: 'LSO', dictLabel: '莱索托' },
{ dictValue: 'LBR', dictLabel: '利比里亚' },
{ dictValue: 'LBY', dictLabel: '利比亚' },
{ dictValue: 'LIE', dictLabel: '列支敦士登' },
{ dictValue: 'LTU', dictLabel: '立陶宛' },
{ dictValue: 'LUX', dictLabel: '卢森堡' },
{ dictValue: 'MKD', dictLabel: '前南马其顿' },
{ dictValue: 'MDG', dictLabel: '马达加斯加' },
{ dictValue: 'MWI', dictLabel: '马拉维' },
{ dictValue: 'MYS', dictLabel: '马来西亚' },
{ dictValue: 'MDV', dictLabel: '马尔代夫' },
{ dictValue: 'MLI', dictLabel: '马里' },
{ dictValue: 'MLT', dictLabel: '马耳他' },
{ dictValue: 'MHL', dictLabel: '马绍尔群岛' },
{ dictValue: 'MTQ', dictLabel: '马提尼克' },
{ dictValue: 'MRT', dictLabel: '毛里塔尼亚' },
{ dictValue: 'MUS', dictLabel: '毛里求斯' },
{ dictValue: 'MYT', dictLabel: '马约特' },
{ dictValue: 'MEX', dictLabel: '墨西哥' },
{ dictValue: 'FSM', dictLabel: '密克罗尼西亚联邦' },
{ dictValue: 'MDA', dictLabel: '摩尔多瓦' },
{ dictValue: 'MCO', dictLabel: '摩纳哥' },
{ dictValue: 'MNG', dictLabel: '蒙古' },
{ dictValue: 'MSR', dictLabel: '蒙特塞拉特' },
{ dictValue: 'MAR', dictLabel: '摩洛哥' },
{ dictValue: 'MOZ', dictLabel: '莫桑比克' },
{ dictValue: 'MMR', dictLabel: '缅甸' },
{ dictValue: 'NAM', dictLabel: '纳米比亚' },
{ dictValue: 'NRU', dictLabel: '瑙鲁' },
{ dictValue: 'NPL', dictLabel: '尼泊尔' },
{ dictValue: 'NLD', dictLabel: '荷兰' },
{ dictValue: 'ANT', dictLabel: '荷属安的列斯' },
{ dictValue: 'NCL', dictLabel: '新喀里多尼亚' },
{ dictValue: 'NZL', dictLabel: '新西兰' },
{ dictValue: 'NIC', dictLabel: '尼加拉瓜' },
{ dictValue: 'NER', dictLabel: '尼日尔' },
{ dictValue: 'NGA', dictLabel: '尼日利亚' },
{ dictValue: 'NIU', dictLabel: '纽埃' },
{ dictValue: 'NFK', dictLabel: '诺福克岛' },
{ dictValue: 'MNP', dictLabel: '北马里亚纳' },
{ dictValue: 'NOR', dictLabel: '挪威' },
{ dictValue: 'OMN', dictLabel: '阿曼' },
{ dictValue: 'PAK', dictLabel: '巴基斯坦' },
{ dictValue: 'PLW', dictLabel: '帕劳' },
{ dictValue: 'PSE', dictLabel: '巴勒斯坦' },
{ dictValue: 'PAN', dictLabel: '巴拿马' },
{ dictValue: 'PNG', dictLabel: '巴布亚新几内亚' },
{ dictValue: 'PRY', dictLabel: '巴拉圭' },
{ dictValue: 'PER', dictLabel: '秘鲁' },
{ dictValue: 'PHL', dictLabel: '菲律宾' },
{ dictValue: 'PCN', dictLabel: '皮特凯恩群岛' },
{ dictValue: 'POL', dictLabel: '波兰' },
{ dictValue: 'PRT', dictLabel: '葡萄牙' },
{ dictValue: 'PRI', dictLabel: '波多黎各' },
{ dictValue: 'QAT', dictLabel: '卡塔尔' },
{ dictValue: 'REU', dictLabel: '留尼汪' },
{ dictValue: 'ROM', dictLabel: '罗马尼亚' },
{ dictValue: 'RUS', dictLabel: '俄罗斯联邦' },
{ dictValue: 'RWA', dictLabel: '卢旺达' },
{ dictValue: 'SHN', dictLabel: '圣赫勒拿' },
{ dictValue: 'KNA', dictLabel: '圣基茨和尼维斯' },
{ dictValue: 'LCA', dictLabel: '圣卢西亚' },
{ dictValue: 'SPM', dictLabel: '圣皮埃尔和密克隆' },
{ dictValue: 'VCT', dictLabel: '圣文森特和格林纳丁斯' },
{ dictValue: 'WSM', dictLabel: '萨摩亚' },
{ dictValue: 'SMR', dictLabel: '圣马力诺' },
{ dictValue: 'STP', dictLabel: '圣多美和普林西比' },
{ dictValue: 'SAU', dictLabel: '沙特阿拉伯' },
{ dictValue: 'SEN', dictLabel: '塞内加尔' },
{ dictValue: 'SYC', dictLabel: '塞舌尔' },
{ dictValue: 'SLE', dictLabel: '塞拉利昂' },
{ dictValue: 'SGP', dictLabel: '新加坡' },
{ dictValue: 'SVK', dictLabel: '斯洛伐克' },
{ dictValue: 'SVN', dictLabel: '斯洛文尼亚' },
{ dictValue: 'SLB', dictLabel: '所罗门群岛' },
{ dictValue: 'SOM', dictLabel: '索马里' },
{ dictValue: 'ZAF', dictLabel: '南非' },
{ dictValue: 'SGS', dictLabel: '南乔治亚岛和南桑威奇群岛' },
{ dictValue: 'ESP', dictLabel: '西班牙' },
{ dictValue: 'LKA', dictLabel: '斯里兰卡' },
{ dictValue: 'SDN', dictLabel: '苏丹' },
{ dictValue: 'SUR', dictLabel: '苏里南' },
{ dictValue: 'SJM', dictLabel: '斯瓦尔巴群岛和扬马延岛' },
{ dictValue: 'SWZ', dictLabel: '斯威士兰' },
{ dictValue: 'SWE', dictLabel: '瑞典' },
{ dictValue: 'CHE', dictLabel: '瑞士' },
{ dictValue: 'SYR', dictLabel: '叙利亚' },
{ dictValue: 'TWN', dictLabel: '台湾' },
{ dictValue: 'TJK', dictLabel: '塔吉克斯坦' },
{ dictValue: 'TZA', dictLabel: '坦桑尼亚' },
{ dictValue: 'THA', dictLabel: '泰国' },
{ dictValue: 'TGO', dictLabel: '多哥' },
{ dictValue: 'TKL', dictLabel: '托克劳' },
{ dictValue: 'TON', dictLabel: '汤加' },
{ dictValue: 'TTO', dictLabel: '特立尼达和多巴哥' },
{ dictValue: 'TUN', dictLabel: '突尼斯' },
{ dictValue: 'TUR', dictLabel: '土耳其' },
{ dictValue: 'TKM', dictLabel: '土库曼斯坦' },
{ dictValue: 'TCA', dictLabel: '特克斯和凯科斯群岛' },
{ dictValue: 'TUV', dictLabel: '图瓦卢' },
{ dictValue: 'UGA', dictLabel: '乌干达' },
{ dictValue: 'UKR', dictLabel: '乌克兰' },
{ dictValue: 'ARE', dictLabel: '阿联酋' },
{ dictValue: 'GBR', dictLabel: '英国' },
{ dictValue: 'USA', dictLabel: '美国' },
{ dictValue: 'UMI', dictLabel: '美国本土外小岛屿' },
{ dictValue: 'URY', dictLabel: '乌拉圭' },
{ dictValue: 'UZB', dictLabel: '乌兹别克斯坦' },
{ dictValue: 'VUT', dictLabel: '瓦努阿图' },
{ dictValue: 'VEN', dictLabel: '委内瑞拉' },
{ dictValue: 'VNM', dictLabel: '越南' },
{ dictValue: 'VGB', dictLabel: '英属维尔京群岛' },
{ dictValue: 'VIR', dictLabel: '美属维尔京群岛' },
{ dictValue: 'WLF', dictLabel: '瓦利斯和富图纳' },
{ dictValue: 'ESH', dictLabel: '西撒哈拉' },
{ dictValue: 'YEM', dictLabel: '也门' },
{ dictValue: 'ZMB', dictLabel: '赞比亚' },
{ dictValue: 'ZWE', dictLabel: '津巴布韦' }
];
countryDict = mockCountries;
console.log('使用与nat_regn_code字典一致的模拟数据共生成:', countryDict.length, '条国家地区代码数据');
// 提示管理员检查数据库中的国家地区代码数据
console.warn('提示: 请检查数据库中的sys_dict_type和sys_dict_data表确保存在nat_regn_code类型的完整国家地区代码数据');
}
// 确保有足够的数据
console.log('最终获取到的国家地区代码数据数量:', countryDict.length);
// 转换为统一格式
const formattedCountries = countryDict.map(item => ({
value: item.value || item.dictValue || item.code || '', // 使用字典键值或编码
label: item.label || item.dictLabel || item.name || '' // 使用字典标签
}));
// 数据去重根据value字段去重
const uniqueCountries = [];
const valueSet = new Set();
formattedCountries.forEach(item => {
if (item.value && !valueSet.has(item.value)) {
valueSet.add(item.value);
uniqueCountries.push(item);
}
});
console.log('去重后的数据数量:', uniqueCountries.length);
// 按字典编码升序排序
const sortedCountries = uniqueCountries.sort((a, b) => {
// 获取字典编码
const codeA = a.value || '';
const codeB = b.value || '';
// 按字典编码字符串升序排序
return codeA.localeCompare(codeB);
});
countryCodeList.value = sortedCountries;
// 确保中国是第一个选项(如果存在)
const chinaIndex = countryCodeList.value.findIndex(item => item.label === '中国');
if (chinaIndex > 0) {
// 将中国选项移到数组开头
const chinaOption = countryCodeList.value.splice(chinaIndex, 1)[0];
countryCodeList.value.unshift(chinaOption);
}
// 设置中国为默认值(查找标签为'中国'的选项)
const chinaOption = countryCodeList.value.find(item => item.label === '中国');
if (chinaOption && !form.value.countryCode) {
form.value.countryCode = chinaOption.value;
}
console.log('最终处理后的国家地区代码选项数量:', countryCodeList.value.length);
console.log('前5个国家地区代码选项:', countryCodeList.value.slice(0, 5));
} catch (error) {
console.error('获取国家地区代码字典数据失败:', error);
// 改进的降级方案:提供更完整的默认选项
countryCodeList.value = [
{ value: 'CHN', label: '中国' },
{ value: 'USA', label: '美国' },
{ value: 'JPN', label: '日本' },
{ value: 'KOR', label: '韩国' },
{ value: 'GBR', label: '英国' },
{ value: 'FRA', label: '法国' },
{ value: 'DEU', label: '德国' },
{ value: 'CAN', label: '加拿大' },
{ value: 'AUS', label: '澳大利亚' },
{ value: 'RUS', label: '俄罗斯' }
];
// 设置中国为默认值
if (!form.value.countryCode) {
form.value.countryCode = 'CHN';
}
// 显示错误提示,提醒用户检查系统配置
if (proxy && proxy.modal && proxy.modal.msgError) {
proxy.modal.msgError('获取国家地区代码数据失败,请联系系统管理员');
}
}
};
// 显示弹框
function show() {
// queryParams.roleId = props.roleId;
getList();
// 调用从字典管理获取性别数据的函数
getGenderOptions();
// 调用从字典管理获取文化程度数据的函数
getEducationLevelOptions();
// 调用从字典管理获取国家地区代码数据的函数
getCountryCodeOptions();
// 调用从字典管理获取患者来源数据的函数
getPatientDerivedOptions();
visible.value = true;
}

View File

@@ -338,18 +338,19 @@ const handleCurrentChange = (newPage) => {
total.value = response.data.total || 0
selectedPatient.value = null // 查询时重置选中状态
// 如果只有一条记录且是第一页,自动选中
if (response.data.records.length === 1 && currentPage.value === 1) {
const patient = response.data.records[0]
// 确保patient对象中同时包含id和patientId字段
if (patient.id && !patient.patientId) {
patient.patientId = patient.id;
}
// 设置为选中状态,但不自动确认
selectedPatient.value = patient
ElMessage.warning('已自动选中唯一患者,请点击确定')
} else {
// 如果只有一条记录且是第一页,自动选中并展示到页面
if (response.data.records.length === 1 && currentPage.value === 1) {
const patient = response.data.records[0]
// 确保patient对象中同时包含id和patientId字段
if (patient.id && !patient.patientId) {
patient.patientId = patient.id;
}
// 设置为选中状态自动确认,将患者信息展示到页面
selectedPatient.value = patient
confirmSelectPatient() // 自动调用确认选择方法,将患者信息展示到页面
ElMessage.success('已自动选中唯一患者')
} else {
// 如果有多条记录或不是第一页,显示患者列表供选择
// 确保每条患者记录都包含patientId字段优先使用id字段
patientList.value = response.data.records.map(patient => ({
@@ -492,16 +493,7 @@ const handleKeydown = (event) => {
onMounted(() => {
document.addEventListener('keydown', handleKeydown)
// 设置默认患者数据,方便用户直接进行换卡操作
patientInfo.value = {
outpatientNo: '20231001001',
patientName: '张三',
idCard: '110101199001011234',
phoneNumber: '13800138000',
gender: '男',
age: '33岁',
patientId: '1001'
}
// 初始化患者信息为空
})
// 组件卸载时移除键盘事件监听

View File

@@ -8,17 +8,24 @@
</div>
<!-- 可滚动的内容区域 -->
<div class="prescription-scroll-container" style="flex: 1; overflow-y: auto; overflow-x: hidden; max-height: calc(100vh - 300px);">
<div class="prescription-scroll-container" style="flex: 1; overflow-y: auto; overflow-x: auto; max-height: calc(100vh - 300px); width: 100%;">
<!-- 循环显示所有西药方 -->
<div v-for="(prescription, pIndex) in westernPrescriptions" :key="prescription.id" style="margin-bottom: 20px; border: 1px solid #e4e7ed; border-radius: 8px; padding: 10px;">
<div v-for="(prescription, pIndex) in westernPrescriptions" :key="prescription.id" style="margin-bottom: 20px; border: 1px solid #e4e7ed; border-radius: 8px; padding: 10px; min-width: fit-content;">
<!-- 西药方标题栏 -->
<div style="margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; background: #f5f7fa; padding: 10px 12px; border-radius: 4px;">
<span style="font-weight: 600; font-size: 14px; color: #409eff;">{{ prescription.name }}</span>
<el-button type="danger" plain size="small" @click="handleClosePrescription(prescription.id)">删除</el-button>
<div class="prescription-header" style="margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; background: #f5f7fa; padding: 10px 12px; border-radius: 4px; min-height: 40px; width: 100%; box-sizing: border-box; position: relative;">
<span style="font-weight: 600; font-size: 14px; color: #409eff; flex: 0 0 auto;">{{ prescription.name }}</span>
<el-button
type="danger"
size="small"
@click="handleClosePrescription(prescription.id)"
style="flex: 0 0 auto; margin-left: 10px;"
>
删除
</el-button>
</div>
<!-- 西药方操作区 -->
<div style="margin-bottom: 5px">
<div style="margin-bottom: 5px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px;">
<el-button type="primary" @click="handleAddPrescription(prescription.id)" :disabled="false">
新增
</el-button>
@@ -44,6 +51,9 @@
<el-button type="default" @click="combination(prescription.id)" :disabled="false"> 组合 </el-button>
<el-button type="default" @click="split(prescription.id)" :disabled="false"> 拆组 </el-button>
<el-button type="danger" plain @click="handleDelete(prescription.id)" :disabled="false"> 删除 </el-button>
<el-button type="primary" @click="refresh(prescription.id)" :disabled="false">
刷新
</el-button>
<span class="descriptions-item-label"> 诊断 </span>
<el-select v-model="prescription.conditionDefinitionId" placeholder="诊断" style="width: 180px" @change="handleDiagnosisChange(prescription.conditionDefinitionId, prescription.id)">
<el-option
@@ -65,9 +75,6 @@
<span class="descriptions-item-label">
合计金额{{ getPrescriptionTotalAmount(prescription.id) }}
</span>
<el-button type="primary" style="float: right" @click="refresh(prescription.id)" :disabled="false">
刷新
</el-button>
</div>
<el-table
max-height="400"
@@ -79,6 +86,7 @@
@row-dblclick="(row, event) => clickRowDb(row, event, prescription.id)"
v-loading="loading"
:expand-row-keys="prescription.expandOrder || []"
style="width: 100%; min-width: 100%;"
>
<el-table-column type="expand" width="1" style="width: 0">
<template #default="scope">
@@ -976,7 +984,7 @@ import {
getActivityBindDevice,
} from '../api';
import adviceBaseList from '../adviceBaseList.vue';
import { computed, getCurrentInstance, nextTick, watch, unref } from 'vue';
import { computed, getCurrentInstance, nextTick, watch, unref, reactive } from 'vue';
import { calculateQuantityByDays, formatNumber } from '@/utils/his';
import OrderGroupDrawer from './orderGroupDrawer';
import PrescriptionHistory from './prescriptionHistory';
@@ -1446,16 +1454,40 @@ function getListInfo(addNewRow) {
}
function getDiagnosisInfo() {
getEncounterDiagnosis(props.patientInfo.encounterId).then((res) => {
diagnosisList.value = res.data;
if (!props.patientInfo || !props.patientInfo.encounterId) {
console.warn('患者信息不完整,无法获取诊断信息');
return Promise.resolve({ data: [] });
}
return getEncounterDiagnosis(props.patientInfo.encounterId).then((res) => {
console.log('getDiagnosisInfo - API返回结果:', res);
const diagnosisData = res.data || res || [];
diagnosisList.value = Array.isArray(diagnosisData) ? diagnosisData : [];
console.log('getDiagnosisInfo - 诊断列表已更新:', diagnosisList.value);
let diagnosisInfo = diagnosisList.value.filter((item) => {
return item.maindiseFlag == 1;
});
diagnosisInfo.value = diagnosisInfo[0];
conditionDefinitionId.value = diagnosisInfo[0].definitionId;
conditionId.value = diagnosisInfo[0].conditionId;
encounterDiagnosisId.value = diagnosisInfo[0].encounterDiagnosisId;
diagnosisName.value = diagnosisInfo[0].name;
if (diagnosisInfo.length > 0) {
diagnosisInfo.value = diagnosisInfo[0];
conditionDefinitionId.value = diagnosisInfo[0].definitionId;
conditionId.value = diagnosisInfo[0].conditionId;
encounterDiagnosisId.value = diagnosisInfo[0].encounterDiagnosisId;
diagnosisName.value = diagnosisInfo[0].name;
console.log('getDiagnosisInfo - 已设置主诊断:', diagnosisInfo[0]);
} else if (diagnosisList.value.length > 0) {
// 如果没有主诊断,使用第一个诊断
conditionDefinitionId.value = diagnosisList.value[0].definitionId;
conditionId.value = diagnosisList.value[0].conditionId;
encounterDiagnosisId.value = diagnosisList.value[0].encounterDiagnosisId;
diagnosisName.value = diagnosisList.value[0].name;
console.log('getDiagnosisInfo - 已设置第一个诊断:', diagnosisList.value[0]);
}
return res;
}).catch((error) => {
console.error('获取诊断信息失败:', error);
diagnosisList.value = [];
return { data: [] };
});
}
@@ -3210,23 +3242,147 @@ function validateGroups(saveList) {
/**
* 新增西药处方
* 自动引入诊断和费用性质
*/
function handleAddWesternPrescription() {
async function handleAddWesternPrescription() {
// 检查患者信息是否完整
if (!props.patientInfo || !props.patientInfo.encounterId) {
proxy.$modal.msgWarning('患者信息不完整,无法创建处方');
return;
}
prescriptionCounter.value++;
const newPrescriptionId = `prescription_${Date.now()}_${prescriptionCounter.value}`;
const newPrescription = {
// 如果诊断列表为空,先加载诊断信息
if (!diagnosisList.value || diagnosisList.value.length === 0) {
try {
const diagnosisRes = await getDiagnosisInfo();
console.log('诊断信息加载完成:', diagnosisRes);
// 确保诊断列表已更新
if (diagnosisRes && diagnosisRes.data) {
diagnosisList.value = diagnosisRes.data || [];
}
} catch (error) {
console.error('加载诊断信息失败:', error);
// 即使加载失败,也继续创建处方,只是不自动引入诊断
}
}
// 如果费用性质列表为空,先加载费用性质信息
if (!contractList.value || contractList.value.length === 0) {
try {
const res = await getContract({ encounterId: props.patientInfo.encounterId });
console.log('费用性质信息加载完成:', res);
if (res && res.data) {
contractList.value = res.data;
}
} catch (error) {
console.error('加载费用性质失败:', error);
// 即使加载失败,也继续创建处方,只是不自动引入费用性质
}
}
// 再次确认数据已加载
console.log('数据加载检查 - 诊断列表:', diagnosisList.value?.length || 0, diagnosisList.value);
console.log('数据加载检查 - 费用性质列表:', contractList.value?.length || 0, contractList.value);
// 自动引入诊断:优先使用全局变量,否则从诊断列表中获取第一个主诊断,再否则获取第一个诊断
let autoConditionDefinitionId = conditionDefinitionId.value;
console.log('自动引入诊断 - 当前全局诊断ID:', autoConditionDefinitionId);
console.log('自动引入诊断 - 诊断列表:', diagnosisList.value);
if (!autoConditionDefinitionId && diagnosisList.value && diagnosisList.value.length > 0) {
// 优先获取主诊断
const mainDiagnosis = diagnosisList.value.find(item => item.maindiseFlag == 1);
if (mainDiagnosis) {
autoConditionDefinitionId = mainDiagnosis.definitionId;
console.log('自动引入诊断 - 找到主诊断:', mainDiagnosis);
// 同时更新全局变量
conditionDefinitionId.value = autoConditionDefinitionId;
conditionId.value = mainDiagnosis.conditionId;
encounterDiagnosisId.value = mainDiagnosis.encounterDiagnosisId;
diagnosisName.value = mainDiagnosis.name;
} else {
// 如果没有主诊断,使用第一个诊断
autoConditionDefinitionId = diagnosisList.value[0].definitionId;
console.log('自动引入诊断 - 使用第一个诊断:', diagnosisList.value[0]);
// 同时更新全局变量
conditionDefinitionId.value = autoConditionDefinitionId;
conditionId.value = diagnosisList.value[0].conditionId;
encounterDiagnosisId.value = diagnosisList.value[0].encounterDiagnosisId;
diagnosisName.value = diagnosisList.value[0].name;
}
} else if (!autoConditionDefinitionId) {
console.warn('自动引入诊断 - 无法自动引入:诊断列表为空或全局变量未设置');
}
// 自动引入费用性质:优先使用全局变量,否则从费用性质列表中获取第一个,再否则使用患者信息中的费用性质
let autoAccountId = accountId.value;
console.log('自动引入费用性质 - 当前全局费用性质ID:', autoAccountId);
console.log('自动引入费用性质 - 费用性质列表:', contractList.value);
console.log('自动引入费用性质 - 患者信息中的费用性质:', props.patientInfo?.accountId);
if (!autoAccountId) {
if (contractList.value && contractList.value.length > 0) {
autoAccountId = contractList.value[0].accountId;
console.log('自动引入费用性质 - 从列表获取:', contractList.value[0]);
// 同时更新全局变量
accountId.value = autoAccountId;
} else if (props.patientInfo && props.patientInfo.accountId) {
autoAccountId = props.patientInfo.accountId;
console.log('自动引入费用性质 - 从患者信息获取:', autoAccountId);
// 同时更新全局变量
accountId.value = autoAccountId;
} else {
console.warn('自动引入费用性质 - 无法自动引入:费用性质列表为空且患者信息中也没有');
}
}
// 创建处方对象,确保诊断和费用性质被正确设置
const newPrescription = reactive({
id: newPrescriptionId,
name: `西药方${prescriptionCounter.value}`,
prescriptionNo: '', // 处方单号码,保存时由后端生成
conditionDefinitionId: conditionDefinitionId.value, // 诊断
accountId: accountId.value, // 费用性质
conditionDefinitionId: autoConditionDefinitionId || undefined, // 诊断(自动引入)
accountId: autoAccountId || undefined, // 费用性质(自动引入)
expandOrder: [], // 展开的行
};
});
westernPrescriptions.value.push(newPrescription);
allPrescriptionsData.value[newPrescriptionId] = []; // 初始化空数据
console.log('新增西药处方:', newPrescription);
console.log('新增西药处方完成:', {
prescriptionId: newPrescriptionId,
prescription: newPrescription,
autoConditionDefinitionId: autoConditionDefinitionId,
autoAccountId: autoAccountId,
diagnosisListLength: diagnosisList.value?.length || 0,
contractListLength: contractList.value?.length || 0,
diagnosisList: diagnosisList.value,
contractList: contractList.value
});
// 使用 nextTick 确保 Vue 响应式更新,然后再次检查并更新处方对象
await nextTick();
// 确保处方对象中的诊断和费用性质已正确设置(使用响应式对象直接更新)
if (autoConditionDefinitionId) {
newPrescription.conditionDefinitionId = autoConditionDefinitionId;
console.log('已设置诊断ID到处方对象:', autoConditionDefinitionId);
}
if (autoAccountId) {
newPrescription.accountId = autoAccountId;
console.log('已设置费用性质ID到处方对象:', autoAccountId);
}
// 再次等待一个tick确保视图更新
await nextTick();
console.log('最终处方对象:', {
id: newPrescription.id,
conditionDefinitionId: newPrescription.conditionDefinitionId,
accountId: newPrescription.accountId
});
}
/**
@@ -3290,24 +3446,60 @@ function updateExpandOrder(keys) {
}
/**
* 关闭处方
* 关闭处方(删除西药方)
* 控制规则:
* 1. 西药方有已保存的数据不能删除
* 2. 西药方已签发和已收费不能删除
* 3. 西药方只有在待保存和无数据的情况才能删除
*/
function handleClosePrescription(prescriptionId) {
// 检查该处方是否有数据
const prescriptionData = allPrescriptionsData.value[prescriptionId] || [];
const hasData = prescriptionData.length > 0;
if (hasData) {
// 如果有数据,提示用户确认
proxy.$modal.confirm('该处方包含数据,确定要关闭吗?').then(() => {
doClosePrescription(prescriptionId);
}).catch(() => {
console.log('取消关闭处方');
});
} else {
// 如果没有数据,直接关闭
if (!hasData) {
// 如果有数据,直接删除
doClosePrescription(prescriptionId);
return;
}
// 检查是否有已保存的数据statusEnum == 1 && (requestId || isSaved)
const hasSavedData = prescriptionData.some(item => {
return item.statusEnum == 1 && (item.requestId || item.isSaved);
});
if (hasSavedData) {
proxy.$modal.msgWarning('西药方有已保存的数据,不能删除');
return;
}
// 检查是否有已签发的数据statusEnum == 2
const hasIssuedData = prescriptionData.some(item => {
return item.statusEnum == 2;
});
if (hasIssuedData) {
proxy.$modal.msgWarning('西药方已签发,不能删除');
return;
}
// 检查是否有已收费的数据chargeStatus == 5 表示已收费)
const hasChargedData = prescriptionData.some(item => {
return item.chargeStatus == 5;
});
if (hasChargedData) {
proxy.$modal.msgWarning('西药方已收费,不能删除');
return;
}
// 如果所有数据都是待保存状态statusEnum == 1 && !requestId && !isSaved或无数据可以删除
// 提示用户确认
proxy.$modal.confirm('确定要删除该西药方吗?').then(() => {
doClosePrescription(prescriptionId);
}).catch(() => {
console.log('取消删除西药方');
});
}
/**
@@ -3435,14 +3627,19 @@ defineExpose({ getListInfo, getDiagnosisInfo, getSignedPrescriptionInfo });
margin-bottom: 0px;
}
/* 优化滚动条样式 */
/* 优化滚动条样式 - 支持水平和垂直滚动 */
.prescription-scroll-container {
scrollbar-width: thin;
scrollbar-color: #c1c1c1 #f1f1f1;
/* 确保内容可以超出容器宽度,触发水平滚动 */
overflow-x: auto;
overflow-y: auto;
}
/* 垂直滚动条样式 */
.prescription-scroll-container::-webkit-scrollbar {
width: 8px;
height: 8px;
}
.prescription-scroll-container::-webkit-scrollbar-track {
@@ -3458,4 +3655,32 @@ defineExpose({ getListInfo, getDiagnosisInfo, getSignedPrescriptionInfo });
.prescription-scroll-container::-webkit-scrollbar-thumb:hover {
background: #a8a8a8;
}
/* 水平滚动条样式 */
.prescription-scroll-container::-webkit-scrollbar:horizontal {
height: 8px;
}
/* 确保表格可以水平滚动 */
.prescription-scroll-container .el-table {
min-width: 100%;
}
.prescription-scroll-container .el-table__body-wrapper {
overflow-x: auto;
}
/* 确保标题栏删除按钮可见 */
.prescription-header {
position: relative;
z-index: 1;
}
.prescription-header .el-button {
position: relative;
z-index: 10;
visibility: visible !important;
display: inline-block !important;
opacity: 1 !important;
}
</style>

View File

@@ -0,0 +1,643 @@
<template>
<div class="package-management">
<!-- 左侧导航栏 -->
<nav class="sidebar" :class="{ active: sidebarActive }">
<div class="sidebar-item" @click="navigateToTab(0)">检验类型</div>
<div class="sidebar-item" @click="navigateToTab(1)">检验项目</div>
<div class="sidebar-item active" @click="navigateToTab(2)">套餐设置</div>
</nav>
<!-- 主内容区域 -->
<main class="content">
<!-- 导航切换按钮响应式 -->
<div class="menu-toggle" @click="toggleSidebar">
<i class="fas fa-bars"></i>
</div>
<!-- 查询过滤区域 -->
<section class="filter-bar">
<div class="filter-item">
<label>日期</label>
<input type="date" v-model="searchParams.startDate" placeholder="开始日期">
<span></span>
<input type="date" v-model="searchParams.endDate" placeholder="结束日期">
</div>
<div class="filter-item">
<label>卫生机构</label>
<select>
<option>演示医院</option>
</select>
</div>
<div class="filter-item">
<label>套餐名称</label>
<input type="text" v-model="searchParams.packageName" placeholder="套餐名称">
</div>
<div class="filter-item">
<label>套餐级别</label>
<select v-model="searchParams.packageLevel">
<option value="">请选择套餐级别</option>
<option value="全院套餐">全院套餐</option>
<option value="科室套餐">科室套餐</option>
<option value="个人套餐">个人套餐</option>
</select>
</div>
<div class="filter-item">
<label>套餐类别</label>
<select>
<option>检验套餐</option>
</select>
</div>
<div class="filter-item">
<label>科室</label>
<select>
<option value="">请选择科室</option>
<option value="内科">内科</option>
<option value="儿科">儿科</option>
<option value="外科">外科</option>
<option value="妇科">妇科</option>
</select>
</div>
<div class="filter-item">
<label>用户</label>
<select></select>
</div>
<!-- 操作按钮组 -->
<div class="button-group">
<button class="btn btn-search" @click="handleSearch"><i class="fas fa-search" style="margin-right: 6px;"></i>查询</button>
<button class="btn btn-reset" @click="handleReset"><i class="fas fa-redo" style="margin-right: 6px;"></i>重置</button>
<button class="btn btn-primary" @click="handleAdd"><i class="fas fa-plus" style="margin-right: 6px;"></i>新增</button>
<button class="btn btn-export" @click="handleExport"><i class="fas fa-download" style="margin-right: 6px;"></i>导出</button>
<button class="btn btn-copy" @click="returnToPackageSetup"><i class="fas fa-arrow-left" style="margin-right: 6px;"></i>返回</button>
</div>
</section>
<!-- 表格区域 -->
<section class="table-container">
<table>
<thead>
<tr>
<th>ID</th>
<th>卫生机构</th>
<th>日期</th>
<th>套餐名称</th>
<th>套餐类别</th>
<th>套餐级别</th>
<th>科室</th>
<th>用户</th>
<th class="text-right">金额</th>
<th class="text-right">服务费</th>
<th class="text-right">总金额</th>
<th>组合套餐</th>
<th>显示套餐名</th>
<th>启用标志</th>
<th>操作人</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr v-for="item in filteredData" :key="item.id">
<td>{{ item.id }}</td>
<td>{{ item.hospital }}</td>
<td>{{ item.date }}</td>
<td>{{ item.name }}</td>
<td>{{ item.type }}</td>
<td>{{ item.level }}</td>
<td>{{ item.dept || '-' }}</td>
<td>{{ item.user || '-' }}</td>
<td class="text-right">{{ item.amount.toFixed(2) }}</td>
<td class="text-right">{{ item.fee.toFixed(2) }}</td>
<td class="text-right">{{ item.total.toFixed(2) }}</td>
<td><span class="status-tag" :class="item.combined === '是' ? 'status-no' : 'status-yes'">{{ item.combined }}</span></td>
<td><span class="status-tag" :class="item.display === '是' ? 'status-yes' : 'status-no'">{{ item.display }}</span></td>
<td><span class="status-tag" :class="item.enabled === '是' ? 'status-yes' : 'status-no'">{{ item.enabled }}</span></td>
<td>{{ item.operator }}</td>
<td>
<div class="action-icons">
<el-button type="text" @click="handleEdit(item)"><el-icon><Edit /></el-icon></el-button>
<el-button type="text" @click="handleView(item)"><el-icon><View /></el-icon></el-button>
<el-button type="text" @click="handleDelete(item)"><el-icon><Delete /></el-icon></el-button>
</div>
</td>
</tr>
</tbody>
</table>
</section>
<!-- 分页组件 -->
<div class="pagination">
<button class="page-btn">&lt;</button>
<button class="page-btn active">1</button>
<button class="page-btn">2</button>
<button class="page-btn">3</button>
<button class="page-btn">...</button>
<button class="page-btn">10</button>
<button class="page-btn">&gt;</button>
<div class="total-count">总数{{ filteredData.length }}</div>
</div>
</main>
</div>
</template>
<script setup>
import { ref, computed } from 'vue';
import { useRouter } from 'vue-router';
import { Edit, View, Delete } from '@element-plus/icons-vue';
// 创建路由实例
const router = useRouter();
// 侧边栏状态
const sidebarActive = ref(false);
// 表格数据
const tableData = ref([
{id: 2348, hospital: '演示医院', date: '2025-11-17', name: '血脂333', type: '检验套餐', level: '全院套餐', dept: '', user: '', amount: 40.00, fee: 0.00, total: 40.00, combined: '否', display: '是', enabled: '是', operator: '徐斌'},
{id: 2341, hospital: '演示医院', date: '2025-10-31', name: '病理检测', type: '检验套餐', level: '全院套餐', dept: '', user: '', amount: 50.00, fee: 0.00, total: 50.00, combined: '否', display: '是', enabled: '是', operator: '徐斌'},
{id: 2340, hospital: '演示医院', date: '2025-10-31', name: '肝功能', type: '检验套餐', level: '全院套餐', dept: '', user: '', amount: 31.00, fee: 0.00, total: 31.00, combined: '否', display: '是', enabled: '是', operator: '徐斌'},
{id: 2339, hospital: '演示医院', date: '2025-10-31', name: '风湿', type: '检验套餐', level: '全院套餐', dept: '', user: '', amount: 119.00, fee: 0.00, total: 119.00, combined: '否', display: '是', enabled: '是', operator: '徐斌'},
{id: 2338, hospital: '演示医院', date: '2025-10-31', name: '尿常规', type: '检验套餐', level: '全院套餐', dept: '', user: '', amount: 1.00, fee: 0.00, total: 1.00, combined: '否', display: '是', enabled: '是', operator: '徐斌'},
{id: 2297, hospital: '演示医院', date: '2025-04-30', name: '测试', type: '检验套餐', level: '全院套餐', dept: '', user: '', amount: 241.00, fee: 0.00, total: 241.00, combined: '否', display: '是', enabled: '否', operator: '徐斌'},
]);
// 获取当前日期的函数格式为YYYY-MM-DD
function getCurrentDate() {
const today = new Date();
const year = today.getFullYear();
const month = String(today.getMonth() + 1).padStart(2, '0');
const day = String(today.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
// 搜索参数
const searchParams = ref({
startDate: getCurrentDate(),
endDate: getCurrentDate(),
packageName: '',
packageLevel: ''
});
// 过滤后的数据
const filteredData = computed(() => {
return tableData.value.filter(item => {
// 日期筛选
if (searchParams.value.startDate && item.date < searchParams.value.startDate) return false;
if (searchParams.value.endDate && item.date > searchParams.value.endDate) return false;
// 套餐名称筛选
if (searchParams.value.packageName && !item.name.toLowerCase().includes(searchParams.value.packageName.toLowerCase())) return false;
// 套餐级别筛选
if (searchParams.value.packageLevel && item.level !== searchParams.value.packageLevel) return false;
return true;
});
});
// 返回套餐设置主界面
function returnToPackageSetup() {
router.push('/maintainSystem/Inspection?tab=2');
}
// 导航到指定标签页
function navigateToTab(tabIndex) {
router.push(`/maintainSystem/Inspection?tab=${tabIndex}`);
}
// 切换侧边栏
function toggleSidebar() {
sidebarActive.value = !sidebarActive.value;
}
// 处理查询
function handleSearch() {
// 过滤逻辑已在computed属性中实现
}
// 处理重置
function handleReset() {
searchParams.value = {
startDate: getCurrentDate(),
endDate: getCurrentDate(),
packageName: '',
packageLevel: ''
};
}
// 处理新增
function handleAdd() {
router.push('/maintainSystem/Inspection?tab=2');
}
// 处理编辑
function handleEdit(item) {
alert(`准备编辑套餐:${item.name}\n数据已加载至编辑表单套餐设置主界面`);
}
// 处理查看
function handleView(item) {
alert(`准备查看套餐:${item.name}\n数据已加载至查看表单套餐设置主界面`);
}
// 处理删除
function handleDelete(item) {
if (confirm(`确定要删除套餐 "${item.name}" 吗?`)) {
const index = tableData.value.findIndex(i => i.id === item.id);
if (index !== -1) {
tableData.value.splice(index, 1);
alert(`套餐 "${item.name}" 已删除`);
}
}
}
// 处理导出
function handleExport() {
// 获取当前筛选后的数据
const dataToExport = filteredData.value;
// 转换为CSV格式
const csvContent = convertToCSV(dataToExport);
// 创建下载链接
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.setAttribute('href', url);
link.setAttribute('download', `套餐数据_${new Date().toISOString().slice(0,10)}.csv`);
link.style.visibility = 'hidden';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
// 将数据转换为CSV格式的函数
function convertToCSV(data) {
if (data.length === 0) return '';
// 获取表头
const headers = Object.keys(data[0]);
// 构建CSV内容
let csv = headers.join(',') + '\n';
// 添加数据行
data.forEach(row => {
const values = headers.map(header => {
// 处理可能包含逗号的值
const value = row[header] === null || row[header] === undefined ? '' : row[header];
return `"${value.toString().replace(/"/g, '""')}"`;
});
csv += values.join(',') + '\n';
});
return csv;
}
</script>
<style>
:root {
--background: #FFFFFF;
--primary: #5C8DFF;
--primary-hover: #7DA3FF;
--text-primary: #333333;
--text-secondary: #666666;
--text-disabled: #CCCCCC;
--danger: #FF6B6B;
--border: #E0E0E0;
--header-bg: #F5F5F5;
--row-hover: #FAFAFA;
--table-border: #E8E8E8;
--sidebar-width: 200px;
--content-padding: 24px;
--secondary: #8E8E93;
--secondary-hover: #A7A7AB;
--success: #4CAF50;
--info: #2196F3;
--btn-search: #6c757d;
--btn-reset: #17a2b8;
--btn-add: #28a745;
--btn-export: #17a2b8;
--btn-copy: #6c757d;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
/* 移除body样式避免影响其他页面 */
.package-management {
display: flex;
height: 100vh;
background-color: var(--background);
color: var(--text-primary);
overflow: hidden;
}
/* 左侧导航栏 */
.sidebar {
width: var(--sidebar-width);
background-color: var(--background);
border-right: 1px solid var(--border);
height: 100%;
display: flex;
flex-direction: column;
}
.sidebar-item {
padding: 16px 24px;
font-size: 14px;
color: var(--text-primary);
cursor: pointer;
transition: all 0.2s;
display: flex;
align-items: center;
}
.sidebar-item:hover {
background-color: #f0f8ff;
}
.sidebar-item.active {
background-color: var(--primary);
color: white;
}
/* 主内容区域 */
.content {
flex: 1;
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
}
/* 查询过滤栏 */
.filter-bar {
padding: 16px var(--content-padding);
border-bottom: 1px solid var(--border);
display: flex;
flex-wrap: wrap;
gap: 12px;
align-items: center;
}
.filter-item {
display: flex;
align-items: center;
gap: 8px;
}
.filter-item label {
font-size: 14px;
color: var(--text-secondary);
white-space: nowrap;
}
input, select {
height: 32px;
border-radius: 4px;
border: 1px solid var(--border);
padding: 0 8px;
font-size: 14px;
min-width: 120px;
}
input:focus, select:focus {
outline: none;
border-color: var(--primary);
}
/* 按钮样式 */
.btn {
padding: 6px 16px;
border-radius: 6px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
height: 36px;
display: inline-flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
border: none;
box-shadow: 0 1px 2px rgba(0,0,0,0.05);
min-width: 80px;
}
.btn-primary {
background-color: var(--primary);
color: white;
border: 1px solid var(--primary);
box-shadow: 0 2px 4px rgba(92, 141, 255, 0.2);
}
.btn-text {
background-color: #F5F7FA;
color: var(--secondary);
border: 1px solid var(--border);
}
.btn-search {
background-color: var(--btn-search);
color: white;
}
.btn-reset {
background-color: var(--btn-reset);
color: white;
}
.btn-export {
background-color: var(--btn-export);
color: white;
}
.btn-copy {
background-color: var(--btn-copy);
color: white;
}
.btn-text:hover {
background-color: #EBEEF2;
color: var(--text-primary);
border-color: var(--secondary-hover);
}
.btn-danger {
background-color: var(--danger);
color: white;
}
.btn:hover {
opacity: 0.9;
}
.btn-primary:hover {
background-color: var(--primary-hover);
border-color: var(--primary-hover);
}
.button-group {
display: flex;
gap: 12px;
margin-left: auto;
flex-wrap: wrap;
}
/* 表格区域 */
.table-container {
flex: 1;
overflow: auto;
padding: 0 var(--content-padding) var(--content-padding);
}
table {
width: 100%;
border-collapse: collapse;
font-size: 14px;
}
th, td {
padding: 8px;
text-align: left;
border-bottom: 1px solid var(--table-border);
}
th {
background-color: var(--header-bg);
font-weight: 500;
position: sticky;
top: 0;
}
tr:hover {
background-color: var(--row-hover);
}
.text-right {
text-align: right;
}
/* 状态标签 */
.status-tag {
padding: 0 8px;
border-radius: 2px;
font-size: 12px;
height: 20px;
display: inline-flex;
align-items: center;
justify-content: center;
}
.status-yes {
background-color: #f6ffed;
border: 1px solid #b7eb8f;
color: #389e0d;
}
.status-no {
background-color: #fff2f0;
border: 1px solid #ffccc7;
color: var(--danger);
}
/* 操作图标 */
.action-icons {
display: flex;
gap: 8px;
}
.action-icons .el-button {
color: var(--danger);
padding: 0;
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
}
.action-icons .el-button:hover {
background-color: #fff2f0;
color: var(--danger);
}
/* 分页样式 */
.pagination {
display: flex;
justify-content: center;
align-items: center;
padding: 16px 0;
gap: 8px;
}
.page-btn {
width: 32px;
height: 32px;
border-radius: 4px;
border: 1px solid var(--border);
background-color: white;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.page-btn.active {
background-color: var(--primary);
color: white;
border: none;
}
.total-count {
margin-left: 16px;
font-size: 14px;
color: var(--text-secondary);
}
/* 响应式设计 */
@media (max-width: 1200px) {
.sidebar {
transform: translateX(calc(-1 * var(--sidebar-width)));
position: absolute;
z-index: 100;
transition: transform 0.3s;
}
.sidebar.active {
transform: translateX(0);
}
.menu-toggle {
display: flex;
align-items: center;
justify-content: center;
height: 40px;
width: 40px;
position: absolute;
top: 16px;
left: 16px;
z-index: 101;
cursor: pointer;
background: white;
border: 1px solid var(--border);
border-radius: 4px;
}
.filter-bar {
padding-top: 64px;
}
}
</style>
<style scoped>
/* 移除未使用的图标样式 */
</style>
<style scoped>
/* 移除自动生成的未使用样式 */
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -135,6 +135,7 @@
import { ref, reactive } from 'vue';
import { useRouter } from 'vue-router';
import { ElMessage } from 'element-plus';
import { getConfigKey, addConfig, updateConfig } from '@/api/system/config';
const router = useRouter();
const formRef = ref(null);
@@ -198,46 +199,72 @@ const handleSave = async () => {
await formRef.value.validate();
}
// 将表单数据转换为系统配置格式
// 将表单数据转换为系统配置格式,并添加必要的默认值
const configData = [
{ configKey: 'medicalRecordFee', configValue: formData.medicalRecordFee, configName: '病历本费用' },
{ configKey: 'patientCardFee', configValue: formData.patientCardFee, configName: '就诊卡费' },
{ configKey: 'medicalRecordFlag', configValue: formData.medicalRecordFlag ? '1' : '0', configName: '病历费入账标志' },
{ configKey: 'isNightShift', configValue: formData.isNightShift ? '1' : '0', configName: '是否启用晚班' },
{ configKey: 'patientCardFlag', configValue: formData.patientCardFlag ? '1' : '0', configName: '就诊卡记账标志' },
{ configKey: 'morningStartTime', configValue: formData.morningStartTime, configName: '上午接诊起始时间' },
{ configKey: 'autoGenerateOutpatientNo', configValue: formData.autoGenerateOutpatientNo ? '1' : '0', configName: '自动产生门诊号' },
{ configKey: 'allowModifyOutpatientNo', configValue: formData.allowModifyOutpatientNo ? '1' : '0', configName: '建档时是否允许修改门诊号' },
{ configKey: 'afternoonStartTime', configValue: formData.afternoonStartTime, configName: '下午起始时间' },
{ configKey: 'eveningStartTime', configValue: formData.eveningStartTime, configName: '晚上起始时间' },
{ configKey: 'registrationValidity', configValue: formData.registrationValidity, configName: '挂号有效期' },
{ configKey: 'registrationDocumentMode', configValue: formData.registrationDocumentMode, configName: '挂号单据模式' },
{ configKey: 'exemptFlag', configValue: formData.exemptFlag ? '1' : '0', configName: '减免标志' },
{ configKey: 'consultationFlag', configValue: formData.consultationFlag ? '1' : '0', configName: '义诊标志' },
{ configKey: 'enableHolidayFeeFloat', configValue: formData.enableHolidayFeeFloat ? '1' : '0', configName: '启用法定节假日挂号费浮动' },
{ configKey: 'guardianAge', configValue: formData.guardianAge, configName: '监护人规定年龄' },
{ configKey: 'enableDoubleScreen', configValue: formData.enableDoubleScreen ? '1' : '0', configName: '门诊挂号启用双屏' },
{ configKey: 'optionalRegistrationType', configValue: formData.optionalRegistrationType ? '1' : '0', configName: '挂号类型可选择' },
{ configKey: 'isPrint', configValue: formData.isPrint ? '1' : '0', configName: '是否打印挂号单' },
{ configKey: 'medicalRecordFee', configValue: formData.medicalRecordFee, configName: '病历本费用', configType: 'Y' },
{ configKey: 'patientCardFee', configValue: formData.patientCardFee, configName: '就诊卡费', configType: 'Y' },
{ configKey: 'medicalRecordFlag', configValue: formData.medicalRecordFlag ? '1' : '0', configName: '病历费入账标志', configType: 'Y' },
{ configKey: 'isNightShift', configValue: formData.isNightShift ? '1' : '0', configName: '是否启用晚班', configType: 'Y' },
{ configKey: 'patientCardFlag', configValue: formData.patientCardFlag ? '1' : '0', configName: '就诊卡记账标志', configType: 'Y' },
{ configKey: 'morningStartTime', configValue: formData.morningStartTime, configName: '上午接诊起始时间', configType: 'Y' },
{ configKey: 'autoGenerateOutpatientNo', configValue: formData.autoGenerateOutpatientNo ? '1' : '0', configName: '自动产生门诊号', configType: 'Y' },
{ configKey: 'allowModifyOutpatientNo', configValue: formData.allowModifyOutpatientNo ? '1' : '0', configName: '建档时是否允许修改门诊号', configType: 'Y' },
{ configKey: 'afternoonStartTime', configValue: formData.afternoonStartTime, configName: '下午起始时间', configType: 'Y' },
{ configKey: 'eveningStartTime', configValue: formData.eveningStartTime, configName: '晚上起始时间', configType: 'Y' },
{ configKey: 'registrationValidity', configValue: formData.registrationValidity, configName: '挂号有效期', configType: 'Y' },
{ configKey: 'registrationDocumentMode', configValue: formData.registrationDocumentMode, configName: '挂号单据模式', configType: 'Y' },
{ configKey: 'exemptFlag', configValue: formData.exemptFlag ? '1' : '0', configName: '减免标志', configType: 'Y' },
{ configKey: 'consultationFlag', configValue: formData.consultationFlag ? '1' : '0', configName: '义诊标志', configType: 'Y' },
{ configKey: 'enableHolidayFeeFloat', configValue: formData.enableHolidayFeeFloat ? '1' : '0', configName: '启用法定节假日挂号费浮动', configType: 'Y' },
{ configKey: 'guardianAge', configValue: formData.guardianAge, configName: '监护人规定年龄', configType: 'Y' },
{ configKey: 'enableDoubleScreen', configValue: formData.enableDoubleScreen ? '1' : '0', configName: '门诊挂号启用双屏', configType: 'Y' },
{ configKey: 'optionalRegistrationType', configValue: formData.optionalRegistrationType ? '1' : '0', configName: '挂号类型可选择', configType: 'Y' },
{ configKey: 'isPrint', configValue: formData.isPrint ? '1' : '0', configName: '是否打印挂号单', configType: 'Y' },
];
let successCount = 0;
let failedParams = [];
// 调用系统配置API保存每个参数
for (const config of configData) {
// 先查询是否存在该配置
const existingConfig = await getConfigKey(config.configKey);
if (existingConfig.data) {
// 如果存在则更新
await updateConfig({ ...config, configId: existingConfig.data.configId });
} else {
// 如果不存在则新增
await addConfig(config);
try {
// 先查询是否存在该配置
const existingConfig = await getConfigKey(config.configKey, { skipErrorMsg: true });
if (existingConfig.data && existingConfig.data.configId) {
// 如果存在则更新保留原有数据的configId
await updateConfig({
...config,
configId: existingConfig.data.configId,
createTime: existingConfig.data.createTime, // 保留创建时间
remark: existingConfig.data.remark || '收费系统配置参数' // 保留或设置默认备注
});
} else {
// 如果不存在则新增,添加默认备注
await addConfig({
...config,
remark: '收费系统配置参数'
});
}
successCount++;
} catch (paramError) {
console.error(`保存参数 ${config.configName} (${config.configKey}) 失败:`, paramError);
failedParams.push(config.configName);
// 继续处理下一个参数,不中断整体流程
}
}
ElMessage.success('保存成功');
// 根据保存结果显示相应消息
if (failedParams.length === 0) {
ElMessage.success(`所有 ${successCount} 个参数保存成功`);
} else if (successCount > 0) {
ElMessage.warning(`${successCount} 个参数保存成功,但以下 ${failedParams.length} 个参数保存失败: ${failedParams.join(', ')}`);
} else {
ElMessage.error(`所有参数保存失败,请检查系统配置`);
}
} catch (error) {
console.error('保存失败:', error);
ElMessage.error('保存失败,请重试');
console.error('保存过程中发生错误:', error);
ElMessage.error('保存操作异常,请重试');
}
};

View File

@@ -78,13 +78,14 @@
<!-- 表格展示区 -->
<div class="table-section">
<el-table
:data="tableData"
border
style="width: 100%"
v-loading="loading"
:max-height="600"
>
<div class="table-wrapper">
<el-table
:data="tableData"
border
style="width: 100%"
v-loading="loading"
:max-height="600"
>
<el-table-column prop="id" label="ID" width="80" align="center" />
<el-table-column prop="organization" label="卫生机构" width="120" align="center" />
<el-table-column prop="maintainDate" label="日期" width="120" align="center" />
@@ -169,6 +170,7 @@
</template>
</el-table-column>
</el-table>
</div>
</div>
<!-- 底部分页 -->
@@ -568,6 +570,10 @@ function handleDelete(row) {
padding: 24px;
background-color: #f5f7fa;
min-height: 100vh;
width: 100%;
height: 100%;
overflow: auto;
box-sizing: border-box;
}
.filter-section {
@@ -576,6 +582,8 @@ function handleDelete(row) {
padding: 20px;
margin-bottom: 16px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
width: 100%;
box-sizing: border-box;
}
.filter-section :deep(.el-form-item) {
@@ -587,6 +595,17 @@ function handleDelete(row) {
border-radius: 8px;
padding: 20px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
width: 100%;
box-sizing: border-box;
overflow: hidden;
}
.table-wrapper {
width: 100%;
overflow-x: auto;
overflow-y: auto;
max-height: calc(100vh - 400px);
min-height: 400px;
}
.pagination-section {
@@ -599,6 +618,40 @@ function handleDelete(row) {
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}
/* 优化滚动条样式 - 支持水平和垂直滚动 */
.table-wrapper {
scrollbar-width: thin;
scrollbar-color: #c1c1c1 #f1f1f1;
}
.table-wrapper::-webkit-scrollbar {
width: 8px;
height: 8px;
}
.table-wrapper::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 4px;
}
.table-wrapper::-webkit-scrollbar-thumb {
background: #c1c1c1;
border-radius: 4px;
}
.table-wrapper::-webkit-scrollbar-thumb:hover {
background: #a8a8a8;
}
/* 确保表格可以水平滚动 */
.table-wrapper :deep(.el-table) {
min-width: 100%;
}
.table-wrapper :deep(.el-table__body-wrapper) {
overflow-x: auto;
}
/* 响应式设计 */
@media (max-width: 1200px) {
.filter-section :deep(.el-form) {
@@ -617,6 +670,10 @@ function handleDelete(row) {
.pagination-section {
padding: 16px;
}
.table-wrapper {
max-height: calc(100vh - 350px);
}
}
</style>

View File

@@ -0,0 +1,999 @@
<template>
<div class="lis-group-maintain">
<!-- 标题区域 -->
<div class="header">
<h2>LIS分组维护</h2>
</div>
<!-- 表格展示区域 -->
<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>
</thead>
<tbody>
<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>
</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 }"
>
<span v-if="item.errors?.lisGroupName" class="error-message">{{ item.errors.lisGroupName }}</span>
</template>
<template v-else>
{{ item.lisGroupName }}
</template>
</td>
<td>
<template v-if="item.editing">
<select
v-model="item.bloodCollectionTube"
:class="{ 'error-input': item.errors?.bloodCollectionTube }"
>
<option value="">请选择采血管</option>
<option v-for="tube in bloodTubeOptions" :key="tube" :value="tube">
{{ tube }}
</option>
</select>
<span v-if="item.errors?.bloodCollectionTube" class="error-message">{{ item.errors.bloodCollectionTube }}</span>
</template>
<template v-else>
{{ item.bloodCollectionTube }}
</template>
</td>
<td>
<template v-if="item.editing">
<input type="text" v-model="item.remark" placeholder="请输入备注信息">
</template>
<template v-else>
{{ item.remark || '' }}
</template>
</td>
<td>
<div class="actions">
<template v-if="!item.editing">
<button class="btn btn-edit" @click="startEdit(item)"></button>
<button class="btn btn-primary" @click="addRow">+</button>
<button class="btn btn-delete" @click="deleteRow(index)">🗑</button>
</template>
<template v-else>
<button class="btn btn-confirm" @click="confirmEdit(item)"></button>
<button class="btn btn-cancel" @click="cancelEdit(item)">×</button>
</template>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- 分页区域 -->
<div class="pagination">
<button class="pagination-btn"></button>
<span>1</span>
<button class="pagination-btn"></button>
</div>
</div>
</template>
<script>
import { ref, reactive, computed, onMounted, onBeforeUnmount } from 'vue'
import { listLisGroup, addLisGroup, updateLisGroup, delLisGroup } from '@/api/system/checkType'
import { getDicts } from "@/api/system/dict/data";
import axios from 'axios'
export default {
name: 'LisGroupMaintain',
setup() {
// 加载状态
const loading = ref(false)
// 采血管选项
const bloodTubeOptions = ref([]);
// 加载采血管颜色字典数据
const loadBloodTubeDict = async () => {
try {
const response = await getDicts('test_the_color_of_the_blood_collection_tube');
if (response.code === 200 && response.data) {
// 根据实际返回数据格式调整
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 tableData = reactive([])
// 获取当前日期
const getCurrentDate = () => {
const date = new Date()
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
}
// 加载LIS分组数据
const loadLisGroups = async () => {
// 确保采血管字典数据已加载
if (bloodTubeOptions.value.length === 0) {
await loadBloodTubeDict();
}
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
});
} else {
console.warn(`记录 ${index + 1} 不是有效对象,跳过处理:`, item);
}
});
totalItems.value = total;
console.log('数据加载完成,表格显示', tableData.length, '条记录,总数:', totalItems.value);
} else {
console.log('未获取到有效数据,表格为空');
}
} 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})`
} 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)
}
}
// 开始编辑
const startEdit = (item) => {
// 存储原始数据,用于取消操作
item.originalData = { ...item }
item.editing = true
}
// 验证数据
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但添加了类型标识
if (type === 'error') {
console.error(message)
alert(`错误: ${message}`)
} else {
console.log(message)
// 可以使用更友好的提示方式这里暂时注释掉alert以避免频繁弹窗
// alert(message)
}
}
// 确认编辑
const confirmEdit = async (item) => {
// 验证数据
if (!validateData(item)) {
showMessage('请检查并修正错误信息', 'error')
return
}
// 检查是否有重复的分组名称(在同一个卫生机构内)
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,
hospital: item.healthInstitution, // 前端字段映射到后端字段
date: item.date,
groupName: item.lisGroupName, // 前端字段映射到后端字段
tube: item.bloodCollectionTube, // 前端字段映射到后端字段
remark: item.remark
}
let response
// 判断是新增还是修改
if (item.isNew) {
// 新增
response = await addLisGroup(submitData)
} else {
// 修改
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
showMessage('保存成功')
// 如果是新增,重新加载数据以确保数据一致性
if (isNewRecord) {
loadLisGroups()
}
} else {
showMessage(`保存失败: ${response.msg || '未知错误'}`, 'error')
}
} catch (error) {
console.error('保存LIS分组数据失败:', error)
showMessage(`保存失败: ${error.message || '未知错误'}`, 'error')
} finally {
loading.value = false
}
}
// 取消编辑
const cancelEdit = (item) => {
try {
if (item.isNew) {
// 如果是新增的行,从数组中移除
const index = tableData.findIndex(row => row.id === item.id)
if (index > -1) {
tableData.splice(index, 1)
// 更新总数
if (totalItems.value > 0) {
totalItems.value--
}
}
} else if (item.originalData) {
// 恢复原始数据
Object.assign(item, item.originalData)
delete item.originalData
item.editing = false
} else {
item.editing = false
}
} catch (error) {
console.error('取消编辑失败:', error)
showMessage('取消编辑失败', 'error')
}
}
// 添加新行
const addRow = () => {
// 检查是否已有正在编辑的行
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)
tableData.push({
id: newId,
healthInstitution: '', // 空默认值
date: getCurrentDate(), // 默认当前系统时间
lisGroupName: '',
bloodCollectionTube: '',
remark: '',
editing: true,
errors: null,
isNew: true // 标记为新记录
})
showMessage('请填写新记录信息')
}
// 删除行
const deleteRow = async (index) => {
const item = tableData[index]
// 检查是否正在编辑
if (item.editing) {
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')
}
}
} catch (error) {
console.error('删除LIS分组数据失败:', error)
showMessage(`删除失败: ${error.message || '未知错误'}`, 'error')
} finally {
loading.value = false
}
}
}
// 分页方法
const prevPage = () => {
if (currentPage.value > 1) {
currentPage.value--
// 调用加载数据方法
loadLisGroups()
}
}
const nextPage = () => {
if (currentPage.value < totalPages.value) {
currentPage.value++
// 调用加载数据方法
loadLisGroups()
}
}
const goToPage = (page) => {
if (page >= 1 && page <= totalPages.value) {
currentPage.value = page
// 调用加载数据方法
loadLisGroups()
}
}
// 组件挂载时加载数据
onMounted(() => {
// 加载采血管字典数据
loadBloodTubeDict();
// 加载表格数据
loadLisGroups()
})
return {
tableData,
bloodTubeOptions,
startEdit,
confirmEdit,
cancelEdit,
addRow,
deleteRow,
currentPage,
totalPages,
prevPage,
nextPage,
goToPage,
loading
}
}
}
</script>
<style scoped>
.lis-group-maintain {
padding: 20px;
min-height: 100vh;
}
.header {
height: 56px;
border-bottom: 1px solid #e8e8e8;
margin-bottom: 20px;
display: flex;
align-items: center;
}
.header h1 {
font-size: 18px;
font-weight: 500;
color: #333;
margin: 0;
}
.table-container {
margin-bottom: 20px;
overflow-x: auto;
border: 1px solid #e8e8e8;
border-radius: 2px;
}
.data-table {
width: 100%;
border-collapse: collapse;
text-align: left;
background-color: #fff;
}
.data-table th,
.data-table td {
padding: 12px;
border: 1px solid #e8e8e8;
word-break: break-all;
vertical-align: middle;
}
.data-table th {
background-color: #fafafa;
font-weight: 500;
}
.editing-row {
background-color: #f0f8ff;
}
.actions {
white-space: nowrap;
}
.pagination-section {
height: 48px;
display: flex;
justify-content: center;
align-items: center;
}
/* 分页样式 */
.pagination {
display: flex;
justify-content: flex-end;
align-items: center;
padding: 16px 0;
margin-top: 8px;
}
.pagination span {
font-size: 14px;
margin: 0 16px;
}
.pagination-btn {
background: none;
border: 1px solid #D9D9D9;
border-radius: 4px;
width: 32px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.2s ease;
}
.pagination-btn:hover {
border-color: #1890FF;
color: #1890FF;
}
.pagination-btn:disabled {
cursor: not-allowed;
opacity: 0.5;
}
.pagination-number.active {
background-color: #1890ff;
color: #fff;
border-color: #1890ff;
}
.pagination-number.active:hover {
background-color: #40a9ff;
border-color: #40a9ff;
color: #fff;
}
.btn {
width: 24px;
height: 24px;
padding: 0;
margin-right: 5px;
border: 1px solid #d9d9d9;
background-color: #fff;
cursor: pointer;
border-radius: 4px;
font-size: 12px;
display: inline-flex;
align-items: center;
justify-content: center;
}
.btn:hover {
border-color: #40a9ff;
color: #40a9ff;
}
.btn-primary {
background-color: #1890ff;
color: #fff;
border-color: #1890ff;
}
.btn-primary:hover {
background-color: #40a9ff;
border-color: #40a9ff;
color: #fff;
}
.btn-confirm {
background-color: #52c41a;
color: #fff;
border-color: #52c41a;
}
.btn-confirm:hover {
background-color: #73d13d;
border-color: #73d13d;
color: #fff;
}
.btn-cancel {
background-color: #f5f5f5;
color: #333;
border-color: #d9d9d9;
}
.btn-edit {
background-color: #faad14;
color: #fff;
border-color: #faad14;
}
.btn-edit:hover {
background-color: #ffc53d;
border-color: #ffc53d;
color: #fff;
}
.btn-delete {
background-color: #ff4d4f;
color: #fff;
border-color: #ff4d4f;
}
.btn-delete:hover {
background-color: #ff7875;
border-color: #ff7875;
color: #fff;
}
input, select {
width: 100%;
padding: 4px 6px;
border: 1px solid #d9d9d9;
border-radius: 2px;
box-sizing: border-box;
}
input:disabled {
background-color: #f5f5f5;
cursor: not-allowed;
}
/* 错误状态样式 */
.error-input {
border-color: #ff4d4f !important;
}
.error-input:focus {
border-color: #ff4d4f !important;
box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.2) !important;
}
.error-message {
display: block;
font-size: 12px;
color: #ff4d4f;
margin-top: 2px;
line-height: 1.2;
}
/* 错误提示区域样式 */
.error-message-container {
padding: 12px 16px;
background-color: #fff2f0;
border: 1px solid #ffccc7;
border-radius: 2px;
margin-bottom: 16px;
}
.error-text {
color: #ff4d4f;
font-size: 14px;
}
/* 加载状态样式 */
.loading-overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(255, 255, 255, 0.7);
display: flex;
align-items: center;
justify-content: center;
z-index: 10;
}
/* 确保页面容器相对定位,使加载遮罩正常工作 */
.lis-group-maintain {
position: relative;
}
.table-container {
overflow-x: auto;
border: 1px solid #e8e8e8;
border-radius: 4px;
margin-bottom: 16px;
}
.data-table {
width: 100%;
border-collapse: collapse;
}
.data-table th,
.data-table td {
padding: 12px 8px;
text-align: center;
border-bottom: 1px solid #e8e8e8;
}
.data-table th {
background-color: #fafafa;
font-weight: 500;
color: rgba(0, 0, 0, 0.85);
}
/* 响应式设计 */
@media (max-width: 768px) {
.lis-group-maintain {
padding: 10px;
}
.header h1 {
font-size: 16px;
}
.table-container {
border-radius: 0;
}
.data-table {
font-size: 12px;
min-width: 600px; /* 确保表格在小屏幕上可以横向滚动 */
}
.data-table th,
.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;
font-size: 12px;
margin: 0 2px;
}
}
/* 平滑过渡效果 */
.btn,
.pagination-btn,
.editing-row {
transition: all 0.3s ease;
}
/* 美化输入框和选择框的焦点样式 */
input:focus,
select:focus {
outline: none;
border-color: #40a9ff;
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}
</style>

View File

@@ -765,10 +765,16 @@ watch(
if (newVlaue) {
editData.value.editRow = newVlaue?.editRow;
editData.value.item = newVlaue?.item;
edit();
// 使用nextTick确保变量初始化完成后再执行edit
nextTick(() => {
edit();
});
} else {
editData.value = {};
show();
// 使用nextTick确保变量初始化完成后再执行show
nextTick(() => {
show();
});
}
},
{ immediate: true }
@@ -1156,6 +1162,12 @@ function changeValEnd(val, index) {
}
// 切换仓库类型获取药房/药库/耗材库列表
function handleChangeLocationType(value) {
// 确保locationList变量已初始化
if (!locationList) {
console.warn('locationList未初始化');
return;
}
if (value == 16) {
// 药房类型
getPharmacyList().then((res) => {

View File

@@ -590,6 +590,7 @@ const visible = ref(false);
const row = ref({});
const rowIndex = ref(-1);
const totalAmount = ref(0);
const locationList = ref([]);
const props = defineProps({
practitionerListOptions: {
type: Object,
@@ -768,7 +769,6 @@ function handleSearch(value) {
medicineSearchKey.value = value;
}
const locationList = ref([]);
// 选择药品
function selectRow(rowValue, index) {
rowIndex.value = index;

View File

@@ -111,7 +111,12 @@
</el-form>
</el-row>
<el-row :gutter="10">
<el-scrollbar height="calc(100vh - 350px)" style="width: 100%">
<!-- 固定位置的新增单据按钮始终可见 -->
<div class="fixed-add-button" style="margin-bottom: 10px; text-align: center;">
<el-button type="primary" @click="handleAdd" :disabled="isAddDisabled"> 新增单据 </el-button>
</div>
<el-scrollbar height="calc(100vh - 400px)" style="width: 100%">
<div class="order-list-container">
<!-- 有数据时显示列表 -->
<template v-if="orderList.length > 0">
@@ -169,7 +174,7 @@
<!-- 空状态显示 -->
<div v-else class="empty-state">
<el-empty description="暂无单据" :image-size="80">
<el-button type="primary" @click="handleAdd"> 新增单据 </el-button>
<!-- 空状态下不再显示新增单据按钮因为已在上方固定位置显示 -->
</el-empty>
</div>
</div>

View File

@@ -111,67 +111,72 @@
</el-form>
</el-row>
<el-row :gutter="10">
<el-scrollbar height="calc(100vh - 350px)" style="width: 100%">
<div class="order-list-container">
<!-- 有数据时显示列表 -->
<template v-if="orderList.length > 0">
<div
v-for="item in orderList"
:key="item.supplyBusNo"
:class="['order-item', { 'is-active': selectedOrder === item }]"
@click="handleOrderClick(item)"
>
<el-card class="order-card" shadow="hover">
<div class="order-header">
<div class="order-number">
<el-icon><Document /></el-icon>
<span class="number-text">{{ item.supplyBusNo }}</span>
</div>
</div>
<div class="order-content">
<div class="info-item">
<el-icon class="info-icon"><User /></el-icon>
<span class="label">采购员</span>
<span class="value">{{ item.applicantId_dictText }}</span>
</div>
<div class="info-item">
<el-icon class="info-icon"><Shop /></el-icon>
<span class="label">供应商</span>
<span class="value">{{ item.supplierId_dictText }}</span>
</div>
<div class="info-item">
<el-icon class="info-icon"><User /></el-icon>
<span class="label">审核状态</span>
<el-tag type="success" v-if="item.statusEnum_enumText === '同意'">
{{ item.statusEnum_enumText }}
</el-tag>
<el-tag type="danger" v-else>
{{ item.statusEnum_enumText }}
</el-tag>
</div>
<div class="info-item">
<el-icon class="info-icon"><Files /></el-icon>
<span class="label">单据类型</span>
<span class="value">{{ item.typeEnum_enumText }}</span>
</div>
<div class="info-item">
<el-icon class="info-icon"><Calendar /></el-icon>
<span class="label">单据日期</span>
<span class="value">{{
parseTime(item.applyTime, '{y}-{m}-{d} {h}:{i}:{s}')
}}</span>
</div>
</div>
</el-card>
</div>
</template>
<!-- 空状态显示 -->
<div v-else class="empty-state">
<el-empty description="暂无单据" :image-size="80">
<el-button type="primary" @click="handleAdd"> 新增单据 </el-button>
</el-empty>
<!-- 固定位置的新增单据按钮始终可见 -->
<div class="fixed-add-button" style="margin-bottom: 10px; text-align: center;">
<el-button type="primary" @click="handleAdd" :disabled="isAddDisabled"> 新增单据 </el-button>
</div>
<el-scrollbar height="calc(100vh - 400px)" style="width: 100%">
<div class="order-list-container">
<!-- 有数据时显示列表 -->
<template v-if="orderList.length > 0">
<div
v-for="item in orderList"
:key="item.supplyBusNo"
:class="['order-item', { 'is-active': selectedOrder === item }]"
@click="handleOrderClick(item)"
>
<el-card class="order-card" shadow="hover">
<div class="order-header">
<div class="order-number">
<el-icon><Document /></el-icon>
<span class="number-text">{{ item.supplyBusNo }}</span>
</div>
</div>
<div class="order-content">
<div class="info-item">
<el-icon class="info-icon"><User /></el-icon>
<span class="label">采购员</span>
<span class="value">{{ item.applicantId_dictText }}</span>
</div>
<div class="info-item">
<el-icon class="info-icon"><Shop /></el-icon>
<span class="label">供应商</span>
<span class="value">{{ item.supplierId_dictText }}</span>
</div>
<div class="info-item">
<el-icon class="info-icon"><User /></el-icon>
<span class="label">审核状态</span>
<el-tag type="success" v-if="item.statusEnum_enumText === '同意'">
{{ item.statusEnum_enumText }}
</el-tag>
<el-tag type="danger" v-else>
{{ item.statusEnum_enumText }}
</el-tag>
</div>
<div class="info-item">
<el-icon class="info-icon"><Files /></el-icon>
<span class="label">单据类型</span>
<span class="value">{{ item.typeEnum_enumText }}</span>
</div>
<div class="info-item">
<el-icon class="info-icon"><Calendar /></el-icon>
<span class="label">单据日期</span>
<span class="value">{{
parseTime(item.applyTime, '{y}-{m}-{d} {h}:{i}:{s}')
}}</span>
</div>
</div>
</el-card>
</div>
</template>
<!-- 空状态显示 -->
<div v-else class="empty-state">
<el-empty description="暂无单据" :image-size="80">
<!-- 空状态下不再显示新增单据按钮因为已在上方固定位置显示 -->
</el-empty>
</div>
</div>
</el-scrollbar>
</el-row>

View File

@@ -3,14 +3,14 @@
* @Date: 2025-04-09 09:33:35
* @Description:
*/
import {defineConfig, loadEnv} from 'vite';
import { defineConfig, loadEnv } from 'vite';
import path from 'path';
import createVitePlugins from './vite/plugins';
// https://vitejs.dev/config/
export default defineConfig (({mode, command}) => {
const env = loadEnv (mode, process.cwd ());
const {VITE_APP_ENV} = env;
export default defineConfig(({ mode, command }) => {
const env = loadEnv(mode, process.cwd());
const { VITE_APP_ENV } = env;
return {
// define: {
// // enable hydration mismatch details in production build
@@ -19,15 +19,15 @@ export default defineConfig (({mode, command}) => {
// 部署生产环境和开发环境下的URL。
// 默认情况下vite 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.openHIS.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.openhis.vip/admin/,则设置 baseUrl 为 /admin/。
base: VITE_APP_ENV === 'production' ? '/' : '/',
plugins: createVitePlugins (env, command === 'build'),
base: VITE_APP_ENV === 'prod' ? '/' : '/',
plugins: createVitePlugins(env, command === 'build'),
resolve: {
// https://cn.vitejs.dev/config/#resolve-alias
alias: {
// 设置路径
'~': path.resolve (__dirname, './'),
'~': path.resolve(__dirname, './'),
// 设置别名
'@': path.resolve (__dirname, './src'),
'@': path.resolve(__dirname, './src'),
},
// https://cn.vitejs.dev/config/#resolve-extensions
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
@@ -40,23 +40,24 @@ export default defineConfig (({mode, command}) => {
proxy: {
// https://cn.vitejs.dev/config/#server-proxy
'/dev-api': {
target: 'http://localhost:18080/openhis',
// target: 'http://192.168.31.30:18080/openhis', // zwh
// target: 'http://192.168.31.50:18080/openhis', // wh
// target: 'http://192.168.31.190:18080/openhis', // yangmo
// target: 'http://60.188.247.175:18080/openhis',// 公网
target: 'http://localhost:18080/openhis',
changeOrigin: true,
rewrite: p => p.replace (/^\/dev-api/, ''),
rewrite: p => p.replace(/^\/dev-api/, ''),
},
'/ybplugin':{
'/ybplugin': {
target: 'http://localhost:5000',
changeOrigin: true,
rewrite: p => p.replace (/^\/ybplugin/, ''),
rewrite: p => p.replace(/^\/ybplugin/, ''),
},
'/prod-api': {
target: 'http://localhost:18080/openhis',
'/prd-api': {
target: 'http://localhost:18082/openhis',
changeOrigin: true,
rewrite: p => p.replace (/^\/prod-api/, ''),
rewrite: p => p.replace(/^\/prd-api/, ''),
},
'/test-api': {
target: 'http://localhost:18081/openhis',
changeOrigin: true,
rewrite: p => p.replace(/^\/test-api/, ''),
}
},
},
@@ -69,7 +70,7 @@ export default defineConfig (({mode, command}) => {
AtRule: {
charset: atRule => {
if (atRule.name === 'charset') {
atRule.remove ();
atRule.remove();
}
},
},