门诊皮试 up

This commit is contained in:
liuhongrui
2025-03-12 14:55:41 +08:00
parent b6c14a3f42
commit ae8070849c
6 changed files with 76 additions and 44 deletions

View File

@@ -2,16 +2,12 @@ package com.openhis.web.outpatientmanage.appservice;
import java.util.List;
import com.core.common.core.domain.R;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordDto;
import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordSearchParam;
import com.openhis.web.patientmanage.dto.PatientListDto;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* 门诊管理 应用实现类
@@ -31,6 +27,11 @@ public interface IOutpatientSkinTestRecordService {
*/
List<PatientListDto> getSkinTestResult();
/**
* 获取药品状态列表
*/
List<PatientListDto> getMedicationStatus();
/**
* 分页查询门诊皮试记录,可选条件
*
@@ -67,13 +68,13 @@ public interface IOutpatientSkinTestRecordService {
*
* @param outpatientSkinTestRecordDto 皮试记录信息
*/
int editSkinTestRecord(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto);
boolean editSkinTestRecord(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto);
/**
* 护士核对皮试结果后,确认签名(服务申请管理与过敏与不耐受的相关字段更新)
*
* @param outpatientSkinTestRecordDto 皮试记录信息
*/
int nurseSignChkPs(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto);
boolean nurseSignChkPs(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto);
}

View File

