From b77c664076a5ddab0fe2b9d53f8fa894b19c02f7 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期五, 16 十月 2026 15:00:21 +0800
Subject: [PATCH] 【丽水】随访延期完成、超时完成
---
smartor/src/main/java/com/smartor/domain/ServiceSubtask.java | 6 +++
smartor/src/main/java/com/smartor/domain/ServiceTask.java | 7 +++
smartor/src/main/java/com/smartor/domain/ServiceTaskVO.java | 7 +++
smartor/src/main/resources/mapper/smartor/ServiceTaskMapper.xml | 6 +++
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml | 55 +++++++++++++++++++++++++++
5 files changed, 81 insertions(+), 0 deletions(-)
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubtask.java b/smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
index a6299cb..c7efd5b 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
@@ -277,6 +277,12 @@
private Date finishtime;
/**
+ * 瀹屾垚鏃剁姸鎬侊細1-姝e父瀹屾垚 2-寤舵湡瀹屾垚 3-瓒呮椂瀹屾垚
+ */
+ @ApiModelProperty(value = "瀹屾垚鏃剁姸鎬侊細1-姝e父瀹屾垚 2-寤舵湡瀹屾垚 3-瓒呮椂瀹屾垚")
+ private Long finishState;
+
+ /**
* 灏辫瘖璁板綍缂栧彿
*/
@Excel(name = " 灏辫瘖璁板綍缂栧彿 ")
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceTask.java b/smartor/src/main/java/com/smartor/domain/ServiceTask.java
index 796723e..aa082db 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceTask.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceTask.java
@@ -117,6 +117,13 @@
private Long sendDay;
/**
+ * 寤舵湡瀹屾垚澶╂暟锛堥殢璁夸换鍔″畬鎴愭椂鐢ㄤ簬鍒ゆ柇鏄惁瓒呮椂锛岀己鐪�0锛�
+ */
+ @Excel(name = "寤舵湡瀹屾垚澶╂暟")
+ @ApiModelProperty(value = "寤舵湡瀹屾垚澶╂暟")
+ private Long delayFinishDays;
+
+ /**
* 鎮h�呭鍚�
*/
@Excel(name = "鎮h�呭鍚�")
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceTaskVO.java b/smartor/src/main/java/com/smartor/domain/ServiceTaskVO.java
index 767cd72..42e8e90 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceTaskVO.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceTaskVO.java
@@ -47,6 +47,13 @@
private Long sendDay;
/**
+ * 寤舵湡瀹屾垚澶╂暟锛堥殢璁夸换鍔″畬鎴愭椂鐢ㄤ簬鍒ゆ柇鏄惁瓒呮椂锛岀己鐪�0锛�
+ */
+ @Excel(name = "寤舵湡瀹屾垚澶╂暟")
+ @ApiModelProperty(value = "寤舵湡瀹屾垚澶╂暟")
+ private Long delayFinishDays;
+
+ /**
*
*/
@Excel(name = " ")
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index a38a90a..1fbe2f7 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -23,6 +23,7 @@
<result property="senduuid" column="senduuid"/>
<result property="result" column="result"/>
<result property="finishtime" column="finishtime"/>
+ <result property="finishState" column="finish_state"/>
<result property="recordid" column="recordid"/>
<result property="exrecallcount" column="exrecallcount"/>
<result property="pulltime" column="pulltime"/>
@@ -202,6 +203,7 @@
senduuid,
result,
finishtime,
+ finish_state,
recordid,
exrecallcount,
pulltime,
@@ -249,6 +251,53 @@
task_situation,
is_manually_called
from service_subtask
+ </sql>
+
+ <!-- 瀹屾垚鏃剁姸鎬�(finish_state)璁$畻锛氫粎褰撴湰娆℃洿鏂版妸 sendstate 缃负 6锛堥殢璁垮畬鎴愶級鏃朵娇鐢ㄣ��
+ 鍩哄噯鎴鏃堕棿 base = endtime + send_day(缂虹渷1) + (危 service_subtask_preachform.compensate_time + 1) 澶╋紝
+ 涓� RyTask/RedisMqReceiver 鐨� isSubtaskDeadline 鍙e緞淇濇寔涓�鑷达紱
+ delay = COALESCE(service_task.delay_finish_days, 0)锛�
+ finish_time = COALESCE(鍏ュ弬 finishtime, 搴撲腑 finishtime, NOW())锛�
+ finish_time <= base -> 1 姝e父瀹屾垚
+ delay > 0 涓� finish_time <= base + delay -> 2 寤舵湡瀹屾垚
+ 鍏朵綑锛堝惈 delay 涓� 0 鎴� NULL銆佹垨宸茶秴鍑哄欢鏈熺獥鍙o級 -> 3 瓒呮椂瀹屾垚
+ finishtime 涓虹┖鏃剁敤 NOW() 鍏滃簳锛屼繚璇佸畬鎴愭椂涓�瀹氬啓鍏ョ姸鎬侊紱
+ 浠呭綋 endtime 涓虹┖瀵艰嚧鏃犳硶璁$畻鏃舵墠淇濇寔鍘熷�间笉瑕嗙洊銆� -->
+ <sql id="finishStateExpr">
+ CASE
+ WHEN service_subtask.endtime IS NULL THEN finish_state
+ WHEN COALESCE(#{finishtime,jdbcType=TIMESTAMP}, service_subtask.finishtime, NOW())
+ <= DATE_ADD(
+ DATE_ADD(
+ service_subtask.endtime,
+ INTERVAL COALESCE((SELECT st.send_day FROM service_task st
+ WHERE st.taskid = service_subtask.taskid AND st.del_flag = '0' LIMIT 1), 1) DAY
+ ),
+ INTERVAL (COALESCE((SELECT SUM(CAST(COALESCE(NULLIF(TRIM(pf.compensate_time), ''), '0') AS SIGNED))
+ FROM service_subtask_preachform pf
+ WHERE pf.subid = service_subtask.id AND pf.del_flag = 0), 0) + 1) DAY
+ )
+ THEN 1
+ WHEN COALESCE((SELECT st.delay_finish_days FROM service_task st
+ WHERE st.taskid = service_subtask.taskid AND st.del_flag = '0' LIMIT 1), 0) > 0
+ AND COALESCE(#{finishtime,jdbcType=TIMESTAMP}, service_subtask.finishtime, NOW())
+ <= DATE_ADD(
+ DATE_ADD(
+ DATE_ADD(
+ service_subtask.endtime,
+ INTERVAL COALESCE((SELECT st.send_day FROM service_task st
+ WHERE st.taskid = service_subtask.taskid AND st.del_flag = '0' LIMIT 1), 1) DAY
+ ),
+ INTERVAL (COALESCE((SELECT SUM(CAST(COALESCE(NULLIF(TRIM(pf.compensate_time), ''), '0') AS SIGNED))
+ FROM service_subtask_preachform pf
+ WHERE pf.subid = service_subtask.id AND pf.del_flag = 0), 0) + 1) DAY
+ ),
+ INTERVAL COALESCE((SELECT st.delay_finish_days FROM service_task st
+ WHERE st.taskid = service_subtask.taskid AND st.del_flag = '0' LIMIT 1), 0) DAY
+ )
+ THEN 2
+ ELSE 3
+ END
</sql>
<select id="selectServiceSubtaskBySendstate" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
@@ -950,6 +999,7 @@
<if test="senduuid != null">senduuid,</if>
<if test="result != null">result,</if>
<if test="finishtime != null">finishtime,</if>
+ <if test="finishState != null">finish_state,</if>
<if test="recordid != null">recordid,</if>
<if test="exrecallcount != null">exrecallcount,</if>
<if test="pulltime != null">pulltime,</if>
@@ -1048,6 +1098,7 @@
<if test="senduuid != null">#{senduuid},</if>
<if test="result != null">#{result},</if>
<if test="finishtime != null">#{finishtime},</if>
+ <if test="finishState != null">#{finishState},</if>
<if test="recordid != null">#{recordid},</if>
<if test="exrecallcount != null">#{exrecallcount},</if>
<if test="pulltime != null">#{pulltime},</if>
@@ -1188,6 +1239,7 @@
<if test="openid != null ">openid = #{openid},</if>
<if test="longSendTime != null ">long_send_time = #{longSendTime},</if>
<if test="sendstate != null ">sendstate = #{sendstate},</if>
+ <if test="sendstate != null and sendstate == 6">finish_state = <include refid="finishStateExpr"/>,</if>
<if test="serviceType != null ">service_type = #{serviceType},</if>
<if test="score != null ">score = #{score},</if>
<if test="submit != null ">submit = #{submit},</if>
@@ -1292,6 +1344,7 @@
<if test="openid != null ">openid = #{openid},</if>
<if test="longSendTime != null ">long_send_time = #{longSendTime},</if>
<if test="sendstate != null ">sendstate = #{sendstate},</if>
+ <if test="sendstate != null and sendstate == 6">finish_state = <include refid="finishStateExpr"/>,</if>
<if test="serviceType != null ">service_type = #{serviceType},</if>
<if test="score != null ">score = #{score},</if>
<if test="visitCount != null ">visit_count = #{visitCount},</if>
@@ -1347,6 +1400,7 @@
<if test="sex != null">sex = #{sex},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="sendstate != null ">sendstate = #{sendstate},</if>
+ <if test="sendstate != null and sendstate == 6">finish_state = <include refid="finishStateExpr"/>,</if>
<if test="age != null">age = #{age},</if>
<if test="sfzh != null">sfzh = #{sfzh},</if>
<if test="addr != null">addr = #{addr},</if>
@@ -1458,6 +1512,7 @@
<if test="phone != null">phone = #{phone},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="sendstate != null ">sendstate = #{sendstate},</if>
+ <if test="sendstate != null and sendstate == 6">finish_state = <include refid="finishStateExpr"/>,</if>
<if test="age != null">age = #{age},</if>
<if test="sfzh != null">sfzh = #{sfzh},</if>
<if test="addr != null">addr = #{addr},</if>
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceTaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceTaskMapper.xml
index 2331fcb..09634e7 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceTaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceTaskMapper.xml
@@ -15,6 +15,7 @@
<result property="unexecuted" column="unexecuted"/>
<result property="fail" column="fail"/>
<result property="sendDay" column="send_day"/>
+ <result property="delayFinishDays" column="delay_finish_days"/>
<result property="checkuserid" column="checkuserid"/>
<result property="checkusername" column="checkusername"/>
<result property="checktime" column="checktime"/>
@@ -70,6 +71,7 @@
pat_cycle,
appltype,
send_day,
+ delay_finish_days,
long_task,
show_date,
compensate_date,
@@ -206,6 +208,7 @@
service_task.task_name,
service_task.appltype,
service_task.send_day,
+ service_task.delay_finish_days,
service_task.long_task,
service_task.show_date,
service_task.compensate_date,
@@ -490,6 +493,7 @@
<if test="leavehospitaldistrictcode != null ">leavehospitaldistrictcode,</if>
<if test="compensateDate != null and compensateDate != ''">compensate_date,</if>
<if test="sendDay != null ">send_day,</if>
+ <if test="delayFinishDays != null ">delay_finish_days,</if>
<if test="appltype != null ">appltype,</if>
<if test="patCycle != null ">pat_cycle,</if>
<if test="diagType != null and diagType != ''">diag_type,</if>
@@ -547,6 +551,7 @@
<if test="leavehospitaldistrictcode != null ">#{leavehospitaldistrictcode},</if>
<if test="compensateDate != null and compensateDate != ''">#{compensateDate},</if>
<if test="sendDay != null ">#{sendDay},</if>
+ <if test="delayFinishDays != null ">#{delayFinishDays},</if>
<if test="appltype != null ">#{appltype},</if>
<if test="patCycle != null ">#{patCycle},</if>
<if test="diagType != null and diagType != ''">#{diagType},</if>
@@ -610,6 +615,7 @@
</if>
<if test="compensateDate != null and compensateDate != ''">compensate_date = #{compensateDate},</if>
<if test="sendDay != null ">send_day = #{sendDay},</if>
+ <if test="delayFinishDays != null ">delay_finish_days = #{delayFinishDays},</if>
<if test="appltype != null ">appltype = #{appltype},</if>
<if test="patCycle != null ">pat_cycle = #{patCycle},</if>
<if test="diagType != null and diagType != ''">diag_type = #{diagType},</if>
--
Gitblit v1.9.3