完成:102 门诊医生站-》诊断TAB页:增加报卡弹框登记界面
疾病报告卡新增功能。 修改诊断疾病的sql查询语句
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<InfectiousDiseaseReport> 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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,6 +58,9 @@ public class DiagnosisQueryDto {
|
||||
/** 医保编码 */
|
||||
private String ybNo;
|
||||
|
||||
/** 报卡类型 */
|
||||
private String reportTypeCode;
|
||||
|
||||
/** 诊断排序(医保文档要求数值型字符长度为2) */
|
||||
private Integer diagSrtNo;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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<InfectiousDiseaseReport> {
|
||||
|
||||
}
|
||||
@@ -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<InfectiousDiseaseReport> {
|
||||
|
||||
}
|
||||
@@ -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<InfectiousDiseaseReportMapper, InfectiousDiseaseReport>
|
||||
implements IInfectiousDiseaseReportService {
|
||||
|
||||
}
|
||||
@@ -64,7 +64,7 @@
|
||||
<el-col :span="20" :xs="24">
|
||||
<div style="margin-bottom: 10px">
|
||||
<el-button type="primary" plain @click="handleAddDiagnosis()"> 新增诊断 </el-button>
|
||||
<el-button type="primary" plain @click="handleSaveDiagnosis()"> 保存诊断 </el-button>
|
||||
<el-button type="primary" plain @click="handleSaveDiagnosis()" :loading="saveLoading"> 保存诊断 </el-button>
|
||||
<el-button type="primary" plain @click="handleAddTcmDiagonsis()"> 中医诊断 </el-button>
|
||||
<el-button type="primary" plain @click="handleImport()"> 导入慢性病诊断 </el-button>
|
||||
<span style="font-size: 12px; margin-left: 10px"
|
||||
@@ -279,6 +279,7 @@ const diagnosisOptions = ref([]);
|
||||
const rowIndex = ref();
|
||||
const diagnosis = ref();
|
||||
const orgOrUser = ref();
|
||||
const saveLoading = ref(false);
|
||||
const form = ref({
|
||||
diagnosisList: [],
|
||||
isDataLoaded: false,
|
||||
@@ -325,52 +326,52 @@ function refreshData() {
|
||||
getList();
|
||||
}
|
||||
let maxNo = 99;
|
||||
function getList() {
|
||||
getEncounterDiagnosis(props.patientInfo.encounterId)
|
||||
.then((res) => {
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user