|
@@ -4,9 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.etotem.cfc.dto.EmotionAlertVO;
|
|
import com.etotem.cfc.dto.EmotionAlertVO;
|
|
|
import com.etotem.cfc.dto.ScreenResultVO;
|
|
import com.etotem.cfc.dto.ScreenResultVO;
|
|
|
import com.etotem.cfc.dto.ScreenSubmitDTO;
|
|
import com.etotem.cfc.dto.ScreenSubmitDTO;
|
|
|
|
|
+import com.etotem.cfc.entity.Child;
|
|
|
import com.etotem.cfc.entity.EmotionAlert;
|
|
import com.etotem.cfc.entity.EmotionAlert;
|
|
|
|
|
+import com.etotem.cfc.entity.FollowUp;
|
|
|
import com.etotem.cfc.entity.MentalHealthScreen;
|
|
import com.etotem.cfc.entity.MentalHealthScreen;
|
|
|
|
|
+import com.etotem.cfc.mapper.ChildMapper;
|
|
|
import com.etotem.cfc.mapper.EmotionAlertMapper;
|
|
import com.etotem.cfc.mapper.EmotionAlertMapper;
|
|
|
|
|
+import com.etotem.cfc.mapper.FollowUpMapper;
|
|
|
import com.etotem.cfc.mapper.MentalHealthScreenMapper;
|
|
import com.etotem.cfc.mapper.MentalHealthScreenMapper;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
@@ -28,6 +32,12 @@ public class MentalHealthScreenService {
|
|
|
@Resource
|
|
@Resource
|
|
|
private EmotionAlertMapper emotionAlertMapper;
|
|
private EmotionAlertMapper emotionAlertMapper;
|
|
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private FollowUpMapper followUpMapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private ChildMapper childMapper;
|
|
|
|
|
+
|
|
|
@Resource
|
|
@Resource
|
|
|
private WechatAlertTemplateService wechatAlertTemplateService;
|
|
private WechatAlertTemplateService wechatAlertTemplateService;
|
|
|
|
|
|
|
@@ -186,6 +196,30 @@ public class MentalHealthScreenService {
|
|
|
alert.setResolved(true);
|
|
alert.setResolved(true);
|
|
|
alert.setResolvedAt(new Date());
|
|
alert.setResolvedAt(new Date());
|
|
|
emotionAlertMapper.updateById(alert);
|
|
emotionAlertMapper.updateById(alert);
|
|
|
|
|
+
|
|
|
|
|
+ // Auto-create follow_up record
|
|
|
|
|
+ try {
|
|
|
|
|
+ FollowUp followUp = new FollowUp();
|
|
|
|
|
+ followUp.setChildId(alert.getChildId());
|
|
|
|
|
+ Child child = childMapper.selectById(alert.getChildId());
|
|
|
|
|
+ if (child != null && child.getFamilyId() != null) {
|
|
|
|
|
+ followUp.setFamilyId(child.getFamilyId());
|
|
|
|
|
+ }
|
|
|
|
|
+ followUp.setDescription("情绪/心理危机告警已处理,待7天后复核");
|
|
|
|
|
+ followUp.setStatus("pending");
|
|
|
|
|
+ followUp.setPriority("high");
|
|
|
|
|
+
|
|
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
|
|
+ cal.add(Calendar.DAY_OF_YEAR, 7);
|
|
|
|
|
+ followUp.setDueDate(cal.getTime());
|
|
|
|
|
+
|
|
|
|
|
+ followUp.setCreatedAt(new Date());
|
|
|
|
|
+
|
|
|
|
|
+ followUpMapper.insert(followUp);
|
|
|
|
|
+ log.info("告警解决后自动生成follow_up: childId={}, alertId={}", alert.getChildId(), alertId);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("创建follow_up失败: {}", e.getMessage());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|