需求17 门诊医生站-》患者列表,修复门诊医生站的初诊/复诊标识没有完成数据存储和显示

This commit is contained in:
HuangShun
2026-01-29 14:59:07 +08:00
parent 96a8f75aa1
commit 638f853af6
5 changed files with 56 additions and 45 deletions

View File

@@ -50,7 +50,7 @@ public interface IDoctorStationMainAppService {
* @param encounterId 就诊id * @param encounterId 就诊id
* @return 结果 * @return 结果
*/ */
R<?> completeEncounter(Long encounterId); R<?> completeEncounter(Long encounterId, Integer firstEnum);
/** /**
* 取消完成 * 取消完成

View File

@@ -173,51 +173,52 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
* @return 结果 * @return 结果
*/ */
@Override @Override
public R<?> completeEncounter(Long encounterId) { @Transactional(rollbackFor = Exception.class)
// 1. 检查当前患者状态是否为就诊中20 public R<?> completeEncounter(Long encounterId, Integer firstEnum) {
// 1. 检查当前患者状态
Encounter encounter = encounterMapper.selectById(encounterId); Encounter encounter = encounterMapper.selectById(encounterId);
if (encounter == null) { if (encounter == null) {
return R.fail("就诊记录不存在"); return R.fail("就诊记录不存在");
} }
// 检查状态是否为就诊中
if (!EncounterStatus.IN_PROGRESS.getValue().equals(encounter.getStatusEnum())) { if (!EncounterStatus.IN_PROGRESS.getValue().equals(encounter.getStatusEnum())) {
return R.fail("当前患者不在就诊中状态"); return R.fail("当前患者不在就诊中状态");
} }
// 2. 更新状态为已完成30并写入完成时间 // 2. 更新状态、完成时间以及初复诊标识
Date now = new Date(); Date now = new Date();
int update = encounterMapper.update(null, int update = encounterMapper.update(null,
new LambdaUpdateWrapper<Encounter>().eq(Encounter::getId, encounterId) new LambdaUpdateWrapper<Encounter>()
.set(Encounter::getStatusEnum, EncounterStatus.DISCHARGED.getValue()) .eq(Encounter::getId, encounterId)
.set(Encounter::getSubjectStatusEnum, EncounterSubjectStatus.DEPARTED.getValue()) .set(Encounter::getStatusEnum, EncounterStatus.DISCHARGED.getValue())
.set(Encounter::getEndTime, now)); .set(Encounter::getSubjectStatusEnum, EncounterSubjectStatus.DEPARTED.getValue())
.set(Encounter::getEndTime, now)
if (update <= 0) { .set(Encounter::getFirstEnum, firstEnum) // 直接在此处更新字段
return R.fail("更新状态失败"); .set(Encounter::getUpdateTime, now));
}
if (update <= 0) return R.fail("完诊失败");
// 3. 写入审计日志
// 3. 审计日志
try { try {
String username = SecurityUtils.getUsernameSafe(); String username = SecurityUtils.getUsernameSafe();
String sql = "INSERT INTO sys_oper_log " String sql = "INSERT INTO sys_oper_log "
+ "(title,oper_time,method,request_method,oper_name,oper_url,oper_param,json_result) " + "(title,oper_time,method,request_method,oper_name,oper_url,oper_param,json_result) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; + "VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
jdbcTemplate.update(sql, jdbcTemplate.update(sql,
"完诊操作", "完诊操作",
now, now,
"DoctorStationMainAppServiceImpl.completeEncounter()", "DoctorStationMainAppServiceImpl.completeEncounter()",
"POST", "POST",
username, username,
"/doctorstation/main/complete-encounter", "/doctorstation/main/complete-encounter",
"{\"encounterId\": " + encounterId + "}", "{\"encounterId\": " + encounterId + "}",
"{\"code\": 200, \"msg\": \"就诊完成\", \"data\": null}"); "{\"code\": 200, \"msg\": \"就诊完成\", \"data\": null}");
} catch (Exception e) { } catch (Exception e) {
log.error("写入完诊审计日志失败", e); log.error("写入完诊审计日志失败", e);
// 审计日志失败不影响主流程 // 审计日志失败不影响主流程
} }
return R.ok("就诊完成"); return R.ok("就诊完成");
} }

View File

@@ -4,6 +4,7 @@
package com.openhis.web.doctorstation.controller; package com.openhis.web.doctorstation.controller;
import com.core.common.core.domain.R; import com.core.common.core.domain.R;
import com.core.common.utils.StringUtils;
import com.openhis.common.enums.Whether; import com.openhis.common.enums.Whether;
import com.openhis.web.doctorstation.appservice.IDoctorStationMainAppService; import com.openhis.web.doctorstation.appservice.IDoctorStationMainAppService;
import com.openhis.web.doctorstation.dto.DoctorStationInitDto; import com.openhis.web.doctorstation.dto.DoctorStationInitDto;
@@ -11,12 +12,10 @@ import com.openhis.web.doctorstation.dto.PatientInfoDto;
import com.openhis.web.doctorstation.dto.PrescriptionInfoBaseDto; import com.openhis.web.doctorstation.dto.PrescriptionInfoBaseDto;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/** /**
* 医生站-主页面 controller * 医生站-主页面 controller
@@ -98,19 +97,29 @@ public class DoctorStationMainController {
/** /**
* 就诊完成 * 就诊完成
* *
* @param encounterId 就诊id * @param params 包含 encounterId 和 firstEnum 的键值对
* @return 结果 * @return 结果
*/ */
@GetMapping(value = "/complete-encounter") @PostMapping(value = "/complete-encounter") // JSON提交必须用POST
public R<?> completeEncounter(@RequestParam(value = "encounterId", required = false) String encounterId) { public R<?> completeEncounter(@RequestBody Map<String, Object> params) {
if (encounterId == null || "undefined".equals(encounterId) || "null".equals(encounterId)) { // 从 map 中提取数据
Object encounterIdObj = params.get("encounterId");
Object firstEnumObj = params.get("firstEnum");
if (encounterIdObj == null || StringUtils.isEmpty(encounterIdObj.toString())) {
return R.fail("就诊ID不能为空"); return R.fail("就诊ID不能为空");
} }
if (firstEnumObj == null) {
return R.fail("初复诊状态不能为空");
}
try { try {
Long id = Long.parseLong(encounterId); Long id = Long.parseLong(encounterIdObj.toString());
return iDoctorStationMainAppService.completeEncounter(id); Integer firstEnum = Integer.parseInt(firstEnumObj.toString());
// 调用 Service
return iDoctorStationMainAppService.completeEncounter(id, firstEnum);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
return R.fail("就诊ID格式错误"); return R.fail("数据格式错误ID或初复诊状态非数字");
} }
} }

View File

@@ -68,10 +68,11 @@ export const rearrangeMissedNumber = (encounterId) => {
/** /**
* 完诊 * 完诊
*/ */
export function completeEncounter(encounterId) { export function completeEncounter(params) {
return request({ return request({
url: '/doctor-station/main/complete-encounter?encounterId=' + encounterId, url: '/doctor-station/main/complete-encounter',
method: 'get', method: 'post',
data: params,
}); });
} }

View File

@@ -569,7 +569,7 @@ function handleLeave(encounterId) {
} }
function handleFinish(encounterId) { function handleFinish(encounterId) {
completeEncounter(encounterId).then((res) => { completeEncounter({ encounterId, firstEnum: firstEnum.value }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
proxy.$modal.msgSuccess('操作成功'); proxy.$modal.msgSuccess('操作成功');
patientInfo.value = {}; patientInfo.value = {};