| | |
| | | |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.google.gson.Gson; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.http.HttpUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.mapper.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | import com.smartor.service.IServiceTaskService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO(); |
| | | serviceSubtaskVO.setPatid(patid); |
| | | serviceSubtaskVO.setTaskid(taskid); |
| | | List<ServiceSubtask> selectServiceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO); |
| | | //查询患者是否重覆做题 |
| | | if (CollectionUtils.isEmpty(selectServiceSubtaskList)) { |
| | | Long submit = selectServiceSubtaskList.get(0).getSubmit(); |
| | | if (submit == 1L) { |
| | | map.put("submit", "1"); |
| | | return map; |
| | | } |
| | | } |
| | | // List<ServiceSubtask> selectServiceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO); |
| | | // //查询患者是否重覆做题 |
| | | // if (CollectionUtils.isEmpty(selectServiceSubtaskList)) { |
| | | // Long submit = selectServiceSubtaskList.get(0).getSubmit(); |
| | | // if (submit == 1L) { |
| | | // map.put("submit", "1"); |
| | | // return map; |
| | | // } |
| | | // } |
| | | //通过任务ID获取模板ID |
| | | ServiceTask serviceTask = selectServiceTaskByTaskid(taskid); |
| | | List info = new ArrayList(); |
| | | if (serviceTask.getType().equals("1")) { |
| | | //随访 |
| | | log.error("文本随访问题"); |
| | | info = sfInfo(serviceTask, patid); |
| | | } else if (serviceTask.getType().equals("2")) { |
| | | //问卷 |
| | | log.error("文本问卷问题"); |
| | | info = wjInfo(serviceTask, patid, isFinish); |
| | | } else { |
| | | //宣教 |
| | | info = xjInfo(Long.valueOf(serviceTask.getLibtemplateid()), taskid, patid,isFinish); |
| | | info = xjInfo(Long.valueOf(serviceTask.getLibtemplateid()), taskid, patid, isFinish); |
| | | } |
| | | |
| | | //只要打开了页面,就算成功 |
| | | ServiceSubtask ServiceTaskSingle = new ServiceSubtask(); |
| | | ServiceTaskSingle.setTaskid(taskid); |
| | | ServiceTaskSingle.setPatid(patid); |
| | | ServiceTaskSingle.setResult("success"); |
| | | ServiceTaskSingle.setFinishtime(new Date()); |
| | | serviceSubtaskMapper.updateServiceSubtaskByCondition(ServiceTaskSingle); |
| | | if (isFinish) { |
| | | ServiceSubtask ss = new ServiceSubtask(); |
| | | ss.setTaskid(taskid); |
| | | ss.setPatid(patid); |
| | | ss.setSendstate(1L); |
| | | ss.setResult("success"); |
| | | ss.setFinishtime(new Date()); |
| | | serviceSubtaskMapper.updateServiceSubtaskByCondition(ss); |
| | | } |
| | | SvyTaskTemplate svyTaskTemplate = svyTaskTemplateMapper.selectSvyTaskTemplateBySvyid(serviceTask.getTemplateid()); |
| | | if (StringUtils.isNotEmpty(serviceTask.getKcb())) map.put("kcb", serviceTask.getKcb()); |
| | | map.put("script", info); |