医生站-部分

This commit is contained in:
Wang.Huan
2025-03-10 13:52:31 +08:00
parent e2d17ce60c
commit f78d8902da
13 changed files with 430 additions and 16 deletions

View File

@@ -0,0 +1,23 @@
package com.openhis.web.doctorstation.appservice;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.openhis.web.doctorstation.dto.PatientInfoDto;
/**
* 医生站-电子病历 应用Service
*/
public interface IDoctorStationEmrAppService {
/**
* 查询就诊患者信息
*
* @param patientInfoDto 查询条件 (前端传 statusEnum 区分就诊状态tab)
* @param searchKey 模糊查询关键字
* @param pageNo 当前页
* @param pageSize 每页多少条
* @return 就诊患者信息
*/
IPage<PatientInfoDto> getPatientInfo(PatientInfoDto patientInfoDto, String searchKey, Integer pageNo,
Integer pageSize);
}

View File

@@ -0,0 +1,61 @@
package com.openhis.web.doctorstation.appservice.impl;
import java.util.Arrays;
import java.util.HashSet;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.utils.AgeCalculatorUtil;
import com.openhis.common.enums.AdministrativeGender;
import com.openhis.common.enums.ClinicalStatus;
import com.openhis.common.enums.EncounterStatus;
import com.openhis.common.enums.ParticipantType;
import com.openhis.common.utils.EnumUtils;
import com.openhis.common.utils.HisQueryUtils;
import com.openhis.web.doctorstation.appservice.IDoctorStationEmrAppService;
import com.openhis.web.doctorstation.dto.PatientInfoDto;
import com.openhis.web.doctorstation.mapper.DoctorStationEmrAppMapper;
/**
* 医生站-电子病历 应用实现类
*/
@Service
public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppService {
@Resource
DoctorStationEmrAppMapper doctorStationEmrAppMapper;
/**
* 查询就诊患者信息
*
* @param patientInfoDto 查询条件 (前端传 statusEnum 区分就诊状态tab)
* @param searchKey 模糊查询关键字
* @param pageNo 当前页
* @param pageSize 每页多少条
* @return 就诊患者信息
*/
@Override
public IPage<PatientInfoDto> getPatientInfo(PatientInfoDto patientInfoDto, String searchKey, Integer pageNo,
Integer pageSize) {
// 构建查询条件
QueryWrapper<PatientInfoDto> queryWrapper = HisQueryUtils.buildQueryWrapper(patientInfoDto, searchKey,
new HashSet<>(Arrays.asList("patient_name", "id_card", "phone")), null);
IPage<PatientInfoDto> patientInfo = doctorStationEmrAppMapper.getPatientInfo(new Page<>(pageNo, pageSize),
ParticipantType.ADMITTER.getCode(), ClinicalStatus.INACTIVE.getValue(), null, null, queryWrapper);
patientInfo.getRecords().forEach(e -> {
// 性别
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
// 计算年龄
e.setAge(AgeCalculatorUtil.getAge(e.getBirthDate()));
// 就诊状态
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(EncounterStatus.class, e.getStatusEnum()));
});
return patientInfo;
}
}

View File

@@ -0,0 +1,21 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.doctorstation.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* 医生站-医嘱 controller
*/
@RestController
@RequestMapping("/doctor-station/advice")
@Slf4j
@AllArgsConstructor
public class DoctorStationAdviceController {
}

View File

@@ -0,0 +1,21 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.doctorstation.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* 医生站-诊断 controller
*/
@RestController
@RequestMapping("/doctor-station/diagnosis")
@Slf4j
@AllArgsConstructor
public class DoctorStationDiagnosisController {
}

View File

