门诊记录 相关更新
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
package com.openhis.web.patientmanage.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.enums.AdministrativeGender;
|
||||
import com.openhis.web.patientmanage.dto.OutpatientRecordDto;
|
||||
import com.openhis.web.patientmanage.dto.OutpatientRecordSearchParam;
|
||||
import com.openhis.web.patientmanage.dto.PatientListDto;
|
||||
import com.openhis.web.patientmanage.mapper.PatientManageMapper;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 门诊记录
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/2/28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/patientmanage/records")
|
||||
@Slf4j
|
||||
public class OutpatientRecordController {
|
||||
|
||||
@Autowired(required = false)
|
||||
PatientManageMapper patientManageMapper;
|
||||
|
||||
/**
|
||||
* 获取医生名字列表
|
||||
*/
|
||||
@GetMapping("/list-doctornames")
|
||||
public R<?> getDoctorNames() {
|
||||
// 获取医生名字列表
|
||||
List<String> listDoctorNames = patientManageMapper.getDoctorNames();
|
||||
|
||||
return R.ok(listDoctorNames);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取性别列表
|
||||
*/
|
||||
@GetMapping("/list-administrativegender")
|
||||
public R<?> getAdministrativeGender() {
|
||||
// 获取性别
|
||||
List<AdministrativeGender> statusList = Arrays.asList(AdministrativeGender.values());
|
||||
List<PatientListDto> dtos = new ArrayList<>();
|
||||
// 取得更新值
|
||||
for (AdministrativeGender status : statusList) {
|
||||
PatientListDto dto = new PatientListDto();
|
||||
dto.setValue(status.getValue());
|
||||
dto.setInfo(status.getInfo());
|
||||
dtos.add(dto);
|
||||
}
|
||||
return R.ok(dtos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询门诊记录,可选条件
|
||||
*
|
||||
* @param outpatientRecordSearchParam 查询条件
|
||||
* @param pageNo 页码(默认为1)
|
||||
* @param pageSize 每页大小(默认为10)
|
||||
*/
|
||||
@GetMapping("/outpatient-record-page")
|
||||
public R<?> getPatient(@RequestParam(required = false) OutpatientRecordSearchParam outpatientRecordSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
|
||||
// 跳过的记录数
|
||||
Integer offset = (pageNo - 1) * pageSize;
|
||||
// 连表查询患者信息
|
||||
List<OutpatientRecordDto> listOutpatientRecords =
|
||||
patientManageMapper.getOutpatientRecord(outpatientRecordSearchParam, pageSize, offset);
|
||||
// 查询总记录数
|
||||
long total = patientManageMapper.countOutpatientRecords(outpatientRecordSearchParam);
|
||||
// 创建Page对象并设置属性
|
||||
Page<OutpatientRecordDto> OutpatientRecordPage = new Page<>(pageNo, pageSize, total);
|
||||
OutpatientRecordPage.setRecords(listOutpatientRecords);
|
||||
|
||||
return R.ok(OutpatientRecordPage);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.utils.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -12,6 +11,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.enums.AssignSeqEnum;
|
||||
import com.core.common.utils.*;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.administration.domain.Patient;
|
||||
import com.openhis.administration.service.IPatientService;
|
||||
@@ -256,11 +256,12 @@ public class PatientInformationController {
|
||||
// 职业编码枚举类回显赋值
|
||||
e.setPrfsEnum_enumText(EnumUtils.getInfoByValue(OccupationType.class, e.getPrfsEnum()));
|
||||
// 血型ABO枚举类回显赋值
|
||||
e.setBloodAbo_text(EnumUtils.getInfoByValue(BloodTypeABO.class, e.getBloodAbo()));
|
||||
e.setBloodAbo_enumText(EnumUtils.getInfoByValue(BloodTypeABO.class, e.getBloodAbo()));
|
||||
// 血型RH枚举类回显赋值
|
||||
e.setBloodRh_enumText(EnumUtils.getInfoByValue(BloodTypeRH.class, e.getBloodRh()));
|
||||
// 家庭关系枚举类回显赋值
|
||||
e.setLinkRelationCode_enumText(EnumUtils.getInfoByValue(FamilyRelationshipType.class, e.getLinkRelationCode()));
|
||||
e.setLinkRelationCode_enumText(
|
||||
EnumUtils.getInfoByValue(FamilyRelationshipType.class, e.getLinkRelationCode()));
|
||||
});
|
||||
return R.ok(patientInformationPage);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.openhis.web.patientmanage.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 门诊记录Dto
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/2/28
|
||||
*/
|
||||
@Data
|
||||
public class OutpatientRecordDto {
|
||||
|
||||
/** 患者姓名 */
|
||||
private String name;
|
||||
|
||||
/** 身份证号 */
|
||||
private String idCard;
|
||||
|
||||
/** 疾病与诊断描述 */
|
||||
private String description;
|
||||
|
||||
/** 患者院内编码/病历号 */
|
||||
private String patientBusNo;
|
||||
|
||||
/** 就诊号 */
|
||||
private String encounterBusNo;
|
||||
|
||||
/** 性别编码 */
|
||||
private Integer genderEnum;
|
||||
|
||||
/** 就诊时间 */
|
||||
private Date encounterTime;
|
||||
|
||||
/** 就诊对象状态 */
|
||||
private Integer subjectStatusEnum;
|
||||
|
||||
/** 机构名称/接诊医院 */
|
||||
private String organizationName;
|
||||
|
||||
/** 接诊医生姓名 */
|
||||
private String doctorName;
|
||||
|
||||
/** 手机号码 */
|
||||
private String phone;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.openhis.web.patientmanage.dto;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 门诊记录查询参数
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/2/28
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OutpatientRecordSearchParam {
|
||||
|
||||
/** 身份证号/病人ID/门诊号/病人姓名 */
|
||||
private String searchKey;
|
||||
|
||||
/** 手机号码 */
|
||||
private String phone;
|
||||
|
||||
/** 医生姓名 */
|
||||
private String doctorName;
|
||||
|
||||
/** 筛选开始时间 */
|
||||
private Date startTime;
|
||||
|
||||
/** 筛选结束时间 */
|
||||
private Date endTime;
|
||||
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public class PatientInformationDto {
|
||||
|
||||
/** 血型ABO */
|
||||
private Integer bloodAbo;
|
||||
private String bloodAbo_text;
|
||||
private String bloodAbo_enumText;
|
||||
|
||||
/** 血型RH */
|
||||
private Integer bloodRh;
|
||||
|
||||
@@ -7,12 +7,14 @@ import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.openhis.administration.domain.Patient;
|
||||
import com.openhis.web.patientmanage.dto.OutpatientRecordDto;
|
||||
import com.openhis.web.patientmanage.dto.OutpatientRecordSearchParam;
|
||||
import com.openhis.web.patientmanage.dto.PatientInformationDto;
|
||||
|
||||
/**
|
||||
* 病人信息管理
|
||||
*
|
||||
* @author Wuser
|
||||
* @author liuhr
|
||||
* @date 2025/2/25
|
||||
*/
|
||||
@Repository
|
||||
@@ -31,7 +33,7 @@ public interface PatientManageMapper extends BaseMapper<Patient> {
|
||||
@Param("pageSize") Integer pageSize, @Param("offset") Integer offset);
|
||||
|
||||
/**
|
||||
* 统计总记录数的方法
|
||||
* 统计病人信息总记录数的方法
|
||||
*
|
||||
* @param busNo 病人ID
|
||||
* @param name 病人姓名
|
||||
@@ -39,4 +41,32 @@ public interface PatientManageMapper extends BaseMapper<Patient> {
|
||||
*/
|
||||
long countPatients(@Param("busNo") String busNo, @Param("name") String name);
|
||||
|
||||
/**
|
||||
* 门诊信息分页查询
|
||||
*
|
||||
* @param outpatientRecordSearchParam 门诊查询参数
|
||||
* @param pageSize 页面大小
|
||||
* @param offset 跳过条数
|
||||
* @return 分页查询
|
||||
*/
|
||||
List<OutpatientRecordDto> getOutpatientRecord(
|
||||
@Param("OutpatientRecordSearchParam") OutpatientRecordSearchParam outpatientRecordSearchParam,
|
||||
@Param("pageSize") Integer pageSize, @Param("offset") Integer offset);
|
||||
|
||||
/**
|
||||
* 统计门诊总记录数的方法
|
||||
*
|
||||
* @param outpatientRecordSearchParam 门诊查询参数
|
||||
* @return 分页查询
|
||||
*/
|
||||
long countOutpatientRecords(
|
||||
@Param("OutpatientRecordSearchParam") OutpatientRecordSearchParam outpatientRecordSearchParam);
|
||||
|
||||
/**
|
||||
* 获取医生名字列表
|
||||
*
|
||||
* @return 医生名字列表
|
||||
*/
|
||||
List<String> getDoctorNames();
|
||||
|
||||
}
|
||||
|
||||
@@ -38,8 +38,7 @@
|
||||
pt.organization_id,
|
||||
pt.create_time
|
||||
FROM adm_patient pt
|
||||
<!-- 类型不一致,把organization_id转换成字符串类型-->
|
||||
LEFT JOIN adm_organization ogt ON CAST(pt.organization_id AS VARCHAR) = ogt.bus_no
|
||||
LEFT JOIN adm_organization ogt ON pt.organization_id = ogt.id
|
||||
<where>
|
||||
<!-- 如果传入busNo参数,且不为空 -->
|
||||
<if test="busNo != null and busNo != ''">
|
||||
@@ -72,7 +71,7 @@
|
||||
SELECT COUNT(*)
|
||||
FROM adm_patient pt
|
||||
<!-- 类型不一致,把organization_id转换成字符串类型-->
|
||||
LEFT JOIN adm_organization ogt ON CAST(pt.organization_id AS VARCHAR) = ogt.bus_no
|
||||
LEFT JOIN adm_organization ogt ON pt.organization_id = ogt.id
|
||||
<where>
|
||||
<!-- 如果传入busNo参数,且不为空 -->
|
||||
<if test="busNo != null and busNo != ''">
|
||||
@@ -99,6 +98,115 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 门诊记录相关查询-->
|
||||
<select id="getOutpatientRecord" parameterType="com.openhis.web.patientmanage.dto.OutpatientRecordSearchParam"
|
||||
resultType="com.openhis.web.patientmanage.dto.OutpatientRecordDto">
|
||||
SELECT
|
||||
pt.name,
|
||||
pt.id_card,
|
||||
c.description,
|
||||
pt.bus_no,
|
||||
e.bus_no,
|
||||
pt.gender_enum,
|
||||
e.start_time,
|
||||
e.subject_status_enum,
|
||||
ogt.name,
|
||||
p.name,
|
||||
pt.phone
|
||||
FROM
|
||||
adm_encounter e
|
||||
LEFT JOIN
|
||||
adm_organization ogt ON e.organization_id = ogt.id
|
||||
LEFT JOIN
|
||||
adm_patient pt ON e.patient_id = pt.id
|
||||
LEFT JOIN
|
||||
cli_condition c ON e.patient_id = c.patient_id
|
||||
LEFT JOIN
|
||||
adm_encounter_participant ep ON ep.encounter_id = e.id
|
||||
LEFT JOIN
|
||||
adm_practitioner p ON p.id = ep.practitioner_id
|
||||
<where>
|
||||
<!-- 参与者类型是首诊医生 -->
|
||||
ep.type_code = '1'
|
||||
<!-- 如果传入searchKey参数,且不为空 -->
|
||||
<if test="OutpatientRecordSearchParam != null and OutpatientRecordSearchParam.searchKey != null and OutpatientRecordSearchParam.searchKey != ''">
|
||||
AND pt.id_card LIKE CONCAT('%',#{OutpatientRecordSearchParam.searchKey}, '%')
|
||||
OR pt.bus_no LIKE CONCAT('%',#{OutpatientRecordSearchParam.searchKey}, '%')
|
||||
OR e.bus_no LIKE CONCAT('%',#{OutpatientRecordSearchParam.searchKey}, '%')
|
||||
OR pt.name LIKE CONCAT('%',#{OutpatientRecordSearchParam.searchKey}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 如果传入phone参数,且不为空 -->
|
||||
<if test="OutpatientRecordSearchParam != null and OutpatientRecordSearchParam.phone != null and OutpatientRecordSearchParam.phone != ''">
|
||||
AND pt.phone LIKE CONCAT('%',#{phone}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 时间筛选 -->
|
||||
<if test="OutpatientRecordSearchParam != null and OutpatientRecordSearchParam.startTime != null and OutpatientRecordSearchParam.endTime != null">
|
||||
AND e.start_time BETWEEN #{OutpatientRecordSearchParam.startTime} AND
|
||||
#{OutpatientRecordSearchParam.endTime}
|
||||
</if>
|
||||
|
||||
<!-- 如果传入doctorName参数,且不为空 -->
|
||||
<if test="OutpatientRecordSearchParam != null and OutpatientRecordSearchParam.doctorName != null and OutpatientRecordSearchParam.doctorName != null">
|
||||
AND p.name = #{OutpatientRecordSearchParam.doctorName}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY pt.bus_no,e.bus_no,ep.practitioner_id
|
||||
LIMIT #{pageSize} OFFSET #{offset}
|
||||
</select>
|
||||
|
||||
<select id="countOutpatientRecords" resultType="long">
|
||||
SELECT COUNT(*)
|
||||
FROM
|
||||
adm_encounter e
|
||||
LEFT JOIN
|
||||
adm_organization ogt ON e.organization_id = ogt.id
|
||||
LEFT JOIN
|
||||
adm_patient pt ON e.patient_id = pt.id
|
||||
LEFT JOIN
|
||||
cli_condition c ON e.patient_id = c.patient_id
|
||||
LEFT JOIN
|
||||
adm_encounter_participant ep ON ep.encounter_id = e.id
|
||||
LEFT JOIN
|
||||
adm_practitioner p ON p.id = ep.practitioner_id
|
||||
<where>
|
||||
<!-- 参与者类型是首诊医生 -->
|
||||
ep.type_code = '1'
|
||||
<!-- 如果传入searchKey参数,且不为空 -->
|
||||
<if test="OutpatientRecordSearchParam != null and OutpatientRecordSearchParam.searchKey != null and OutpatientRecordSearchParam.searchKey != ''">
|
||||
AND pt.id_card LIKE CONCAT('%',#{OutpatientRecordSearchParam.searchKey}, '%')
|
||||
OR pt.bus_no LIKE CONCAT('%',#{OutpatientRecordSearchParam.searchKey}, '%')
|
||||
OR e.bus_no LIKE CONCAT('%',#{OutpatientRecordSearchParam.searchKey}, '%')
|
||||
OR pt.name LIKE CONCAT('%',#{OutpatientRecordSearchParam.searchKey}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 如果传入phone参数,且不为空 -->
|
||||
<if test="OutpatientRecordSearchParam != null and OutpatientRecordSearchParam.phone != null and OutpatientRecordSearchParam.phone != ''">
|
||||
AND pt.phone LIKE CONCAT('%',#{phone}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 时间筛选 -->
|
||||
<if test="OutpatientRecordSearchParam != null and OutpatientRecordSearchParam.startTime != null and OutpatientRecordSearchParam.endTime != null">
|
||||
AND e.start_time BETWEEN #{OutpatientRecordSearchParam.startTime} AND
|
||||
#{OutpatientRecordSearchParam.endTime}
|
||||
</if>
|
||||
|
||||
<!-- 如果传入doctorName参数,且不为空 -->
|
||||
<if test="OutpatientRecordSearchParam != null and OutpatientRecordSearchParam.doctorName != null and OutpatientRecordSearchParam.doctorName != null">
|
||||
AND p.name = #{OutpatientRecordSearchParam.doctorName}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 查询医生名字列表-->
|
||||
<select id="getDoctorNames" resultType="java.lang.String">
|
||||
SELECT MIN(p.name) AS practitioner_name
|
||||
FROM adm_encounter_participant ep
|
||||
LEFT JOIN adm_practitioner p ON ep.practitioner_id = p.id
|
||||
WHERE ep.type_code = '1'
|
||||
GROUP BY ep.practitioner_id;
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user