|
@@ -42,7 +42,14 @@
|
|
|
<select id="getPage" resultType="com.diagbot.dto.BehospitalInfoDTO">
|
|
|
SELECT * FROM (
|
|
|
select t.*,
|
|
|
- CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status
|
|
|
+ CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
|
|
|
+ CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
|
|
|
+ g.check_type AS ch_type,
|
|
|
+ h.check_type AS mr_type,
|
|
|
+ g.check_name AS ch_name,
|
|
|
+ h.check_name AS mr_name,
|
|
|
+ g.check_time AS ch_time,
|
|
|
+ h.check_time AS mr_time
|
|
|
from (
|
|
|
select a.*, ifnull(b.level,'未评分') as `level`, b.grade_type, b.score_res, b.gmt_create as
|
|
|
grade_time, c.age from med_behospital_info a
|
|
@@ -51,9 +58,12 @@
|
|
|
left join med_home_page c
|
|
|
on a.behospital_code = c.behospital_code and c.is_deleted = 'N'
|
|
|
) t
|
|
|
- LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N') g
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
|
|
|
ON t.behospital_code = g.behospital_code
|
|
|
AND t.hospital_id = g.hospital_id
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
|
|
|
+ ON t.behospital_code = h.behospital_code
|
|
|
+ AND t.hospital_id = h.hospital_id
|
|
|
where t.is_deleted = 'N'
|
|
|
<if test="deptId != null and deptId != ''">
|
|
|
and t.beh_dept_id = #{deptId}
|
|
@@ -104,6 +114,27 @@
|
|
|
<if test="checkStatus != null ">
|
|
|
and p.check_status = #{checkStatus}
|
|
|
</if>
|
|
|
+ <if test="mrStatus != null ">
|
|
|
+ AND p.mr_status = #{mrStatus}
|
|
|
+ </if>
|
|
|
+ <if test="chName != null and chName !=''">
|
|
|
+ AND p.ch_name like CONCAT('%',#{chName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="mrName != null and mrName !=''">
|
|
|
+ AND p.mr_name like CONCAT('%',#{mrName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="chTimeStart != null">
|
|
|
+ <![CDATA[ and p.ch_time >= #{chTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="chTimeEnd != null">
|
|
|
+ <![CDATA[ and p.ch_time < #{chTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeStart != null">
|
|
|
+ <![CDATA[ and p.mr_time >= #{mrTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeEnd != null">
|
|
|
+ <![CDATA[ and p.mr_time < #{mrTimeEnd}]]>
|
|
|
+ </if>
|
|
|
</select>
|
|
|
|
|
|
<select id="getMsg" resultType="com.diagbot.dto.MsgDTO">
|
|
@@ -262,7 +293,14 @@
|
|
|
SELECT * from (
|
|
|
SELECT
|
|
|
t.*,
|
|
|
- CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status
|
|
|
+ CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
|
|
|
+ CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
|
|
|
+ g.check_type as ch_type,
|
|
|
+ h.check_type AS mr_type,
|
|
|
+ g.check_name as ch_name,
|
|
|
+ h.check_name as mr_name,
|
|
|
+ g.check_time as ch_time,
|
|
|
+ h.check_time AS mr_time
|
|
|
FROM
|
|
|
( SELECT
|
|
|
a.*,
|
|
@@ -285,9 +323,12 @@
|
|
|
WHERE d.is_deleted = 'N'
|
|
|
AND d.user_id = #{userId}
|
|
|
) t
|
|
|
- LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N') g
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
|
|
|
ON t.behospital_code = g.behospital_code
|
|
|
AND t.hospital_id = g.hospital_id
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
|
|
|
+ ON t.behospital_code = h.behospital_code
|
|
|
+ AND t.hospital_id = h.hospital_id
|
|
|
where t.is_deleted = 'N'
|
|
|
<if test="deptId != null and deptId != ''">
|
|
|
and t.beh_dept_id = #{deptId}
|
|
@@ -338,13 +379,41 @@
|
|
|
<if test="checkStatus != null ">
|
|
|
and p.check_status = #{checkStatus}
|
|
|
</if>
|
|
|
+ <if test="mrStatus != null ">
|
|
|
+ AND p.mr_status = #{mrStatus}
|
|
|
+ </if>
|
|
|
+ <if test="chName != null and chName !=''">
|
|
|
+ AND p.ch_name like CONCAT('%',#{chName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="mrName != null and mrName !=''">
|
|
|
+ AND p.mr_name like CONCAT('%',#{mrName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="chTimeStart != null">
|
|
|
+ <![CDATA[ and p.ch_time >= #{chTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="chTimeEnd != null">
|
|
|
+ <![CDATA[ and p.ch_time < #{chTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeStart != null">
|
|
|
+ <![CDATA[ and p.mr_time >= #{mrTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeEnd != null">
|
|
|
+ <![CDATA[ and p.mr_time < #{mrTimeEnd}]]>
|
|
|
+ </if>
|
|
|
</select>
|
|
|
|
|
|
<!--质控评分(个人)分页-->
|
|
|
<select id="getPageByPerson" resultType="com.diagbot.dto.BehospitalInfoDTO">
|
|
|
Select * from (
|
|
|
select t.*,
|
|
|
- CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status
|
|
|
+ CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
|
|
|
+ CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
|
|
|
+ g.check_type as ch_type,
|
|
|
+ h.check_type AS mr_type,
|
|
|
+ g.check_name as ch_name,
|
|
|
+ h.check_name as mr_name,
|
|
|
+ g.check_time as ch_time,
|
|
|
+ h.check_time AS mr_time
|
|
|
from (SELECT
|
|
|
a.*,
|
|
|
IFNULL(b.level, '未评分') AS `level`,
|
|
@@ -379,9 +448,12 @@
|
|
|
IFNULL(a.director_doctor_name, '')
|
|
|
) LIKE CONCAT('%', u1.linkman, '%')
|
|
|
) t
|
|
|
- LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N') g
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
|
|
|
ON t.behospital_code = g.behospital_code
|
|
|
AND t.hospital_id = g.hospital_id
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
|
|
|
+ ON t.behospital_code = h.behospital_code
|
|
|
+ AND t.hospital_id = h.hospital_id
|
|
|
WHERE t.is_deleted = 'N'
|
|
|
<if test="deptId != null and deptId != ''">
|
|
|
and t.beh_dept_id = #{deptId}
|
|
@@ -419,13 +491,41 @@
|
|
|
<if test="checkStatus != null ">
|
|
|
and p.check_status = #{checkStatus}
|
|
|
</if>
|
|
|
+ <if test="mrStatus != null ">
|
|
|
+ AND p.mr_status = #{mrStatus}
|
|
|
+ </if>
|
|
|
+ <if test="chName != null and chName !=''">
|
|
|
+ AND p.ch_name like CONCAT('%',#{chName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="mrName != null and mrName !=''">
|
|
|
+ AND p.mr_name like CONCAT('%',#{mrName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="chTimeStart != null">
|
|
|
+ <![CDATA[ and p.ch_time >= #{chTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="chTimeEnd != null">
|
|
|
+ <![CDATA[ and p.ch_time < #{chTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeStart != null">
|
|
|
+ <![CDATA[ and p.mr_time >= #{mrTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeEnd != null">
|
|
|
+ <![CDATA[ and p.mr_time < #{mrTimeEnd}]]>
|
|
|
+ </if>
|
|
|
</select>
|
|
|
|
|
|
<!--质控评分(医疗组)分页-->
|
|
|
<select id="getPageByGroup" resultType="com.diagbot.dto.BehospitalInfoDTO">
|
|
|
select * from (
|
|
|
select t.*,
|
|
|
- CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status
|
|
|
+ CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
|
|
|
+ CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
|
|
|
+ g.check_type as ch_type,
|
|
|
+ h.check_type AS mr_type,
|
|
|
+ g.check_name as ch_name,
|
|
|
+ h.check_name as mr_name,
|
|
|
+ g.check_time as ch_time,
|
|
|
+ h.check_time AS mr_time
|
|
|
from (
|
|
|
select a.*, ifnull(b.level,'未评分') as `level`, b.grade_type, b.score_res, b.gmt_create as
|
|
|
grade_time, c.age from med_behospital_info a
|
|
@@ -434,9 +534,12 @@
|
|
|
left join med_home_page c
|
|
|
on a.behospital_code = c.behospital_code and c.is_deleted = 'N'
|
|
|
) t
|
|
|
- LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N') g
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
|
|
|
ON t.behospital_code = g.behospital_code
|
|
|
AND t.hospital_id = g.hospital_id
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
|
|
|
+ ON t.behospital_code = h.behospital_code
|
|
|
+ AND t.hospital_id = h.hospital_id
|
|
|
WHERE t.is_deleted = 'N'
|
|
|
and
|
|
|
t.doctor_id in (
|
|
@@ -499,6 +602,27 @@
|
|
|
<if test="checkStatus != null ">
|
|
|
and p.check_status = #{checkStatus}
|
|
|
</if>
|
|
|
+ <if test="mrStatus != null ">
|
|
|
+ AND p.mr_status = #{mrStatus}
|
|
|
+ </if>
|
|
|
+ <if test="chName != null and chName !=''">
|
|
|
+ AND p.ch_name like CONCAT('%',#{chName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="mrName != null and mrName !=''">
|
|
|
+ AND p.mr_name like CONCAT('%',#{mrName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="chTimeStart != null">
|
|
|
+ <![CDATA[ and p.ch_time >= #{chTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="chTimeEnd != null">
|
|
|
+ <![CDATA[ and p.ch_time < #{chTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeStart != null">
|
|
|
+ <![CDATA[ and p.mr_time >= #{mrTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeEnd != null">
|
|
|
+ <![CDATA[ and p.mr_time < #{mrTimeEnd}]]>
|
|
|
+ </if>
|
|
|
</select>
|
|
|
|
|
|
<!-- 出院总人数统计-全院-首页 -->
|
|
@@ -2265,7 +2389,15 @@
|
|
|
<!-- 质控评分导出到excel-->
|
|
|
<select id="exportQcresult" resultMap="ExportExcelMap" parameterType="com.diagbot.vo.ExportQcresultVO">
|
|
|
SELECT * FROM (
|
|
|
- SELECT tp.*,CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status FROM (
|
|
|
+ SELECT tp.*,CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
|
|
|
+ CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
|
|
|
+ g.check_type AS ch_type,
|
|
|
+ h.check_type AS mr_type,
|
|
|
+ g.check_name AS ch_name,
|
|
|
+ h.check_name AS mr_name,
|
|
|
+ g.check_time AS ch_time,
|
|
|
+ h.check_time AS mr_time
|
|
|
+ FROM (
|
|
|
SELECT
|
|
|
t1.behDeptId,
|
|
|
t1.behDeptName,
|
|
@@ -2403,23 +2535,53 @@
|
|
|
t1.behDoctorName,
|
|
|
t1.patName,
|
|
|
t1.behospitalCode,
|
|
|
- t1.caseName)tp LEFT JOIN
|
|
|
- (SELECT
|
|
|
- *
|
|
|
- FROM
|
|
|
- med_check_info
|
|
|
- WHERE is_deleted = 'N') g
|
|
|
+ t1.caseName)tp
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
|
|
|
ON tp.behospitalCode = g.behospital_code
|
|
|
- AND tp.hospitalId = g.hospital_id ) tu
|
|
|
+ AND tp.hospitalId = g.hospital_id
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
|
|
|
+ ON tp.behospitalCode = h.behospital_code
|
|
|
+ AND tp.hospitalId = h.hospital_id
|
|
|
+ ) tu
|
|
|
+ WHERE tu.behospitalCode IS NOT NULL
|
|
|
<if test="checkStatus != null ">
|
|
|
- where tu.check_status = #{checkStatus}
|
|
|
+ and tu.check_status = #{checkStatus}
|
|
|
+ </if>
|
|
|
+ <if test="mrStatus != null ">
|
|
|
+ AND tu.mr_status = #{mrStatus}
|
|
|
+ </if>
|
|
|
+ <if test="chName != null and chName !=''">
|
|
|
+ AND tu.ch_name like CONCAT('%',#{chName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="mrName != null and mrName !=''">
|
|
|
+ AND tu.mr_name like CONCAT('%',#{mrName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="chTimeStart != null">
|
|
|
+ <![CDATA[ and tu.ch_time >= #{chTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="chTimeEnd != null">
|
|
|
+ <![CDATA[ and tu.ch_time < #{chTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeStart != null">
|
|
|
+ <![CDATA[ and tu.mr_time >= #{mrTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeEnd != null">
|
|
|
+ <![CDATA[ and tu.mr_time < #{mrTimeEnd}]]>
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
<!-- 科室质控评分导出到excel-->
|
|
|
<select id="exportQcresultByDept" resultMap="ExportExcelMap" parameterType="com.diagbot.vo.ExportQcresultVO">
|
|
|
SELECT * FROM (
|
|
|
- SELECT tp.*,CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status FROM (
|
|
|
+ SELECT tp.*,CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
|
|
|
+ CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
|
|
|
+ g.check_type AS ch_type,
|
|
|
+ h.check_type AS mr_type,
|
|
|
+ g.check_name AS ch_name,
|
|
|
+ h.check_name AS mr_name,
|
|
|
+ g.check_time AS ch_time,
|
|
|
+ h.check_time AS mr_time
|
|
|
+ FROM (
|
|
|
SELECT
|
|
|
t1.behDeptId,
|
|
|
t1.behDeptName,
|
|
@@ -2571,23 +2733,53 @@
|
|
|
t1.behDoctorName,
|
|
|
t1.patName,
|
|
|
t1.behospitalCode,
|
|
|
- t1.caseName)tp LEFT JOIN
|
|
|
- (SELECT
|
|
|
- *
|
|
|
- FROM
|
|
|
- med_check_info
|
|
|
- WHERE is_deleted = 'N') g
|
|
|
+ t1.caseName)tp
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
|
|
|
ON tp.behospitalCode = g.behospital_code
|
|
|
- AND tp.hospitalId = g.hospital_id ) tu
|
|
|
+ AND tp.hospitalId = g.hospital_id
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
|
|
|
+ ON tp.behospitalCode = h.behospital_code
|
|
|
+ AND tp.hospitalId = h.hospital_id
|
|
|
+ ) tu
|
|
|
+ WHERE tu.behospitalCode IS NOT NULL
|
|
|
<if test="checkStatus != null ">
|
|
|
- where tu.check_status = #{checkStatus}
|
|
|
+ and tu.check_status = #{checkStatus}
|
|
|
+ </if>
|
|
|
+ <if test="mrStatus != null ">
|
|
|
+ AND tu.mr_status = #{mrStatus}
|
|
|
+ </if>
|
|
|
+ <if test="chName != null and chName !=''">
|
|
|
+ AND tu.ch_name like CONCAT('%',#{chName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="mrName != null and mrName !=''">
|
|
|
+ AND tu.mr_name like CONCAT('%',#{mrName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="chTimeStart != null">
|
|
|
+ <![CDATA[ and tu.ch_time >= #{chTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="chTimeEnd != null">
|
|
|
+ <![CDATA[ and tu.ch_time < #{chTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeStart != null">
|
|
|
+ <![CDATA[ and tu.mr_time >= #{mrTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeEnd != null">
|
|
|
+ <![CDATA[ and tu.mr_time < #{mrTimeEnd}]]>
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
<!-- 医疗组质控评分导出到excel-->
|
|
|
<select id="exportQcresultByGroup" resultMap="ExportExcelMap" parameterType="com.diagbot.vo.ExportQcresultVO">
|
|
|
SELECT * FROM (
|
|
|
- SELECT tp.*,CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status FROM (
|
|
|
+ SELECT tp.*,CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
|
|
|
+ CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
|
|
|
+ g.check_type AS ch_type,
|
|
|
+ h.check_type AS mr_type,
|
|
|
+ g.check_name AS ch_name,
|
|
|
+ h.check_name AS mr_name,
|
|
|
+ g.check_time AS ch_time,
|
|
|
+ h.check_time AS mr_time
|
|
|
+ FROM (
|
|
|
SELECT
|
|
|
t1.behDeptId,
|
|
|
t1.behDeptName,
|
|
@@ -2745,16 +2937,38 @@
|
|
|
t1.behDoctorName,
|
|
|
t1.patName,
|
|
|
t1.behospitalCode,
|
|
|
- t1.caseName)tp LEFT JOIN
|
|
|
- (SELECT
|
|
|
- *
|
|
|
- FROM
|
|
|
- med_check_info
|
|
|
- WHERE is_deleted = 'N') g
|
|
|
+ t1.caseName)tp
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
|
|
|
ON tp.behospitalCode = g.behospital_code
|
|
|
- AND tp.hospitalId = g.hospital_id ) tu
|
|
|
+ AND tp.hospitalId = g.hospital_id
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
|
|
|
+ ON tp.behospitalCode = h.behospital_code
|
|
|
+ AND tp.hospitalId = h.hospital_id
|
|
|
+ ) tu
|
|
|
+ WHERE tu.behospitalCode IS NOT NULL
|
|
|
<if test="checkStatus != null ">
|
|
|
- where tu.check_status = #{checkStatus}
|
|
|
+ and tu.check_status = #{checkStatus}
|
|
|
+ </if>
|
|
|
+ <if test="mrStatus != null ">
|
|
|
+ AND tu.mr_status = #{mrStatus}
|
|
|
+ </if>
|
|
|
+ <if test="chName != null and chName !=''">
|
|
|
+ AND tu.ch_name like CONCAT('%',#{chName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="mrName != null and mrName !=''">
|
|
|
+ AND tu.mr_name like CONCAT('%',#{mrName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="chTimeStart != null">
|
|
|
+ <![CDATA[ and tu.ch_time >= #{chTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="chTimeEnd != null">
|
|
|
+ <![CDATA[ and tu.ch_time < #{chTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeStart != null">
|
|
|
+ <![CDATA[ and tu.mr_time >= #{mrTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeEnd != null">
|
|
|
+ <![CDATA[ and tu.mr_time < #{mrTimeEnd}]]>
|
|
|
</if>
|
|
|
</select>
|
|
|
|