@@ -0,0 +1,58 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.doctorstation.controller;
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 com.core.common.core.domain.R;
import com.openhis.web.doctorstation.appservice.IDoctorStationEmrAppService;
import com.openhis.web.doctorstation.dto.DoctorStationInitDto;
import com.openhis.web.doctorstation.dto.PatientInfoDto;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* 医生站-电子病历 controller
*/
@RestController
@RequestMapping("/doctor-station/emr")
@Slf4j
@AllArgsConstructor
public class DoctorStationEmrController {
private final IDoctorStationEmrAppService iDoctorStationEmrAppService;
/**
* 医生站基础数据初始化
*
* @return 基础数据
*/
@GetMapping(value = "/init")
public R<?> init() {
// DoctorStationInitDto doctorStationInitDto = new DoctorStationInitDto();
return R.ok(new DoctorStationInitDto());
}
/**
* 查询就诊患者信息
*
* @param patientInfoDto 查询条件 (前端传 statusEnum 区分就诊状态tab)
* @param searchKey 模糊查询关键字
* @param pageNo 当前页
* @param pageSize 每页多少条
* @return 就诊患者信息
*/
@GetMapping(value = "/patient-info")
public R<?> getPatientInfo(PatientInfoDto patientInfoDto,
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
return R.ok(iDoctorStationEmrAppService.getPatientInfo(patientInfoDto, searchKey, pageNo, pageSize));
}
}

View File

@@ -0,0 +1,50 @@
package com.openhis.web.doctorstation.dto;
import java.util.ArrayList;
import java.util.List;
import com.openhis.common.enums.EncounterStatus;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 医生站 init基础数据
*/
@Data
@Accessors(chain = true)
public class DoctorStationInitDto {
private List<patientEncounterStatusOption> patientEncounterStatusOptions;
/**
* 患者就诊状态
*/
@Data
public static class patientEncounterStatusOption {
private Integer value;
private String label;
public patientEncounterStatusOption(Integer value, String label) {
this.value = value;
this.label = label;
}
}
/**
* 设置默认值
*/
public DoctorStationInitDto() {
List<patientEncounterStatusOption> options = new ArrayList<>();
options.add(
new patientEncounterStatusOption(EncounterStatus.PLANNED.getValue(), EncounterStatus.PLANNED.getInfo()));
options.add(new patientEncounterStatusOption(EncounterStatus.IN_PROGRESS.getValue(),
EncounterStatus.IN_PROGRESS.getInfo()));
options.add(
new patientEncounterStatusOption(EncounterStatus.ON_HOLD.getValue(), EncounterStatus.ON_HOLD.getInfo()));
options.add(new patientEncounterStatusOption(EncounterStatus.DISCHARGED.getValue(),
EncounterStatus.DISCHARGED.getInfo()));
this.patientEncounterStatusOptions = options;
}
}

View File

@@ -0,0 +1,73 @@
package com.openhis.web.doctorstation.dto;
import java.util.Date;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 就诊患者信息 dto
*/
@Data
@Accessors(chain = true)
public class PatientInfoDto {
/**
* 就诊ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long encounterId;
/**
* 患者id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long patientId;
/**
* 患者姓名
*/
private String patientName;
/**
* 患者性别
*/
private Integer genderEnum;
private String genderEnum_enumText;
/**
* 证件号
*/
private String idCard;
/**
* 电话
*/
private String phone;
/**
* 生日
*/
private Date birthDate;
/**
* 年龄
*/
private String age;
/**
* 就诊状态
*/
private Integer statusEnum;
private String statusEnum_enumText;
/**
* 过敏史标记
*/
private Integer allergyHistoryFlag;
}

View File

