123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631 |
- <?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.diagbot.mapper.BehospitalInfoMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.diagbot.entity.BehospitalInfo">
- <id column="behospital_code" property="behospitalCode" />
- <result column="hospital_id" property="hospitalId" />
- <result column="name" property="name" />
- <result column="sex" property="sex" />
- <result column="birthday" property="birthday" />
- <result column="file_code" property="fileCode" />
- <result column="qc_type_id" property="qcTypeId" />
- <result column="ward_code" property="wardCode" />
- <result column="ward_name" property="wardName" />
- <result column="beh_dept_id" property="behDeptId" />
- <result column="beh_dept_name" property="behDeptName" />
- <result column="bed_code" property="bedCode" />
- <result column="bed_name" property="bedName" />
- <result column="insurance_name" property="insuranceName" />
- <result column="job_type" property="jobType" />
- <result column="behospital_date" property="behospitalDate" />
- <result column="leave_hospital_date" property="leaveHospitalDate" />
- <result column="diagnose_icd" property="diagnoseIcd" />
- <result column="diagnose" property="diagnose" />
- <result column="beh_doctor_id" property="behDoctorId" />
- <result column="beh_doctor_name" property="behDoctorName" />
- <result column="doctor_id" property="doctorId" />
- <result column="doctor_name" property="doctorName" />
- <result column="director_doctor_id" property="directorDoctorId" />
- <result column="director_doctor_name" property="directorDoctorName" />
- <result column="is_deleted" property="isDeleted" />
- <result column="gmt_create" property="gmtCreate" />
- <result column="gmt_modified" property="gmtModified" />
- <result column="creator" property="creator" />
- <result column="modifier" property="modifier" />
- </resultMap>
- <select id="getPage" resultType="com.diagbot.dto.BehospitalInfoDTO">
- select * 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
- LEFT JOIN med_qcresult_info b
- on a.behospital_code = b.behospital_code and b.is_deleted = 'N'
- left join med_home_page c
- on a.behospital_code = c.behospital_code and c.is_deleted = 'N'
- ) t
- where t.is_deleted = 'N'
- <if test="deptId != null and deptId != ''">
- and t.beh_dept_id = #{deptId}
- </if>
- <if test="doctorName != null and doctorName != ''">
- and CONCAT( IFNULL(t.doctor_name,''),IFNULL(t.beh_doctor_name,''),IFNULL(t.director_doctor_name,'')) like CONCAT('%',#{doctorName},'%')
- </if>
- <if test="name != null and name != ''">
- and t.name like CONCAT('%',#{name},'%')
- </if>
- <if test="doctorCode != null and doctorCode != ''">
- and (t.doctor_id = #{doctorCode}
- or t.beh_doctor_id = #{doctorCode}
- or t.director_doctor_id = #{doctorCode})
- </if>
- <if test="fileCode != null and fileCode != ''">
- and t.file_code like CONCAT('%',#{fileCode},'%')
- </if>
- <if test="hospitalId != null">
- and t.hospital_id = #{hospitalId}
- </if>
- <if test="behospitalCode != null and behospitalCode != ''">
- and t.behospital_code like CONCAT('%',#{behospitalCode},'%')
- </if>
- <if test="behosDateStart != null">
- <![CDATA[ and t.behospital_date >= #{behosDateStart}]]>
- </if>
- <if test="behosDateEnd != null">
- <![CDATA[ and t.behospital_date <= #{behosDateEnd}]]>
- </if>
- <if test="leaveHosDateStart != null">
- <![CDATA[ and t.leave_hospital_date >= #{leaveHosDateStart}]]>
- </if>
- <if test="leaveHosDateEnd != null">
- <![CDATA[ and t.leave_hospital_date <= #{leaveHosDateEnd}]]>
- </if>
- <if test="level != null and level != ''">
- and t.level = #{level}
- </if>
- </select>
- <select id="getMsg" resultType="com.diagbot.dto.MsgDTO">
- SELECT b.`name` model_name,c.score,c.msg,c.cases_entry_id,c.is_reject,c.id id,c.info,
- a.cases_id cases_id, d.score cases_score,b.id model_id, a.name standard_msg
- FROM `qc_cases_entry` a, qc_mode b, med_qcresult_detail c, qc_cases_hospital d
- where a.is_deleted = 'N' and b.is_deleted = 'N' and c.is_deleted = 'N' and d.is_deleted = 'N'
- and a.id = c.cases_entry_id
- and a.mode_id = b.id
- AND c.cases_id = d.cases_id
- and c.hospital_id = d.hospital_id
- and c.hospital_id = #{hospitalId}
- and c.behospital_code = #{behospitalCode}
- order by b.order_no, a.order_no
- </select>
- <!-- 缺陷排行列表 -->
- <select id="resultStatistics" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.NumDTO">
- SELECT
- t1.msg AS name,
- t1.num AS num,
- round( t1.num / t2.totle, 4) AS percent
- FROM
- (
- (
- SELECT
- c.msg,
- count(*) AS num
- FROM
- med_behospital_info a,
- med_qcresult_info b,
- med_qcresult_detail c
- WHERE
- a.behospital_code = b.behospital_code
- AND a.hospital_id = b.hospital_id
- AND b.behospital_code = c.behospital_code
- AND b.hospital_id = c.hospital_id
- AND a.is_deleted = 'N'
- AND b.is_deleted = 'N'
- AND c.is_deleted = 'N'
- AND a.qc_type_id IS NOT NULL
- <if test="hospitalId != null and hospitalId != ''">
- AND a.hospital_id = #{hospitalId}
- </if>
- <if test="startDate != null and startDate != ''">
- <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
- </if>
- <if test="endDate != null and endDate != ''">
- <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
- </if>
- GROUP BY
- c.msg
- ORDER BY
- count(*) DESC
- ) t1,
- (
- SELECT
- count(*) AS totle
- FROM
- med_behospital_info a,
- med_qcresult_info b,
- med_qcresult_detail c
- WHERE
- a.behospital_code = b.behospital_code
- AND a.hospital_id = b.hospital_id
- AND b.behospital_code = c.behospital_code
- AND b.hospital_id = c.hospital_id
- AND a.is_deleted = 'N'
- AND b.is_deleted = 'N'
- AND c.is_deleted = 'N'
- AND a.qc_type_id IS NOT NULL
- <if test="hospitalId != null and hospitalId != ''">
- AND a.hospital_id = #{hospitalId}
- </if>
- <if test="startDate != null and startDate != ''">
- <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
- </if>
- <if test="endDate != null and endDate != ''">
- <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
- </if>
- ) t2
- )
- <if test="limitCount != null and limitCount != ''">
- limit 0,#{limitCount}
- </if>
- </select>
- <!-- 各科室缺陷占比 -->
- <select id="resultStatisticsByDept" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.NumDTO">
- SELECT
- t1.beh_dept_name AS name,
- t1.num AS num,
- round( t1.num / t2.totle, 4 ) AS percent
- FROM
- (
- (
- SELECT
- a.beh_dept_id,
- a.beh_dept_name,
- count(*) AS num
- FROM
- med_behospital_info a,
- med_qcresult_info b,
- med_qcresult_detail c
- WHERE
- a.behospital_code = b.behospital_code
- AND a.hospital_id = b.hospital_id
- AND b.behospital_code = c.behospital_code
- AND b.hospital_id = c.hospital_id
- AND a.is_deleted = 'N'
- AND b.is_deleted = 'N'
- AND c.is_deleted = 'N'
- AND a.qc_type_id IS NOT NULL
- <if test="hospitalId != null and hospitalId != ''">
- AND a.hospital_id = #{hospitalId}
- </if>
- <if test="startDate != null and startDate != ''">
- <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
- </if>
- <if test="endDate != null and endDate != ''">
- <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
- </if>
- GROUP BY
- a.beh_dept_id,
- a.beh_dept_name
- ORDER BY
- count(*) DESC
- ) t1,
- (
- SELECT
- count(*) AS totle
- FROM
- med_behospital_info a,
- med_qcresult_info b,
- med_qcresult_detail c
- WHERE
- a.behospital_code = b.behospital_code
- AND a.hospital_id = b.hospital_id
- AND b.behospital_code = c.behospital_code
- AND b.hospital_id = c.hospital_id
- AND a.is_deleted = 'N'
- AND b.is_deleted = 'N'
- AND c.is_deleted = 'N'
- AND a.qc_type_id IS NOT NULL
- <if test="hospitalId != null and hospitalId != ''">
- AND a.hospital_id = #{hospitalId}
- </if>
- <if test="startDate != null and startDate != ''">
- <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
- </if>
- <if test="endDate != null and endDate != ''">
- <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
- </if>
- ) t2
- )
- </select>
- <!-- 缺陷排行列表 -->
- <select id="resultStatistics2" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.NumDTO">
- SELECT
- c.msg as name,
- count(*) AS num
- FROM
- med_behospital_info a,
- med_qcresult_info b,
- med_qcresult_detail c
- WHERE
- a.behospital_code = b.behospital_code
- AND a.hospital_id = b.hospital_id
- AND b.behospital_code = c.behospital_code
- AND b.hospital_id = c.hospital_id
- AND a.is_deleted = 'N'
- AND b.is_deleted = 'N'
- AND c.is_deleted = 'N'
- AND a.qc_type_id IS NOT NULL
- <if test="hospitalId != null and hospitalId != ''">
- AND a.hospital_id = #{hospitalId}
- </if>
- <if test="startDate != null and startDate != ''">
- <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
- </if>
- <if test="endDate != null and endDate != ''">
- <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
- </if>
- GROUP BY
- c.msg
- ORDER BY
- count(*) DESC
- <if test="limitCount != null and limitCount != ''">
- limit 0,#{limitCount}
- </if>
- </select>
- <!-- 各科室缺陷占比 -->
- <select id="resultStatisticsByDept2" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.NumDTO">
- SELECT
- a.beh_dept_id,
- a.beh_dept_name as name,
- count(*) AS num
- FROM
- med_behospital_info a,
- med_qcresult_info b,
- med_qcresult_detail c
- WHERE
- a.behospital_code = b.behospital_code
- AND a.hospital_id = b.hospital_id
- AND b.behospital_code = c.behospital_code
- AND b.hospital_id = c.hospital_id
- AND a.is_deleted = 'N'
- AND b.is_deleted = 'N'
- AND c.is_deleted = 'N'
- AND a.qc_type_id IS NOT NULL
- <if test="hospitalId != null and hospitalId != ''">
- AND a.hospital_id = #{hospitalId}
- </if>
- <if test="startDate != null and startDate != ''">
- <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
- </if>
- <if test="endDate != null and endDate != ''">
- <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
- </if>
- GROUP BY
- a.beh_dept_id,
- a.beh_dept_name
- ORDER BY
- count(*) DESC
- </select>
- <!-- 缺陷总数查询-->
- <select id="getTotleResultNum" parameterType="com.diagbot.vo.FilterVO" resultType="int">
- SELECT
- count(*) AS totle
- FROM
- med_behospital_info a,
- med_qcresult_info b,
- med_qcresult_detail c
- WHERE
- a.behospital_code = b.behospital_code
- AND a.hospital_id = b.hospital_id
- AND b.behospital_code = c.behospital_code
- AND b.hospital_id = c.hospital_id
- AND a.is_deleted = 'N'
- AND b.is_deleted = 'N'
- AND c.is_deleted = 'N'
- AND a.qc_type_id IS NOT NULL
- <if test="hospitalId != null and hospitalId != ''">
- AND a.hospital_id = #{hospitalId}
- </if>
- <if test="startDate != null and startDate != ''">
- <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
- </if>
- <if test="endDate != null and endDate != ''">
- <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
- </if>
- </select>
- <!--获取未评分病历-->
- <select id="getNoGrade" resultMap="BaseResultMap">
- select * from med_behospital_info a
- where a.is_deleted = 'N'
- and
- not EXISTS (
- SELECT
- 1
- FROM
- med_qcresult_info b
- WHERE
- b.is_deleted = 'N'
- AND a.hospital_id = b.hospital_id
- AND a.behospital_code = b.behospital_code
- )
- </select>
- <!--质控评分(科室)分页-->
- <select id="getPageByDept" resultType="com.diagbot.dto.BehospitalInfoDTO">
- SELECT
- *
- 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
- JOIN sys_user_dept d
- ON a.hospital_id = d.hospital_id
- AND a.beh_dept_id = d.dept_id
- LEFT JOIN med_qcresult_info b
- ON a.behospital_code = b.behospital_code
- AND b.is_deleted = 'N'
- LEFT JOIN med_home_page c
- ON a.behospital_code = c.behospital_code
- AND c.is_deleted = 'N'
- WHERE d.is_deleted = 'N'
- AND d.user_id = #{userId}
- ) t
- where t.is_deleted = 'N'
- <if test="deptId != null and deptId != ''">
- and t.beh_dept_id = #{deptId}
- </if>
- <if test="doctorName != null and doctorName != ''">
- and CONCAT( IFNULL(t.doctor_name,''),IFNULL(t.beh_doctor_name,''),IFNULL(t.director_doctor_name,'')) like CONCAT('%',#{doctorName},'%')
- </if>
- <if test="doctorCode != null and doctorCode != ''">
- and (t.doctor_id = #{doctorCode}
- or t.beh_doctor_id = #{doctorCode}
- or t.director_doctor_id = #{doctorCode})
- </if>
- <if test="name != null and name != ''">
- and t.name like CONCAT('%',#{name},'%')
- </if>
- <if test="fileCode != null and fileCode != ''">
- and t.file_code like CONCAT('%',#{fileCode},'%')
- </if>
- <if test="hospitalId != null">
- and t.hospital_id = #{hospitalId}
- </if>
- <if test="behospitalCode != null and behospitalCode != ''">
- and t.behospital_code like CONCAT('%',#{behospitalCode},'%')
- </if>
- <if test="behosDateStart != null">
- <![CDATA[ and t.behospital_date >= #{behosDateStart}]]>
- </if>
- <if test="behosDateEnd != null">
- <![CDATA[ and t.behospital_date <= #{behosDateEnd}]]>
- </if>
- <if test="leaveHosDateStart != null">
- <![CDATA[ and t.leave_hospital_date >= #{leaveHosDateStart}]]>
- </if>
- <if test="leaveHosDateEnd != null">
- <![CDATA[ and t.leave_hospital_date <= #{leaveHosDateEnd}]]>
- </if>
- <if test="level != null and level != ''">
- and t.level = #{level}
- </if>
- </select>
- <!--质控评分(个人)分页-->
- <select id="getPageByPerson" resultType="com.diagbot.dto.BehospitalInfoDTO">
- select * 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
- JOIN
- (SELECT
- u.id,
- u.linkman AS linkman,
- uh.hospital_id
- FROM
- sys_user u
- JOIN sys_user_hospital uh
- ON u.id = uh.user_id
- WHERE u.is_deleted = "N"
- AND u.id = #{userId}
- AND uh.hospital_id = #{hospitalId}) u1
- ON a.hospital_id = u1.hospital_id
- LEFT JOIN med_qcresult_info b
- ON a.behospital_code = b.behospital_code
- AND b.is_deleted = 'N'
- LEFT JOIN med_home_page c
- ON a.behospital_code = c.behospital_code
- AND c.is_deleted = 'N'
- WHERE CONCAT(
- IFNULL(a.doctor_name, ''),
- IFNULL(a.beh_doctor_name, ''),
- IFNULL(a.director_doctor_name, '')
- ) LIKE CONCAT('%', u1.linkman, '%')
- ) t
- where t.is_deleted = 'N'
- <if test="deptId != null and deptId != ''">
- and t.beh_dept_id = #{deptId}
- </if>
- <if test="name != null and name != ''">
- and t.name like CONCAT('%',#{name},'%')
- </if>
- <if test="fileCode != null and fileCode != ''">
- and t.file_code like CONCAT('%',#{fileCode},'%')
- </if>
- <if test="behospitalCode != null and behospitalCode != ''">
- and t.behospital_code like CONCAT('%',#{behospitalCode},'%')
- </if>
- <if test="behosDateStart != null">
- <![CDATA[ and t.behospital_date >= #{behosDateStart}]]>
- </if>
- <if test="behosDateEnd != null">
- <![CDATA[ and t.behospital_date <= #{behosDateEnd}]]>
- </if>
- <if test="leaveHosDateStart != null">
- <![CDATA[ and t.leave_hospital_date >= #{leaveHosDateStart}]]>
- </if>
- <if test="leaveHosDateEnd != null">
- <![CDATA[ and t.leave_hospital_date <= #{leaveHosDateEnd}]]>
- </if>
- <if test="level != null and level != ''">
- and t.level = #{level}
- </if>
- </select>
- <!-- 病案首页病历数统计 -->
- <select id="homePageCount" parameterType="com.diagbot.vo.HomePageFilterVO" resultType="int">
- SELECT
- COUNT(*)
- FROM
- med_behospital_info a,
- med_home_page b
- WHERE
- a.is_deleted = 'N'
- AND b.is_deleted = 'N'
- AND a.hospital_id = b.hospital_id
- AND a.behospital_code = b.behospital_code
- AND a.qc_type_id IS NOT NULL
- <if test="hospitalId != null and hospitalId != ''">
- AND a.hospital_id = #{hospitalId}
- </if>
- <if test="startDate != null and startDate != ''">
- <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
- </if>
- <if test="endDate != null and endDate != ''">
- <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
- </if>
- <if test="death!=null and death==1">
- AND b.leave_hospital_type = '死亡'
- </if>
- <if test="newBorn!=null and newBorn==1">
- AND ( b.age IS NULL OR b.age = '-' OR b.age = '' )
- <![CDATA[AND ( b.newborn_month IS NOT NULL OR b.newborn_month <> '' OR b.newborn_day IS NOT NULL OR b.newborn_day <> '' )]]>
- </if>
- </select>
- <!-- 病案首页手术病历数统计 -->
- <select id="homePageCountForOperation" parameterType="com.diagbot.vo.FilterVO" resultType="int">
- SELECT
- COUNT(*)
- FROM
- med_behospital_info a,
- med_home_page b,
- med_home_operation_info c
- WHERE
- a.is_deleted = 'N'
- AND b.is_deleted = 'N'
- AND c.is_deleted = 'N'
- AND a.hospital_id = b.hospital_id
- AND a.hospital_id = c.hospital_id
- AND a.behospital_code = b.behospital_code
- AND b.home_page_id = c.home_page_id
- AND a.qc_type_id IS NOT NULL
- <if test="hospitalId != null and hospitalId != ''">
- AND a.hospital_id = #{hospitalId}
- </if>
- <if test="startDate != null and startDate != ''">
- <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
- </if>
- <if test="endDate != null and endDate != ''">
- <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
- </if>
- </select>
- <!-- 按科室统计病案首页病历数 -->
- <select id="homePageCountByDept" parameterType="com.diagbot.vo.HPFilterByDeptVO" resultType="com.diagbot.dto.NumDTO">
- SELECT
- a.beh_dept_id AS id,
- a.beh_dept_name AS NAME,
- COUNT(*) AS num
- FROM
- med_behospital_info a,
- med_home_page b,
- sys_user_dept c
- WHERE
- a.is_deleted = 'N'
- AND b.is_deleted = 'N'
- AND c.is_deleted = 'N'
- AND a.hospital_id = b.hospital_id
- AND a.hospital_id = c.hospital_id
- AND a.behospital_code = b.behospital_code
- AND a.beh_dept_id = c.dept_id
- AND a.qc_type_id IS NOT NULL
- <if test="death!=null and death==1">
- AND b.leave_hospital_type = '死亡'
- </if>
- <if test="userId!=null">
- AND c.user_id = #{userId}
- </if>
- <if test="hospitalId != null and hospitalId != ''">
- AND a.hospital_id = #{hospitalId}
- </if>
- <if test="startDate != null and startDate != ''">
- <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
- </if>
- <if test="endDate != null and endDate != ''">
- <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
- </if>
- GROUP BY
- a.beh_dept_id,
- a.beh_dept_name
- </select>
- <!-- 按科室病案首页手术病历数 -->
- <select id="homePageCountForOperationByDept" parameterType="com.diagbot.vo.FilterByDeptVO" resultType="com.diagbot.dto.NumDTO">
- SELECT
- a.beh_dept_id AS id,
- a.beh_dept_name AS NAME,
- COUNT(*) AS num
- FROM
- med_behospital_info a,
- med_home_page b,
- sys_user_dept c,
- med_home_operation_info d
- WHERE
- a.is_deleted = 'N'
- AND b.is_deleted = 'N'
- AND c.is_deleted = 'N'
- AND d.is_deleted = 'N'
- AND a.hospital_id = b.hospital_id
- AND a.hospital_id = c.hospital_id
- AND a.hospital_id = d.hospital_id
- AND a.behospital_code = b.behospital_code
- AND b.home_page_id = d.home_page_id
- AND a.beh_dept_id = c.dept_id
- AND a.qc_type_id IS NOT NULL
- <if test="userId!=null">
- AND c.user_id = #{userId}
- </if>
- <if test="hospitalId != null and hospitalId != ''">
- AND a.hospital_id = #{hospitalId}
- </if>
- <if test="startDate != null and startDate != ''">
- <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
- </if>
- <if test="endDate != null and endDate != ''">
- <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
- </if>
- GROUP BY
- a.beh_dept_id,
- a.beh_dept_name
- </select>
- </mapper>
|