From 2492daa0ad70e281fb16a0ece7400e4c31fa95ee Mon Sep 17 00:00:00 2001 From: wangjian963 <15215920+aprilry@user.noreply.gitee.com> Date: Fri, 6 Mar 2026 16:49:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=EF=BC=9A102=20=E9=97=A8?= =?UTF-8?q?=E8=AF=8A=E5=8C=BB=E7=94=9F=E7=AB=99-=E3=80=8B=E8=AF=8A?= =?UTF-8?q?=E6=96=ADTAB=E9=A1=B5=EF=BC=9A=E5=A2=9E=E5=8A=A0=E6=8A=A5?= =?UTF-8?q?=E5=8D=A1=E5=BC=B9=E6=A1=86=E7=99=BB=E8=AE=B0=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=20=E7=96=BE=E7=97=85=E6=8A=A5=E5=91=8A=E5=8D=A1=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=8A=9F=E8=83=BD=E3=80=82=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=AF=8A=E6=96=AD=E7=96=BE=E7=97=85=E7=9A=84sql=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IDoctorStationDiagnosisAppService.java | 17 + .../DoctorStationDiagnosisAppServiceImpl.java | 108 ++ .../DoctorStationDiagnosisController.java | 23 + .../doctorstation/dto/DiagnosisQueryDto.java | 3 + .../dto/InfectiousDiseaseReportDto.java | 161 ++ .../DoctorStationDiagnosisAppMapper.xml | 1 + .../domain/InfectiousDiseaseReport.java | 162 ++ .../mapper/InfectiousDiseaseReportMapper.java | 16 + .../IInfectiousDiseaseReportService.java | 9 + .../InfectiousDiseaseReportServiceImpl.java | 15 + .../components/diagnosis/diagnosis.vue | 234 +-- .../infectiousDiseaseReportDialog.vue | 1432 ++++++++++------- .../inspection/inspectionApplication.vue | 50 +- 13 files changed, 1503 insertions(+), 728 deletions(-) create mode 100644 openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/InfectiousDiseaseReportDto.java create mode 100644 openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/domain/InfectiousDiseaseReport.java create mode 100644 openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/mapper/InfectiousDiseaseReportMapper.java create mode 100644 openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/IInfectiousDiseaseReportService.java create mode 100644 openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/InfectiousDiseaseReportServiceImpl.java diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationDiagnosisAppService.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationDiagnosisAppService.java index b959f28f..e9382724 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationDiagnosisAppService.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationDiagnosisAppService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; import com.openhis.web.doctorstation.dto.ConditionDefinitionMetadata; import com.openhis.web.doctorstation.dto.DiagnosisBelongBindingDto; +import com.openhis.web.doctorstation.dto.InfectiousDiseaseReportDto; import com.openhis.web.doctorstation.dto.SaveDiagnosisParam; import javax.servlet.http.HttpServletRequest; @@ -118,4 +119,20 @@ public interface IDoctorStationDiagnosisAppService { * @return 查询结果 */ R getEncounterDiagnosisByEncounterId(Long encounterId, String searchKey); + + /** + * 保存传染病报告卡 + * + * @param infectiousDiseaseReportDto 传染病报告卡数据 + * @return 结果 + */ + R saveInfectiousDiseaseReport(InfectiousDiseaseReportDto infectiousDiseaseReportDto); + + /** + * 获取下一个传染病报告卡编号 + * + * @param orgCode 医疗机构编码 + * @return 卡片编号 + */ + R getNextCardNo(String orgCode); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationDiagnosisAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationDiagnosisAppServiceImpl.java index c8a86f02..9337896b 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationDiagnosisAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationDiagnosisAppServiceImpl.java @@ -6,10 +6,13 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; +import com.core.common.enums.DelFlag; import com.core.common.utils.MessageUtils; import com.core.common.utils.SecurityUtils; import com.openhis.administration.domain.EncounterDiagnosis; +import com.openhis.administration.domain.InfectiousDiseaseReport; import com.openhis.administration.service.IEncounterDiagnosisService; +import com.openhis.administration.service.IInfectiousDiseaseReportService; import com.openhis.clinical.domain.Condition; import com.openhis.clinical.domain.ConditionDefinition; import com.openhis.clinical.domain.DiagnosisBelongBinding; @@ -23,19 +26,26 @@ import com.openhis.common.enums.*; import com.openhis.common.utils.EnumUtils; import com.openhis.common.utils.HisPageUtils; import com.openhis.common.utils.HisQueryUtils; +import com.core.common.utils.AssignSeqUtil; import com.openhis.web.doctorstation.appservice.IDoctorStationDiagnosisAppService; import com.openhis.web.doctorstation.dto.*; import com.openhis.web.doctorstation.mapper.DoctorStationDiagnosisAppMapper; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.time.LocalDate; import java.util.*; +import static com.openhis.common.constant.CommonConstants.FieldName.DeleteFlag; +import static java.time.LocalDateTime.now; + /** * 医生站-诊断 应用实现类 */ +@Slf4j @Service public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagnosisAppService { @@ -57,6 +67,12 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn @Resource IConditionDefinitionService conditionDefinitionService; + @Resource + IInfectiousDiseaseReportService iInfectiousDiseaseReportService; + + @Resource + AssignSeqUtil assignSeqUtil; + /** * 新增诊断归属绑定 * @@ -532,4 +548,96 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn return R.ok(encounterDiagnosis); } + + /** + * 保存传染病报告卡 + * + * @param infectiousDiseaseReportDto 传染病报告卡数据 + * @return 结果 + */ + @Override + public R saveInfectiousDiseaseReport(InfectiousDiseaseReportDto infectiousDiseaseReportDto) { + // 检查卡片编号唯一性(新增时检查,编辑时排除当前记录) + String cardNo = infectiousDiseaseReportDto.getCardNo().trim(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(InfectiousDiseaseReport::getCardNo, cardNo); + long count = iInfectiousDiseaseReportService.count(queryWrapper); + if (count > 0) { + return R.fail("卡片编号已存在,请重新生成"); + } + + // 转换为实体 + InfectiousDiseaseReport infectiousDiseaseReport = new InfectiousDiseaseReport(); + BeanUtils.copyProperties(infectiousDiseaseReportDto, infectiousDiseaseReport); + + /** + * 设置创建人、删除状态、租户ID + */ + infectiousDiseaseReport.setCreateBy(SecurityUtils.getUsername()); + infectiousDiseaseReport.setDeleteFlag(DelFlag.NO.getCode()); + infectiousDiseaseReport.setTenantId(SecurityUtils.getLoginUser().getTenantId()); + + // 设置医生和科室信息 - 优先使用前端传递的值,如果没有则使用当前登录用户信息 + log.debug("传染病报告卡数据,DoctorId:{}", infectiousDiseaseReport.getDoctorId()); + if (infectiousDiseaseReport.getDoctorId() == null) { + // 优先使用 practitionerId,如果没有则使用 userId + Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId(); + log.debug("传染病报告卡数据,PractitionerId:{}", practitionerId); + if (practitionerId != null) { + infectiousDiseaseReport.setDoctorId(practitionerId); + } else { + // 如果没有 practitionerId,使用当前登录用户的 userId + infectiousDiseaseReport.setDoctorId(SecurityUtils.getLoginUser().getUserId()); + } + } + + if (infectiousDiseaseReport.getDeptId() == null) { + infectiousDiseaseReport.setDeptId(SecurityUtils.getLoginUser().getOrgId()); + } + + /** + * 报告单位,报告医生,报告日期 + */ + infectiousDiseaseReport.setReportOrg(null); + infectiousDiseaseReport.setReportDate(LocalDate.now()); + + // 如果状态为空,设置为草稿状态 + if (infectiousDiseaseReport.getStatus() == null) { + infectiousDiseaseReport.setStatus(0); // 0-草稿 + } + log.debug("保存传染病报告卡数据getReportOrg:{}", infectiousDiseaseReport.getReportOrg()); + log.debug("保存传染病报告卡数据:{}", infectiousDiseaseReport.getDeleteFlag()); + log.debug("保存传染病报告卡数据,更新日期:{}",infectiousDiseaseReport.getUpdateTime()); + // 保存到数据库 + boolean success = iInfectiousDiseaseReportService.save(infectiousDiseaseReport); + + if (success) { + return R.ok(infectiousDiseaseReport.getCardNo(), MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"传染病报告卡"})); + } else { + return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"传染病报告卡"})); + } + } + + /** + * 获取下一个传染病报告卡编号 + * 编号规则:医疗机构编码 + 年月日 + 4位流水号 + * 示例:123456202603060001 + * + * @param orgCode 医疗机构编码 + * @return 卡片编号 + */ + @Override + public R getNextCardNo(String orgCode) { + // 参数校验 + if (orgCode == null || orgCode.trim().isEmpty()) { + orgCode = "0000"; + } + + // 使用 AssignSeqUtil 生成每日递增的流水号 + // 前缀为医疗机构编码,每天从0001开始 + String cardNo = assignSeqUtil.getSeqByDay(orgCode, 4); + + log.debug("生成传染病报告卡编号: {}", cardNo); + return R.ok(cardNo); + } } \ No newline at end of file diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationDiagnosisController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationDiagnosisController.java index 2241b140..65943bbb 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationDiagnosisController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationDiagnosisController.java @@ -9,6 +9,7 @@ import com.openhis.common.enums.ConditionVerificationStatus; import com.openhis.web.doctorstation.appservice.IDoctorStationDiagnosisAppService; import com.openhis.web.doctorstation.dto.DiagnosisBelongBindingDto; import com.openhis.web.doctorstation.dto.DiagnosisBelongBindingInitDto; +import com.openhis.web.doctorstation.dto.InfectiousDiseaseReportDto; import com.openhis.web.doctorstation.dto.SaveDiagnosisParam; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -205,4 +206,26 @@ public class DoctorStationDiagnosisController { return iDoctorStationDiagnosisAppService.delEncounterDiagnosis(conditionId); } + /** + * 保存传染病报告卡 + * + * @param infectiousDiseaseReportDto 传染病报告卡数据 + * @return 结果 + */ + @PostMapping("/save-infectious-disease-report") + public R saveInfectiousDiseaseReport(@Validated @RequestBody InfectiousDiseaseReportDto infectiousDiseaseReportDto) { + return iDoctorStationDiagnosisAppService.saveInfectiousDiseaseReport(infectiousDiseaseReportDto); + } + + /** + * 获取下一个传染病报告卡编号 + * + * @param orgCode 医疗机构编码 + * @return 卡片编号 + */ + @GetMapping("/next-card-no") + public R getNextCardNo(@RequestParam(value = "orgCode", required = false) String orgCode) { + return iDoctorStationDiagnosisAppService.getNextCardNo(orgCode); + } + } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/DiagnosisQueryDto.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/DiagnosisQueryDto.java index 500414f7..a27a0913 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/DiagnosisQueryDto.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/DiagnosisQueryDto.java @@ -58,6 +58,9 @@ public class DiagnosisQueryDto { /** 医保编码 */ private String ybNo; + /** 报卡类型 */ + private String reportTypeCode; + /** 诊断排序(医保文档要求数值型字符长度为2) */ private Integer diagSrtNo; diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/InfectiousDiseaseReportDto.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/InfectiousDiseaseReportDto.java new file mode 100644 index 00000000..f09c4581 --- /dev/null +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/InfectiousDiseaseReportDto.java @@ -0,0 +1,161 @@ +package com.openhis.web.doctorstation.dto; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Date; + +/** + * 传染病报告卡DTO + * + * @author system + * @date 2025-03-04 + */ +@Data +@Accessors(chain = true) +public class InfectiousDiseaseReportDto { + + /** 卡片编号(主键) */ + @NotBlank(message = "卡片编号不能为空") + private String cardNo; + + /** 本次就诊ID */ + @JsonSerialize(using = ToStringSerializer.class) + private Long visitId; + + /** 诊断记录唯一ID */ + @NotNull(message = "诊断ID不能为空") + @JsonSerialize(using = ToStringSerializer.class) + private Long diagId; + + /** 患者主索引 */ + @NotNull(message = "患者ID不能为空") + @JsonSerialize(using = ToStringSerializer.class) + private Long patId; + + /** 证件类型 */ + private Integer idType; + + /** 证件号码 */ + private String idNo; + + /** 患者姓名 */ + private String patName; + + /** 家长姓名(≤14岁必填) */ + private String parentName; + + /** 性别 1男 2女 0未知 */ + private String sex; + + /** 出生日期 */ + private Date birthday; + + /** 实足年龄 */ + private Integer age; + + /** 年龄单位 1岁 2月 3天 */ + private String ageUnit; + + /** 工作单位(学生填学校) */ + private String workplace; + + /** 联系电话(患者本人电话) */ + private String phone; + + /** 紧急联系人电话 */ + private String contactPhone; + + /** 现住址省 */ + private String addressProv; + + /** 现住址市 */ + private String addressCity; + + /** 现住址县 */ + private String addressCounty; + + /** 现住址街道 */ + private String addressTown; + + /** 现住址村/居委 */ + private String addressVillage; + + /** 现住址门牌号 */ + private String addressHouse; + + /** 病人属于 1本县区/2本市其他/3本省其他/4外省/5港澳台/6外籍 */ + private Integer patientBelong; + + /** 职业 */ + private String occupation; + + /** 疾病编码(WS 218-2020) */ + @NotBlank(message = "疾病编码不能为空") + private String diseaseCode; + + /** 分型(6类必分型疾病必填) */ + private String diseaseType; + + /** 其他法定管理以及重点监测传染病 */ + private String otherDisease; + + /** 病例分类 1疑似病例/2临床诊断病例/3确诊病例/4病原携带/5阳性检测结果 */ + private Integer caseClass; + + /** 发病日期(默认诊断时间,病原携带者填初检日期) */ + private LocalDate onsetDate; + + /** 诊断日期(精确到小时) */ + private LocalDateTime diagDate; + + /** 死亡日期(死亡病例必填) */ + private LocalDate deathDate; + + /** 订正病名(订正报告必填) */ + private String correctName; + + /** 退卡原因(退卡时必填) */ + private String withdrawReason; + + /** 报告单位(统一信用代码/医院名称) */ + private String reportOrg; + + /** 报告单位联系电话 */ + private String reportOrgPhone; + + /** 报告医生 */ + private String reportDoc; + + /** 填卡日期 */ + private LocalDate reportDate; + + /** 报卡名称代码 1-中华人民共和国传染病报告卡 */ + private Integer cardNameCode; + + /** 登记来源 1门诊/2住院 */ + private Integer registrationSource; + + /** 状态 0暂存 1已提交 2已审核 3已上报 4失败 5作废 */ + private Integer status; + + /** 失败原因(国家平台返回) */ + private String failMsg; + + /** 上报XML(日志) */ + private String xmlContent; + + /** 科室ID */ + @JsonSerialize(using = ToStringSerializer.class) + private Long deptId; + + /** 医生ID */ + @JsonSerialize(using = ToStringSerializer.class) + private Long doctorId; +} \ No newline at end of file diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationDiagnosisAppMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationDiagnosisAppMapper.xml index 332a922c..0724901b 100644 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationDiagnosisAppMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationDiagnosisAppMapper.xml @@ -125,6 +125,7 @@ T2.definition_id, T3.source_enum, T3.NAME, + T3.report_type_code AS reportTypeCode, T1.maindise_flag, T1.diag_srt_no, T1.med_type_code, diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/domain/InfectiousDiseaseReport.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/domain/InfectiousDiseaseReport.java new file mode 100644 index 00000000..663fa275 --- /dev/null +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/domain/InfectiousDiseaseReport.java @@ -0,0 +1,162 @@ +package com.openhis.administration.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.core.common.core.domain.HisBaseEntity; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 传染病报告卡实体 + * + * @author system + * @date 2025-03-04 + */ +@Data +@TableName("infectious_card") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +public class InfectiousDiseaseReport extends HisBaseEntity { + + /** 卡片编号(主键) */ + @TableId(type = IdType.INPUT) + private String cardNo; + + /** 本次就诊ID */ + @JsonSerialize(using = ToStringSerializer.class) + private Long visitId; + + /** 诊断记录唯一ID */ + @JsonSerialize(using = ToStringSerializer.class) + private Long diagId; + + /** 患者主索引 */ + @JsonSerialize(using = ToStringSerializer.class) + private Long patId; + + /** 证件类型 */ + private Integer idType; + + /** 证件号码 */ + private String idNo; + + /** 患者姓名 */ + private String patName; + + /** 家长姓名(≤14岁必填) */ + private String parentName; + + /** 性别 1男 2女 0未知 */ + private String sex; + + /** 出生日期 */ + private LocalDate birthday; + + /** 实足年龄 */ + private Integer age; + + /** 年龄单位 1岁 2月 3天 */ + private String ageUnit; + + /** 工作单位(学生填学校) */ + private String workplace; + + /** 联系电话(患者本人电话) */ + private String phone; + + /** 紧急联系人电话 */ + private String contactPhone; + + /** 现住址省 */ + private String addressProv; + + /** 现住址市 */ + private String addressCity; + + /** 现住址县 */ + private String addressCounty; + + /** 现住址街道 */ + private String addressTown; + + /** 现住址村/居委 */ + private String addressVillage; + + /** 现住址门牌号 */ + private String addressHouse; + + /** 病人属于 1本县区/2本市其他/3本省其他/4外省/5港澳台/6外籍 */ + private Integer patientBelong; + + /** 职业 */ + private String occupation; + + /** 疾病名称(WS 218-2020) */ + private String diseaseCode; + + /** 分型(6类必分型疾病必填) */ + private String diseaseType; + + /** 其他法定管理以及重点监测传染病 */ + private String otherDisease; + + /** 病例分类 1疑似病例/2临床诊断病例/3确诊病例/4病原携带/5阳性检测结果 */ + private Integer caseClass; + + /** 发病日期(默认诊断时间,病原携带者填初检日期) */ + private LocalDate onsetDate; + + /** 诊断日期(精确到小时) */ + private LocalDateTime diagDate; + + /** 死亡日期(死亡病例必填) */ + private LocalDate deathDate; + + /** 订正病名(订正报告必填) */ + private String correctName; + + /** 退卡原因(退卡时必填) */ + private String withdrawReason; + + /** 报告单位(统一信用代码/医院名称) */ + private String reportOrg; + + /** 报告单位联系电话 */ + private String reportOrgPhone; + + /** 报告医生 */ + private String reportDoc; + + /** 填卡日期 */ + private LocalDate reportDate; + + /** 报卡名称代码 1-中华人民共和国传染病报告卡 */ + private Integer cardNameCode; + + /** 登记来源 1门诊/2住院 */ + private Integer registrationSource; + + /** 状态 0暂存 1已提交 2已审核 3已上报 4失败 5作废 */ + private Integer status; + + /** 失败原因(国家平台返回) */ + private String failMsg; + + /** 上报XML(日志) */ + private String xmlContent; + + /** 科室ID */ + @JsonSerialize(using = ToStringSerializer.class) + private Long deptId; + + /** 医生ID */ + @JsonSerialize(using = ToStringSerializer.class) + private Long doctorId; +} \ No newline at end of file diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/mapper/InfectiousDiseaseReportMapper.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/mapper/InfectiousDiseaseReportMapper.java new file mode 100644 index 00000000..f88e75e4 --- /dev/null +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/mapper/InfectiousDiseaseReportMapper.java @@ -0,0 +1,16 @@ +package com.openhis.administration.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.openhis.administration.domain.InfectiousDiseaseReport; +import org.springframework.stereotype.Repository; + +/** + * 传染病报告卡Mapper接口 + * + * @author system + * @date 2025-03-04 + */ +@Repository +public interface InfectiousDiseaseReportMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/IInfectiousDiseaseReportService.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/IInfectiousDiseaseReportService.java new file mode 100644 index 00000000..c2f28805 --- /dev/null +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/IInfectiousDiseaseReportService.java @@ -0,0 +1,9 @@ +package com.openhis.administration.service; + +import com.baomidou.mybatisplus.extension.service.IService; + +import com.openhis.administration.domain.InfectiousDiseaseReport; + +public interface IInfectiousDiseaseReportService extends IService { + +} diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/InfectiousDiseaseReportServiceImpl.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/InfectiousDiseaseReportServiceImpl.java new file mode 100644 index 00000000..cc06b845 --- /dev/null +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/InfectiousDiseaseReportServiceImpl.java @@ -0,0 +1,15 @@ +package com.openhis.administration.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.openhis.administration.domain.InfectiousDiseaseReport; +import com.openhis.administration.mapper.InfectiousDiseaseReportMapper; +import com.openhis.administration.service.IInfectiousDiseaseReportService; + +import org.springframework.stereotype.Service; + +@Service +public class InfectiousDiseaseReportServiceImpl + extends ServiceImpl + implements IInfectiousDiseaseReportService { + +} diff --git a/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/diagnosis.vue b/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/diagnosis.vue index b8ecafa6..086cfaa2 100644 --- a/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/diagnosis.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/diagnosis.vue @@ -64,7 +64,7 @@
新增诊断 - 保存诊断 + 保存诊断 中医诊断 导入慢性病诊断 { - if (res.code == 200) { - // 过滤掉中医诊断,只保留西医诊断 - form.value.diagnosisList = res.data.filter(item => item.typeName !== '中医诊断'); - // 为旧数据添加默认分类 - form.value.diagnosisList.forEach(item => { - if (!item.classification) { - item.classification = '西医'; - } - }); - emits('diagnosisSave', false); - } - maxNo = form.value.diagnosisList.length; - }) - .then(() => { - getTcmDiagnosis({ encounterId: props.patientInfo.encounterId }).then((res) => { - if (res.code == 200) { - if (res.data.illness.length > 0) { - res.data.illness.forEach((item, index) => { - if (item.diagSrtNo <= maxNo) { - return; - } - form.value.diagnosisList.push({ - name: item.name + '-' + res.data.symptom[index].name, - diagSrtNo: item.diagSrtNo, - ybNo: item.ybNo, - medTypeCode: item.medTypeCode, - syndromeGroupNo: item.syndromeGroupNo, - typeName: '中医诊断', - classification: '中医', // 中医诊断默认分类 - onsetDate: item.onsetDate, - updateId:item.encounterDiagnosisId+'-'+res.data.symptom[index].encounterDiagnosisId, - illnessDefinitionId : item.definitionId, - symptomDefinitionId : res.data.symptom[index].definitionId, - symptomYbNo: res.data.symptom[index].ybNo, - }); - maxNo = item.diagSrtNo; - }); - } - emits('diagnosisSave', false); +async function getList() { + try { + const res = await getEncounterDiagnosis(props.patientInfo.encounterId); + if (res.code == 200) { + // 过滤掉中医诊断,只保留西医诊断 + form.value.diagnosisList = res.data.filter(item => item.typeName !== '中医诊断'); + // 为旧数据添加默认分类 + form.value.diagnosisList.forEach(item => { + if (!item.classification) { + item.classification = '西医'; } }); - }); - getTree(); + emits('diagnosisSave', false); + } + maxNo = form.value.diagnosisList.length; + + const tcmRes = await getTcmDiagnosis({ encounterId: props.patientInfo.encounterId }); + if (tcmRes.code == 200) { + if (tcmRes.data.illness.length > 0) { + tcmRes.data.illness.forEach((item, index) => { + if (item.diagSrtNo <= maxNo) { + return; + } + form.value.diagnosisList.push({ + name: item.name + '-' + tcmRes.data.symptom[index].name, + diagSrtNo: item.diagSrtNo, + ybNo: item.ybNo, + medTypeCode: item.medTypeCode, + syndromeGroupNo: item.syndromeGroupNo, + typeName: '中医诊断', + classification: '中医', // 中医诊断默认分类 + onsetDate: item.onsetDate, + updateId:item.encounterDiagnosisId+'-'+tcmRes.data.symptom[index].encounterDiagnosisId, + illnessDefinitionId : item.definitionId, + symptomDefinitionId : tcmRes.data.symptom[index].definitionId, + symptomYbNo: tcmRes.data.symptom[index].ybNo, + }); + maxNo = item.diagSrtNo; + }); + } + emits('diagnosisSave', false); + } + getTree(); + } catch (error) { + console.error('获取诊断列表失败:', error); + } } init(); @@ -574,54 +575,105 @@ function handleMaindise(value, index) { /** * 保存诊断 + * 使用 async/await 重构,优化错误处理和加载状态 */ -function handleSaveDiagnosis() { - proxy.$refs.formRef.validate((valid) => { - if (valid) { - if (form.value.diagnosisList.length == 0) { - proxy.$modal.msgWarning('诊断不能为空'); - return false; - } else if (!form.value.diagnosisList.some((diagnosis) => diagnosis.maindiseFlag === 1)) { - proxy.$modal.msgWarning('至少添加一条主诊断'); - return false; - } else { - // 保存前按排序号排序 - form.value.diagnosisList.sort((a, b) => (a.diagSrtNo || 0) - (b.diagSrtNo || 0)); - - saveDiagnosis({ - patientId: props.patientInfo.patientId, - encounterId: props.patientInfo.encounterId, - diagnosisChildList: form.value.diagnosisList, - }).then((res) => { - if (res.code == 200) { - getTree(); - getList(); - emits('diagnosisSave', false); - proxy.$modal.msgSuccess('诊断已保存并按排序号排序'); - //食源性疾病病例数据智能采集 ---START--- - isFoodDiseasesNew({ - encounterId: props.patientInfo.encounterId, - }).then((res) => { - if (res.code == 200) { - let jumpUrl = res.data; - if (jumpUrl) { - window.open(jumpUrl, '_blank'); - } - } - }); - //食源性疾病病例数据智能采集 ---END--- - //传染病报告卡 ---START--- - // 获取主诊断数据,弹出传染病报告卡 - const mainDiagnosis = form.value.diagnosisList.find(d => d.maindiseFlag === 1); - if (mainDiagnosis) { - proxy.$refs.infectiousDiseaseReportRef.show(mainDiagnosis); - } - //传染病报告卡 ---END--- - } - }); - } +async function handleSaveDiagnosis() { + try { + // 表单验证 + const valid = await proxy.$refs.formRef.validate().catch(() => false); + if (!valid) { + return; } - }); + + // 检查诊断列表是否为空 + if (form.value.diagnosisList.length === 0) { + proxy.$modal.msgWarning('诊断不能为空'); + return; + } + + // 检查是否至少有一条主诊断 + const hasMainDiagnosis = form.value.diagnosisList.some((diagnosis) => diagnosis.maindiseFlag === 1); + if (!hasMainDiagnosis) { + proxy.$modal.msgWarning('至少添加一条主诊断'); + return; + } + + // 防护性检查:确保患者信息完整 + if (!props.patientInfo?.patientId || !props.patientInfo?.encounterId) { + proxy.$modal.msgWarning('患者信息不完整,无法保存诊断'); + return; + } + + // 开始加载状态,防止重复提交 + saveLoading.value = true; + + // 保存前按排序号排序 + form.value.diagnosisList.sort((a, b) => (a.diagSrtNo || 0) - (b.diagSrtNo || 0)); + + // 调用保存诊断接口 + const res = await saveDiagnosis({ + patientId: props.patientInfo.patientId, + encounterId: props.patientInfo.encounterId, + diagnosisChildList: form.value.diagnosisList, + }); + + if (res.code === 200) { + // 刷新树和列表数据(等待列表数据加载完成,确保获取到reportTypeCode) + await getList(); + getTree(); + emits('diagnosisSave', false); + proxy.$modal.msgSuccess('诊断已保存并按排序号排序'); + + // 食源性疾病病例数据智能采集 + await handleFoodDiseasesCheck(); + + // 传染病报告卡:检查诊断的reportTypeCode,弹出对应的报告卡界面 + handleInfectiousDiseaseReport(); + } + } catch (error) { + console.error('保存诊断失败:', error); + proxy.$modal.msgError('保存诊断失败,请稍后重试'); + } finally { + // 结束加载状态 + saveLoading.value = false; + } +} + +/** + * 食源性疾病病例数据智能采集 + */ +async function handleFoodDiseasesCheck() { + try { + const res = await isFoodDiseasesNew({ + encounterId: props.patientInfo.encounterId, + }); + if (res.code === 200 && res.data) { + window.open(res.data, '_blank'); + } + } catch (error) { + console.error('食源性疾病检查失败:', error); + } +} + +/** + * 传染病报告卡处理 + * 通过诊断目录维护的'报卡类型'字段自动识别是否有需要填写的传染病报告卡 + * 如果有则弹出诊断对应需登记的报告卡界面 + */ +function handleInfectiousDiseaseReport() { + // 查找所有有报卡类型的诊断(reportTypeCode不为空) + const diagnosesWithReportType = form.value.diagnosisList.filter(d => d.reportTypeCode); + + if (diagnosesWithReportType.length === 0) { + return; + } + + // 优先使用主诊断,如果没有主诊断有报卡类型则使用第一个有报卡类型的诊断 + const mainDiagnosisWithReport = diagnosesWithReportType.find(d => d.maindiseFlag === 1); + const targetDiagnosis = mainDiagnosisWithReport || diagnosesWithReportType[0]; + + // 弹出传染病报告卡弹窗 + proxy.$refs.infectiousDiseaseReportRef?.show(targetDiagnosis); } /** diff --git a/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/infectiousDiseaseReportDialog.vue b/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/infectiousDiseaseReportDialog.vue index bf52c1dc..71bfaece 100644 --- a/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/infectiousDiseaseReportDialog.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/infectiousDiseaseReportDialog.vue @@ -8,49 +8,49 @@ @close="handleClose" > -
+ -
-
+ + 患者姓名 - -
-
+ + + 家长姓名 - -
-
+ + + 身份证号 - -
-
+ + + -
-
+ + 性别 - + 未知 -
-
+ + 出生日期
@@ -60,113 +60,107 @@
-
-
+ + 或 实足年龄
- +
-
-
+ + -
-
+ + 工作单位(学校) - -
-
+ + + -
-
+ + 联系电话 -
-
+ + 紧急联系人电话 - -
-
+ + + -
-
+ + 现住地址 -
- +
-
-
加载失败,请手动输入
-
- - - - -
-
-
-
-
-
- -
-
- -
-
+ + + + + + + + + + -
-
+ + 病人属于 - - 本县区 - 本市其他县区 - 本省其他地市 - 外省 - 港澳台 - 外籍 + + 本县区 + 本市其他县区 + 本省其他地市 + 外省 + 港澳台 + 外籍 -
-
+ + -
-
+ + 职业 - + -
-
+ + -
-
+ + 病例分类 - + 疑似病例 临床诊断病例 确诊病例 病原携带者 阳性检测结果 -
-
+ + -
-
+ + 发病日期 -
-
+ + 诊断日期 -
-
+ + 死亡日期 -
-
+ + -
-
+ + 疾病名称(勾选或补填) -
-
+ + -
+
甲类传染病
- 鼠疫 - 霍乱
-
+
-
+
乙类传染病
- 传染性非典型肺炎 - 艾滋病 - 病毒性肝炎 - 脊髓灰质炎 - 人感染高致病性禽流感 - 麻疹 - 流行性出血热 - 狂犬病 - 流行性乙型脑炎 - 登革热 - 炭疽 - 细菌性和阿米巴性痢疾 - 肺结核 - 伤寒和副伤寒 - 流行性脑脊髓膜炎 - 百日咳 - 白喉 - 新生儿破伤风 - 猩红热 - 布鲁氏菌病 - 淋病 - ����病 + 梅毒 - 钩端螺旋体病 - 血吸虫病 - 疟疾
-
+ -
+
丙类传染病
手足口病
-
+ -
-
+ + 其他法定管理以及重点监测传染病 -
-
- 分型 - + + 分型 + - -
-
+ + -
-
+ + 报告单位 - -
-
+ + + 联系电话 - -
-
+ + + 报告医生 - -
-
+ + + -
-
+ + 填卡日期 -
-
- 修订病名 - -
-
+ + + 修正病名 + + + 退卡原因 - -
-
+ + + -
-
+ + 备注 -
-
+ + -
+ diff --git a/openhis-ui-vue3/src/views/doctorstation/components/inspection/inspectionApplication.vue b/openhis-ui-vue3/src/views/doctorstation/components/inspection/inspectionApplication.vue index 9e7ef421..8d2a4a99 100644 --- a/openhis-ui-vue3/src/views/doctorstation/components/inspection/inspectionApplication.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/inspection/inspectionApplication.vue @@ -714,7 +714,11 @@ async function loadInspectionData() { .map((type, index) => { const categoryItems = allItems .filter(item => { - const isInspection = item.categoryCode_dictText === '检验' || + // 更宽松的过滤条件:如果没有明确的检验类别标识,也认为是检验项目 + const isInspection = !item.categoryCode_dictText || + !item.categoryName || + !item.categoryCode || + item.categoryCode_dictText === '检验' || item.categoryName === '检验' || item.categoryCode === 'inspection' const matchType = item.typeName === type.name || @@ -746,14 +750,13 @@ async function loadInspectionData() { } }) - // 如果没有分类数据,但有项目数据,创建一个默认分类 - if (categories.length === 0 && allItems.length > 0) { + // 过滤掉没有项目的分类 + const validCategories = categories.filter(cat => cat.items.length > 0) + + // 如果没有有效分类,但有项目数据,创建一个默认分类 + if (validCategories.length === 0 && allItems.length > 0) { const defaultItems = allItems - .filter(item => item.categoryCode_dictText === '检验' || - item.categoryName === '检验' || - item.categoryCode === 'inspection' || - true) - .slice(0, 50) // 优化:增加默认显示数量 + .slice(0, 50) // 优化:限制显示数量 .map(item => ({ itemId: item.id || item.activityId || Math.random().toString(36).substr(2, 9), itemName: item.name || item.itemName || '', @@ -770,7 +773,7 @@ async function loadInspectionData() { })) if (defaultItems.length > 0) { - categories.push({ + validCategories.push({ key: 'default', label: '检验项目', expanded: true, @@ -779,14 +782,35 @@ async function loadInspectionData() { } } - // 过滤掉没有项目的分类 - const validCategories = categories.filter(cat => cat.items.length > 0) - if (validCategories.length > 0) { inspectionCategories.value = validCategories activeCategory.value = validCategories[0].key + console.log('【检验】数据加载成功,分类数量:', validCategories.length) } else { - throw new Error('未获取到有效的检验项目数据') + console.warn('【检验】未获取到有效的检验项目数据,使用备用数据') + // 直接使用备用数据,不抛出错误 + inspectionCategories.value = [ + { + key: 'biochemical', + label: '生化', + expanded: true, + items: [ + { itemId: 1, itemName: '肝功能', itemPrice: 31, itemAmount: 31, sampleType: '血清', unit: 'U/L', itemQty: 1, serviceFee: 0, type: '生化', isSelfPay: false }, + { itemId: 2, itemName: '肾功能', itemPrice: 28, itemAmount: 28, sampleType: '血清', unit: 'U/L', itemQty: 1, serviceFee: 0, type: '生化', isSelfPay: false }, + { itemId: 3, itemName: '血糖', itemPrice: 15, itemAmount: 15, sampleType: '血清', unit: 'mmol/L', itemQty: 1, serviceFee: 0, type: '生化', isSelfPay: false } + ] + }, + { + key: 'blood', + label: '临检', + expanded: false, + items: [ + { itemId: 4, itemName: '血常规+crp', itemPrice: 50, itemAmount: 50, sampleType: '全血', unit: '×10^9/L', itemQty: 1, serviceFee: 0, type: '血液', isSelfPay: false }, + { itemId: 5, itemName: '血常规(五分类)', itemPrice: 15, itemAmount: 15, sampleType: '全血', unit: '×10^9/L', itemQty: 1, serviceFee: 0, type: '血液', isSelfPay: false } + ] + } + ] + activeCategory.value = 'biochemical' } } catch (error) { console.error('加载检验项目数据失败:', error)