@@ -0,0 +1,34 @@
package com.openhis.web.doctorstation.mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.openhis.web.doctorstation.dto.PatientInfoDto;
/**
* 医生站-电子病历 应用Mapper
*/
@Repository
public interface DoctorStationEmrAppMapper {
/**
* 查询就诊患者信息
*
* @param page 分页参数
* @param participantType 参与者类型
* @param ClinicalStatus 过敏史状态
* @param userId 当前登录账号ID
* @param currentUserOrganizationId 当前登录账号所属的科室ID
* @param queryWrapper 查询条件
* @return 就诊患者信息
*/
IPage<PatientInfoDto> getPatientInfo(@Param("page") Page<PatientInfoDto> page,
@Param("participantType") String participantType, @Param("ClinicalStatus") Integer ClinicalStatus,
@Param("userId") Long userId, @Param("currentUserOrganizationId") Long currentUserOrganizationId,
@Param(Constants.WRAPPER) QueryWrapper<PatientInfoDto> queryWrapper);
}

View File

@@ -41,7 +41,7 @@ import com.openhis.web.outpatientservice.mapper.OutpatientRegistrationAppMapper;
* 门诊挂号 应用实现类
*/
@Service
public class IOutpatientRegistrationAppServiceImpl implements IOutpatientRegistrationAppService {
public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistrationAppService {
@Resource
PatientMapper patientMapper;
@@ -283,8 +283,8 @@ public class IOutpatientRegistrationAppServiceImpl implements IOutpatientRegistr
new HashSet<>(Arrays.asList("patient_name", "organization_name", "practitioner_name", "healthcare_name")),
null);
IPage<CurrentDayEncounterDto> currentDayEncounter =
outpatientRegistrationAppMapper.getCurrentDayEncounter(new Page<>(pageNo, pageSize), queryWrapper);
IPage<CurrentDayEncounterDto> currentDayEncounter = outpatientRegistrationAppMapper
.getCurrentDayEncounter(new Page<>(pageNo, pageSize), ParticipantType.ADMITTER.getCode(), queryWrapper);
currentDayEncounter.getRecords().forEach(e -> {
// 性别
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));

View File

@@ -32,10 +32,12 @@ public interface OutpatientRegistrationAppMapper {
* 查询当日就诊数据
*
* @param page 分页参数
* @param participantType 参与者类型
* @param queryWrapper 查询条件
* @return 当日就诊数据
*/
IPage<CurrentDayEncounterDto> getCurrentDayEncounter(@Param("page") Page<CurrentDayEncounterDto> page,
@Param("participantType") String participantType,
@Param(Constants.WRAPPER) QueryWrapper<CurrentDayEncounterDto> queryWrapper);
}

View File

@@ -0,0 +1,70 @@
<?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.doctorstation.mapper.DoctorStationEmrAppMapper">
<select id="getPatientInfo" resultType="com.openhis.web.doctorstation.dto.PatientInfoDto">
SELECT T10.tenant_id,
T10.encounter_id,
T10.organization_id,
T10.organization_name,
T10.healthcare_name,
T10.practitioner_user_id,
T10.practitioner_name,
T10.contract_name,
T10.patient_id,
T10.patient_name,
T10.gender_enum,
T10.id_card,
T10.phone,
T10.birth_date,
T10.status_enum,
T10.register_time,
T10.allergy_history_flag
from
(
SELECT T1.tenant_id AS tenant_id,
T1.ID AS encounter_id,
T1.organization_id AS organization_id,
T2.NAME AS organization_name,
T3.NAME AS healthcare_name,
T5.user_id AS practitioner_user_id,
T5.NAME AS practitioner_name,
T7.contract_name AS contract_name,
T8.ID AS patient_id,
T8.NAME AS patient_name,
T8.gender_enum AS gender_enum,
T8.id_card AS id_card,
T8.phone AS phone,
T8.birth_date AS birth_date,
T1.status_enum AS status_enum,
T1.create_time AS register_time,
CASE
WHEN T9.patient_id IS NOT NULL THEN 1
ELSE 0
END AS allergy_history_flag
FROM adm_encounter AS T1
LEFT JOIN adm_organization AS T2 ON T1.organization_id = T2.ID AND T2.delete_flag = '0'
LEFT JOIN adm_healthcare_service AS T3 ON T1.service_type_id = T3.ID AND T3.delete_flag = '0'
LEFT JOIN adm_encounter_participant AS T4
ON T1.ID = T4.encounter_id AND T4.type_code = #{participantType} AND T4.delete_flag = '0'
LEFT JOIN adm_practitioner AS T5 ON T5.ID = T4.practitioner_id AND T5.delete_flag = '0'
LEFT JOIN adm_account AS T6 ON T1.ID = T6.encounter_id AND T6.delete_flag = '0'
LEFT JOIN fin_contract AS T7 ON T6.contract_no = T7.bus_no AND T7.delete_flag = '0'
LEFT JOIN adm_patient AS T8 ON T1.patient_id = T8.ID AND T8.delete_flag = '0'
LEFT JOIN cli_allergy_intolerance AS T9
ON T1.patient_id = T9.patient_id AND T9.clinical_status_enum != #{ClinicalStatus} AND T9.delete_flag = '0'
WHERE
T1.delete_flag = '0'
<!-- 当前登录账号ID 和 当前登录账号所属的科室ID 用于控制数据权限 -->
<if test="userId != null and currentUserOrganizationId != null">
AND ( T5.user_id = #{userId}
OR T1.organization_id = #{currentUserOrganizationId} )
</if>
ORDER BY
T1.create_time ) AS T10
${ew.customSqlSegment}
</select>
</mapper>

View File

@@ -70,15 +70,15 @@
T1.status_enum AS status_enum,
T1.create_time AS register_time
FROM adm_encounter AS T1
LEFT JOIN adm_organization AS T2 ON T1.organization_id = T2.
ID
LEFT JOIN adm_healthcare_service AS T3 ON T1.service_type_id = T3.
ID
LEFT JOIN adm_encounter_participant AS T4 ON T1.ID = T4.encounter_id
LEFT JOIN adm_practitioner AS T5 ON T5.ID = T4.practitioner_id
LEFT JOIN adm_account AS T6 ON T1.ID = T6.encounter_id
LEFT JOIN fin_contract AS T7 ON T6.contract_no = T7.bus_no
LEFT JOIN adm_patient AS T8 ON T1.patient_id = T8.ID
LEFT JOIN adm_organization AS T2 ON T1.organization_id = T2.ID AND T2.delete_flag = '0'
LEFT JOIN adm_healthcare_service AS T3 ON T1.service_type_id = T3.ID AND T3.delete_flag = '0'
LEFT JOIN adm_encounter_participant AS T4
ON T1.ID = T4.encounter_id AND T4.type_code = #{participantType} AND
T4.delete_flag = '0'
LEFT JOIN adm_practitioner AS T5 ON T5.ID = T4.practitioner_id AND T5.delete_flag = '0'
LEFT JOIN adm_account AS T6 ON T1.ID = T6.encounter_id AND T6.delete_flag = '0'
LEFT JOIN fin_contract AS T7 ON T6.contract_no = T7.bus_no AND T7.delete_flag = '0'
LEFT JOIN adm_patient AS T8 ON T1.patient_id = T8.ID AND T8.delete_flag = '0'
WHERE T1.delete_flag = '0'
AND T1.create_time > CURRENT_DATE) AS T9
${ew.customSqlSegment}

View File

@@ -1,19 +1,20 @@
package com.openhis.common.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum EncounterStatus implements HisEnumInterface {
PLANNED(1, "draft", "已安排"),
PLANNED(1, "draft", "待诊"), // 已安排
IN_PROGRESS(2, "in-progress", "进行中"),
IN_PROGRESS(2, "in-progress", "在诊"), // 进行中
ON_HOLD(3, "on-hold", "暂离"),
DISCHARGED(4, "on-discharged", "诊毕,出院"),
DISCHARGED(4, "on-discharged", "诊毕"), // 诊毕,出院
COMPLETED(5, "completed", "完成,已结算"),