需求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, "传染病报告卡数据");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user