You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
virtual-patient/virtual-patient-model/src/main/resources/mapper/DiseaseQuestionMapper.xml

58 lines
2.7 KiB
XML

<?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.supervision.mapper.DiseaseQuestionMapper">
<resultMap id="BaseResultMap" type="com.supervision.model.DiseaseQuestion">
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="diseaseId" column="disease_id" jdbcType="VARCHAR"/>
<result property="questionId" column="question_id" jdbcType="VARCHAR"/>
<result property="createUserId" column="create_user_id" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateUserId" column="update_user_id" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,disease_id,question_id,
create_user_id,create_time,update_user_id,
update_time
</sql>
<resultMap id="queryPageByDiseaseIdResultMap" type="com.supervision.vo.manage.DiseaseQuestionResVo">
<result property="questionList" column="questionList" jdbcType="ARRAY" typeHandler="com.supervision.handler.StringListTypeHandler"/>
</resultMap>
<select id="queryPageByDiseaseId" resultMap="queryPageByDiseaseIdResultMap">
select dq.id as id,
atql.question as questionList,
atql.default_answer as answer,
cd.code as itemCode,
cd.name_zh_path as itemName
from vp_disease_question dq
left join vp_ask_template_question_library atql on dq.question_id = atql.id
left join vp_common_dic cd on atql.dict_id = cd.id
where dq.disease_id = #{diseaseId} order by dq.create_time desc
</select>
<select id="queryQaLibPageList" resultType="com.supervision.vo.manage.AskQuestionLibraryResVo">
select atql.id as id,
atql.default_answer,
atql.id as libraryQuestionId,
cd.code as code,
atql.dict_id as dictId,
atql.question as question,
cd.name_zh_path as nameZhPath
from vp_ask_template_question_library atql
left join vp_common_dic cd on atql.dict_id = cd.id
where not exists(select 1 from vp_disease_question dq where atql.id = dq.question_id and dq.disease_id = #{askQuestionLibrary.diseaseId})
<if test="askQuestionLibrary.code != null and askQuestionLibrary.code != ''">
AND cd.code = #{askQuestionLibrary.code}
</if>
</select>
</mapper>