revert: restore develop to clean baseline 5132de36 (remove all AI changes)
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
<?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.application.mapper.CatalogItemMapper">
|
||||
|
||||
<resultMap id="CatalogItemResult" type="com.openhis.application.domain.entity.CatalogItem">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="price" column="price"/>
|
||||
<result property="unitId" column="unit_id"/>
|
||||
<result property="unitName" column="unit_name"/>
|
||||
<result property="category" column="category"/>
|
||||
<result property="status" column="status"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 修复 Bug #577:关联字典表获取使用单位中文名称,避免前端直接回显字典ID -->
|
||||
<select id="selectCatalogItemsForLabRequest" resultMap="CatalogItemResult">
|
||||
SELECT
|
||||
c.id,
|
||||
c.name,
|
||||
c.price,
|
||||
c.unit_id,
|
||||
d.dict_label AS unit_name,
|
||||
c.category,
|
||||
c.status
|
||||
FROM catalog_item c
|
||||
LEFT JOIN sys_dict_data d ON c.unit_id = d.dict_id AND d.dict_type = 'catalog_unit'
|
||||
WHERE c.status = 1 AND c.category = 'LAB'
|
||||
ORDER BY c.name ASC
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultMap="CatalogItemResult">
|
||||
SELECT id, name, price, unit_id, category, status FROM catalog_item WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectList" resultMap="CatalogItemResult">
|
||||
SELECT id, name, price, unit_id, category, status FROM catalog_item
|
||||
<where>
|
||||
<if test="name != null and name != ''">AND name LIKE CONCAT('%', #{name}, '%')</if>
|
||||
<if test="category != null and category != ''">AND category = #{category}</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,38 +0,0 @@
|
||||
<?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.mapper.DispensingMapper">
|
||||
|
||||
<resultMap id="DispensingRecordResult" type="com.openhis.domain.entity.DispensingRecord">
|
||||
<id property="id" column="id"/>
|
||||
<result property="patientId" column="patient_id"/>
|
||||
<result property="drugCode" column="drug_code"/>
|
||||
<result property="drugName" column="drug_name"/>
|
||||
<result property="dosage" column="dosage"/>
|
||||
<result property="executeStatus" column="execute_status"/>
|
||||
<result property="summaryApplyStatus" column="summary_apply_status"/>
|
||||
<result property="wardId" column="ward_id"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectDispensingDetails" resultMap="DispensingRecordResult">
|
||||
SELECT
|
||||
id, patient_id, drug_code, drug_name, dosage,
|
||||
execute_status, summary_apply_status, ward_id, create_time
|
||||
FROM his_dispensing_record
|
||||
<where>
|
||||
<if test="wardId != null">
|
||||
AND ward_id = #{wardId}
|
||||
</if>
|
||||
<if test="executeStatus != null">
|
||||
AND execute_status = #{executeStatus}
|
||||
</if>
|
||||
<!-- 修复 Bug #503:动态追加汇总申请状态过滤条件 -->
|
||||
<if test="summaryApplyStatus != null">
|
||||
AND summary_apply_status = #{summaryApplyStatus}
|
||||
</if>
|
||||
AND del_flag = 0
|
||||
</where>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,43 +0,0 @@
|
||||
<?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.application.mapper.LabRequestMapper">
|
||||
|
||||
<resultMap id="LabRequestResult" type="com.openhis.application.domain.entity.LabRequest">
|
||||
<id property="id" column="id"/>
|
||||
<result property="patientId" column="patient_id"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="symptom" column="symptom"/>
|
||||
<result property="sign" column="sign"/>
|
||||
<result property="relatedResult" column="related_result"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectById" resultMap="LabRequestResult">
|
||||
SELECT id, patient_id, status, symptom, sign, related_result, create_time, update_time, del_flag
|
||||
FROM his_lab_request
|
||||
WHERE id = #{id} AND del_flag = 0
|
||||
</select>
|
||||
|
||||
<!-- 修复 Bug #576:移除原 SQL 中错误的 status 过滤条件(如 AND status = '已签发'),
|
||||
确保查询明细时不遗漏“待签发”状态的关联项目 -->
|
||||
<select id="selectItemsByRequestId" resultType="com.openhis.application.domain.entity.LabRequestItem">
|
||||
SELECT id, request_id, item_code, item_name, price, quantity, del_flag
|
||||
FROM his_lab_request_item
|
||||
WHERE request_id = #{requestId} AND del_flag = 0
|
||||
ORDER BY sort_order ASC
|
||||
</select>
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO his_lab_request (patient_id, status, symptom, sign, related_result, create_time, del_flag)
|
||||
VALUES (#{patientId}, #{status}, #{symptom}, #{sign}, #{relatedResult}, NOW(), 0)
|
||||
</insert>
|
||||
|
||||
<update id="updateById">
|
||||
UPDATE his_lab_request
|
||||
SET symptom = #{symptom}, sign = #{sign}, related_result = #{relatedResult}, update_time = NOW()
|
||||
WHERE id = #{id} AND del_flag = 0
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -1,27 +0,0 @@
|
||||
<?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.application.mapper.MedicalRecordMapper">
|
||||
|
||||
<!-- 修复 Bug #562:专用轻量级查询,避免 SELECT * 拉取大字段 -->
|
||||
<select id="selectPendingSummary" parameterType="com.openhis.application.domain.dto.MedicalRecordQueryDto" resultType="com.openhis.application.domain.entity.MedicalRecord">
|
||||
SELECT
|
||||
id,
|
||||
patient_id,
|
||||
patient_name,
|
||||
visit_date,
|
||||
status,
|
||||
doctor_id,
|
||||
dept_id,
|
||||
create_time
|
||||
FROM emr_medical_record
|
||||
WHERE doctor_id = #{doctorId}
|
||||
AND status = 'PENDING'
|
||||
ORDER BY visit_date DESC
|
||||
</select>
|
||||
|
||||
<!-- 原有完整查询保留,供详情接口使用 -->
|
||||
<select id="selectById" parameterType="java.lang.Long" resultType="com.openhis.application.domain.entity.MedicalRecord">
|
||||
SELECT * FROM emr_medical_record WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,65 +0,0 @@
|
||||
<?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.application.mapper.OrderDetailMapper">
|
||||
|
||||
<resultMap id="OrderVerifyResult" type="com.openhis.application.domain.dto.OrderVerifyDto">
|
||||
<id property="id" column="id"/>
|
||||
<result property="orderNo" column="order_no"/>
|
||||
<result property="patientName" column="patient_name"/>
|
||||
<result property="bedNo" column="bed_no"/>
|
||||
<result property="startTime" column="start_time"/>
|
||||
<result property="singleDose" column="single_dose"/>
|
||||
<result property="totalAmount" column="total_amount"/>
|
||||
<result property="totalPrice" column="total_price"/>
|
||||
<result property="frequencyUsage" column="frequency_usage"/>
|
||||
<result property="orderingDoctor" column="ordering_doctor"/>
|
||||
<result property="stopTime" column="stop_time"/>
|
||||
<result property="stoppingDoctor" column="stopping_doctor"/>
|
||||
<result property="drugName" column="drug_name"/>
|
||||
<result property="skinTestStatus" column="skin_test_status"/>
|
||||
<result property="diagnosis" column="diagnosis"/>
|
||||
<result property="status" column="status"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 修复 Bug #595:医嘱校对列表结构化查询,替代原有长文本拼接 -->
|
||||
<select id="selectOrderVerifyList" resultMap="OrderVerifyResult">
|
||||
SELECT
|
||||
om.id,
|
||||
om.order_no,
|
||||
p.name AS patient_name,
|
||||
p.bed_no,
|
||||
om.start_time,
|
||||
od.single_dose,
|
||||
od.total_amount,
|
||||
od.total_price,
|
||||
CONCAT(od.frequency, ' ', od.usage) AS frequency_usage,
|
||||
u1.real_name AS ordering_doctor,
|
||||
om.stop_time,
|
||||
u2.real_name AS stopping_doctor,
|
||||
ci.name AS drug_name,
|
||||
ci.skin_test_flag AS skin_test_status,
|
||||
pd.diagnosis_name AS diagnosis,
|
||||
om.status
|
||||
FROM order_main om
|
||||
INNER JOIN order_detail od ON om.id = od.order_id
|
||||
INNER JOIN patient p ON om.patient_id = p.id
|
||||
LEFT JOIN sys_user u1 ON om.ordering_doctor_id = u1.id
|
||||
LEFT JOIN sys_user u2 ON om.stopping_doctor_id = u2.id
|
||||
LEFT JOIN catalog_item ci ON od.catalog_item_id = ci.id
|
||||
LEFT JOIN patient_diagnosis pd ON om.diagnosis_id = pd.id
|
||||
WHERE om.status = 'PENDING_VERIFY'
|
||||
<if test="patientId != null">
|
||||
AND om.patient_id = #{patientId}
|
||||
</if>
|
||||
ORDER BY om.start_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultType="com.openhis.application.domain.entity.OrderDetail">
|
||||
SELECT * FROM order_detail WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO order_detail (order_id, catalog_item_id, single_dose, total_amount, total_price, frequency, usage)
|
||||
VALUES (#{orderId}, #{catalogItemId}, #{singleDose}, #{totalAmount}, #{totalPrice}, #{frequency}, #{usage})
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -1,36 +0,0 @@
|
||||
<?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.application.mapper.QueueMapper">
|
||||
|
||||
<!-- 查询当前排队(包括完诊) -->
|
||||
<select id="selectCurrentQueue" parameterType="map" resultType="com.openhis.application.domain.entity.QueueInfo">
|
||||
SELECT q.*
|
||||
FROM adm_queue_info q
|
||||
WHERE 1=1
|
||||
<if test="departmentId != null">
|
||||
AND q.department_id = #{departmentId}
|
||||
</if>
|
||||
AND q.status IN ('WAIT','DIAGNOSE','FINISHED')
|
||||
ORDER BY q.queue_no ASC
|
||||
</select>
|
||||
|
||||
<!-- 查询历史排队记录 -->
|
||||
<select id="selectHistoryQueue" parameterType="map" resultType="com.openhis.application.domain.entity.QueueInfo">
|
||||
SELECT q.*
|
||||
FROM adm_queue_info q
|
||||
WHERE q.status IN ('FINISHED','CANCELLED')
|
||||
<if test="departmentId != null">
|
||||
AND q.department_id = #{departmentId}
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
AND q.create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
AND q.create_time <= #{endTime}
|
||||
</if>
|
||||
ORDER BY q.create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,23 +0,0 @@
|
||||
<?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.application.mapper.SchedulePoolMapper">
|
||||
|
||||
<!-- 其它已有SQL省略 -->
|
||||
|
||||
<!-- 原子递增 booked_num -->
|
||||
<update id="incrementBookedNum" parameterType="long">
|
||||
UPDATE adm_schedule_pool
|
||||
SET booked_num = booked_num + 1
|
||||
WHERE id = #{poolId}
|
||||
</update>
|
||||
|
||||
<!-- 原子递减 booked_num,防止出现负数 -->
|
||||
<update id="decrementBookedNum" parameterType="long">
|
||||
UPDATE adm_schedule_pool
|
||||
SET booked_num = CASE WHEN booked_num > 0 THEN booked_num - 1 ELSE 0 END
|
||||
WHERE id = #{poolId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -1,16 +0,0 @@
|
||||
<?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.application.mapper.TriageQueueMapper">
|
||||
<select id="selectQueueList" resultType="com.openhis.application.domain.dto.QueuePatientDto">
|
||||
SELECT
|
||||
q.id, q.patient_name, q.queue_no, q.status, q.triage_time, q.visit_time
|
||||
FROM triage_queue q
|
||||
WHERE q.dept_code = #{deptCode}
|
||||
AND q.queue_date BETWEEN #{startDate} AND #{endDate}
|
||||
<!-- 修复 Bug #544:移除原 AND q.status != 'COMPLETED' 硬编码 -->
|
||||
<if test="status != null and status != ''">
|
||||
AND q.status = #{status}
|
||||
</if>
|
||||
ORDER BY q.triage_time ASC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,28 +0,0 @@
|
||||
<?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.application.mapper.VitalSignMapper">
|
||||
|
||||
<!-- 修复 Bug #566:原查询未严格按时间排序且未过滤空值,导致前端图表渲染断点与错位 -->
|
||||
<select id="selectChartDataByPatient" resultType="com.openhis.application.domain.dto.VitalSignChartDto">
|
||||
SELECT
|
||||
vs.record_time AS recordTime,
|
||||
vs.temperature,
|
||||
vs.pulse,
|
||||
vs.heart_rate AS heartRate
|
||||
FROM hisdev.vital_sign_record vs
|
||||
WHERE vs.patient_id = #{patientId}
|
||||
AND vs.record_time BETWEEN #{startDate} AND #{endDate}
|
||||
AND vs.is_deleted = 0
|
||||
ORDER BY vs.record_time ASC
|
||||
</select>
|
||||
|
||||
<insert id="insertVitalSign" parameterType="com.openhis.application.domain.entity.VitalSignRecord" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO hisdev.vital_sign_record (
|
||||
patient_id, record_time, temperature, pulse, heart_rate,
|
||||
create_by, create_time, is_deleted
|
||||
) VALUES (
|
||||
#{patientId}, #{recordTime}, #{temperature}, #{pulse}, #{heartRate},
|
||||
#{createBy}, NOW(), 0
|
||||
)
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -4,19 +4,217 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.openhis.web.regdoctorstation.mapper.RequestFormManageAppMapper">
|
||||
|
||||
<!-- 其他已有SQL省略 -->
|
||||
<select id="getRequestForm" resultType="com.openhis.web.regdoctorstation.dto.RequestFormQueryDto">
|
||||
SELECT sub.request_form_id,
|
||||
sub.encounter_id,
|
||||
sub.prescription_no,
|
||||
sub.name,
|
||||
sub.desc_json,
|
||||
sub.requester_id,
|
||||
sub.create_time,
|
||||
sub.patient_name,
|
||||
sub.computed_status AS status
|
||||
FROM (
|
||||
SELECT drf.id AS request_form_id,
|
||||
drf.encounter_id,
|
||||
drf.prescription_no,
|
||||
COALESCE(
|
||||
(SELECT STRING_AGG(DISTINCT wad.name, '、')
|
||||
FROM wor_service_request wsr2
|
||||
LEFT JOIN wor_activity_definition wad ON wad.id = wsr2.activity_id AND wad.delete_flag = '0'
|
||||
WHERE wsr2.prescription_no = drf.prescription_no AND wsr2.delete_flag = '0'),
|
||||
drf.name
|
||||
) AS name,
|
||||
drf.desc_json,
|
||||
drf.requester_id,
|
||||
drf.create_time,
|
||||
ap.NAME AS patient_name,
|
||||
CASE
|
||||
WHEN EXISTS (
|
||||
SELECT 1 FROM wor_service_request ws
|
||||
WHERE ws.prescription_no = drf.prescription_no AND ws.delete_flag = '0'
|
||||
AND ws.status_enum = 8
|
||||
) THEN 6
|
||||
WHEN EXISTS (
|
||||
SELECT 1 FROM wor_service_request ws
|
||||
WHERE ws.prescription_no = drf.prescription_no AND ws.delete_flag = '0'
|
||||
AND ws.status_enum = 5
|
||||
) THEN 7
|
||||
WHEN EXISTS (
|
||||
SELECT 1 FROM wor_service_request ws
|
||||
WHERE ws.prescription_no = drf.prescription_no AND ws.delete_flag = '0'
|
||||
AND ws.status_enum = 3
|
||||
) THEN 5
|
||||
WHEN EXISTS (
|
||||
SELECT 1 FROM wor_service_request ws
|
||||
WHERE ws.prescription_no = drf.prescription_no AND ws.delete_flag = '0'
|
||||
AND ws.status_enum = 12
|
||||
) THEN 4
|
||||
WHEN EXISTS (
|
||||
SELECT 1 FROM wor_service_request ws
|
||||
WHERE ws.prescription_no = drf.prescription_no AND ws.delete_flag = '0'
|
||||
AND ws.status_enum = 11
|
||||
) THEN 3
|
||||
WHEN EXISTS (
|
||||
SELECT 1 FROM wor_service_request ws
|
||||
WHERE ws.prescription_no = drf.prescription_no AND ws.delete_flag = '0'
|
||||
AND ws.status_enum = 10
|
||||
) THEN 2
|
||||
WHEN EXISTS (
|
||||
SELECT 1 FROM wor_service_request ws
|
||||
WHERE ws.prescription_no = drf.prescription_no AND ws.delete_flag = '0'
|
||||
AND ws.status_enum = 2
|
||||
) THEN 1
|
||||
ELSE 0
|
||||
END AS computed_status
|
||||
FROM doc_request_form AS drf
|
||||
LEFT JOIN adm_encounter AS ae ON ae.ID = drf.encounter_id
|
||||
AND ae.delete_flag = '0'
|
||||
LEFT JOIN adm_patient AS ap ON ap.ID = ae.patient_id
|
||||
AND ap.delete_flag = '0'
|
||||
WHERE drf.delete_flag = '0'
|
||||
AND drf.encounter_id = #{encounterId}
|
||||
AND drf.type_code = #{typeCode}
|
||||
<if test="startDate != null and startDate != ''">
|
||||
AND drf.create_time >= #{startDate}::date
|
||||
</if>
|
||||
<if test="endDate != null and endDate != ''">
|
||||
AND drf.create_time <= (#{endDate}::date + INTERVAL '1 day' - INTERVAL '1 second')
|
||||
</if>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND (drf.prescription_no ILIKE '%' || #{keyword} || '%'
|
||||
OR EXISTS (
|
||||
SELECT 1 FROM wor_service_request wsr2
|
||||
WHERE wsr2.prescription_no = drf.prescription_no
|
||||
AND wsr2.delete_flag = '0'
|
||||
AND wsr2.activity_id IN (
|
||||
SELECT id FROM wor_activity_definition wad
|
||||
WHERE wad.delete_flag = '0'
|
||||
AND wad.name ILIKE '%' || #{keyword} || '%'
|
||||
)
|
||||
))
|
||||
</if>
|
||||
) sub
|
||||
<if test="status != null and status != ''">
|
||||
WHERE sub.computed_status = #{status}::integer
|
||||
</if>
|
||||
ORDER BY sub.create_time DESC
|
||||
</select>
|
||||
|
||||
<!--
|
||||
新增:停嘱时同时更新停嘱医生和停嘱时间
|
||||
对应 Mapper 接口中的 updateAdviceStatusAndStopInfo 方法
|
||||
-->
|
||||
<update id="updateAdviceStatusAndStopInfo">
|
||||
UPDATE wor_advice
|
||||
SET status = #{status},
|
||||
stop_doctor_id = #{doctorId},
|
||||
stop_time = #{stopTime},
|
||||
update_time = NOW()
|
||||
WHERE id = #{adviceId}
|
||||
</update>
|
||||
<select id="getRequestFormDetail" resultType="com.openhis.web.regdoctorstation.dto.RequestFormDetailQueryDto">
|
||||
SELECT wsr.activity_id AS activity_id,
|
||||
wsr.quantity,
|
||||
wsr.unit_code,
|
||||
COALESCE(wad.NAME, wsr.content_json::jsonb->>'surgeryName') AS advice_name,
|
||||
aci.total_price
|
||||
FROM wor_service_request AS wsr
|
||||
LEFT JOIN wor_activity_definition AS wad ON wad.ID = wsr.activity_id
|
||||
AND wad.delete_flag = '0'
|
||||
LEFT JOIN adm_charge_item AS aci ON aci.service_id = wsr.ID
|
||||
AND aci.service_table = 'wor_service_request'
|
||||
AND aci.delete_flag = '0'
|
||||
WHERE wsr.delete_flag = '0'
|
||||
AND wsr.prescription_no = #{prescriptionNo}
|
||||
</select>
|
||||
|
||||
<select id="getActivityOrganizationConfig"
|
||||
resultType="com.openhis.web.regdoctorstation.dto.ActivityOrganizationConfigDto">
|
||||
SELECT organization_id,
|
||||
activity_definition_id
|
||||
FROM adm_organization_location
|
||||
WHERE delete_flag = '0'
|
||||
AND (CURRENT_TIME :: TIME ( 6 ) BETWEEN start_time AND end_time)
|
||||
AND activity_category_code = #{activityCategoryCode}
|
||||
</select>
|
||||
|
||||
<!-- 结果映射 -->
|
||||
<resultMap id="RequestFormPageDtoMap" type="com.openhis.web.regdoctorstation.dto.RequestFormPageDto">
|
||||
<result column="surgery_no" property="surgeryNo"/>
|
||||
<result column="desc_json" property="descJson" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="gender_enum" property="gender"/>
|
||||
<result column="birth_date" property="birthDay"/>
|
||||
<result column="main_surgeon_id" property="mainSurgeonId"/>
|
||||
<result column="main_surgeon_name" property="mainSurgeonName"/>
|
||||
<result column="surgery_type" property="surgeryType"/>
|
||||
<result column="apply_time" property="applyTime"/>
|
||||
<result column="apply_id" property="applyId"/>
|
||||
<result column="apply_dept_id" property="applyDeptId"/>
|
||||
<result column="apply_dept_name" property="applyDeptName"/>
|
||||
<result column="encounter_id" property="encounterId"/>
|
||||
<result column="surgery_type_enum" property="surgeryTypeEnum"/>
|
||||
<result column="fee_type" property="feeType"/>
|
||||
<result column="anesthesia_type_enum" property="anesthesiaTypeEnum"/>
|
||||
<result column="incision_level" property="incisionLevel"/>
|
||||
<result column="surgery_level" property="surgeryLevel"/>
|
||||
<result column="identifier_no" property="identifierNo"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 分页查询申请单 -->
|
||||
<select id="getRequestFormPage" resultMap="RequestFormPageDtoMap">
|
||||
SELECT
|
||||
drf.prescription_no AS surgery_no,
|
||||
drf.desc_json,
|
||||
drf.create_by AS apply_doctor_name,
|
||||
drf.create_time AS apply_time,
|
||||
drf.id AS apply_id,
|
||||
ae.id AS encounter_id,
|
||||
ap.id AS patient_id,
|
||||
ap.name,
|
||||
ap.gender_enum,
|
||||
ap.birth_date,
|
||||
cs.main_surgeon_id,
|
||||
cs.surgery_type_enum AS surgery_type,
|
||||
cs.main_surgeon_name,
|
||||
cs.apply_dept_id,
|
||||
cs.apply_dept_name,
|
||||
cs.surgery_type_enum,
|
||||
cs.anesthesia_type_enum,
|
||||
cs.incision_level,
|
||||
cs.surgery_level,
|
||||
fc.contract_name AS fee_type,
|
||||
COALESCE(pi.identifier_no, ap.bus_no, '') AS identifier_no
|
||||
FROM doc_request_form drf
|
||||
INNER JOIN cli_surgery cs ON cs.surgery_no = drf.prescription_no AND cs.delete_flag = '0'
|
||||
INNER JOIN adm_patient ap ON ap.id = cs.patient_id AND ap.delete_flag = '0'
|
||||
INNER JOIN adm_encounter ae ON ae.id = cs.encounter_id AND ae.delete_flag = '0'
|
||||
LEFT JOIN adm_account aa ON aa.encounter_id = ae.id AND aa.delete_flag = '0'
|
||||
LEFT JOIN fin_contract fc ON fc.bus_no = aa.contract_no AND fc.delete_flag = '0'
|
||||
LEFT JOIN op_schedule os ON os.apply_id = drf.id AND os.delete_flag = '0'
|
||||
LEFT JOIN (
|
||||
SELECT patient_id, identifier_no
|
||||
FROM (
|
||||
SELECT patient_id, identifier_no,
|
||||
ROW_NUMBER() OVER (PARTITION BY patient_id ORDER BY create_time ASC) AS rn
|
||||
FROM adm_patient_identifier
|
||||
WHERE delete_flag = '0' AND identifier_no IS NOT NULL AND identifier_no != ''
|
||||
) t
|
||||
WHERE rn = 1
|
||||
) pi ON ap.id = pi.patient_id
|
||||
<where>
|
||||
<if test="requestFormDto.surgeryNo != null and requestFormDto.surgeryNo != ''">
|
||||
AND drf.prescription_no LIKE CONCAT('%', #{requestFormDto.surgeryNo}, '%')
|
||||
</if>
|
||||
<if test="requestFormDto.typeCode != null and requestFormDto.typeCode != ''">
|
||||
AND drf.type_code IN (#{requestFormDto.typeCode}, 'SURGERY')
|
||||
</if>
|
||||
<if test="requestFormDto.applyTimeStart != null">
|
||||
AND drf.create_time >= #{requestFormDto.applyTimeStart}
|
||||
</if>
|
||||
<if test="requestFormDto.applyTimeEnd != null">
|
||||
AND drf.create_time <= #{requestFormDto.applyTimeEnd}
|
||||
</if>
|
||||
<if test="requestFormDto.mainDoctorId != null">
|
||||
AND cs.main_surgeon_id = #{requestFormDto.mainDoctorId}
|
||||
</if>
|
||||
<if test="requestFormDto.applyDeptId != null">
|
||||
AND cs.apply_dept_id = #{requestFormDto.applyDeptId}
|
||||
</if>
|
||||
AND drf.delete_flag = '0'
|
||||
AND os.schedule_id IS NULL
|
||||
<!-- 已取消(4)、已完成(3)的手术申请不参与门诊手术安排查找 -->
|
||||
AND cs.status_enum NOT IN (3, 4)
|
||||
</where>
|
||||
ORDER BY drf.create_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
<?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.triage.mapper.TriageQueueMapper">
|
||||
|
||||
<!-- 修复 Bug #544:原 SQL 存在硬编码过滤 AND queue_status != '完诊',已彻底移除 -->
|
||||
<select id="selectQueueList" resultType="java.util.Map">
|
||||
SELECT
|
||||
id,
|
||||
patient_name AS patientName,
|
||||
dept_name AS deptName,
|
||||
doctor_name AS doctorName,
|
||||
queue_status AS queueStatus,
|
||||
triage_time AS triageTime
|
||||
FROM triage_queue
|
||||
WHERE 1=1
|
||||
<if test="status != null and status != ''">
|
||||
AND queue_status = #{status}
|
||||
</if>
|
||||
<if test="startDate != null">
|
||||
AND triage_time >= #{startDate}::timestamp
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
AND triage_time <= #{endDate}::timestamp + interval '1 day'
|
||||
</if>
|
||||
ORDER BY triage_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user