| | |
| | | <result property="visitCount" column="visit_count"/> |
| | | <result property="isVisitAgain" column="is_visit_again"/> |
| | | <result property="upid" column="upid"/> |
| | | <result property="visitType" column="visit_type"/> |
| | | <result property="visitTime" column="visit_time"/> |
| | | <result property="visitDeptName" column="visit_dept_name"/> |
| | | <result property="visitDeptCode" column="visit_dept_code"/> |
| | |
| | | END |
| | | </sql> |
| | | |
| | | <!-- 当前执行方式:首次随访 current_preachform 为空时,取 preachform 的第一个执行方式兜底 --> |
| | | <sql id="effectiveCurrentPreachformExpr"> |
| | | COALESCE(NULLIF(TRIM(current_preachform), ''), TRIM(SUBSTRING_INDEX(preachform, ',', 1))) |
| | | </sql> |
| | | |
| | | <select id="selectServiceSubtaskBySendstate" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity" |
| | | resultMap="ServiceSubtaskResult"> |
| | | <include refid="selectServiceSubtaskVo"/> |
| | |
| | | <if test="managementDoctorCode != null ">and management_doctor_code = #{managementDoctorCode}</if> |
| | | <if test="submit != null ">and submit = #{submit}</if> |
| | | <if test="upid != null ">and upid = #{upid}</if> |
| | | <if test="visitCount != null ">and visit_count = #{visitCount}</if> |
| | | <if test="patfrom != null ">and patfrom = #{patfrom}</if> |
| | | <if test="serviceType != null ">and service_type = #{serviceType}</if> |
| | | <if test="patid != null ">and patid = #{patid}</if> |
| | |
| | | <if test="campusid != null and campusid != ''">and campusid = #{campusid}</if> |
| | | <if test="pid != null ">and pid = #{pid}</if> |
| | | <if test="preachform != null ">and preachform = #{preachform}</if> |
| | | <if test="currentPreachform != null ">and current_preachform = #{currentPreachform}</if> |
| | | <if test="currentPreachform != null and currentPreachform != '' ">and current_preachform = #{currentPreachform}</if> |
| | | <if test="currentPreachforms != null and currentPreachforms != ''"> |
| | | and FIND_IN_SET(<include refid="effectiveCurrentPreachformExpr"/>, #{currentPreachforms}) |
| | | </if> |
| | | <if test="guid != null and guid != ''">and guid = #{guid}</if> |
| | | <if test="textParam != null and textParam != ''">and text_param = #{textParam}</if> |
| | | <if test="bedNo != null">and bed_no = #{bedNo}</if> |
| | |
| | | <if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if> |
| | | <if test="managementDoctorCode != null">and management_doctor_code = #{managementDoctorCode}</if> |
| | | <if test="managementDoctor != null">and management_doctor = #{managementDoctor}</if> |
| | | <if test="currentPreachform != null">and current_preachform = #{currentPreachform}</if> |
| | | <if test="currentPreachform != null and currentPreachform != '' ">and current_preachform = #{currentPreachform}</if> |
| | | <if test="isabnormal != null">and isabnormal = #{isabnormal}</if> |
| | | <if test="continueFlag != null ">and continue_flag = #{continueFlag}</if> |
| | | <if test="continueTimeNow != null ">and continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP}</if> |
| | |
| | | <if test="visitTime != null ">and visit_time = #{visitTime}</if> |
| | | <if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if> |
| | | <if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if> |
| | | <if test="currentPreachform != null">and current_preachform = #{currentPreachform}</if> |
| | | <if test="currentPreachform != null and currentPreachform != '' ">and current_preachform = #{currentPreachform}</if> |
| | | <if test="managementDoctorCode != null">and management_doctor_code = #{managementDoctorCode}</if> |
| | | <if test="isabnormal != null">and isabnormal = #{isabnormal}</if> |
| | | <if test="managementDoctor != null">and management_doctor like concat('%',#{managementDoctor}, '%')</if> |
| | |
| | | <if test="visitDeptName != null">visit_dept_name,</if> |
| | | <if test="managementDoctorCode != null">management_doctor_code,</if> |
| | | <if test="managementDoctor != null">management_doctor,</if> |
| | | <if test="currentPreachform != null">current_preachform,</if> |
| | | <if test="currentPreachform != null and currentPreachform != '' ">current_preachform,</if> |
| | | <if test="taskSituation != null">task_situation,</if> |
| | | <if test="isabnormal != null">isabnormal,</if> |
| | | <if test="continueFlag != null ">continue_flag,</if> |
| | |
| | | <if test="visitDeptName != null">#{visitDeptName},</if> |
| | | <if test="managementDoctorCode != null">#{managementDoctorCode},</if> |
| | | <if test="managementDoctor != null">#{managementDoctor},</if> |
| | | <if test="currentPreachform != null">#{currentPreachform},</if> |
| | | <if test="currentPreachform != null and currentPreachform != '' ">#{currentPreachform},</if> |
| | | <if test="taskSituation != null">#{taskSituation},</if> |
| | | <if test="isabnormal != null">#{isabnormal},</if> |
| | | <if test="continueFlag != null ">#{continueFlag},</if> |
| | |
| | | <if test="visitDeptName != null">visit_dept_name = #{visitDeptName},</if> |
| | | <if test="managementDoctorCode != null">management_doctor_code = #{managementDoctorCode},</if> |
| | | <if test="managementDoctor != null">management_doctor=#{managementDoctor},</if> |
| | | <if test="currentPreachform != null">current_preachform=#{currentPreachform},</if> |
| | | <if test="currentPreachform != null and currentPreachform != '' ">current_preachform=#{currentPreachform},</if> |
| | | <if test="taskSituation != null">task_situation=#{taskSituation},</if> |
| | | <if test="isabnormal != null">isabnormal=#{isabnormal},</if> |
| | | <if test="continueFlag != null ">continue_flag = #{continueFlag},</if> |
| | |
| | | <if test="visitDeptName != null">visit_dept_name = #{visitDeptName},</if> |
| | | <if test="managementDoctorCode != null">management_doctor_code = #{managementDoctorCode},</if> |
| | | <if test="managementDoctor != null">management_doctor=#{managementDoctor},</if> |
| | | <if test="currentPreachform != null">current_preachform=#{currentPreachform},</if> |
| | | <if test="currentPreachform != null and currentPreachform != '' ">current_preachform=#{currentPreachform},</if> |
| | | <if test="taskSituation != null">task_situation=#{taskSituation},</if> |
| | | <if test="isabnormal != null">isabnormal=#{isabnormal},</if> |
| | | <if test="continueFlag != null ">continue_flag = #{continueFlag},</if> |
| | |
| | | <if test="visitDeptName != null">visit_dept_name = #{visitDeptName},</if> |
| | | <if test="managementDoctorCode != null">management_doctor_code = #{managementDoctorCode},</if> |
| | | <if test="managementDoctor != null">management_doctor=#{managementDoctor},</if> |
| | | <if test="currentPreachform != null">current_preachform=#{currentPreachform},</if> |
| | | <if test="currentPreachform != null and currentPreachform != '' ">current_preachform=#{currentPreachform},</if> |
| | | <if test="taskSituation != null">task_situation=#{taskSituation},</if> |
| | | <if test="isabnormal != null">isabnormal=#{isabnormal},</if> |
| | | <if test="continueFlag != null ">continue_flag = #{continueFlag},</if> |
| | |
| | | <if test="visitDeptName != null">visit_dept_name = #{visitDeptName},</if> |
| | | <if test="managementDoctorCode != null">management_doctor_code = #{managementDoctorCode},</if> |
| | | <if test="managementDoctor != null">management_doctor=#{managementDoctor},</if> |
| | | <if test="currentPreachform != null">current_preachform=#{currentPreachform},</if> |
| | | <if test="currentPreachform != null and currentPreachform != '' ">current_preachform=#{currentPreachform},</if> |
| | | <if test="taskSituation != null">task_situation=#{taskSituation},</if> |
| | | <if test="isabnormal != null">isabnormal=#{isabnormal},</if> |
| | | <if test="continueFlag != null ">continue_flag = #{continueFlag},</if> |
| | |
| | | where patid = #{patid} and taskid = #{taskid} |
| | | </update> |
| | | |
| | | <!-- 人工随访:软删除患者出院记录对应的未完成随访任务 --> |
| | | <update id="deleteUnfinishedServiceSubtaskByInhospids"> |
| | | update service_subtask |
| | | set del_flag = 1 |
| | | where del_flag = 0 |
| | | and patid = #{patid} |
| | | and sendstate in |
| | | <foreach collection="sendstates" item="sendstate" open="(" separator="," close=")"> |
| | | #{sendstate} |
| | | </foreach> |
| | | and inhospid in |
| | | <foreach collection="inhospids" item="inhospid" open="(" separator="," close=")"> |
| | | #{inhospid} |
| | | </foreach> |
| | | </update> |
| | | |
| | | <!-- 人工随访重复校验:同一患者同一任务下是否已有未完成随访任务 --> |
| | | <select id="countUnfinishedServiceSubtaskByPatidAndTaskid" resultType="int"> |
| | | select count(1) |
| | | from service_subtask |
| | | where del_flag = 0 |
| | | and patid = #{patid} |
| | | and taskid = #{taskid} |
| | | and sendstate in |
| | | <foreach collection="sendstates" item="sendstate" open="(" separator="," close=")"> |
| | | #{sendstate} |
| | | </foreach> |
| | | </select> |
| | | |
| | | <select id="getSfStatistics" parameterType="com.smartor.domain.ServiceSubtaskCountReq" |
| | | resultMap="ServiceSubtaskResult"> |
| | | select id, |
| | |
| | | deptname, |
| | | sendstate, |
| | | preachform, |
| | | current_preachform, |
| | | <include refid="effectiveCurrentPreachformExpr"/> AS current_preachform, |
| | | excep, |
| | | nurse_id, |
| | | nurse_name, |
| | | taskid, |
| | | task_name, |
| | | visit_time, |
| | | visit_dept_code, |
| | | finishtime, |
| | | endtime, |
| | | senddate, |
| | |
| | | <if test="groupKey != null and groupKey != ''"> |
| | | group by ${groupKey} |
| | | </if> |
| | | <if test="pageSize != null and pageNum != null"> |
| | | limit ${pageSize} OFFSET ${pageNum} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getSfStatisticsHyperlink" parameterType="com.smartor.domain.ServiceSubtaskCountReq" |
| | |
| | | deptname, |
| | | sendstate, |
| | | preachform, |
| | | current_preachform, |
| | | <include refid="effectiveCurrentPreachformExpr"/> AS current_preachform, |
| | | excep, |
| | | nurse_id, |
| | | nurse_name, |
| | | taskid, |
| | | task_name, |
| | | visit_time, |
| | | visit_dept_code, |
| | | visit_dept_name, |
| | | finishtime, |
| | | endtime, |
| | | senddate, |
| | |
| | | #{state} |
| | | </foreach> |
| | | </if> |
| | | <if test="currentPreachform != null"> |
| | | AND current_preachform = #{currentPreachform} |
| | | <if test="currentPreachform != null and currentPreachform != '' "> |
| | | AND <include refid="effectiveCurrentPreachformExpr"/> = #{currentPreachform} |
| | | <if test="followUpCountStyle != null and followUpCountStyle = '1'"> |
| | | AND sendstate != 4 |
| | | </if> |
| | |
| | | </if> |
| | | <if test="isManuallyCalled != null"> |
| | | AND is_manually_called = #{isManuallyCalled} |
| | | </if> |
| | | <if test="suggest != null and suggest != ''"> |
| | | AND TRIM(suggest) = #{suggest} |
| | | </if> |
| | | order by endtime desc |
| | | <if test="pageSize != null and pageNum != null"> |
| | |
| | | #{state} |
| | | </foreach> |
| | | </if> |
| | | <if test="currentPreachforms != null and currentPreachforms != ''"> |
| | | AND FIND_IN_SET(<include refid="effectiveCurrentPreachformExpr"/>, #{currentPreachforms}) |
| | | </if> |
| | | <if test="orgid != null and orgid != ''"> |
| | | AND orgid = #{orgid} |
| | | </if> |