| | |
| | | import com.smartor.mapper.*; |
| | | import com.smartor.service.*; |
| | | import com.sun.org.apache.bcel.internal.generic.NEW; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | |
| | | serviceSubtaskStatistic.setDischargeCount(serviceSubtaskList.size()); |
| | | //记录过滤患者详情 |
| | | List<ServiceSubtask> filterServiceSubtasks = new ArrayList<>(); |
| | | //记录首次应随访详情 |
| | | List<ServiceSubtask> needFollowUpInfo = new ArrayList<>(); |
| | | //记录首次待随访详情 |
| | | List<ServiceSubtask> pendingFollowUpInfo = new ArrayList<>(); |
| | | //记录首次随访成功详情 |
| | | List<ServiceSubtask> followUpSuccessInfo = new ArrayList<>(); |
| | | //记录首次随访失败详情 |
| | | List<ServiceSubtask> followUpFailInfo = new ArrayList<>(); |
| | | |
| | | for (ServiceSubtask serviceSubtask : serviceSubtaskList) { |
| | | //无需随访人次 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 4) { |
| | |
| | | |
| | | //首次出院随访 |
| | | if (serviceSubtask.getVisitCount() != null && serviceSubtask.getVisitCount() == 1) { |
| | | //首次应随访 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) { |
| | | serviceSubtaskStatistic.setNeedFollowUp(serviceSubtaskStatistic.getNeedFollowUp() + 1L); |
| | | needFollowUpInfo.add(serviceSubtask); |
| | | } |
| | | //首次待随访 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 2) { |
| | | serviceSubtaskStatistic.setPendingFollowUp(serviceSubtaskStatistic.getPendingFollowUp() + 1L); |
| | | pendingFollowUpInfo.add(serviceSubtask); |
| | | } |
| | | //首次随访成功 |
| | | if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 6)) { |
| | | serviceSubtaskStatistic.setFollowUpSuccess(serviceSubtaskStatistic.getFollowUpSuccess() + 1L); |
| | | followUpSuccessInfo.add(serviceSubtask); |
| | | } |
| | | //首次随访失败 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 5) { |
| | | serviceSubtaskStatistic.setFollowUpFail(serviceSubtaskStatistic.getFollowUpFail() + 1L); |
| | | followUpFailInfo.add(serviceSubtask); |
| | | } |
| | | if (serviceSubtaskStatistic.getNeedFollowUp() > 0) { |
| | | double rate = (double) (serviceSubtaskStatistic.getFollowUpSuccess() + serviceSubtaskStatistic.getFollowUpFail()) / serviceSubtaskStatistic.getNeedFollowUp(); |
| | |
| | | } |
| | | } |
| | | serviceSubtaskStatistic.setFilterCountList(filterServiceSubtasks); |
| | | |
| | | //记录首次应随访详情 |
| | | serviceSubtaskStatistic.setNeedFollowUpInfo(needFollowUpInfo); |
| | | //记录首次待随访详情 |
| | | serviceSubtaskStatistic.setPendingFollowUpInfo(pendingFollowUpInfo); |
| | | //记录首次随访成功详情 |
| | | serviceSubtaskStatistic.setFollowUpSuccessInfo(followUpSuccessInfo); |
| | | //记录首次随访失败详情 |
| | | serviceSubtaskStatistic.setFollowUpFailInfo(followUpFailInfo); |
| | | return serviceSubtaskStatistic; |
| | | } |
| | | |
| | |
| | | |
| | | return total; |
| | | } |
| | | |
| | | /** |
| | | * 历史随访记录导出类封装 |
| | | * ServiceSubtask 转换为 ServiceSubtaskDiagname |
| | | */ |
| | | public List<ServiceSubtaskDiagname> convertToDiagnameList(List<ServiceSubtask> subtaskList) { |
| | | if (CollectionUtils.isEmpty(subtaskList)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | return subtaskList.stream().map(subtask -> { |
| | | ServiceSubtaskDiagname diagname = new ServiceSubtaskDiagname(); |
| | | |
| | | diagname.setTaskName(subtask.getTaskName()); |
| | | diagname.setSendstate(subtask.getSendstate()); |
| | | diagname.setSendname(subtask.getSendname()); |
| | | diagname.setLeavediagname(subtask.getLeavediagname()); |
| | | diagname.setSuggest(subtask.getSuggest()); |
| | | diagname.setOperator(subtask.getOperator()); |
| | | diagname.setFinishtime(subtask.getFinishtime()); |
| | | diagname.setLongSendTime(subtask.getLongSendTime()); |
| | | diagname.setEndtime(subtask.getEndtime()); |
| | | //计算出院天数 |
| | | if(!Objects.isNull(diagname.getEndtime())){ |
| | | Integer endDay = DateUtils.differentDaysByMillisecond(diagname.getEndtime(),new Date()); |
| | | diagname.setEndDay(endDay); |
| | | } |
| | | diagname.setSfzh(subtask.getSfzh()); |
| | | diagname.setPhone(subtask.getPhone()); |
| | | diagname.setNurseName(subtask.getNurseName()); |
| | | diagname.setDrname(subtask.getDrname()); |
| | | diagname.setDeptname(subtask.getDeptname()); |
| | | diagname.setLeavehospitaldistrictname(subtask.getLeavehospitaldistrictname()); |
| | | diagname.setTemplatename(subtask.getTemplatename()); |
| | | diagname.setPreachform(subtask.getPreachform()); |
| | | diagname.setResult(subtask.getResult()); |
| | | |
| | | return diagname; |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | |
| | | } |