| | |
| | | package com.ruoyi.web.controller.smartor; |
| | | |
| | | import com.github.pagehelper.ISelect; |
| | | import com.github.pagehelper.Page; |
| | | import com.ruoyi.common.annotation.AddOrgId; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.enums.PreachFormEnum; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.PageUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.utils.reflect.ReflectUtils; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.system.domain.SysConfig; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysUserDeptService; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.domain.VO.ServiceSubtaskCotinueCountVO; |
| | | import com.smartor.domain.VO.ServiceSubtaskVO; |
| | | import com.smartor.domain.entity.ServiceSubtaskEntity; |
| | | import com.smartor.mapper.PatMedInhospMapper; |
| | | import com.smartor.mapper.PatMedOuthospMapper; |
| | | import com.smartor.service.IServiceSubtaskRecordService; |
| | | import com.smartor.service.IServiceSubtaskService; |
| | | import com.smartor.service.IServiceTaskService; |
| | | import com.smartor.service.impl.ServiceSubtaskServiceImpl; |
| | | import com.sun.org.apache.bcel.internal.generic.NEW; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import net.bytebuddy.implementation.bytecode.Throw; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.collections4.MapUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.web.bind.WebDataBinder; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.text.DecimalFormat; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | @RestController |
| | | @RequestMapping("/smartor/serviceSubtask") |
| | | public class ServiceSubtaskController extends BaseController { |
| | | @InitBinder |
| | | public void initBinder(WebDataBinder binder) { |
| | | binder.setAutoGrowCollectionLimit(1024); // 或 2048、4096 等 |
| | | } |
| | | |
| | | @Autowired |
| | | private IServiceSubtaskService serviceSubtaskService; |
| | | |
| | |
| | | // 直接从已有聚合结果推算total,避免去掉分页后再全量查一遍大表 |
| | | long total = 0L; |
| | | try { |
| | | long wzx = map.get("wzx") != null ? ((Number) map.get("wzx")).longValue() : 0L; |
| | | long ysf = map.get("ysf") != null ? ((Number) map.get("ysf")).longValue() : 0L; |
| | | long dsf = map.get("dsf") != null ? ((Number) map.get("dsf")).longValue() : 0L; |
| | | long yc = map.get("yc") != null ? ((Number) map.get("yc")).longValue() : 0L; |
| | | long jg = map.get("jg") != null ? ((Number) map.get("jg")).longValue() : 0L; |
| | | long fssb = map.get("fssb") != null ? ((Number) map.get("fssb")).longValue() : 0L; |
| | | long yfs = map.get("yfs") != null ? ((Number) map.get("yfs")).longValue() : 0L; |
| | | long blq = map.get("blq") != null ? ((Number) map.get("blq")).longValue() : 0L; |
| | | total = wzx + ysf + dsf + yc + jg + fssb + yfs + blq; |
| | | total = map.get("total") != null ? ((Number) map.get("total")).longValue() : 0L; |
| | | |
| | | } catch (Exception e) { |
| | | // 兜底:全量count |
| | | serviceSubtaskEntity.setPageNum(null); |
| | |
| | | //@PreAuthorize("@ss.hasPermi('system:taskcall:export')") |
| | | @Log(title = "单一任务(随访宣教)", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/patItemExport") |
| | | public void patItemExport(HttpServletResponse response, @RequestBody ServiceSubtaskEntity serviceSubtaskVO) { |
| | | public void patItemExport(HttpServletResponse response, ServiceSubtaskEntity serviceSubtaskVO) { |
| | | LoginUser loginUser = getLoginUser(); |
| | | SysUser user = loginUser.getUser(); |
| | | serviceSubtaskVO.setOrgid(user.getOrgid()); |
| | | List<ServiceSubtaskRes> serviceSubtaskList = null; |
| | | if (serviceSubtaskVO != null) { |
| | | if (serviceSubtaskVO.getPageNum() != null && serviceSubtaskVO.getPageSize() != null) |
| | | PageUtils.startPageByPost(serviceSubtaskVO.getPageNum(), serviceSubtaskVO.getPageSize()); |
| | | serviceSubtaskList = serviceSubtaskService.patItem(serviceSubtaskVO); |
| | | } |
| | | List<ServiceSubtaskExprot> serviceSubtaskExprots = null; |
| | | List<ServiceSubtaskExport> serviceSubtaskExports = null; |
| | | if (!CollectionUtils.isEmpty(serviceSubtaskList)) { |
| | | serviceSubtaskExprots = DtoConversionUtils.sourceToTarget(serviceSubtaskList, ServiceSubtaskExprot.class); |
| | | for (ServiceSubtaskExprot serviceSubtaskExprot : serviceSubtaskExprots) { |
| | | String pf = PreachFormEnum.getDescByCode(serviceSubtaskExprot.getPreachform()); |
| | | serviceSubtaskExprot.setPreachform(pf); |
| | | serviceSubtaskExports = DtoConversionUtils.sourceToTarget(serviceSubtaskList, ServiceSubtaskExport.class); |
| | | for (ServiceSubtaskExport serviceSubtaskExport : serviceSubtaskExports) { |
| | | String pf = PreachFormEnum.getDescByCode(serviceSubtaskExport.getPreachform()); |
| | | serviceSubtaskExport.setPreachform(pf); |
| | | |
| | | //计算出院天数 |
| | | if (!Objects.isNull(serviceSubtaskExport.getEndtime())) { |
| | | Integer endDay = DateUtils.differentDaysByMillisecond(serviceSubtaskExport.getEndtime(), new Date()); |
| | | serviceSubtaskExport.setEndDay(endDay); |
| | | } |
| | | } |
| | | |
| | | } |
| | | ExcelUtil<ServiceSubtaskExprot> util = new ExcelUtil<ServiceSubtaskExprot>(ServiceSubtaskExprot.class); |
| | | util.exportExcel(response, serviceSubtaskExprots, "患者随访信息表单"); |
| | | ExcelUtil<ServiceSubtaskExport> util = new ExcelUtil<ServiceSubtaskExport>(ServiceSubtaskExport.class); |
| | | util.exportExcel(response, serviceSubtaskExports, "患者随访信息表单"); |
| | | } |
| | | |
| | | |
| | |
| | | @PostMapping("/getSfStatisticsExport") |
| | | public void export(HttpServletResponse response, ServiceSubtaskCountReq serviceSubtaskCountReq) { |
| | | List<ServiceSubtaskStatistic> sfStatistics = serviceSubtaskService.getSfStatisticsExport(serviceSubtaskCountReq); |
| | | |
| | | ExcelUtil<ServiceSubtaskStatistic> util = new ExcelUtil<ServiceSubtaskStatistic>(ServiceSubtaskStatistic.class); |
| | | |
| | | String sheetName = ""; |
| | | String fileName = ""; |
| | | if (active.equals("ls") || active.equals("druid")) { |
| | |
| | | } |
| | | return success(serviceSubtaskService.getSfStatisticsJoydetails(serviceSubtaskCountReq)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 延续护理统计 |
| | | */ |
| | | @ApiOperation("延续护理统计") |
| | | @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid") |
| | | @PostMapping("/getContinueNerseCount") |
| | | public AjaxResult getContinueNerseCount(@RequestBody ServiceSubtaskCotinueCountVO serviceSubtaskCotinueCountVO) { |
| | | SysUser user = getLoginUser().getUser(); |
| | | serviceSubtaskCotinueCountVO.setOrgid(user.getOrgid()); |
| | | serviceSubtaskCotinueCountVO.setCampusid(user.getCampusid()); |
| | | boolean hasDistrict = !CollectionUtils.isEmpty(serviceSubtaskCotinueCountVO.getLeavehospitaldistrictcodes()); |
| | | boolean hasDept = !CollectionUtils.isEmpty(serviceSubtaskCotinueCountVO.getDeptcodes()); |
| | | if (hasDistrict && hasDept) { |
| | | return error("病区Code集合与科室Code集合互斥,不能同时传入"); |
| | | } |
| | | return success(serviceSubtaskService.getContinueNurseCount(serviceSubtaskCotinueCountVO)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取随访分类统计明细 |
| | |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | |
| | | } |