<?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.document.mapper.DocStatisticsDefinitionAppMapper">
    <!-- 患者信息分页查询-->
    <select id="getDocStatisticsDefinitionPageList" parameterType="java.util.Map"
            resultType="com.openhis.web.document.dto.DocStatisticsDefinitionDto">

    </select>
    <select id="getOptionList" parameterType="java.util.Map"
            resultType="com.openhis.web.document.dto.OptionDto">
        SELECT op.id as option_id,
        op.option,
        op.display_order,
        d.id,
        d.name,
        d.type_enum,
        d.code,
        d.required,
        d.remark,
        d.is_statistics,
        d.unit
        from doc_statistics_definition_option op
        RIGHT JOIN doc_statistics_definition d
        on op.doc_statistics_definition_id = d.id
        WHERE
        d.delete_flag='0'
        <if test="id!= null">
            and d.id = #{id}
        </if>
        <if test="code!= null and code.isEmpty() == false">
            and d.code = #{code}
        </if>
        <if test="name!= null">
            and d.name = #{name}
        </if>
    </select>

</mapper>