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.
146 lines
6.1 KiB
146 lines
6.1 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.FmsFollowupDao">
|
|
|
|
<select id="queryCommonQueue" resultType="com.acupuncture.system.domain.vo.FmsFollowupVo$FollowupQueueVO">
|
|
select
|
|
id,
|
|
name,
|
|
followup_method as followupMethod,
|
|
followup_type as followupType,
|
|
frequency,
|
|
followup_month as followupMonth,
|
|
person_in_charge as personInCharge,
|
|
person_in_charge_username as personInChargeUsername,
|
|
status,
|
|
create_by as createBy
|
|
from
|
|
fms_followup_queue
|
|
<where>
|
|
<if test="name != null and name != ''">
|
|
and name like concat('%', #{name}, '%')
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectQueueList" resultType="com.acupuncture.system.domain.vo.FmsFollowupVo$FollowupQueueVO">
|
|
SELECT id,
|
|
name,
|
|
followup_method as followupMethod,
|
|
followup_type as followupType,
|
|
frequency,
|
|
followup_month as followupMonth,
|
|
person_in_charge as personInCharge,
|
|
person_in_charge_username as personInChargeUsername,
|
|
status,
|
|
create_by as createBy,
|
|
create_time as createTime
|
|
FROM fms_followup_queue
|
|
WHERE del_flag = 0
|
|
<if test="id != null">
|
|
and id = #{id}
|
|
</if>
|
|
<if test="name != null and name != ''">
|
|
and name like concat('%', #{name}, '%')
|
|
</if>
|
|
<if test="status != null">
|
|
and status = #{status}
|
|
</if>
|
|
</select>
|
|
|
|
<resultMap id="BaseResultMap" type="com.acupuncture.system.domain.vo.FmsFollowupVo$FollowupPatient">
|
|
<id column="id" property="id"/>
|
|
<id column="queueId" property="queueId"/>
|
|
<result column="name" property="name"/>
|
|
<result column="pinyinFull" property="pinyinFull"/>
|
|
<result column="pinyinSimple" property="pinyinSimple"/>
|
|
<result column="gender" property="gender"/>
|
|
<result column="birthDate" property="birthDate"/>
|
|
<result column="ethnicity" property="ethnicity"/>
|
|
<result column="education_years" property="educationYears"/>
|
|
<result column="phone" property="phone"/>
|
|
<result column="dischargeTime" property="dischargeTime"/>
|
|
<result column="idCardType" property="idCardType"/>
|
|
<result column="idCard" property="idCard"/>
|
|
<result column="tenantId" property="tenantId"/>
|
|
<result column="createBy" property="createBy"/>
|
|
<result column="createTime" property="createTime"/>
|
|
<collection property="queueList" ofType="com.acupuncture.system.domain.vo.FmsFollowupVo$FollowupPatient$QueueVo">
|
|
<id column="queueId" property="queueId" />
|
|
<result column="queueName" property="queueName" />
|
|
</collection>
|
|
</resultMap>
|
|
|
|
<select id="queryPatient" resultMap="BaseResultMap">
|
|
select
|
|
r.patient_id as id,
|
|
r.queue_id as queueId,
|
|
r.name,
|
|
r.pinyin_full as pinyinFull,
|
|
r.pinyin_simple as pinyinSimple,
|
|
r.gender,
|
|
r.birth_date as birthDate,
|
|
r.ethnicity,
|
|
r.education_years as educationYears,
|
|
r.phone,
|
|
r.discharge_time as dischargeTime,
|
|
r.id_card_type as idCardType,
|
|
r.id_card as idCard,
|
|
r.tenant_id as tenantId,
|
|
r.create_by as createBy,
|
|
r.create_time as createTime,
|
|
q.name as queueName
|
|
FROM fms_patient_queue_relation r
|
|
left join
|
|
fms_followup_queue q
|
|
on r.queue_id = q.id
|
|
WHERE r.del_flag = 0
|
|
|
|
<if test="id != null">
|
|
AND queue_id = #{id}
|
|
</if>
|
|
<if test="taskFlag != null">
|
|
AND r.task_flag = #{taskFlag}
|
|
</if>
|
|
group by r.id_card, r.queue_id
|
|
</select>
|
|
|
|
<select id="selectTaskList" resultType="com.acupuncture.system.domain.vo.FmsFollowupVo$FollowupTaskVO"
|
|
parameterType="com.acupuncture.system.domain.dto.FmsFollowupDto$FollowupTaskQueryDTO">
|
|
SELECT
|
|
id, patient_id as patientId, name, gender, age, ethnicity, education_years as educationYears,
|
|
phone, id_card_type as idCardType, id_card as idCard, tenant_id as tenantId, queue_id as queueId, times, start_time as startTime, end_time as endTime, status,
|
|
lost_reason as lostReason, followuper, followup_time as followupTime, followup_text as followupText, create_by as createBy, create_time as createTime
|
|
FROM fms_followup_task
|
|
<where>
|
|
<if test="dto.queueId != null">
|
|
queue_id = #{dto.queueId}
|
|
</if>
|
|
<if test="dto.status != null">
|
|
AND status = #{dto.status}
|
|
</if>
|
|
<if test="dto.keywords != null and dto.keywords != ''">
|
|
AND (name LIKE CONCAT('%', #{dto.keywords}, '%')
|
|
</if>
|
|
<if test="dto.startAge != null">
|
|
AND age >= #{dto.startAge}
|
|
</if>
|
|
<if test="dto.endAge != null">
|
|
AND age <= #{dto.endAge}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<update id="updateStatusToLost" parameterType="com.acupuncture.system.domain.dto.FmsFollowupDto$FollowupLostDTO">
|
|
UPDATE fms_followup_task
|
|
SET status = 2, lost_reason = #{dto.reason}
|
|
WHERE id =#{dto.id}
|
|
</update>
|
|
|
|
<update id="completeFollowup" parameterType="com.acupuncture.system.domain.dto.FmsFollowupDto$FollowupCompleteDTO">
|
|
UPDATE fms_followup_task
|
|
SET status = 1, followuper = #{dto.followuper},
|
|
followup_time = #{dto.followupTime}, followup_text = #{dto.followupText}
|
|
WHERE id =#{dto.id}
|
|
</update>
|
|
</mapper>
|
|
|