@@ -26,6 +26,7 @@ import com.openhis.clinical.domain.AllergyIntolerance;
import com.openhis.clinical.mapper.AllergyIntoleranceMapper;
import com.openhis.clinical.service.IAllergyIntoleranceService;
import com.openhis.common.enums.ClinicalStatus;
import com.openhis.common.enums.EventStatus;
import com.openhis.common.enums.VerificationStatus;
import com.openhis.common.utils.EnumUtils;
import com.openhis.web.outpatientmanage.appservice.IOutpatientSkinTestRecordService;
@@ -59,7 +60,7 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR
PractitionerRoleMapper practitionerRoleMapper;
@Autowired
IAllergyIntoleranceService AllergyIntoleranceService;
IAllergyIntoleranceService allergyIntoleranceService;
@Autowired
IPractitionerRoleService practitionerRoleService;
@@ -109,6 +110,24 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR
return dtos;
}
/**
* 获取药品状态列表
*/
@Override
public List<PatientListDto> getMedicationStatus() {
// 获取药品状态列表
List<EventStatus> statusList = Arrays.asList(EventStatus.values());
List<PatientListDto> dtos = new ArrayList<>();
// 取得更新值
for (EventStatus status : statusList) {
PatientListDto dto = new PatientListDto();
dto.setValue(status.getValue());
dto.setInfo(status.getInfo());
dtos.add(dto);
}
return dtos;
}
/**
* 分页查询门诊皮试记录,可选条件
*
@@ -136,6 +155,9 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR
// 皮试检查项目状态枚举类回显赋值
e.setVerificationStatusEnum_enumText(
EnumUtils.getInfoByValue(VerificationStatus.class, e.getVerificationStatusEnum()));
// 药品状态状态枚举类回显赋值
e.setMedicationStatusEnum_enumText(
EnumUtils.getInfoByValue(EventStatus.class, e.getMedicationStatusEnum()));
});
return outpatientSkinTestRecordPage;
}
@@ -173,11 +195,12 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR
* @param outpatientSkinTestRecordDto 皮试记录信息
*/
@Override
public int editSkinTestRecord(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) {
// 判断核对人是否不为空
if (outpatientSkinTestRecordDto.getPerformerCheckId() != null) {
// 签名后不能修改
return 0;
public boolean editSkinTestRecord(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) {
// 判断核对人是否不为空,药品状态不是已发药
if (outpatientSkinTestRecordDto.getPerformerCheckId() != null
|| outpatientSkinTestRecordDto.getMedicationStatusEnum() != EventStatus.COMPLETED.getValue()) {
// 签名后不能修改,未发药不能修改
return false;
}
// 更新服务申请管理表
@@ -187,7 +210,7 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR
// 判断开始时间为空,不允许更新表
if (StringUtils.isEmpty(outpatientSkinTestRecordDto.getOccurrenceStartTime())) {
return 0;
return false;
}
Date endTime;
// 判断结束时间为空以开始时间基础加10分钟
@@ -208,7 +231,7 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR
Practitioner practitioner =
practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId());
if (practitioner == null) {
return 0;
return false;
}
// 设置执行人ID
serviceRequest.setPerformerId(practitioner.getId());
@@ -249,26 +272,20 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR
// 设置备注
.setNote(outpatientSkinTestRecordDto.getNote());
// 当皮试结果是为阳性的时候,设置过敏时间
if (allergyIntolerance.getClinicalStatusEnum() == 0) {
// 设置过敏时间(当下日期)
allergyIntolerance.setOnsetDateTime(DateUtils.getNowDate());
}
// 以服务申请ID为主条件更新过敏与不耐受表
UpdateWrapper<AllergyIntolerance> updateWrapperAI = new UpdateWrapper<>();
updateWrapperAI.eq("request_id", allergyIntolerance.getRequestId());
boolean result = AllergyIntoleranceService.saveOrUpdate(allergyIntolerance, updateWrapperAI);
boolean result = allergyIntoleranceService.saveOrUpdate(allergyIntolerance, updateWrapperAI);
// 更新或插入失败
if (!result || countUpdate <= 0) {
return 0;
return false;
}
return 1;
return true;
}
@Override
public int nurseSignChkPs(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) {
public boolean nurseSignChkPs(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) {
// 过敏与不耐受表更新
QueryWrapper<AllergyIntolerance> queryWrapper = new QueryWrapper<>();
@@ -276,9 +293,10 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR
AllergyIntolerance allergyIntolerance = allergyIntoleranceMapper.selectOne(queryWrapper);
// 检查的状态是确定和反驳的时候,不更新
if (allergyIntolerance == null || (allergyIntolerance.getVerificationStatusEnum() != 2
&& allergyIntolerance.getVerificationStatusEnum() != 3)) {
return 0;
if (allergyIntolerance == null
|| (allergyIntolerance.getVerificationStatusEnum() != VerificationStatus.CONFIRMED.getValue()
&& allergyIntolerance.getVerificationStatusEnum() != VerificationStatus.REFUTED.getValue())) {
return false;
}
// 更新服务申请管理表的
@@ -288,30 +306,42 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR
practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId());
// 找不到找到practitionerId时不更新
if (practitioner == null) {
return 0;
return false;
}
// 设置核对人ID
serviceRequest.setPerformerCheckId(practitioner.getId());
// 把服务请求的状态设置为已完成
serviceRequest.setStatusEnum(EventStatus.COMPLETED.getValue());
// 以id为主条件更新服务申请管理表
UpdateWrapper<ServiceRequest> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", outpatientSkinTestRecordDto.getId()).set("performer_check_id",
serviceRequest.getPerformerCheckId());
updateWrapper.eq("id", outpatientSkinTestRecordDto.getId())
.set("performer_check_id", serviceRequest.getPerformerCheckId())
.set("status_enum", serviceRequest.getStatusEnum());
boolean resultUpdateRequestService = serviceRequestService.update(null, updateWrapper);
// 设置断言人
allergyIntolerance.setCheckPractitionerId(practitioner.getId());
// 以服务申请ID为主条件更新服务申请管理表
UpdateWrapper<AllergyIntolerance> updateWrapperAI = new UpdateWrapper<>();
updateWrapperAI.eq("request_id", outpatientSkinTestRecordDto.getId()).set("check_practitioner_id",
allergyIntolerance.getCheckPractitionerId());
boolean resultUpdateAllergyIntolerance = serviceRequestService.update(updateWrapper);
if (resultUpdateRequestService && resultUpdateAllergyIntolerance) {
return 1;
// 当皮试结果是为阳性的时候,设置过敏时间
if (allergyIntolerance.getClinicalStatusEnum() == ClinicalStatus.ACTIVE.getValue()) {
// 设置过敏时间(皮实结束时间)
allergyIntolerance
.setOnsetDateTime(DateUtils.parseDate(outpatientSkinTestRecordDto.getOccurrenceEndTime()));
}
return 0;
// 以服务申请ID为主条件更新服务申请管理表
UpdateWrapper<AllergyIntolerance> updateWrapperAI = new UpdateWrapper<>();
updateWrapperAI.eq("request_id", outpatientSkinTestRecordDto.getId())
.set("check_practitioner_id", allergyIntolerance.getCheckPractitionerId())
.set("onset_date_time", allergyIntolerance.getOnsetDateTime());
boolean resultUpdateAllergyIntolerance = allergyIntoleranceService.update(null, updateWrapperAI);
if (resultUpdateRequestService && resultUpdateAllergyIntolerance) {
return true;
}
return false;
}
}

View File

@@ -55,7 +55,7 @@ public class OutpatientSkinTestRecordController {
@PutMapping("/outpatient-record-skintest")
public R<?> editSkinTestRecord(@Validated @RequestBody OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) {
if (OutpatientSkinTestRecordService.editSkinTestRecord(outpatientSkinTestRecordDto) <= 0) {
if (!OutpatientSkinTestRecordService.editSkinTestRecord(outpatientSkinTestRecordDto)) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"皮试项目检查"}));
@@ -69,7 +69,7 @@ public class OutpatientSkinTestRecordController {
@PutMapping("/outpatient-record-signcheck")
public R<?> nurseSignChkPs(@Validated @RequestBody OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) {
if (OutpatientSkinTestRecordService.nurseSignChkPs(outpatientSkinTestRecordDto) <= 0) {
if (!OutpatientSkinTestRecordService.nurseSignChkPs(outpatientSkinTestRecordDto)) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00003, null));
}
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"皮试记录护士核对签名"}));

