| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- <?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="cn.tr.module.smart.common.repository.BizReasearchQueueClinicRepository">
- <resultMap id="stdResult" type="cn.tr.module.smart.common.controller.vo.BizReasearchQueueClinicVO">
- <result property="id" column="id" />
- <result property="clinicRoomId" column="clinic_room_id" />
- <result property="patientName" column="patient_name" />
- <result property="patientGender" column="patient_gender" />
- <result property="patientAge" column="patient_age" />
- <result property="deptId" column="dept_id" />
- <result property="deptName" column="dept_name" />
- <result property="clinicName" column="clinic_name" />
- <result property="queueId" column="queue_id" />
- <result property="lastPushInterval" column="last_push_interval" />
- <result property="pushCount" column="push_count" />
- <result property="lastPushTime" column="last_push_time" />
- <result property="answerCount" column="answer_count" />
- </resultMap>
- <resultMap id="questionAnswerResult" type="cn.tr.module.smart.common.controller.vo.BizReasearchQueueQuestionAnswerVO">
- <result property="id" column="id" />
- <result property="content" column="content" typeHandler="cn.tr.module.smart.app.config.ContentListType"/>
- <result property="question" column="question" typeHandler="cn.tr.module.smart.app.config.QuestionListType"/>
- <result property="answerTime" column="answer_time" />
- </resultMap>
- <resultMap id="pushInfo" type="cn.tr.module.smart.wx.dto.BizMpPublishInfoDTO">
- <result property="openId" column="open_id" />
- <result property="clinicId" column="clinic_id" />
- <result property="clinicName" column="clinic_name" />
- <result property="patientName" column="patient_name" />
- <result property="patientCode" column="patient_code" />
- <result property="clinicStartTime" column="clinic_start_time" />
- <result property="tenantId" column="tenant_id" />
- <result property="tenantName" column="tenant_name" />
- <result property="clinicStatus" column="clinic_status" />
- <result property="queueId" column="queue_id" />
- </resultMap>
- <resultMap id="reasearchQueuePush" type="cn.tr.module.smart.common.controller.vo.BizReasearchQueuePushVO">
- <result property="id" column="id" />
- <result property="clinicRoomId" column="clinic_room_id" />
- <result property="status" column="status" />
- <!-- <result property="timePointsFormat" column="time_points_format" typeHandler="cn.tr.module.smart.common.config.handler.JsonbLongListTypeHandler"/>-->
- <result property="timePointsFormat" column="time_points_format" typeHandler="cn.tr.plugin.mybatis.config.handler.LongListTypeHandler"/>
- <result property="lastPushInterval" column="last_push_interval"/>
- <result property="clinicEndTime" column="clinic_end_time"/>
- <result property="queueId" column="queue_id" />
- <result property="createBy" column="create_by" />
- <result property="updateBy" column="update_by" />
- <result property="createTime" column="create_time" />
- <result property="updateTime" column="update_time" />
- <result property="tenantId" column="tenant_id" />
- </resultMap>
- <resultMap id="QuestionAnswerListAll" type="cn.tr.module.smart.common.controller.vo.BizReasearchQueueQuestionAnswerAllVO">
- <result property="id" column="id" />
- <result property="answerUserName" column="answer_user_name" />
- <result property="content" column="content" typeHandler="cn.tr.module.smart.app.config.ContentListType"/>
- <result property="question" column="question" typeHandler="cn.tr.module.smart.app.config.QuestionListType"/>
- <result property="answerTime" column="answer_time" />
- </resultMap>
- <select id="stdSelectBizReasearchQueueClinicList" resultMap="stdResult">
- SELECT
- brqc.id,
- brqc.clinic_room_id,
- brqc.queue_id,
- brqc.last_push_interval,
- brqc.push_count,
- brqc.last_push_time,
- brqc.answer_count,
- brqc.create_time,
- brqc.update_time,
- bcr.patient_name,
- bcr.patient_gender,
- bcr.patient_age,
- bcr.dept_id,
- bcr.dept_name,
- bcr.clinic_name
- FROM
- biz_reasearch_queue_clinic brqc
- LEFT JOIN biz_clinic_room bcr ON brqc.clinic_room_id = bcr.id
- <where>
- and brqc.queue_id = #{query.queueId}
- <if test="query.condition != null">
- and bcr.patient_name like concat('%',#{query.condition},'%')
- </if>
- </where>
- order by brqc.create_time desc
- </select>
- <select id="selectPushInfo" resultMap="pushInfo">
- select
- bcr.id as clinic_id,
- bcr.clinic_name as clinic_name,
- bcr.clinic_start_time as clinic_start_time,
- bcr.patient_code as patient_code,
- bcr.patient_name as patient_name,
- bcr.clinic_status as clinic_status,
- st.id as tenant_id,
- st.name as tenant_name,
- bwump.from_user as open_id,
- brqc.queue_id as queue_id
- from
- biz_reasearch_queue_clinic brqc
- join biz_clinic_room as bcr on bcr.id = brqc.clinic_room_id
- join sys_tenant as st on st.id=bcr.tenant_id
- join biz_clinic_room_wx_user as bcrwu on bcrwu.clinic_room_id = bcr.id
- join biz_wx_user as bwu on bwu.id = bcrwu.wx_user_id
- join biz_wx_user_mp_care as bwump on bwump.union_id=bwu.union_id
- where brqc.id = #{id}
- </select>
- <select id="stdSelectBizReasearchQueueClinicById" resultMap="reasearchQueuePush">
- SELECT
- brqc.id,
- brqc.clinic_room_id,
- brq.status,
- brq.time_points_format,
- brqc.push_count,
- brqc.last_push_time,
- brqc.last_push_interval,
- bcr.clinic_end_time,
- brqc.create_by,
- brqc.queue_id,
- brqc.create_time,
- brqc.update_time,
- brqc.update_by,
- brqc.tenant_id
- FROM
- biz_reasearch_queue_clinic brqc
- JOIN biz_reasearch_queue brq ON brq.id = brqc.queue_id
- join biz_clinic_room as bcr on bcr.id = brqc.clinic_room_id
- where brqc.id = #{id}
- </select>
- <select id="stdSelectClinicAndPatientList"
- resultType="cn.tr.module.smart.common.controller.vo.BizReasearchQueueClinicAndPatientVO">
- SELECT bcr.ID,
- bcr.patient_name AS name,
- bcr.patient_age AS age,
- bcr.patient_gender AS gender,
- bcr.clinic_name AS clinicName,
- bcr.clinic_start_time AS clinicStartTime,
- bcr.ID AS currentClinicId,
- bcr.create_by AS create_by,
- bcr.create_time AS create_time,
- bcr.update_time AS update_time,
- bcr.update_by AS update_by
- FROM biz_clinic_room bcr
- <where>
- bcr.deleted = 0
- <if test="query.queueId != null and query.queueId != '' ">
- AND NOT EXISTS (SELECT 1 FROM biz_reasearch_queue_clinic brqc WHERE brqc.queue_id = #{query.queueId} AND brqc.clinic_room_id = bcr.id)
- </if>
- <if test="query.condition != null and query.condition != ''">
- AND bcr.patient_name LIKE CONCAT('%', #{query.condition}, '%')
- </if>
- </where>
- </select>
- <select id="stdSelectQuestionAnswerListAll" resultMap="QuestionAnswerListAll">
- SELECT
- bqa.id,
- bcr.patient_name AS answer_user_name,
- bqa.content,
- bqa.question,
- bqa.answer_time
- FROM
- biz_question_answer bqa
- JOIN biz_clinic_room bcr ON bqa.clinic_id = bcr.ID and bcr.deleted =0
- <where>
- and bqa.deleted = 0
- <if test="query.queueId != null and query.queueId != ''">
- and bqa.reasearch_queue_id = #{query.queueId}
- </if>
- <if test="query.condition != null and query.condition != ''">
- and bcr.patient_name LIKE CONCAT('%', #{query.condition}, '%')
- </if>
- </where>
- order by bqa.answer_time desc
- </select>
- </mapper>
|