123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?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.KlDiagnoseBaseMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.diagbot.entity.KlDiagnoseBase">
- <id column="id" property="id" />
- <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" />
- <result column="description" property="description" />
- <result column="type" property="type" />
- <result column="min_operator" property="minOperator" />
- <result column="min_value" property="minValue" />
- <result column="min_unit" property="minUnit" />
- <result column="max_operator" property="maxOperator" />
- <result column="max_value" property="maxValue" />
- <result column="max_unit" property="maxUnit" />
- <result column="eq_operator" property="eqOperator" />
- <result column="eq_value" property="eqValue" />
- <result column="eq_unit" property="eqUnit" />
- </resultMap>
- <select id="getAllBaseDiagnose" resultType="com.diagbot.dto.BaseDiagnoseDTO">
- SELECT
- t.type baseType,
- t.max_operator baseMaxOperator,
- t.max_value baseMaxValue,
- t.max_unit baseMaxUnit,
- t.min_operator baseMinOperator,
- t.min_value baseMinValue,
- t.min_unit baseMinUnit,
- t.eq_operator baseEqOperator,
- t.eq_value baseEqValue,
- t.eq_unit baseEqUnit,
- t.conceptids baseConceptids,
- t.lib_name baseLibName,
- t.lib_type baseLibType,
- GROUP_CONCAT(t.id) ids
- FROM
- (
- SELECT
- t1.id,
- t1.type,
- t1.max_operator,
- t1.max_value,
- t1.max_unit,
- t1.min_operator,
- t1.min_value,
- t1.min_unit,
- t1.eq_operator,
- t1.eq_value,
- t1.eq_unit,
- IFNULL(t2.conceptids, 0) conceptids,
- IFNULL(t2.lib_name, '') lib_name,
- IFNULL(t2.lib_type, 0) lib_type
- FROM
- kl_diagnose_base t1
- LEFT JOIN (
- SELECT
- diagnose_base_id,
- lib_type,
- GROUP_CONCAT(
- concept_id
- ORDER BY
- concept_id
- ) conceptids,
- GROUP_CONCAT(
- lib_name
- ORDER BY
- concept_id SEPARATOR '#'
- ) lib_name
- FROM
- `kl_diagnose_base_relation` m,
- kl_concept c
- WHERE
- m.is_deleted = 'N'
- AND c.is_deleted = 'N'
- AND c. STATUS = 1
- AND m.concept_id = c.id
- GROUP BY m.diagnose_base_id, c.lib_type
- ) t2 ON t1.id = t2.diagnose_base_id
- WHERE
- t1.is_deleted = 'N'
- ) t
- GROUP BY
- t.type,
- t.max_operator,
- t.max_value,
- t.max_unit,
- t.min_operator,
- t.min_value,
- t.min_unit,
- t.eq_operator,
- t.eq_value,
- t.eq_unit,
- t.conceptids,
- t.lib_name
- </select>
- </mapper>
|