90,分诊排队管理-》医生叫号界面
This commit is contained in:
@@ -90,4 +90,10 @@ public interface IDoctorStationMainAppService {
|
||||
*/
|
||||
List<ReceptionStatisticsDto> getReceptionStatistics(String startTime,String endTime,Long practitionerId);
|
||||
|
||||
/**
|
||||
* 过号重排
|
||||
* @param encounterId 就诊ID
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> rearrangeMissedEncounter(Long encounterId);
|
||||
}
|
||||
|
||||
@@ -26,9 +26,11 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -323,4 +325,45 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
|
||||
practitionerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 过号重排核心实现
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class) // 事务保证原子性
|
||||
public R<?> rearrangeMissedEncounter(Long encounterId) {
|
||||
// 1. 校验就诊记录是否存在
|
||||
Encounter encounter = encounterMapper.selectById(encounterId);
|
||||
if (encounter == null) {
|
||||
return R.fail("就诊记录不存在");
|
||||
}
|
||||
|
||||
// 2. 校验状态:仅「在诊(IN_PROGRESS=2)」可重排
|
||||
if (!EncounterStatus.IN_PROGRESS.getValue().equals(encounter.getStatusEnum())) {
|
||||
return R.fail("仅「在诊」状态的患者可执行过号重排");
|
||||
}
|
||||
|
||||
// 3. 核心更新:改回待诊+更新missed_time
|
||||
Date now = new Date();
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
int updateCount = encounterMapper.update(null,
|
||||
new LambdaUpdateWrapper<Encounter>()
|
||||
.eq(Encounter::getId, encounterId)
|
||||
.set(Encounter::getStatusEnum, EncounterStatus.PLANNED.getValue()) // 改回1-待诊
|
||||
.set(Encounter::getMissedTime, now) // 新增:设置过号时间为当前时间
|
||||
.set(Encounter::getUpdateBy, practitionerId.toString()) // 操作医生ID
|
||||
.eq(Encounter::getStatusEnum, EncounterStatus.IN_PROGRESS.getValue())); // 防并发
|
||||
|
||||
if (updateCount == 0) {
|
||||
return R.fail("过号重排失败:状态更新异常");
|
||||
}
|
||||
|
||||
// 4. 同步更新接诊参与记录
|
||||
iEncounterParticipantService.update(new LambdaUpdateWrapper<EncounterParticipant>()
|
||||
.eq(EncounterParticipant::getEncounterId, encounterId)
|
||||
.eq(EncounterParticipant::getTypeCode, ParticipantType.ADMITTER.getCode())
|
||||
.set(EncounterParticipant::getStatusEnum, EncounterActivityStatus.COMPLETED.getValue()));
|
||||
|
||||
return R.ok("过号重排成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -133,6 +133,29 @@ public class DoctorStationMainController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 过号重排
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping(value = "/rearrange-missed-encounter")
|
||||
public R<?> rearrangeMissedEncounter(@RequestParam(value = "encounterId", required = false) String encounterId) {
|
||||
// 1. 空值校验(和现有接口保持一致)
|
||||
if (encounterId == null || "undefined".equals(encounterId) || "null".equals(encounterId)) {
|
||||
return R.fail("就诊ID不能为空");
|
||||
}
|
||||
try {
|
||||
// 2. 字符串转Long(和现有接口保持一致)
|
||||
Long id = Long.parseLong(encounterId);
|
||||
// 3. 调用AppService的过号重排方法
|
||||
return iDoctorStationMainAppService.rearrangeMissedEncounter(id);
|
||||
} catch (NumberFormatException e) {
|
||||
// 4. 格式错误处理(和现有接口保持一致)
|
||||
return R.fail("就诊ID格式错误");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询处方号列表信息
|
||||
*
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.openhis.web.doctorstation.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
@@ -127,4 +128,9 @@ public class PatientInfoDto {
|
||||
* 就诊卡号
|
||||
*/
|
||||
private String identifierNo;
|
||||
|
||||
/**
|
||||
* 过号时间
|
||||
*/
|
||||
private Date missedTime;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user