需求102 门诊医生站-》诊断TAB页:增加报卡弹框登记界面;
1.建立对应数据库表infectious_card 2.实现前端表单样式 3.完成相关表单数据查询以及数据传递与保存
This commit is contained in:
@@ -0,0 +1,161 @@
|
||||
package com.openhis.web.doctorstation.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.openhis.clinical.domain.InfectiousCard;
|
||||
import com.openhis.clinical.service.IInfectiousCardService;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.common.utils.poi.ExcelUtil;
|
||||
import com.core.common.core.domain.AjaxResult;
|
||||
import com.core.common.core.page.PageDomain;
|
||||
import com.core.common.core.page.TableDataInfo;
|
||||
import com.core.common.core.page.TableSupport;
|
||||
import com.core.common.utils.PageUtils;
|
||||
import com.core.common.core.controller.BaseController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.core.common.utils.PageUtils.startPage;
|
||||
|
||||
/**
|
||||
* 传染病报告卡 Controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/doctor-station/diagnosis")
|
||||
public class InfectiousDiseaseReportController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IInfectiousCardService infectiousCardService;
|
||||
|
||||
/**
|
||||
* 获取下一个卡片编号
|
||||
*/
|
||||
@GetMapping("/next-card-no")
|
||||
public AjaxResult getNextCardNo(@RequestParam String orgCode) {
|
||||
if (StringUtils.isEmpty(orgCode)) {
|
||||
return AjaxResult.error("机构编码不能为空");
|
||||
}
|
||||
try {
|
||||
String nextCardNo = infectiousCardService.generateNextCardNo(orgCode);
|
||||
return AjaxResult.success("获取成功", nextCardNo);
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("获取卡片编号失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存传染病报告卡
|
||||
*/
|
||||
@PostMapping("/save-infectious-disease-report")
|
||||
public AjaxResult saveInfectiousDiseaseReport(@RequestBody InfectiousCard infectiousCard) {
|
||||
// 验证必要参数
|
||||
if (infectiousCard == null) {
|
||||
return AjaxResult.error("请求数据不能为空");
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(infectiousCard.getCardNo())) {
|
||||
return AjaxResult.error("卡片编号不能为空");
|
||||
}
|
||||
|
||||
if (infectiousCard.getPatId() == null) {
|
||||
return AjaxResult.error("患者ID不能为空");
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(infectiousCard.getDiseaseCode())) {
|
||||
return AjaxResult.error("疾病编码不能为空");
|
||||
}
|
||||
|
||||
// 验证年龄和家长姓名的关系
|
||||
if (infectiousCard.getAge() != null && infectiousCard.getAgeUnit() != null &&
|
||||
infectiousCard.getAgeUnit().equals("1") && infectiousCard.getAge() <= 14) {
|
||||
if (StringUtils.isEmpty(infectiousCard.getParentName())) {
|
||||
return AjaxResult.error("14岁及以下患者必须填写家长姓名");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
boolean result = infectiousCardService.saveInfectiousCard(infectiousCard);
|
||||
if (result) {
|
||||
return AjaxResult.success("传染病报告卡保存成功");
|
||||
} else {
|
||||
return AjaxResult.error("传染病报告卡保存失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("保存过程中发生异常:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据卡片编号查询传染病报告卡
|
||||
*/
|
||||
@GetMapping("/get-infectious-card/{cardNo}")
|
||||
public AjaxResult getInfectiousCardByCardNo(@PathVariable String cardNo) {
|
||||
if (StringUtils.isEmpty(cardNo)) {
|
||||
return AjaxResult.error("卡片编号不能为空");
|
||||
}
|
||||
|
||||
try {
|
||||
InfectiousCard infectiousCard = infectiousCardService.getById(cardNo);
|
||||
if (infectiousCard != null) {
|
||||
return AjaxResult.success(infectiousCard);
|
||||
} else {
|
||||
return AjaxResult.error("未找到对应的传染病报告卡");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("查询过程中发生异常:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交传染病报告卡(更新状态为已提交)
|
||||
*/
|
||||
@PutMapping("/submit-infectious-card/{cardNo}")
|
||||
public AjaxResult submitInfectiousCard(@PathVariable String cardNo) {
|
||||
if (StringUtils.isEmpty(cardNo)) {
|
||||
return AjaxResult.error("卡片编号不能为空");
|
||||
}
|
||||
|
||||
try {
|
||||
InfectiousCard infectiousCard = infectiousCardService.getById(cardNo);
|
||||
if (infectiousCard == null) {
|
||||
return AjaxResult.error("未找到对应的传染病报告卡");
|
||||
}
|
||||
|
||||
// 只有暂存状态的卡片才能提交
|
||||
if (infectiousCard.getStatus() != 0) {
|
||||
return AjaxResult.error("只有暂存状态的卡片才能提交");
|
||||
}
|
||||
|
||||
infectiousCard.setStatus(1); // 设置为已提交状态
|
||||
boolean result = infectiousCardService.updateById(infectiousCard);
|
||||
if (result) {
|
||||
return AjaxResult.success("传染病报告卡提交成功");
|
||||
} else {
|
||||
return AjaxResult.error("传染病报告卡提交失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("提交过程中发生异常:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询传染病报告卡列表
|
||||
*/
|
||||
@GetMapping("/list-infectious-cards")
|
||||
public TableDataInfo listInfectiousCards(InfectiousCard infectiousCard) {
|
||||
startPage();
|
||||
List<InfectiousCard> list = infectiousCardService.list(new LambdaQueryWrapper<>(infectiousCard));
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出传染病报告卡列表
|
||||
*/
|
||||
@PostMapping("/export-infectious-cards")
|
||||
public AjaxResult exportInfectiousCards(InfectiousCard infectiousCard) {
|
||||
List<InfectiousCard> list = infectiousCardService.list(new LambdaQueryWrapper<>(infectiousCard));
|
||||
ExcelUtil<InfectiousCard> util = new ExcelUtil<>(InfectiousCard.class);
|
||||
return util.exportExcel(list, "传染病报告卡数据");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,378 @@
|
||||
package com.openhis.clinical.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 传染病报卡表
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "infectious_card")
|
||||
public class InfectiousCard implements Serializable {
|
||||
|
||||
/**
|
||||
* 卡片编号:机构代码+年月日+4位流水
|
||||
*/
|
||||
@TableId(value = "card_no")
|
||||
private String cardNo;
|
||||
|
||||
/**
|
||||
* 本次就诊ID (adm_encounter.id)
|
||||
*/
|
||||
@TableField(value = "visit_id")
|
||||
private Long visitId;
|
||||
|
||||
/**
|
||||
* 诊断记录唯一ID (adm_encounter_diagnosis.condition_id)
|
||||
*/
|
||||
@TableField(value = "diag_id")
|
||||
private Long diagId;
|
||||
|
||||
/**
|
||||
* 患者ID
|
||||
*/
|
||||
@TableField(value = "pat_id")
|
||||
private Long patId;
|
||||
|
||||
/**
|
||||
* 证件类型
|
||||
*/
|
||||
@TableField(value = "id_type")
|
||||
private Integer idType;
|
||||
|
||||
/**
|
||||
* 证件号码:18位校验
|
||||
*/
|
||||
@TableField(value = "id_no")
|
||||
private String idNo;
|
||||
|
||||
/**
|
||||
* 患者姓名
|
||||
*/
|
||||
@TableField(value = "pat_name")
|
||||
private String patName;
|
||||
|
||||
/**
|
||||
* 家长姓名:≤14岁必填
|
||||
*/
|
||||
@TableField(value = "parent_name")
|
||||
private String parentName;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
@TableField(value = "sex")
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 出生日期
|
||||
*/
|
||||
@TableField(value = "birthday")
|
||||
private LocalDate birthday;
|
||||
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
@TableField(value = "age")
|
||||
private Integer age;
|
||||
|
||||
/**
|
||||
* 年龄单位:1岁/2月/3天
|
||||
*/
|
||||
@TableField(value = "age_unit")
|
||||
private String ageUnit;
|
||||
|
||||
/**
|
||||
* 工作单位
|
||||
*/
|
||||
@TableField(value = "workplace")
|
||||
private String workplace;
|
||||
|
||||
/**
|
||||
* 电话
|
||||
*/
|
||||
@TableField(value = "phone")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@TableField(value = "contact_phone")
|
||||
private String contactPhone;
|
||||
|
||||
/**
|
||||
* 地址-省
|
||||
*/
|
||||
@TableField(value = "address_prov")
|
||||
private String addressProv;
|
||||
|
||||
/**
|
||||
* 地址-市
|
||||
*/
|
||||
@TableField(value = "address_city")
|
||||
private String addressCity;
|
||||
|
||||
/**
|
||||
* 地址-县/区
|
||||
*/
|
||||
@TableField(value = "address_county")
|
||||
private String addressCounty;
|
||||
|
||||
/**
|
||||
* 地址-乡镇/街道
|
||||
*/
|
||||
@TableField(value = "address_town")
|
||||
private String addressTown;
|
||||
|
||||
/**
|
||||
* 地址-村/居委会
|
||||
*/
|
||||
@TableField(value = "address_village")
|
||||
private String addressVillage;
|
||||
|
||||
/**
|
||||
* 地址-门牌号
|
||||
*/
|
||||
@TableField(value = "address_house")
|
||||
private String addressHouse;
|
||||
|
||||
/**
|
||||
* 患者归属:1本县区/2本市/3本省/4外省/5港澳台/6外籍
|
||||
*/
|
||||
@TableField(value = "patient_belong")
|
||||
private Integer patientBelong;
|
||||
|
||||
/**
|
||||
* 职业
|
||||
*/
|
||||
@TableField(value = "occupation")
|
||||
private String occupation;
|
||||
|
||||
/**
|
||||
* 疾病编码
|
||||
*/
|
||||
@TableField(value = "disease_code")
|
||||
private String diseaseCode;
|
||||
|
||||
/**
|
||||
* 疾病类型
|
||||
*/
|
||||
@TableField(value = "disease_type")
|
||||
private String diseaseType;
|
||||
|
||||
/**
|
||||
* 其他疾病
|
||||
*/
|
||||
@TableField(value = "other_disease")
|
||||
private String otherDisease;
|
||||
|
||||
/**
|
||||
* 病例分类:1疑似/2临床诊断/3确诊/4病原携带/5阳性
|
||||
*/
|
||||
@TableField(value = "case_class")
|
||||
private Integer caseClass;
|
||||
|
||||
/**
|
||||
* 发病日期
|
||||
*/
|
||||
@TableField(value = "onset_date")
|
||||
private LocalDate onsetDate;
|
||||
|
||||
/**
|
||||
* 诊断日期
|
||||
*/
|
||||
@TableField(value = "diag_date")
|
||||
private LocalDateTime diagDate;
|
||||
|
||||
/**
|
||||
* 死亡日期
|
||||
*/
|
||||
@TableField(value = "death_date")
|
||||
private LocalDate deathDate;
|
||||
|
||||
/**
|
||||
* 订正姓名
|
||||
*/
|
||||
@TableField(value = "correct_name")
|
||||
private String correctName;
|
||||
|
||||
/**
|
||||
* 撤销原因
|
||||
*/
|
||||
@TableField(value = "withdraw_reason")
|
||||
private String withdrawReason;
|
||||
|
||||
/**
|
||||
* 报告机构
|
||||
*/
|
||||
@TableField(value = "report_org")
|
||||
private String reportOrg;
|
||||
|
||||
/**
|
||||
* 报告机构电话
|
||||
*/
|
||||
@TableField(value = "report_org_phone")
|
||||
private String reportOrgPhone;
|
||||
|
||||
/**
|
||||
* 报告医生
|
||||
*/
|
||||
@TableField(value = "report_doc")
|
||||
private String reportDoc;
|
||||
|
||||
/**
|
||||
* 报告日期
|
||||
*/
|
||||
@TableField(value = "report_date")
|
||||
private LocalDate reportDate;
|
||||
|
||||
/**
|
||||
* 状态:0暂存 1已提交 2已审核 3已上报 4失败 5作废
|
||||
*/
|
||||
@TableField(value = "status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 失败信息
|
||||
*/
|
||||
@TableField(value = "fail_msg")
|
||||
private String failMsg;
|
||||
|
||||
/**
|
||||
* XML内容
|
||||
*/
|
||||
@TableField(value = "xml_content")
|
||||
private String xmlContent;
|
||||
|
||||
/**
|
||||
* 卡片名称代码:默认1-中华人民共和国传染病报告卡
|
||||
*/
|
||||
@TableField(value = "card_name_code")
|
||||
private Integer cardNameCode;
|
||||
|
||||
/**
|
||||
* 登记来源
|
||||
*/
|
||||
@TableField(value = "registration_source")
|
||||
private Integer registrationSource;
|
||||
|
||||
/**
|
||||
* 科室ID
|
||||
*/
|
||||
@TableField(value = "dept_id")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 医生ID
|
||||
*/
|
||||
@TableField(value = "doctor_id")
|
||||
private Long doctorId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(value = "update_time")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
public static final String COL_CARD_NO = "card_no";
|
||||
|
||||
public static final String COL_VISIT_ID = "visit_id";
|
||||
|
||||
public static final String COL_DIAG_ID = "diag_id";
|
||||
|
||||
public static final String COL_PAT_ID = "pat_id";
|
||||
|
||||
public static final String COL_ID_TYPE = "id_type";
|
||||
|
||||
public static final String COL_ID_NO = "id_no";
|
||||
|
||||
public static final String COL_PAT_NAME = "pat_name";
|
||||
|
||||
public static final String COL_PARENT_NAME = "parent_name";
|
||||
|
||||
public static final String COL_SEX = "sex";
|
||||
|
||||
public static final String COL_BIRTHDAY = "birthday";
|
||||
|
||||
public static final String COL_AGE = "age";
|
||||
|
||||
public static final String COL_AGE_UNIT = "age_unit";
|
||||
|
||||
public static final String COL_WORKPLACE = "workplace";
|
||||
|
||||
public static final String COL_PHONE = "phone";
|
||||
|
||||
public static final String COL_CONTACT_PHONE = "contact_phone";
|
||||
|
||||
public static final String COL_ADDRESS_PROV = "address_prov";
|
||||
|
||||
public static final String COL_ADDRESS_CITY = "address_city";
|
||||
|
||||
public static final String COL_ADDRESS_COUNTY = "address_county";
|
||||
|
||||
public static final String COL_ADDRESS_TOWN = "address_town";
|
||||
|
||||
public static final String COL_ADDRESS_VILLAGE = "address_village";
|
||||
|
||||
public static final String COL_ADDRESS_HOUSE = "address_house";
|
||||
|
||||
public static final String COL_PATIENT_BELONG = "patient_belong";
|
||||
|
||||
public static final String COL_OCCUPATION = "occupation";
|
||||
|
||||
public static final String COL_DISEASE_CODE = "disease_code";
|
||||
|
||||
public static final String COL_DISEASE_TYPE = "disease_type";
|
||||
|
||||
public static final String COL_OTHER_DISEASE = "other_disease";
|
||||
|
||||
public static final String COL_CASE_CLASS = "case_class";
|
||||
|
||||
public static final String COL_ONSET_DATE = "onset_date";
|
||||
|
||||
public static final String COL_DIAG_DATE = "diag_date";
|
||||
|
||||
public static final String COL_DEATH_DATE = "death_date";
|
||||
|
||||
public static final String COL_CORRECT_NAME = "correct_name";
|
||||
|
||||
public static final String COL_WITHDRAW_REASON = "withdraw_reason";
|
||||
|
||||
public static final String COL_REPORT_ORG = "report_org";
|
||||
|
||||
public static final String COL_REPORT_ORG_PHONE = "report_org_phone";
|
||||
|
||||
public static final String COL_REPORT_DOC = "report_doc";
|
||||
|
||||
public static final String COL_REPORT_DATE = "report_date";
|
||||
|
||||
public static final String COL_STATUS = "status";
|
||||
|
||||
public static final String COL_FAIL_MSG = "fail_msg";
|
||||
|
||||
public static final String COL_XML_CONTENT = "xml_content";
|
||||
|
||||
public static final String COL_CARD_NAME_CODE = "card_name_code";
|
||||
|
||||
public static final String COL_REGISTRATION_SOURCE = "registration_source";
|
||||
|
||||
public static final String COL_DEPT_ID = "dept_id";
|
||||
|
||||
public static final String COL_DOCTOR_ID = "doctor_id";
|
||||
|
||||
public static final String COL_CREATE_TIME = "create_time";
|
||||
|
||||
public static final String COL_UPDATE_TIME = "update_time";
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.openhis.clinical.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.openhis.clinical.domain.InfectiousCard;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* 传染病报卡表 Mapper 接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfectiousCardMapper extends BaseMapper<InfectiousCard> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.openhis.clinical.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.openhis.clinical.domain.InfectiousCard;
|
||||
|
||||
/**
|
||||
* 传染病报卡表 Service接口
|
||||
*/
|
||||
public interface IInfectiousCardService extends IService<InfectiousCard> {
|
||||
|
||||
/**
|
||||
* 保存传染病报告卡
|
||||
* @param infectiousCard 传染病报告卡对象
|
||||
* @return 保存结果
|
||||
*/
|
||||
boolean saveInfectiousCard(InfectiousCard infectiousCard);
|
||||
|
||||
/**
|
||||
* 生成下一个卡片编号
|
||||
* @param orgCode 医疗机构编码
|
||||
* @return 下一个卡片编号(机构编码+YYYYMMDD+4位流水号)
|
||||
*/
|
||||
String generateNextCardNo(String orgCode);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.openhis.clinical.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.openhis.clinical.domain.InfectiousCard;
|
||||
import com.openhis.clinical.mapper.InfectiousCardMapper;
|
||||
import com.openhis.clinical.service.IInfectiousCardService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* 传染病报卡表 Service实现
|
||||
*/
|
||||
@Service
|
||||
public class InfectiousCardServiceImpl extends ServiceImpl<InfectiousCardMapper, InfectiousCard> implements IInfectiousCardService {
|
||||
|
||||
@Override
|
||||
public String generateNextCardNo(String orgCode) {
|
||||
String dateStr = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
String prefix = orgCode + dateStr;
|
||||
|
||||
// --- MyBatis-Plus Lambda 重构部分开始 ---
|
||||
InfectiousCard maxCardEntity = this.lambdaQuery()
|
||||
.select(InfectiousCard::getCardNo) // 只查询编号列
|
||||
.likeRight(InfectiousCard::getCardNo, prefix) // 匹配前缀 (prefix%)
|
||||
.orderByDesc(InfectiousCard::getCardNo) // 按编号降序
|
||||
.last("LIMIT 1") // 取最大的一条
|
||||
.one(); // 获取单条实体
|
||||
|
||||
String maxCardNo = (maxCardEntity != null) ? maxCardEntity.getCardNo() : null;
|
||||
// --- 重构部分结束 ---
|
||||
|
||||
int nextSerial = 1;
|
||||
if (maxCardNo != null && maxCardNo.length() >= 4) {
|
||||
String lastFour = maxCardNo.substring(maxCardNo.length() - 4);
|
||||
try {
|
||||
nextSerial = Integer.parseInt(lastFour) + 1;
|
||||
} catch (NumberFormatException e) {
|
||||
// 流水号解析失败,使用默认值1
|
||||
}
|
||||
}
|
||||
return prefix + String.format("%04d", nextSerial);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveInfectiousCard(InfectiousCard infectiousCard) {
|
||||
// 设置默认值
|
||||
if (infectiousCard.getStatus() == null) {
|
||||
infectiousCard.setStatus(0);
|
||||
}
|
||||
|
||||
if (infectiousCard.getReportDate() == null) {
|
||||
infectiousCard.setReportDate(LocalDate.now());
|
||||
}
|
||||
|
||||
if (infectiousCard.getCreateTime() == null) {
|
||||
infectiousCard.setCreateTime(LocalDateTime.now());
|
||||
} else {
|
||||
infectiousCard.setUpdateTime(LocalDateTime.now());
|
||||
}
|
||||
|
||||
return this.saveOrUpdate(infectiousCard);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user