View File

@@ -72,6 +72,7 @@ public class OutpatientSkinTestRecordDto {
/** 药品状态 */
private Integer medicationStatusEnum;
private String medicationStatusEnum_enumText;
/** 皮试结果 */
private Integer clinicalStatusEnum;

View File

@@ -16,7 +16,7 @@
ad.name AS medicationInformation, --药品信息
md.bus_no || ' ' || md.name || ' 规格:' || COALESCE(m.total_volume, '') AS medicationDetail,--药品
m.lot_number AS medicationLotNumber, --药品批次号
mr.status_enum, --药品状态
mr.status_enum AS medicationStatusEnum, --药品状态
sr.performer_id, --执行护士
sr.performer_check_id,--核对人
to_char(sr.occurrence_start_time, 'YYYY-MM-DD HH24:MI:SS') AS occurrenceStartTime, --预计执行时间
@@ -39,7 +39,7 @@
ad.bus_no = 'ps001' -- 皮试检查的编号todo编号未定后期修改
AND mr.skin_test_flag = 1
AND md.skin_test_flag = 1
AND sr.status_enum = 2 --服务状态有效
AND sr.status_enum in (2,3,6) --服务状态有效
AND ep.type_code = '1' --参与者身份类型是医生
<!-- 门诊号 查询条件-->
@@ -95,7 +95,7 @@
ad.bus_no = 'ps001' -- 皮试检查的编号todo编号未定后期修改
AND mr.skin_test_flag = 1
AND md.skin_test_flag = 1
AND sr.status_enum = 2 --服务状态有效
AND sr.status_enum in (2,3,6) --服务状态有效
AND ep.type_code = '1' --参与者身份类型是医生
<!-- 门诊号 查询条件-->