You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
172 lines
7.6 KiB
172 lines
7.6 KiB
<?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.acupuncture.system.persist.dao.ScreeningDetailDao">
|
|
|
|
|
|
<select id="querySubmitStatus" resultType="java.lang.Integer">
|
|
SELECT submit_status
|
|
FROM scr_questionnaire_detail AS qd
|
|
WHERE qd.user_id = #{userId}
|
|
AND questionnaire_id = #{qid}
|
|
AND qd.rec_status = 0
|
|
</select>
|
|
|
|
<select id="queryIsExist" resultType="com.acupuncture.system.domain.vo.QuestionnaireVo$DetailInfo">
|
|
SELECT q.id,
|
|
qd.id AS detailId
|
|
FROM scr_questionnaire AS q
|
|
LEFT JOIN scr_questionnaire_detail AS qd ON q.id = qd.questionnaire_id
|
|
AND qd.rec_status = 0
|
|
AND qd.user_id = #{userId}
|
|
WHERE q.write_start_time < #{time}
|
|
AND q.write_end_time > #{time}
|
|
AND q.type = #{type}
|
|
AND q.rec_status = 0
|
|
</select>
|
|
|
|
<select id="queryDetailIsExist" resultType="java.lang.Long">
|
|
SELECT id
|
|
FROM scr_screening_detail
|
|
WHERE del_flag = 0
|
|
AND question_code = #{code}
|
|
AND record_id = #{detailId}
|
|
</select>
|
|
|
|
<resultMap id="BaseResultMap" type="com.acupuncture.system.domain.vo.ScrScreenVo$Result">
|
|
<id column="id" jdbcType="BIGINT" property="id"/>
|
|
<result column="name" jdbcType="VARCHAR" property="name"/>
|
|
<result column="idcard" jdbcType="VARCHAR" property="idcard"/>
|
|
<result column="age" jdbcType="INTEGER" property="age"/>
|
|
<result column="phone" jdbcType="VARCHAR" property="phone"/>
|
|
<result column="city" jdbcType="VARCHAR" property="city"/>
|
|
<result column="county" jdbcType="VARCHAR" property="county"/>
|
|
<result column="province" jdbcType="VARCHAR" property="province"/>
|
|
<result column="hospital_level" jdbcType="TINYINT" property="hospitalLevel"/>
|
|
<result column="tenantName" jdbcType="VARCHAR" property="tenantName"/>
|
|
<result column="departments" jdbcType="VARCHAR" property="departments"/>
|
|
<result column="user_id" jdbcType="BIGINT" property="userId"/>
|
|
<result column="screen_id" jdbcType="BIGINT" property="screenId"/>
|
|
<result column="submit_status" jdbcType="TINYINT" property="submitStatus"/>
|
|
<result column="position_id" jdbcType="BIGINT" property="positionId"/>
|
|
<result column="tenant_id" jdbcType="BIGINT" property="tenantId"/>
|
|
<result column="rzsc_result" jdbcType="INTEGER" property="rzscResult"/>
|
|
<result column="screen_type" jdbcType="TINYINT" property="screenType"/>
|
|
<result column="screen_result" jdbcType="VARCHAR" property="screenResult"/>
|
|
<result column="del_flag" jdbcType="TINYINT" property="delFlag"/>
|
|
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
|
<!-- <collection property="detailList"-->
|
|
<!-- ofType="com.acupuncture.system.domain.vo.ScrScreenVo$ScreeningDetailVo">-->
|
|
<!-- <id column="detailId" property="detailId"/>-->
|
|
<!-- <result column="question_code" property="questionCode"/>-->
|
|
<!-- <result column="answer" property="answer"/>-->
|
|
<!-- <result column="record_id" property="recordId"/>-->
|
|
<!-- </collection>-->
|
|
</resultMap>
|
|
|
|
<select id="queryResult" resultMap="BaseResultMap" parameterType="com.acupuncture.system.domain.dto.ScreeningDto$Query">
|
|
select r.*,
|
|
t.name as tenantName
|
|
from
|
|
scr_screening_record r
|
|
left join
|
|
dms_tenant t on r.tenant_id = t.id
|
|
<where>
|
|
r.del_flag = 0
|
|
<if test="type != null">
|
|
and r.screen_type = #{type}
|
|
</if>
|
|
<if test="param.keywords != null and param.keywords != ''">
|
|
<if test="param.keywords.length() > 0">
|
|
and (
|
|
r.name like concat('%', #{param.keywords}, '%')
|
|
or r.pinyin_full like concat('%', #{param.keywords}, '%')
|
|
or r.pinyin_simple like concat('%', #{param.keywords}, '%')
|
|
or r.idcard like concat('%', #{param.keywords}, '%')
|
|
or r.phone like concat('%', #{param.keywords}, '%')
|
|
)
|
|
</if>
|
|
</if>
|
|
<if test="param.tenantId != null">
|
|
and r.tenant_id = #{tenantId}
|
|
</if>
|
|
<if test="param.startTime != null and param.startTime != ''">
|
|
and r.create_time >= #{param.startTime}
|
|
</if>
|
|
<if test="param.endTime != null and param.endTime != ''">
|
|
and r.create_time <= #{param.endTime}
|
|
</if>
|
|
<if test="param.startAge != null and param.endAge != ''">
|
|
and r.age between #{param.startAge} and #{param.endAge}
|
|
</if>
|
|
</where>
|
|
-- group by r.id
|
|
order by r.create_time desc
|
|
</select>
|
|
|
|
<select id="adminQueryResult" resultMap="BaseResultMap" parameterType="com.acupuncture.system.domain.dto.ScreeningDto$Query">
|
|
select r.*,
|
|
t.name as tenantName
|
|
from
|
|
v_scr_screening_record r
|
|
left join
|
|
dms_tenant t on r.tenant_id = t.id
|
|
<where>
|
|
r.del_flag = 0
|
|
<if test="type != null">
|
|
and r.screen_type = #{type}
|
|
</if>
|
|
<if test="param.keywords != null and param.keywords != ''">
|
|
<if test="param.keywords.length() > 0">
|
|
and (
|
|
r.name like concat('%', #{param.keywords}, '%')
|
|
or r.pinyin_full like concat('%', #{param.keywords}, '%')
|
|
or r.pinyin_simple like concat('%', #{param.keywords}, '%')
|
|
or r.idcard like concat('%', #{param.keywords}, '%')
|
|
or r.phone like concat('%', #{param.keywords}, '%')
|
|
)
|
|
</if>
|
|
</if>
|
|
<if test="param.tenantId != null">
|
|
and r.tenant_id = #{param.tenantId}
|
|
</if>
|
|
<if test="param.startTime != null and param.startTime != ''">
|
|
and r.create_time >= #{param.startTime}
|
|
</if>
|
|
<if test="param.endTime != null and param.endTime != ''">
|
|
and r.create_time <= #{param.endTime}
|
|
</if>
|
|
<if test="param.startAge != null and param.endAge != ''">
|
|
and r.age between #{param.startAge} and #{param.endAge}
|
|
</if>
|
|
</where>
|
|
-- group by r.id
|
|
order by r.create_time desc
|
|
</select>
|
|
|
|
<select id="queryDetailList" resultType="com.acupuncture.system.domain.vo.ScrScreenVo$ScreeningDetailVo">
|
|
select id as detailId,
|
|
question_code as questionCode,
|
|
answer,
|
|
record_id as recordId
|
|
from scr_screening_detail
|
|
where del_flag = 0
|
|
and record_id in
|
|
<foreach collection="detailIdList" item="item" index="index" separator="," open="(" close=")">
|
|
#{item}
|
|
</foreach>
|
|
</select>
|
|
|
|
<select id="adminQueryDetailList" resultType="com.acupuncture.system.domain.vo.ScrScreenVo$ScreeningDetailVo">
|
|
select id as detailId,
|
|
question_code as questionCode,
|
|
answer,
|
|
record_id as recordId
|
|
from v_scr_screening_detail
|
|
where del_flag = 0
|
|
and record_id in
|
|
<foreach collection="detailIdList" item="item" index="index" separator="," open="(" close=")">
|
|
#{item}
|
|
</foreach>
|
|
</select>
|
|
</mapper>
|
|
|