需求17 门诊医生站-》患者列表,修复门诊医生站的初诊/复诊标识没有完成数据存储和显示
This commit is contained in:
@@ -50,7 +50,7 @@ public interface IDoctorStationMainAppService {
|
||||
* @param encounterId 就诊id
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> completeEncounter(Long encounterId);
|
||||
R<?> completeEncounter(Long encounterId, Integer firstEnum);
|
||||
|
||||
/**
|
||||
* 取消完成
|
||||
|
||||
@@ -173,46 +173,47 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> completeEncounter(Long encounterId) {
|
||||
// 1. 检查当前患者状态是否为就诊中(20)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R<?> completeEncounter(Long encounterId, Integer firstEnum) {
|
||||
// 1. 检查当前患者状态
|
||||
Encounter encounter = encounterMapper.selectById(encounterId);
|
||||
if (encounter == null) {
|
||||
return R.fail("就诊记录不存在");
|
||||
}
|
||||
|
||||
// 检查状态是否为就诊中
|
||||
if (!EncounterStatus.IN_PROGRESS.getValue().equals(encounter.getStatusEnum())) {
|
||||
return R.fail("当前患者不在就诊中状态");
|
||||
}
|
||||
|
||||
// 2. 更新状态为已完成(30),并写入完成时间
|
||||
// 2. 更新状态、完成时间以及初复诊标识
|
||||
Date now = new Date();
|
||||
int update = encounterMapper.update(null,
|
||||
new LambdaUpdateWrapper<Encounter>().eq(Encounter::getId, encounterId)
|
||||
.set(Encounter::getStatusEnum, EncounterStatus.DISCHARGED.getValue())
|
||||
.set(Encounter::getSubjectStatusEnum, EncounterSubjectStatus.DEPARTED.getValue())
|
||||
.set(Encounter::getEndTime, now));
|
||||
new LambdaUpdateWrapper<Encounter>()
|
||||
.eq(Encounter::getId, encounterId)
|
||||
.set(Encounter::getStatusEnum, EncounterStatus.DISCHARGED.getValue())
|
||||
.set(Encounter::getSubjectStatusEnum, EncounterSubjectStatus.DEPARTED.getValue())
|
||||
.set(Encounter::getEndTime, now)
|
||||
.set(Encounter::getFirstEnum, firstEnum) // 直接在此处更新字段
|
||||
.set(Encounter::getUpdateTime, now));
|
||||
|
||||
if (update <= 0) {
|
||||
return R.fail("更新状态失败");
|
||||
}
|
||||
if (update <= 0) return R.fail("完诊失败");
|
||||
|
||||
// 3. 写入审计日志
|
||||
// 3. 审计日志
|
||||
try {
|
||||
String username = SecurityUtils.getUsernameSafe();
|
||||
String sql = "INSERT INTO sys_oper_log "
|
||||
+ "(title,oper_time,method,request_method,oper_name,oper_url,oper_param,json_result) "
|
||||
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
+ "(title,oper_time,method,request_method,oper_name,oper_url,oper_param,json_result) "
|
||||
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
jdbcTemplate.update(sql,
|
||||
"完诊操作",
|
||||
now,
|
||||
"DoctorStationMainAppServiceImpl.completeEncounter()",
|
||||
"POST",
|
||||
username,
|
||||
"/doctorstation/main/complete-encounter",
|
||||
"{\"encounterId\": " + encounterId + "}",
|
||||
"{\"code\": 200, \"msg\": \"就诊完成\", \"data\": null}");
|
||||
"完诊操作",
|
||||
now,
|
||||
"DoctorStationMainAppServiceImpl.completeEncounter()",
|
||||
"POST",
|
||||
username,
|
||||
"/doctorstation/main/complete-encounter",
|
||||
"{\"encounterId\": " + encounterId + "}",
|
||||
"{\"code\": 200, \"msg\": \"就诊完成\", \"data\": null}");
|
||||
} catch (Exception e) {
|
||||
log.error("写入完诊审计日志失败", e);
|
||||
// 审计日志失败不影响主流程
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package com.openhis.web.doctorstation.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.openhis.common.enums.Whether;
|
||||
import com.openhis.web.doctorstation.appservice.IDoctorStationMainAppService;
|
||||
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 lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 医生站-主页面 controller
|
||||
@@ -98,19 +97,29 @@ public class DoctorStationMainController {
|
||||
/**
|
||||
* 就诊完成
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @param params 包含 encounterId 和 firstEnum 的键值对
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping(value = "/complete-encounter")
|
||||
public R<?> completeEncounter(@RequestParam(value = "encounterId", required = false) String encounterId) {
|
||||
if (encounterId == null || "undefined".equals(encounterId) || "null".equals(encounterId)) {
|
||||
@PostMapping(value = "/complete-encounter") // JSON提交必须用POST
|
||||
public R<?> completeEncounter(@RequestBody Map<String, Object> params) {
|
||||
// 从 map 中提取数据
|
||||
Object encounterIdObj = params.get("encounterId");
|
||||
Object firstEnumObj = params.get("firstEnum");
|
||||
|
||||
if (encounterIdObj == null || StringUtils.isEmpty(encounterIdObj.toString())) {
|
||||
return R.fail("就诊ID不能为空");
|
||||
}
|
||||
if (firstEnumObj == null) {
|
||||
return R.fail("初复诊状态不能为空");
|
||||
}
|
||||
|
||||
try {
|
||||
Long id = Long.parseLong(encounterId);
|
||||
return iDoctorStationMainAppService.completeEncounter(id);
|
||||
Long id = Long.parseLong(encounterIdObj.toString());
|
||||
Integer firstEnum = Integer.parseInt(firstEnumObj.toString());
|
||||
// 调用 Service
|
||||
return iDoctorStationMainAppService.completeEncounter(id, firstEnum);
|
||||
} catch (NumberFormatException e) {
|
||||
return R.fail("就诊ID格式错误");
|
||||
return R.fail("数据格式错误(ID或初复诊状态非数字)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,10 +68,11 @@ export const rearrangeMissedNumber = (encounterId) => {
|
||||
/**
|
||||
* 完诊
|
||||
*/
|
||||
export function completeEncounter(encounterId) {
|
||||
export function completeEncounter(params) {
|
||||
return request({
|
||||
url: '/doctor-station/main/complete-encounter?encounterId=' + encounterId,
|
||||
method: 'get',
|
||||
url: '/doctor-station/main/complete-encounter',
|
||||
method: 'post',
|
||||
data: params,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -569,7 +569,7 @@ function handleLeave(encounterId) {
|
||||
}
|
||||
|
||||
function handleFinish(encounterId) {
|
||||
completeEncounter(encounterId).then((res) => {
|
||||
completeEncounter({ encounterId, firstEnum: firstEnum.value }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
proxy.$modal.msgSuccess('操作成功');
|
||||
patientInfo.value = {};
|
||||
|
||||
Reference in New Issue
Block a user