123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306 |
- <?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.QcCasesEntryMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.diagbot.entity.QcCasesEntry">
- <id column="id" property="id" />
- <result column="cases_id" property="casesId" />
- <result column="cases_name" property="casesName" />
- <result column="mode_id" property="modeId" />
- <result column="code" property="code" />
- <result column="name" property="name" />
- <result column="rule_type" property="ruleType" />
- <result column="dev_type" property="devType" />
- <result column="accuracy_type" property="accuracyType" />
- <result column="drgs" property="drgs" />
- <result column="type" property="type" />
- <result column="precond" property="precond" />
- <result column="order_no" property="orderNo" />
- <result column="remark" property="remark" />
- <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="getAllQcCasesEntry" parameterType="com.diagbot.vo.QcCasesEntryAllVO" resultType="com.diagbot.dto.QcCasesEntryAllDTO">
- SELECT a.*,b.name as modeName FROM qc_cases_entry a
- LEFT JOIN qc_mode b ON b.id= a.mode_id
- WHERE a.is_deleted = 'N'
- <if test="casesId != null and casesId != ''">
- AND a.cases_id = #{casesId}
- </if>
- <if test="modeId != null and modeId != ''">
- AND b.id = #{modeId}
- </if>
- <if test="ruleType != null">
- AND a.rule_type = #{ruleType}
- </if>
- <if test="devType != null">
- AND a.dev_type = #{devType}
- </if>
- <if test="accuracyType != null">
- AND a.accuracy_type = #{accuracyType}
- </if>
- <if test="drgs != null">
- AND a.drgs = #{drgs}
- </if>
- <if test="type != null">
- AND a.type = #{type}
- </if>
- <if test="name != null and name != ''">
- AND UPPER(a.name) LIKE CONCAT('%', UPPER(trim(#{name})), '%')
- </if>
- <if test="code != null and code != ''">
- AND UPPER(a.code) LIKE CONCAT('%', UPPER(trim(#{code})), '%')
- </if>
- ORDER BY a.gmt_modified DESC
- </select>
- <select id="getQcCasesEntryIndex" resultType="com.diagbot.dto.QcCasesEntryAllDTO">
- SELECT distinct a.*,b.name as modeName
- FROM qc_cases_entry a, qc_mode b, qc_cases_entry_hospital c
- WHERE a.is_deleted = 'N' and b.is_deleted = 'N' and c.is_deleted = 'N '
- and b.id= a.mode_id and a.id = c.cases_entry_id
- <if test="hospitalId != null">
- AND c.hospital_id = #{hospitalId}
- </if>
- <if test="casesId != null and casesId != ''">
- AND a.cases_id = #{casesId}
- </if>
- <if test="modeId != null and modeId != ''">
- AND b.id = #{modeId}
- </if>
- <if test="name != null and name != ''">
- AND UPPER(a.name) LIKE CONCAT('%', UPPER(trim(#{name})), '%')
- </if>
- <if test="code != null and code != ''">
- AND a.code = #{code}
- </if>
- <if test="ids != null and ids.size() > 0 ">
- and a.id in
- <foreach collection="ids" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="notIds != null and notIds.size() > 0 ">
- and a.id not in
- <foreach collection="notIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="filter != null and filter == 1">
- and a.id not in
- (
- select DISTINCT q2.cases_entry_id from qc_question_info q1, qc_question_entry q2
- where q1.is_deleted = 'N' and q2.is_deleted = 'N' and q1.id = q2.question_id
- <if test="hospitalId != null">
- and q1.hospital_id = #{hospitalId}
- </if>
- <if test="modeId != null and modeId != ''">
- AND q1.mode_id = #{modeId}
- </if>
- )
- </if>
- ORDER BY a.cases_id,a.id
- </select>
- <select id="getByCasesEntryId" resultType="com.diagbot.dto.QcCasesEntryDTO">
- SELECT a.*,b.name as modeName FROM qc_cases_entry a
- LEFT JOIN qc_mode b ON b.id= a.mode_id
- WHERE a.is_deleted = 'N' AND a.id
- IN
- <foreach collection="ids" item="ids" open="(" close=")" separator=",">
- #{ids}
- </foreach>
- </select>
- <select id ="getQcCasesEntryAll" resultType="com.diagbot.dto.QcCasesEntryAllDTO">
- SELECT a.id,a.cases_id,a.cases_name,a.mode_id,a.code,a.name,a.drgs,a.type,a.rule_type,a.dev_type,a.accuracy_type,a.precond,a.is_deleted,a.order_no,a.gmt_create,a.gmt_modified,a.creator,a.modifier,
- b.name as modeName FROM qc_cases_entry a
- LEFT JOIN qc_mode b ON b.id= a.mode_id
- WHERE a.is_deleted = 'N'
- ORDER BY a.cases_id,a.id
- </select>
- <select id="index" resultType="com.diagbot.dto.QcCasesEntrySimpleDTO">
- SELECT distinct t3.msg name, t2.id
- FROM
- qc_cases_entry t2,
- qc_cases_entry_hospital t3
- where t2.is_deleted = 'N'
- and t3.is_deleted = 'N'
- and t2.id = t3.cases_entry_id
- and t3.is_used = 1
- <if test="hospitalId != null">
- and t3.hospital_id = #{hospitalId}
- </if>
- <if test="input != null and input != ''">
- and t2.name like concat('%', #{input}, '%')
- </if>
- <if test="notIds != null and notIds.size > 0">
- and t2.id not in
- <foreach item="item" collection="notIds" open="(" separator="," close=")" >
- #{item}
- </foreach>
- </if>
- order by t2.order_no
- </select>
-
- <select id="getEntryByHospital" resultType="com.diagbot.dto.QcCasesEntrySimpleDTO">
- SELECT
- t1.`name`, t1.id, t3.`name` mode_name, t2.is_used, 1 as sel
- FROM
- qc_cases_entry t1,
- qc_cases_entry_hospital t2,
- qc_mode t3
- WHERE
- t1.is_deleted = 'N'
- AND t2.is_deleted = 'N'
- AND t3.is_deleted = 'N'
- AND t1.id = t2.cases_entry_id
- AND t1.mode_id = t3.id
- AND t2.hospital_id = #{hospitalId}
- ORDER BY t3.order_no,t1.order_no
- </select>
- <select id="entryTypePage" resultType="com.diagbot.dto.QcEntryTypeDTO">
- SELECT
- t.*, qc.cases_id,
- qc.cases_name,
- qc.`code`,
- qc.`name` entry_name
- FROM
- (
- SELECT
- a1.entry_id,
- a1.hospital_id,
- GROUP_CONCAT(b1. NAME) type_str
- FROM
- (
- SELECT
- t1.id entry_id,
- t2.hospital_id
- FROM
- qc_cases_entry t1,
- qc_cases_entry_hospital t2
- WHERE
- t1.is_deleted = 'N'
- AND t2.is_deleted = 'N'
- AND t1.id = t2.cases_entry_id
- ) a1
- LEFT JOIN (
- SELECT
- a1. NAME,
- a2.case_entry_id,
- a1.hospital_id
- FROM
- qc_type a1,
- qc_type_cases_entry a2
- WHERE
- a1.is_deleted = 'N'
- AND a2.is_deleted = 'N'
- AND a1.id = a2.type_id
- ) b1 ON a1.entry_id = b1.case_entry_id
- AND a1.hospital_id = b1.hospital_id
- GROUP BY
- a1.entry_id,
- a1.hospital_id
- ) t,
- qc_cases_entry qc
- WHERE
- t.entry_id = qc.id
- <if test="hospitalId != null">
- and t.hospital_id = #{hospitalId}
- </if>
- <if test="entryName != null and entryName != ''">
- and qc.name like concat('%', #{entryName}, '%')
- </if>
- <if test="code != null and code != ''">
- and qc.code like concat('%', #{code}, '%')
- </if>
- <if test="casesId != null and casesId != ''">
- and qc.cases_id = #{casesId}
- </if>
- <if test="typeName != null and typeName != ''">
- and t.type_str like concat('%', #{typeName}, '%')
- </if>
- <if test="typeIsNull != null and typeIsNull == 1">
- and t.type_str is null
- </if>
- </select>
- <select id="entryTypeDetail" resultType="com.diagbot.dto.QcTypeByEntryDTO">
- SELECT
- t1.id entry_id,
- t1.`name` entry_name,
- t2.hospital_id,
- t4.NAME type_name,
- t4.id type_id,
- t1.cases_name
- FROM
- qc_cases_entry t1,
- qc_cases_entry_hospital t2,
- qc_type_cases_entry t3,
- qc_type t4
- WHERE
- t1.is_deleted = 'N'
- AND t2.is_deleted = 'N'
- AND t3.is_deleted = 'N'
- AND t4.is_deleted = 'N'
- AND t1.id = t2.cases_entry_id
- AND t1.id = t3.case_entry_id
- AND t3.type_id = t4.id
- AND t2.hospital_id = t4.hospital_id
- AND t2.hospital_id = #{hospitalId}
- AND t1.id = #{entryId}
- ORDER BY
- t4.id
- </select>
- <select id="indexQcType" resultType="com.diagbot.dto.QcTypeSimpDTO">
- SELECT
- *
- FROM
- `qc_type` t1
- WHERE
- t1.is_deleted = 'N'
- AND t1.hospital_id = #{hospitalId}
- AND t1.id NOT IN (
- SELECT DISTINCT
- type_id
- FROM
- qc_type_cases_entry t2
- WHERE
- t2.is_deleted = 'N'
- AND t2.case_entry_id = #{entryId}
- )
- </select>
- <delete id="deleteQcTypeEntry">
- DELETE t2
- FROM
- qc_type t1,
- qc_type_cases_entry t2
- WHERE
- t1.hospital_id = #{hospitalId}
- AND t1.id = t2.type_id
- AND t2.case_entry_id = #{entryId}
- </delete>
- <select id="getTypeByHospital" resultType="com.diagbot.dto.QcTypeSimpDTO">
- SELECT DISTINCT
- NAME
- FROM
- `qc_type`
- WHERE
- is_deleted = 'N'
- <if test="hospitalId != null">
- and hospital_id = #{hospitalId}
- </if>
- ORDER BY
- id
- </select>
- </mapper>
|