| | |
| | | leavehospitaldistrictcode, |
| | | leavehospitaldistrictname, |
| | | leavediagname, |
| | | leaveicd10code |
| | | leaveicd10code, |
| | | orgid, |
| | | visit_type |
| | | from service_subtask |
| | | </sql> |
| | | |
| | |
| | | </if> |
| | | <if test="leavehospitaldistrictname != null and leavehospitaldistrictname != ''">and |
| | | leavehospitaldistrictname = #{leavehospitaldistrictname} |
| | | </if> |
| | | <if test="leavediagname != null and leavediagname != ''">and leavediagname like concat('%', |
| | | #{leavediagname}, '%') |
| | | </if> |
| | | <if test="sex != null and sex != ''">and sex = #{sex}</if> |
| | | <if test="age != null ">and age = #{age}</if> |
| | |
| | | <if test="taskGuid != null">and task_guid = #{taskGuid}</if> |
| | | <if test="isVisitAgain != null">and is_visit_again = #{isVisitAgain}</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="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if> |
| | | <if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if>--> |
| | | <if test="visitCount != null and visitCount > 1 and visitDeptCodes != null and visitDeptCodes.size() > 0"> |
| | | AND visit_dept_code IN |
| | | <foreach collection="visitDeptCodes" item="visitDeptCodes" open="(" |
| | | separator="," |
| | | close=")"> |
| | | #{visitDeptCodes} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | <if test="sort != null and sort==0">order by endtime asc</if> |
| | | <if test="sort != null and sort==1">order by endtime desc</if> |
| | |
| | | and b.patid = #{patid} |
| | | </select> |
| | | |
| | | <select id="selectTimelyRate" parameterType="com.smartor.domain.ServiceSubtask" resultType="double"> |
| | | SELECT sum( a.finished )/ sum( 1 ) FROM |
| | | (SELECT id, visit_time, finishtime, |
| | | (CASE WHEN ( DATE_FORMAT( visit_time, '%y%m%d' )< DATE_FORMAT( IF ( ISNULL( finishtime ), NOW(), finishtime |
| | | ), '%y%m%d' ) ) |
| | | THEN 1 ELSE 0 END ) finished,1 AS tasknumber FROM service_subtask |
| | | WHERE del_flag=0 |
| | | <if test="starttime == null and endtime==null"> |
| | | AND visit_time < NOW() |
| | | </if> |
| | | <if test="starttime != null and endtime!=null"> |
| | | AND date_format(visit_time,'%y%m%d') >= date_format(#{starttime},'%y%m%d') |
| | | AND date_format(visit_time,'%y%m%d') <= date_format(#{endtime},'%y%m%d') |
| | | </if> |
| | | <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if> |
| | | <if test="deptcode != null and deptcode != ''">and deptcode = #{deptcode}</if> |
| | | <if test="deptname != null and deptname != ''">and deptname = #{deptname}</if> |
| | | <if test="leavehospitaldistrictcode != null and leavehospitaldistrictcode != ''">and |
| | | leavehospitaldistrictcode = #{leavehospitaldistrictcode} |
| | | </if> |
| | | <if test="leavehospitaldistrictname != null and leavehospitaldistrictname != ''">and |
| | | leavehospitaldistrictname = #{leavehospitaldistrictname} |
| | | </if> |
| | | ) a |
| | | </select> |
| | | |
| | | <select id="selectTimelyRateDetail" parameterType="com.smartor.domain.ServiceSubtask" |
| | | resultMap="ServiceSubtaskResult"> |
| | | <include refid="selectServiceSubtaskVo"/> |
| | | <where> |
| | | id in ( |
| | | SELECT id FROM |
| | | (SELECT id, visit_time, finishtime, |
| | | (CASE WHEN ( DATE_FORMAT( visit_time, '%y%m%d' ) < DATE_FORMAT( IF ( ISNULL( finishtime ), NOW(), |
| | | finishtime |
| | | ), '%y%m%d' ) ) |
| | | THEN 1 ELSE 0 END ) finished,1 AS tasknumber FROM service_subtask |
| | | WHERE del_flag=0 |
| | | -- AND visit_time < NOW() |
| | | <if test="starttime != null and endtime!=null"> |
| | | AND date_format(visit_time,'%y%m%d') >= date_format(#{starttime},'%y%m%d') |
| | | AND date_format(visit_time,'%y%m%d') <= date_format(#{endtime},'%y%m%d') |
| | | </if> |
| | | <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if> |
| | | <if test="deptcode != null and deptcode != ''">and deptcode = #{deptcode}</if> |
| | | <if test="deptname != null and deptname != ''">and deptname = #{deptname}</if> |
| | | <if test="leavehospitaldistrictcode != null and leavehospitaldistrictcode != ''">and |
| | | leavehospitaldistrictcode = #{leavehospitaldistrictcode} |
| | | </if> |
| | | <if test="leavehospitaldistrictname != null and leavehospitaldistrictname != ''">and |
| | | leavehospitaldistrictname = #{leavehospitaldistrictname} |
| | | </if> |
| | | |
| | | ) a where a.finished =1) |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectServiceSubtaskById" parameterType="Long" resultMap="ServiceSubtaskResult"> |
| | | <include refid="selectServiceSubtaskVo"/> |
| | | where id = #{id} |
| | |
| | | <if test="visitCount != null ">visit_count,</if> |
| | | <if test="isVisitAgain != null ">is_visit_again,</if> |
| | | <if test="upid != null ">upid,</if> |
| | | <if test="visit_time != null ">visitTime,</if> |
| | | <if test="visitTime != null ">visit_Time,</if> |
| | | <if test="visitDeptCode != null">visit_dept_code,</if> |
| | | <if test="visitDeptName != null">visit_dept_name,</if> |
| | | </trim> |
| | |
| | | #{leavehospitaldistrictcode} |
| | | </foreach> |
| | | </if> |
| | | <if test="deptcodes != null and deptcodes.size() > 0"> |
| | | AND deptcode IN |
| | | <foreach collection="deptcodes" item="deptcode" open="(" separator="," |
| | | close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | <if test="serviceType != null and serviceType.size() > 0"> |
| | | AND service_type IN |
| | | <foreach collection="serviceType" item="serviceType" open="(" separator="," |
| | |
| | | </foreach> |
| | | </if> |
| | | <if test="startTime != null and endTime!=null"> |
| | | AND endtime > #{startTime} |
| | | AND endtime <= #{endTime} |
| | | AND date_format(visit_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d') |
| | | AND date_format(visit_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d') |
| | | </if> |
| | | <if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if> |
| | | <if test="visitDeptName != null">abd visit_dept_name = #{visitDeptName}</if> |