Merge branch 'master' of https://codeup.aliyun.com/61c0318acd8b75daa5a125f7/medical/openhis
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 门诊管理 应用实现类
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/3/7
|
||||
*/
|
||||
public interface IOutpatientSkinTestRecordService {
|
||||
|
||||
/**
|
||||
* 获取皮试项目检查状态列表
|
||||
*/
|
||||
List<PatientListDto> getSkinTestStatus();
|
||||
|
||||
/**
|
||||
* 获取皮试结果列表
|
||||
*/
|
||||
List<PatientListDto> getSkinTestResult();
|
||||
|
||||
/**
|
||||
* 分页查询门诊皮试记录,可选条件
|
||||
*
|
||||
* @param outpatientSkinTestRecordSearchParam 查询条件
|
||||
* @param pageNo 页码(默认为1)
|
||||
* @param pageSize 每页大小(默认为10)
|
||||
*/
|
||||
Page<OutpatientSkinTestRecordDto> getSkinTestRecords(
|
||||
OutpatientSkinTestRecordSearchParam outpatientSkinTestRecordSearchParam, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取门诊皮试记录列表
|
||||
*
|
||||
* @param outpatientSkinTestRecordSearchParam 门诊皮试记录查询参数
|
||||
* @param pageSize 页面大小
|
||||
* @param offset 跳过条数
|
||||
* @return 分页查询
|
||||
*/
|
||||
List<OutpatientSkinTestRecordDto> getOutpatientSkinTestRecord(
|
||||
@Param("OutpatientSkinTestRecordSearchParam") OutpatientSkinTestRecordSearchParam outpatientSkinTestRecordSearchParam,
|
||||
@Param("pageSize") Integer pageSize, @Param("offset") Integer offset);
|
||||
|
||||
/**
|
||||
* 统计门诊皮试记录数的方法
|
||||
*
|
||||
* @param outpatientSkinTestRecordSearchParam 门诊皮试记录查询参数
|
||||
* @return 分页查询
|
||||
*/
|
||||
long countOutpatientSkinTestRecords(
|
||||
@Param("OutpatientSkinTestRecordSearchParam") OutpatientSkinTestRecordSearchParam outpatientSkinTestRecordSearchParam);
|
||||
|
||||
/**
|
||||
* 护士确认执行皮试后,更新皮试记录信息(服务申请管理与过敏与不耐受的相关字段更新)
|
||||
*
|
||||
* @param outpatientSkinTestRecordDto 皮试记录信息
|
||||
*/
|
||||
int editSkinTestRecord(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
package com.openhis.web.outpatientmanage.appservice.impl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.core.common.utils.DateUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import com.openhis.administration.domain.PractitionerRole;
|
||||
import com.openhis.administration.mapper.PractitionerMapper;
|
||||
import com.openhis.administration.mapper.PractitionerRoleMapper;
|
||||
import com.openhis.clinical.domain.AllergyIntolerance;
|
||||
import com.openhis.workflow.domain.ServiceRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.clinical.mapper.AllergyIntoleranceMapper;
|
||||
import com.openhis.common.enums.ClinicalStatus;
|
||||
import com.openhis.common.enums.VerificationStatus;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.web.outpatientmanage.appservice.IOutpatientSkinTestRecordService;
|
||||
import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordDto;
|
||||
import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordSearchParam;
|
||||
import com.openhis.web.outpatientmanage.mapper.OutpatientManageMapper;
|
||||
import com.openhis.web.patientmanage.dto.PatientListDto;
|
||||
import com.openhis.workflow.mapper.ServiceRequestMapper;
|
||||
|
||||
/**
|
||||
* 门诊管理 应用实现类
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/3/7
|
||||
*/
|
||||
@Service
|
||||
public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestRecordService {
|
||||
|
||||
@Resource
|
||||
OutpatientManageMapper outpatientManageMapper;
|
||||
|
||||
@Resource
|
||||
ServiceRequestMapper serviceRequestMapper;
|
||||
|
||||
@Resource
|
||||
AllergyIntoleranceMapper allergyIntoleranceMapper;
|
||||
|
||||
@Resource
|
||||
PractitionerMapper practitionerMapper;
|
||||
|
||||
@Resource
|
||||
PractitionerRoleMapper practitionerRoleMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 获取皮试项目检查状态列表
|
||||
*/
|
||||
@Override
|
||||
public List<PatientListDto> getSkinTestStatus() {
|
||||
// 获取皮试状态列表
|
||||
List<VerificationStatus> statusList = Arrays.asList(VerificationStatus.values());
|
||||
List<PatientListDto> dtos = new ArrayList<>();
|
||||
// 取得更新值
|
||||
for (VerificationStatus status : statusList) {
|
||||
PatientListDto dto = new PatientListDto();
|
||||
dto.setValue(status.getValue());
|
||||
dto.setInfo(status.getInfo());
|
||||
dtos.add(dto);
|
||||
}
|
||||
return dtos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取皮试项目检查状态列表
|
||||
*/
|
||||
@Override
|
||||
public List<PatientListDto> getSkinTestResult() {
|
||||
// 获取皮试状态列表
|
||||
List<ClinicalStatus> statusList = Arrays.asList(ClinicalStatus.values());
|
||||
List<PatientListDto> dtos = new ArrayList<>();
|
||||
// 取得更新值
|
||||
for (ClinicalStatus status : statusList) {
|
||||
PatientListDto dto = new PatientListDto();
|
||||
dto.setValue(status.getValue());
|
||||
dto.setInfo(status.getInfo());
|
||||
dtos.add(dto);
|
||||
}
|
||||
return dtos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询门诊皮试记录,可选条件
|
||||
*
|
||||
* @param outpatientSkinTestRecordSearchParam 查询条件
|
||||
* @param pageNo 页码(默认为1)
|
||||
* @param pageSize 每页大小(默认为10)
|
||||
*/
|
||||
@Override
|
||||
public Page<OutpatientSkinTestRecordDto> getSkinTestRecords(
|
||||
OutpatientSkinTestRecordSearchParam outpatientSkinTestRecordSearchParam, Integer pageNo, Integer pageSize) {
|
||||
// 跳过的记录数
|
||||
Integer offset = (pageNo - 1) * pageSize;
|
||||
// 连表查询患者信息
|
||||
List<OutpatientSkinTestRecordDto> listOutpatientSkinTestRecords =
|
||||
outpatientManageMapper.getOutpatientSkinTestRecord(outpatientSkinTestRecordSearchParam, pageSize, offset);
|
||||
|
||||
// 查询总记录数
|
||||
long total = outpatientManageMapper.countOutpatientSkinTestRecords(outpatientSkinTestRecordSearchParam);
|
||||
// 创建Page对象并设置属性
|
||||
Page<OutpatientSkinTestRecordDto> outpatientSkinTestRecordPage = new Page<>(pageNo, pageSize, total);
|
||||
outpatientSkinTestRecordPage.setRecords(listOutpatientSkinTestRecords);
|
||||
outpatientSkinTestRecordPage.getRecords().forEach(e -> {
|
||||
// 皮试结果状态枚举类回显赋值
|
||||
e.setClinicalStatusEnum_enumText(EnumUtils.getInfoByValue(ClinicalStatus.class, e.getClinicalStatusEnum()));
|
||||
// 皮试检查项目状态枚举类回显赋值
|
||||
e.setVerificationStatusEnum_enumText(
|
||||
EnumUtils.getInfoByValue(VerificationStatus.class, e.getVerificationStatusEnum()));
|
||||
});
|
||||
return outpatientSkinTestRecordPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取门诊皮试记录列表
|
||||
*
|
||||
* @param outpatientSkinTestRecordSearchParam 门诊皮试记录查询参数
|
||||
* @param pageSize 页面大小
|
||||
* @param offset 跳过条数
|
||||
* @return 分页查询
|
||||
*/
|
||||
@Override
|
||||
public List<OutpatientSkinTestRecordDto> getOutpatientSkinTestRecord(
|
||||
OutpatientSkinTestRecordSearchParam outpatientSkinTestRecordSearchParam, Integer pageSize, Integer offset) {
|
||||
return outpatientManageMapper.getOutpatientSkinTestRecord(outpatientSkinTestRecordSearchParam, pageSize,
|
||||
offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计门诊皮试记录数的方法
|
||||
*
|
||||
* @param outpatientSkinTestRecordSearchParam 门诊皮试记录查询参数
|
||||
* @return 分页查询
|
||||
*/
|
||||
@Override
|
||||
public long
|
||||
countOutpatientSkinTestRecords(OutpatientSkinTestRecordSearchParam outpatientSkinTestRecordSearchParam) {
|
||||
return outpatientManageMapper.countOutpatientSkinTestRecords(outpatientSkinTestRecordSearchParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 护士确认执行皮试后,更新皮试记录信息(服务申请管理与过敏与不耐受的相关字段更新)
|
||||
*
|
||||
* @param outpatientSkinTestRecordDto 皮试记录信息
|
||||
*/
|
||||
@Override
|
||||
public int editSkinTestRecord(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) {
|
||||
|
||||
// 更新服务申请管理表
|
||||
ServiceRequest serviceRequest = new ServiceRequest();
|
||||
// 更新的条件
|
||||
serviceRequest.setId(outpatientSkinTestRecordDto.getId());
|
||||
|
||||
// 判断开始时间为空,不允许更新表
|
||||
if (StringUtils.isEmpty(outpatientSkinTestRecordDto.getOccurrenceStartTime())) {
|
||||
return 0;
|
||||
}
|
||||
Date endTime;
|
||||
//判断结束时间,为空以开始时间基础加10分钟
|
||||
if (StringUtils.isEmpty(outpatientSkinTestRecordDto.getOccurrenceEndTime())) {
|
||||
// 结束时间为空,开始时间加10min设置
|
||||
endTime =
|
||||
DateUtils.addDateMinute(DateUtils.parseDate(outpatientSkinTestRecordDto.getOccurrenceEndTime()), 10);
|
||||
} else {
|
||||
endTime = DateUtils.parseDate(outpatientSkinTestRecordDto.getOccurrenceEndTime());
|
||||
}
|
||||
// 设置开始时间
|
||||
serviceRequest
|
||||
.setOccurrenceStartTime(DateUtils.parseDate(outpatientSkinTestRecordDto.getOccurrenceStartTime()));
|
||||
// 设置结束时间
|
||||
serviceRequest.setOccurrenceEndTime(endTime);
|
||||
|
||||
// 获取系统登录的userId,找到practitionerId
|
||||
Practitioner practitioner;
|
||||
QueryWrapper<Practitioner> queryWrapperP = new QueryWrapper<>();
|
||||
queryWrapperP.eq("user_id", SecurityUtils.getLoginUser().getUserId()); // 设置查询条件为user_id等于指定值
|
||||
practitioner = practitionerMapper.selectOne(queryWrapperP);
|
||||
// 设置执行人ID
|
||||
serviceRequest.setPerformerId(practitioner.getId());
|
||||
|
||||
// 以执行人ID,获取执行人的身份类别
|
||||
PractitionerRole practitionerRole;
|
||||
QueryWrapper<PractitionerRole> queryWrapperPR = new QueryWrapper<>();
|
||||
queryWrapperP.eq("practitioner_id", practitioner.getId());
|
||||
practitionerRole = practitionerRoleMapper.selectOne(queryWrapperPR);
|
||||
// 设置执行人身份类别
|
||||
serviceRequest.setPerformerTypeCode(practitionerRole.getRoleCode());
|
||||
|
||||
// 以id为主条件更新服务申请管理表
|
||||
UpdateWrapper<ServiceRequest> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("id", serviceRequest.getId())
|
||||
.set("performer_type_code", serviceRequest.getPerformerTypeCode())
|
||||
.set("performer_id", serviceRequest.getPerformerId())
|
||||
.set("occurrence_start_time", serviceRequest.getOccurrenceStartTime())
|
||||
.set("occurrence_end_time", serviceRequest.getOccurrenceEndTime());
|
||||
|
||||
int count = serviceRequestMapper.update(null, updateWrapper);
|
||||
|
||||
//过敏与不耐受表更新
|
||||
AllergyIntolerance allergyIntolerance = new AllergyIntolerance();
|
||||
//设置服务申请ID
|
||||
allergyIntolerance.setRequestId(outpatientSkinTestRecordDto.getId());
|
||||
//设置临床状态(皮试结果)
|
||||
allergyIntolerance.setClinicalStatusEnum(outpatientSkinTestRecordDto.getClinicalStatusEnum());
|
||||
//设置验证状态(皮试检查的状态)
|
||||
allergyIntolerance.setVerificationStatusEnum(outpatientSkinTestRecordDto.getVerificationStatusEnum());
|
||||
//设置患者id
|
||||
allergyIntolerance.setPatientId(outpatientSkinTestRecordDto.getPatientId());
|
||||
//设置记录者id
|
||||
allergyIntolerance.setPractitionerId(practitioner.getId());
|
||||
//设置记录日期(当下日期)
|
||||
allergyIntolerance.setRecordedDate(DateUtils.getNowDate());
|
||||
//设置备注
|
||||
allergyIntolerance.setNote(outpatientSkinTestRecordDto.getNote());
|
||||
|
||||
// 以服务申请ID为主条件更新过敏与不耐受表
|
||||
UpdateWrapper<AllergyIntolerance> updateWrapperAI = new UpdateWrapper<>();
|
||||
updateWrapperAI.eq("request_id",allergyIntolerance.getRequestId());
|
||||
// boolean result = allergyIntoleranceMapper.saveOrUpdate(allergyIntolerance, updateWrapper);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.openhis.web.outpatientmanage.controller;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.web.outpatientmanage.appservice.IOutpatientSkinTestRecordService;
|
||||
import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordDto;
|
||||
import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordSearchParam;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 门诊皮试记录
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/3/5
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/outpatientmanage")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class OutpatientSkinTestRecordController {
|
||||
|
||||
private final IOutpatientSkinTestRecordService OutpatientSkinTestRecordService;
|
||||
|
||||
/**
|
||||
* 获取皮试项目检查状态列表
|
||||
*/
|
||||
@GetMapping("/list-skinteststatus")
|
||||
public R<?> getSkinTestStatus() {
|
||||
|
||||
return R.ok(OutpatientSkinTestRecordService.getSkinTestStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取皮试结果列表
|
||||
*/
|
||||
@GetMapping("/list-skintestresult")
|
||||
public R<?> getSkinTestResult() {
|
||||
|
||||
return R.ok(OutpatientSkinTestRecordService.getSkinTestResult());
|
||||
}
|
||||
|
||||
/**
|
||||
* 护士确认执行皮试后,更新皮试记录信息
|
||||
*
|
||||
* @param outpatientSkinTestRecordDto 皮试记录信息
|
||||
*/
|
||||
@PutMapping("/outpatient-record-skintest")
|
||||
public R<?> editSkinTestRecord(@Validated @RequestBody OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) {
|
||||
|
||||
if (OutpatientSkinTestRecordService.editSkinTestRecord(outpatientSkinTestRecordDto) <= 0) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"皮试项目检查"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 护士签名核对皮试记录
|
||||
*
|
||||
* @param outpatientSkinTestRecordDto 皮试记录信息
|
||||
*/
|
||||
@PutMapping("/outpatient-record-signcheck")
|
||||
public R<?> nurseSignChkPs(@Validated @RequestBody OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) {
|
||||
return R.ok("这里别忘记替换");
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询门诊皮实记录,可选条件
|
||||
*
|
||||
* @param outpatientSkinTestRecordSearchParam 查询条件
|
||||
* @param pageNo 页码(默认为1)
|
||||
* @param pageSize 每页大小(默认为10)
|
||||
*/
|
||||
@GetMapping("/outpatient-record-page")
|
||||
public R<?> getSkinTestRecords(OutpatientSkinTestRecordSearchParam outpatientSkinTestRecordSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
|
||||
return R.ok(
|
||||
OutpatientSkinTestRecordService.getSkinTestRecords(outpatientSkinTestRecordSearchParam, pageNo, pageSize));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.openhis.web.outpatientmanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 门诊皮试记录Dto
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/3/5
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OutpatientSkinTestRecordDto {
|
||||
|
||||
/** 服务申请管理表ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 处方号 */
|
||||
private String prescriptionNo;
|
||||
|
||||
/** 就诊号 */
|
||||
private String encounterBusNo;
|
||||
|
||||
/** 病人ID(前台显示用) */
|
||||
private String patientBusNo;
|
||||
|
||||
/** 病人ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long patientId;
|
||||
|
||||
/** 病人姓名 */
|
||||
private String patientName;
|
||||
|
||||
/** 执行护士 */
|
||||
@Dict(dictCode = "id", dictTable = "adm_practitioner", dictText = "name")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long performerId;
|
||||
private String performerId_dictText;
|
||||
|
||||
/** 核对人 */
|
||||
@Dict(dictCode = "id", dictTable = "adm_practitioner", dictText = "name")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long performerCheckId;
|
||||
private String performerCheckId_dictText;
|
||||
|
||||
/** 预计执行时间 */
|
||||
private String occurrenceStartTime;
|
||||
|
||||
/** 预计结束时间 */
|
||||
private String occurrenceEndTime;
|
||||
|
||||
/** 药品信息 */
|
||||
private String medicationInformation;
|
||||
|
||||
/** 药品 */
|
||||
private String medicationDetail;
|
||||
|
||||
/** 药品批次号 */
|
||||
private String medicationLotNumber;
|
||||
|
||||
/** 药品状态 */
|
||||
private Integer medicationStatusEnum;
|
||||
|
||||
/** 皮试结果 */
|
||||
private Integer clinicalStatusEnum;
|
||||
private String clinicalStatusEnum_enumText;
|
||||
|
||||
/** 皮试检查项目状态 */
|
||||
private Integer verificationStatusEnum;;
|
||||
private String verificationStatusEnum_enumText;
|
||||
|
||||
/** 备注 */
|
||||
private String note;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.openhis.web.outpatientmanage.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 门诊皮试记录查询体体条件类
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/3/5
|
||||
*/
|
||||
@Data
|
||||
public class OutpatientSkinTestRecordSearchParam {
|
||||
|
||||
/** 就诊号 */
|
||||
private String encounterBusNo;
|
||||
|
||||
/** 处方号 */
|
||||
private String prescriptionNo;
|
||||
|
||||
/** 病人ID */
|
||||
private String patientBusNo;
|
||||
|
||||
/** 手机号 */
|
||||
private String phone;
|
||||
|
||||
/** 皮试项目检查状态 */
|
||||
private Integer status;
|
||||
|
||||
/** 筛选开始时间 */
|
||||
private String beginTime;
|
||||
|
||||
/** 筛选结束时间 */
|
||||
private String endTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.openhis.web.outpatientmanage.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordSearchParam;
|
||||
import com.openhis.web.patientmanage.dto.OutpatientRecordDto;
|
||||
|
||||
/**
|
||||
* 门诊管理
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/3/5
|
||||
*/
|
||||
public interface OutpatientManageMapper {
|
||||
|
||||
/**
|
||||
* 门诊皮试记录分页查询
|
||||
*
|
||||
* @param outpatientSkinTestRecordSearchParam 门诊皮试记录查询参数
|
||||
* @param pageSize 页面大小
|
||||
* @param offset 跳过条数
|
||||
* @return 分页查询
|
||||
*/
|
||||
List<OutpatientSkinTestRecordDto> getOutpatientSkinTestRecord(
|
||||
@Param("OutpatientSkinTestRecordSearchParam") OutpatientSkinTestRecordSearchParam outpatientSkinTestRecordSearchParam,
|
||||
@Param("pageSize") Integer pageSize, @Param("offset") Integer offset);
|
||||
|
||||
/**
|
||||
* 统计门诊皮试记录数的方法
|
||||
*
|
||||
* @param outpatientSkinTestRecordSearchParam 门诊皮试记录查询参数
|
||||
* @return 分页查询
|
||||
*/
|
||||
long countOutpatientSkinTestRecords(
|
||||
@Param("OutpatientSkinTestRecordSearchParam") OutpatientSkinTestRecordSearchParam outpatientSkinTestRecordSearchParam);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.openhis.web.outpatientmanage.mapper.OutpatientManageMapper">
|
||||
|
||||
<!-- 门诊皮试记录相关查询-->
|
||||
<select id="getOutpatientSkinTestRecord"
|
||||
parameterType="com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordSearchParam"
|
||||
resultType="com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordDto">
|
||||
SELECT
|
||||
sr.prescription_no, --处方号
|
||||
e.bus_no as encounterBusNo, --就诊号
|
||||
pt.name AS patientName, --病人姓名
|
||||
pt.bus_no AS patientBusNo, --病人ID(前台显示用)
|
||||
sr.patient_id, --病人ID
|
||||
md.bus_no || ' ' || md.name || ' <br>规格:' || COALESCE(m.total_volume, '') AS medicationDetail,--药品
|
||||
m.lot_number AS medicationLotNumber, --药品批次号
|
||||
mr.status_enum, --药品状态
|
||||
sr.performer_id, --执行护士
|
||||
sr.performer_check_id,--核对人
|
||||
sr.occurrence_start_time, --预计执行时间
|
||||
sr.occurrence_end_time,--预计结束时间
|
||||
ai.clinical_status_enum, --皮试结果
|
||||
ai.verification_status_enum, --皮试检查项目状态
|
||||
ai.note --备注
|
||||
FROM
|
||||
wor_service_request sr
|
||||
LEFT JOIN adm_encounter e ON e.id = sr.encounter_id
|
||||
LEFT JOIN adm_patient pt ON pt.id = sr.patient_id
|
||||
LEFT JOIN wor_activity_definition ad ON ad.id = sr.activity_id
|
||||
LEFT JOIN med_medication_request mr ON mr.prescription_no = sr.prescription_no
|
||||
LEFT JOIN med_medication_definition md ON md.id = mr.medication_id
|
||||
LEFT JOIN med_medication m ON m.medication_def_id = md.id
|
||||
LEFT JOIN adm_encounter_participant ep ON ep.encounter_id = sr.encounter_id
|
||||
LEFT JOIN cli_allergy_intolerance ai ON ai.request_id = sr.id
|
||||
<where>
|
||||
ad.bus_no = 'ps001' -- 皮试检查的编号,todo:编号未定,后期修改
|
||||
AND mr.skin_test_flag = 1
|
||||
AND md.skin_test_flag = 1
|
||||
AND ep.type_code = '1' --首诊医生
|
||||
|
||||
<!-- 门诊号 查询条件-->
|
||||
<if test="OutpatientSkinTestRecordSearchParam != null and OutpatientSkinTestRecordSearchParam.encounterBusNo != null and OutpatientSkinTestRecordSearchParam.encounterBusNo != ''">
|
||||
AND e.bus_no LIKE CONCAT('%',#{encounterBusNo}, '%')
|
||||
</if>
|
||||
<!-- 处方号 查询条件-->
|
||||
<if test="OutpatientSkinTestRecordSearchParam != null and OutpatientSkinTestRecordSearchParam.prescriptionNo != null and OutpatientSkinTestRecordSearchParam.prescriptionNo != ''">
|
||||
AND sr.prescription_no LIKE CONCAT('%',#{prescriptionNo}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 手机号 查询条件-->
|
||||
<if test="OutpatientSkinTestRecordSearchParam != null and OutpatientSkinTestRecordSearchParam.phone != null and OutpatientSkinTestRecordSearchParam.phone != ''">
|
||||
AND pt.phone LIKE CONCAT('%',#{OutpatientRecordSearchParam.phone}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 时间筛选 -->
|
||||
<if test="OutpatientSkinTestRecordSearchParam != null and OutpatientSkinTestRecordSearchParam.beginTime != null and OutpatientSkinTestRecordSearchParam.endTime != null">
|
||||
AND ai.recorded_date BETWEEN
|
||||
TO_TIMESTAMP(#{OutpatientSkinTestRecordSearchParam.beginTime} || ' 00:00:00', 'YYYY-MM-DD HH24:MI:SS') AND
|
||||
TO_TIMESTAMP(#{OutpatientSkinTestRecordSearchParam.endTime} || ' 23:59:59', 'YYYY-MM-DD HH24:MI:SS')
|
||||
</if>
|
||||
|
||||
<!-- 皮试项目检查状态 查询条件-->
|
||||
<if test="OutpatientSkinTestRecordSearchParam != null and OutpatientSkinTestRecordSearchParam.status != null and OutpatientSkinTestRecordSearchParam.status != null">
|
||||
AND ai.verification_status_enum = #{OutpatientSkinTestRecordSearchParam.status}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY sr.prescription_no,e.bus_no,md.bus_no
|
||||
LIMIT #{pageSize} OFFSET #{offset}
|
||||
</select>
|
||||
|
||||
<select id="countOutpatientSkinTestRecords" resultType="long">
|
||||
SELECT COUNT(*)
|
||||
FROM
|
||||
wor_service_request sr
|
||||
LEFT JOIN adm_encounter e ON e.id = sr.encounter_id
|
||||
LEFT JOIN adm_patient pt ON pt.id = sr.patient_id
|
||||
LEFT JOIN wor_activity_definition ad ON ad.id = sr.activity_id
|
||||
LEFT JOIN med_medication_request mr ON mr.prescription_no = sr.prescription_no
|
||||
LEFT JOIN med_medication_definition md ON md.id = mr.medication_id
|
||||
LEFT JOIN med_medication m ON m.medication_def_id = md.id
|
||||
LEFT JOIN adm_encounter_participant ep ON ep.encounter_id = sr.encounter_id
|
||||
LEFT JOIN cli_allergy_intolerance ai ON ai.request_id = sr.id
|
||||
<where>
|
||||
ad.bus_no = 'ps001' -- 皮试检查的编号,todo:编号未定,后期修改
|
||||
AND mr.skin_test_flag = 1
|
||||
AND md.skin_test_flag = 1
|
||||
AND ep.type_code = '1' --首诊医生
|
||||
|
||||
<!-- 门诊号 查询条件-->
|
||||
<if test="OutpatientSkinTestRecordSearchParam != null and OutpatientSkinTestRecordSearchParam.encounterBusNo != null and OutpatientSkinTestRecordSearchParam.encounterBusNo != ''">
|
||||
AND e.bus_no LIKE CONCAT('%',#{encounterBusNo}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 处方号 查询条件-->
|
||||
<if test="OutpatientSkinTestRecordSearchParam != null and OutpatientSkinTestRecordSearchParam.prescriptionNo != null and OutpatientSkinTestRecordSearchParam.prescriptionNo != ''">
|
||||
AND sr.prescription_no LIKE CONCAT('%',#{prescriptionNo}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 手机号 查询条件-->
|
||||
<if test="OutpatientSkinTestRecordSearchParam != null and OutpatientSkinTestRecordSearchParam.phone != null and OutpatientSkinTestRecordSearchParam.phone != ''">
|
||||
AND pt.phone LIKE CONCAT('%',#{OutpatientRecordSearchParam.phone}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 时间筛选 -->
|
||||
<if test="OutpatientSkinTestRecordSearchParam != null and OutpatientSkinTestRecordSearchParam.beginTime != null and OutpatientSkinTestRecordSearchParam.endTime != null">
|
||||
AND ai.recorded_date BETWEEN
|
||||
TO_TIMESTAMP(#{OutpatientSkinTestRecordSearchParam.beginTime} || ' 00:00:00', 'YYYY-MM-DD HH24:MI:SS') AND
|
||||
TO_TIMESTAMP(#{OutpatientSkinTestRecordSearchParam.endTime} || ' 23:59:59', 'YYYY-MM-DD HH24:MI:SS')
|
||||
</if>
|
||||
|
||||
<!-- 皮试项目检查状态 查询条件-->
|
||||
<if test="OutpatientSkinTestRecordSearchParam != null and OutpatientSkinTestRecordSearchParam.status != null and OutpatientSkinTestRecordSearchParam.status != null">
|
||||
AND ai.verification_status_enum = #{OutpatientSkinTestRecordSearchParam.status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 门诊皮试记录相关更新-->
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user