|
|
|
|
<?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.ccsens.tcm.persist.dao.ReportCodeDao">
|
|
|
|
|
<resultMap id="BaseResultMap" type="com.ccsens.tcm.bean.po.ReportCode">
|
|
|
|
|
<id column="id" jdbcType="BIGINT" property="id" />
|
|
|
|
|
<result column="code" jdbcType="VARCHAR" property="code" />
|
|
|
|
|
<result column="name" jdbcType="VARCHAR" property="name" />
|
|
|
|
|
<result column="parent_code" jdbcType="VARCHAR" property="parentCode" />
|
|
|
|
|
<result column="must" jdbcType="TINYINT" property="must" />
|
|
|
|
|
<result column="level" jdbcType="TINYINT" property="level" />
|
|
|
|
|
<result column="sort" jdbcType="INTEGER" property="sort" />
|
|
|
|
|
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
|
|
|
|
<result column="report_type" jdbcType="TINYINT" property="reportType" />
|
|
|
|
|
<result column="operator" jdbcType="BIGINT" property="operator" />
|
|
|
|
|
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
|
|
|
|
|
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
|
|
|
|
|
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
<insert id="insertBatch">
|
|
|
|
|
replace into t_report_code (id, code, name,
|
|
|
|
|
parent_code, must, level,
|
|
|
|
|
sort, remark, report_type)
|
|
|
|
|
values
|
|
|
|
|
<foreach collection="list" item="report" separator=",">
|
|
|
|
|
(#{report.id,jdbcType=BIGINT}, #{report.code,jdbcType=VARCHAR}, #{report.name,jdbcType=VARCHAR},
|
|
|
|
|
#{report.parentCode,jdbcType=VARCHAR}, #{report.must,jdbcType=TINYINT}, #{report.level,jdbcType=TINYINT},
|
|
|
|
|
#{report.sort,jdbcType=INTEGER}, #{report.remark,jdbcType=VARCHAR}, #{report.reportType,jdbcType=TINYINT})
|
|
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<resultMap id="selectCodeAll" type="com.ccsens.tcm.bean.vo.QuestionVo$ReportCodeVo">
|
|
|
|
|
<id column="fId" jdbcType="BIGINT" property="id" />
|
|
|
|
|
<result column="fCode" jdbcType="VARCHAR" property="code" />
|
|
|
|
|
<result column="fName" jdbcType="VARCHAR" property="name" />
|
|
|
|
|
<result column="fParentId" jdbcType="VARCHAR" property="parentCode" />
|
|
|
|
|
<result column="fMust" jdbcType="TINYINT" property="must" />
|
|
|
|
|
<result column="fLevel" jdbcType="TINYINT" property="level" />
|
|
|
|
|
<result column="fSort" jdbcType="INTEGER" property="sort" />
|
|
|
|
|
<result column="fRemark" jdbcType="VARCHAR" property="remark" />
|
|
|
|
|
<result column="fReportType" jdbcType="TINYINT" property="reportType" />
|
|
|
|
|
<collection property="subReportCodes" ofType="com.ccsens.tcm.bean.vo.QuestionVo$ReportCodeVo">
|
|
|
|
|
<id column="sId" jdbcType="BIGINT" property="id" />
|
|
|
|
|
<result column="sParentId" jdbcType="BIGINT" property="parentCode" />
|
|
|
|
|
<result column="sCode" jdbcType="VARCHAR" property="code" />
|
|
|
|
|
<result column="sName" jdbcType="VARCHAR" property="name" />
|
|
|
|
|
<result column="sMust" jdbcType="TINYINT" property="must" />
|
|
|
|
|
<result column="sLevel" jdbcType="TINYINT" property="level" />
|
|
|
|
|
<result column="sSort" jdbcType="INTEGER" property="sort" />
|
|
|
|
|
<result column="sRemark" jdbcType="VARCHAR" property="remark" />
|
|
|
|
|
<result column="sReportType" jdbcType="TINYINT" property="reportType" />
|
|
|
|
|
</collection>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<select id="selectCode" resultMap="selectCodeAll">
|
|
|
|
|
SELECT
|
|
|
|
|
c1.id as fId,
|
|
|
|
|
c1.code as fCode,
|
|
|
|
|
c1.`name` as fName,
|
|
|
|
|
c1.parent_code as fParentId,
|
|
|
|
|
c1.must as fMust,
|
|
|
|
|
c1.`level` as fLevel,
|
|
|
|
|
c1.sort as fSort,
|
|
|
|
|
c1.remark as fRemark,
|
|
|
|
|
c1.report_type as fReportType,
|
|
|
|
|
c2.id as sId,
|
|
|
|
|
c2.code as sCode,
|
|
|
|
|
c2.`name` as sName,
|
|
|
|
|
c2.parent_code as sParentId,
|
|
|
|
|
c2.must as sMust,
|
|
|
|
|
c2.`level` as sLevel,
|
|
|
|
|
c2.sort as sSort,
|
|
|
|
|
c2.remark as sRemark,
|
|
|
|
|
c2.report_type as sReportType
|
|
|
|
|
FROM
|
|
|
|
|
t_report_code c1
|
|
|
|
|
LEFT JOIN (
|
|
|
|
|
SELECT
|
|
|
|
|
*
|
|
|
|
|
FROM
|
|
|
|
|
t_report_code
|
|
|
|
|
WHERE
|
|
|
|
|
`level` = 2
|
|
|
|
|
and rec_status = 0
|
|
|
|
|
) c2 on c1.`code` = c2.parent_code
|
|
|
|
|
WHERE
|
|
|
|
|
c1.`level` = 1
|
|
|
|
|
and c1.rec_status = 0
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<resultMap id="selectCodeByCode" type="com.ccsens.tcm.bean.vo.QuestionVo$PatientCode">
|
|
|
|
|
<id column="fId" jdbcType="BIGINT" property="id" />
|
|
|
|
|
<result column="fCode" jdbcType="VARCHAR" property="code" />
|
|
|
|
|
<result column="fName" jdbcType="VARCHAR" property="name" />
|
|
|
|
|
<result column="fMust" jdbcType="TINYINT" property="must" />
|
|
|
|
|
<result column="fSort" jdbcType="INTEGER" property="sort" />
|
|
|
|
|
<result column="fRemark" jdbcType="VARCHAR" property="remark" />
|
|
|
|
|
<result column="fReportType" jdbcType="TINYINT" property="reportType" />
|
|
|
|
|
<collection property="subReportCodes" ofType="com.ccsens.tcm.bean.vo.QuestionVo$PatientCode">
|
|
|
|
|
<id column="sId" jdbcType="BIGINT" property="id" />
|
|
|
|
|
<result column="sCode" jdbcType="VARCHAR" property="code" />
|
|
|
|
|
<result column="sName" jdbcType="VARCHAR" property="name" />
|
|
|
|
|
<result column="sMust" jdbcType="TINYINT" property="must" />
|
|
|
|
|
<result column="sSort" jdbcType="INTEGER" property="sort" />
|
|
|
|
|
<result column="sRemark" jdbcType="VARCHAR" property="remark" />
|
|
|
|
|
<result column="sReportType" jdbcType="TINYINT" property="reportType" />
|
|
|
|
|
</collection>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<select id="selectCodeByCode" resultMap="selectCodeByCode">
|
|
|
|
|
SELECT
|
|
|
|
|
c1.id as fId,
|
|
|
|
|
c1.code as fCode,
|
|
|
|
|
c1.`name` as fName,
|
|
|
|
|
c1.must as fMust,
|
|
|
|
|
c1.sort as fSort,
|
|
|
|
|
c1.remark as fRemark,
|
|
|
|
|
c1.report_type as fReportType,
|
|
|
|
|
c2.id as sId,
|
|
|
|
|
c2.code as sCode,
|
|
|
|
|
c2.`name` as sName,
|
|
|
|
|
c2.must as sMust,
|
|
|
|
|
c2.sort as sSort,
|
|
|
|
|
c2.remark as sRemark,
|
|
|
|
|
c2.report_type as sReportType
|
|
|
|
|
FROM
|
|
|
|
|
t_report_code c1
|
|
|
|
|
LEFT JOIN (
|
|
|
|
|
SELECT
|
|
|
|
|
*
|
|
|
|
|
FROM
|
|
|
|
|
t_report_code
|
|
|
|
|
WHERE
|
|
|
|
|
`level` = 2
|
|
|
|
|
and rec_status = 0
|
|
|
|
|
) c2 on c1.`code` = c2.parent_code
|
|
|
|
|
WHERE
|
|
|
|
|
c1.`level` = 1
|
|
|
|
|
and c1.rec_status = 0
|
|
|
|
|
<if test="code != null and code != ''">
|
|
|
|
|
and (c1.`code` = #{code})
|
|
|
|
|
</if>
|
|
|
|
|
<if test="code==null or code==''">
|
|
|
|
|
<if test="nums == 0">
|
|
|
|
|
and (c1.`report_type`in (0,1))
|
|
|
|
|
</if>
|
|
|
|
|
<if test="nums == 14">
|
|
|
|
|
and (c1.`report_type`in (1))
|
|
|
|
|
</if>
|
|
|
|
|
<if test="nums == 90">
|
|
|
|
|
and (c1.`report_type`in (1))
|
|
|
|
|
</if>
|
|
|
|
|
<if test="nums == 180">
|
|
|
|
|
and (c1.`report_type`in (2))
|
|
|
|
|
</if>
|
|
|
|
|
<if test="nums == 365">
|
|
|
|
|
and (c1.`report_type`in (2))
|
|
|
|
|
</if>
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
<select id="queryCodeAll" resultType="java.lang.String">
|
|
|
|
|
SELECT `code` FROM `t_report_code` WHERE rec_status = 0
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|