123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627 |
- package com.diagbot.facade;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.diagbot.dto.BehospitalCodeDetail;
- import com.diagbot.dto.BehospitalCodeInfo;
- import com.diagbot.dto.BehospitalInfoDTO;
- import com.diagbot.dto.DeptBaseDTO;
- import com.diagbot.dto.EntryDefectImprove;
- import com.diagbot.dto.EntryDefectImproveInner;
- import com.diagbot.dto.GetEntryDefectImproveDTO;
- import com.diagbot.dto.GetEntryInfoDTO;
- import com.diagbot.dto.GetQcClickDTO;
- import com.diagbot.dto.GetQcClickInnerPageDTO;
- import com.diagbot.dto.QcResultDetailInfo;
- import com.diagbot.entity.BehospitalInfo;
- import com.diagbot.entity.MedClickInfo;
- import com.diagbot.entity.MedQcresultClick;
- import com.diagbot.entity.QcresultDetail;
- import com.diagbot.entity.QcresultInfo;
- import com.diagbot.enums.IsDeleteEnum;
- import com.diagbot.exception.CommonErrorCode;
- import com.diagbot.exception.CommonException;
- import com.diagbot.service.MedQcresultClickService;
- import com.diagbot.service.impl.MedClickInfoServiceImpl;
- import com.diagbot.util.BeanUtil;
- import com.diagbot.util.DateUtil;
- import com.diagbot.util.ExcelUtils;
- import com.diagbot.util.ListUtil;
- import com.diagbot.util.StringUtil;
- import com.diagbot.util.SysUserUtils;
- import com.diagbot.vo.BasDeptInfoVO;
- import com.diagbot.vo.GetEntryDefectImproveInnerVO;
- import com.diagbot.vo.GetEntryDefectImproveVO;
- import com.diagbot.vo.GetQcClickInnerPageVO;
- import com.diagbot.vo.GetQcClickVO;
- import com.diagbot.vo.MedClickInfoVO;
- import org.apache.commons.lang3.StringUtils;
- import org.josql.Query;
- import org.josql.QueryExecutionException;
- import org.josql.QueryParseException;
- import org.josql.QueryResults;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.beans.factory.annotation.Qualifier;
- import org.springframework.stereotype.Component;
- import javax.servlet.http.HttpServletResponse;
- import java.text.ParseException;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.HashSet;
- import java.util.Iterator;
- import java.util.List;
- import java.util.Map;
- import java.util.Set;
- import java.util.stream.Collectors;
- /**
- * @Description:数据分析
- * @Author: cy
- * @time: 2021/11/16 18:28
- */
- @Component
- public class DataAnalysisFacade {
- @Autowired
- @Qualifier("medClickInfoServiceImpl")
- private MedClickInfoServiceImpl medClickInfoService;
- @Autowired
- private QcresultInfoFacade qcresultInfoFacade;
- @Autowired
- private QcresultDetailFacade qcresultDetailFacade;
- @Autowired
- private MedQcresultClickService medQcresultClickService;
- @Autowired
- private BehospitalInfoFacade behospitalInfoFacade;
- /**
- * @Description:医生质控信息次数
- * @Param: [medClickInfoVO]
- * @return: void
- * @Author: cy
- * @Date: 2021/11/10
- */
- public Boolean addMedClickInfo(MedClickInfoVO medClickInfoVO) {
- MedClickInfo medClickInfo = new MedClickInfo();
- BeanUtil.copyProperties(medClickInfoVO, medClickInfo);
- QcresultInfo qcresultInfo = qcresultInfoFacade.lambdaQuery()
- .eq(QcresultInfo::getHospitalId, medClickInfoVO.getHospitalId())
- .eq(QcresultInfo::getBehospitalCode, medClickInfoVO.getBehospitalCode())
- .eq(QcresultInfo::getIsDeleted, IsDeleteEnum.N.getKey())
- .select(QcresultInfo::getId).one();
- if (null == qcresultInfo || null == qcresultInfo.getId()
- ) {
- throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "内部参数异常");
- }
- medClickInfo.setQcresultInfoId(qcresultInfo.getId());
- medClickInfo.setGmtCreate(new Date());
- medClickInfoService.save(medClickInfo);
- BehospitalInfo behospitalInfo = behospitalInfoFacade.lambdaQuery()
- .eq(BehospitalInfo::getHospitalId, medClickInfoVO.getHospitalId())
- .eq(BehospitalInfo::getBehospitalCode, medClickInfoVO.getBehospitalCode())
- .ne(BehospitalInfo::getQcTypeId, "0")
- .eq(BehospitalInfo::getIsDeleted, IsDeleteEnum.N.getKey())
- .one();
- List<QcresultDetail> list = qcresultDetailFacade.lambdaQuery()
- .eq(QcresultDetail::getHospitalId, medClickInfoVO.getHospitalId())
- .eq(QcresultDetail::getBehospitalCode, medClickInfoVO.getBehospitalCode())
- .eq(QcresultDetail::getQcresultInfoId, qcresultInfo.getId())
- .eq(QcresultDetail::getIsDeleted, IsDeleteEnum.N.getKey()).list();
- if (ListUtil.isNotEmpty(list)) {
- StringBuilder sbFir = new StringBuilder();
- for (QcresultDetail qcresultDetail : list) {
- if (1 == qcresultDetail.getGradeType()) {
- if (null != qcresultDetail.getCasesEntryId()) {
- sbFir.append(qcresultDetail.getCasesEntryId() + "、");
- }
- }
- }
- if (sbFir.length() > 0) {
- sbFir = sbFir.deleteCharAt(sbFir.length() - 1);
- }
- MedQcresultClick medQcresultClick = new MedQcresultClick();
- medQcresultClick.setHospitalId(medClickInfoVO.getHospitalId());
- medQcresultClick.setBehospitalCode(medClickInfoVO.getBehospitalCode());
- if (null != behospitalInfo) {
- medQcresultClick.setDeptId(behospitalInfo.getBehDeptId());
- medQcresultClick.setDeptName(behospitalInfo.getBehDeptName());
- medQcresultClick.setDoctorId(behospitalInfo.getDoctorId());
- medQcresultClick.setDoctorName(behospitalInfo.getDoctorName());
- }
- medQcresultClick.setQcresultInfoId(qcresultInfo.getId());
- medQcresultClick.setCasesEntryIds(sbFir.toString());
- medQcresultClickService.save(medQcresultClick);
- }
- return true;
- }
- public List<DeptBaseDTO> getQcClickDeptList(BasDeptInfoVO basDeptInfoVO) {
- long hospitalId = Long.parseLong(SysUserUtils.getCurrentHospitalID());
- List<DeptBaseDTO> deptDTO = new ArrayList<>();
- List<MedClickInfo> deptList = medClickInfoService.lambdaQuery()
- .eq(MedClickInfo::getHospitalId, hospitalId)
- .eq(MedClickInfo::getIsDeleted, IsDeleteEnum.N.getKey())
- .like(MedClickInfo::getDeptName, basDeptInfoVO.getInputStr())
- .select(MedClickInfo::getDeptId, MedClickInfo::getDeptName)
- .groupBy(MedClickInfo::getDeptId)
- .groupBy(MedClickInfo::getDeptName)
- .list();
- if (ListUtil.isNotEmpty(deptList)) {
- for (MedClickInfo kfc : deptList) {
- if (null == kfc) {
- return deptDTO;
- }
- DeptBaseDTO deptBaseDTO = new DeptBaseDTO();
- deptBaseDTO.setDeptId(kfc.getDeptId());
- deptBaseDTO.setDeptName(kfc.getDeptName());
- deptDTO.add(deptBaseDTO);
- }
- }
- return deptDTO;
- }
- public List<GetQcClickDTO> getQcClick(GetQcClickVO getQcClickVO) {
- clickPageSet(getQcClickVO);
- List<GetQcClickDTO> records = medClickInfoService.getBaseMapper().getQcClick(getQcClickVO);
- //没有科室过滤时增加全院数据
- if (StringUtil.isBlank(getQcClickVO.getDeptName()) || getQcClickVO.getDeptName().equals("全院")) {
- GetQcClickDTO item = getGlobleTitle(records);
- if (item != null) {
- records.add(0, item);
- }
- }
- return records;
- }
- public void getQcClickByExport(HttpServletResponse response, GetQcClickVO getQcClickVO) {
- List<GetQcClickDTO> records = getQcClick(getQcClickVO);
- String fileName = "临床质控使用统计.xls";
- ExcelUtils.exportExcel(records, null, "sheet1", GetQcClickDTO.class, fileName, response, 12.8f);
- }
- public IPage<GetQcClickInnerPageDTO> getQcClickInnerPage(GetQcClickInnerPageVO getQcClickInnerPageVO) {
- clickInnerPageSet(getQcClickInnerPageVO);
- IPage<GetQcClickInnerPageDTO> records = medClickInfoService.getBaseMapper().getQcClickInnerPage(getQcClickInnerPageVO);
- return records;
- }
- public void getQcClickInnerPageByExport(HttpServletResponse response, GetQcClickInnerPageVO getQcClickInnerPageVO) {
- getQcClickInnerPageVO.setCurrent(1L);
- getQcClickInnerPageVO.setSize(Long.MAX_VALUE);
- getQcClickInnerPageVO.setSearchCount(false);
- IPage<GetQcClickInnerPageDTO> page = getQcClickInnerPage(getQcClickInnerPageVO);
- String fileName = "临床质控使用统计内页.xls";
- ExcelUtils.exportExcel(page.getRecords(), null, "sheet1", GetQcClickInnerPageDTO.class, fileName, response, 12.8f);
- }
- public IPage<GetEntryDefectImproveDTO> getEntryDefectImprove(GetEntryDefectImproveVO getEntryDefectImproveVO) {
- int current = (int) getEntryDefectImproveVO.getCurrent();
- int size = (int) getEntryDefectImproveVO.getSize();
- IPage<GetEntryDefectImproveDTO> page = new Page<>();
- entryDefectSet(getEntryDefectImproveVO);
- List<GetEntryDefectImproveDTO> getEntryDefectImproveDTO = new ArrayList<>();
- //获取标准缺陷信息
- List<GetEntryInfoDTO> entryInfo = medClickInfoService.getBaseMapper().getEntryInfo();
- //查询基础数据源
- List<EntryDefectImprove> records = medClickInfoService.getBaseMapper().getEntryDefectImprove(getEntryDefectImproveVO);
- //遍历科室
- for (EntryDefectImprove entryDefectImprove : records) {
- Map<String, Long> totalMap = new HashMap<>();
- Map<String, Long> improveleMap = new HashMap<>();
- List<BehospitalCodeInfo> behospitalCodeInfoList = entryDefectImprove.getBehospitalCodeInfos();
- //多份病历多次质控评分得到质控缺陷总量、待改善总量
- unitProcessing(behospitalCodeInfoList, totalMap, improveleMap);
- //按照全院维度进行数据封装
- for (Map.Entry<String, Long> stringLongEntry : totalMap.entrySet()) {
- //封装DTO
- GetEntryDefectImproveDTO getEntryDefectImprove = new GetEntryDefectImproveDTO();
- getEntryDefectImprove.setDeptId(entryDefectImprove.getDeptId());
- getEntryDefectImprove.setDeptName(entryDefectImprove.getDeptName());
- getEntryDefectImprove.setEntryId(stringLongEntry.getKey());
- getEntryInfo(entryInfo, stringLongEntry, getEntryDefectImprove);
- getEntryDefectImprove.setTotalNum(stringLongEntry.getValue());
- if (improveleMap.containsKey(stringLongEntry.getKey())) {
- getEntryDefectImprove.setImproveleNum(improveleMap.get(stringLongEntry.getKey()));
- }
- getEntryDefectImprove.setHandleNum(getEntryDefectImprove.getTotalNum() - getEntryDefectImprove.getImproveleNum());
- getEntryDefectImproveDTO.add(getEntryDefectImprove);
- }
- }
- //(部分模糊查询在此)
- if (ListUtil.isNotEmpty(getEntryDefectImproveDTO)) {
- if (StringUtils.isNotBlank(getEntryDefectImproveVO.getCasesName()) || StringUtils.isNotBlank(getEntryDefectImproveVO.getEntryName())) {
- getEntryDefectImproveQuery(getEntryDefectImproveVO, getEntryDefectImproveDTO);
- }
- }
- //导出操作
- if (getEntryDefectImproveVO.getExportType() == 1L) {
- size = getEntryDefectImproveDTO.size();
- }
- page.setSize(size);
- page.setTotal(getEntryDefectImproveDTO.size());
- page.setCurrent(current);
- //分页操作
- List<GetEntryDefectImproveDTO> getEntryDefectImproveDTOS = page(getEntryDefectImproveDTO, size, current);
- if (ListUtil.isNotEmpty(getEntryDefectImproveDTOS)) {
- //排序操作
- getEntryDefectImproveDTOS = sortList(getEntryDefectImproveDTOS, getEntryDefectImproveVO.getAsc() != null ? getEntryDefectImproveVO.getAsc() : getEntryDefectImproveVO.getDesc() + " desc");
- };
- page.setRecords(getEntryDefectImproveDTOS);
- return page;
- }
- /**
- * @Description: 缺陷信息封装
- * @Param: [entryInfo, stringLongEntry, getEntryDefectImprove]
- * @return: com.diagbot.dto.GetEntryDefectImproveDTO
- * @Author: cy
- * @Date: 2021/12/3
- */
- public GetEntryDefectImproveDTO getEntryInfo(List<GetEntryInfoDTO> entryInfo, Map.Entry<String, Long> stringLongEntry,
- GetEntryDefectImproveDTO getEntryDefectImprove) {
- entryInfo.parallelStream().filter(kfc -> kfc.getEntryId().equals(stringLongEntry.getKey())).forEach(
- obj -> {
- getEntryDefectImprove.setCasesId(obj.getCasesId());
- getEntryDefectImprove.setCasesName(obj.getCasesName());
- getEntryDefectImprove.setEntryName(obj.getEntryName());
- }
- );
- return getEntryDefectImprove;
- }
- /**
- * @Description: 多份病历多次质控评分得到质控缺陷总量、待改善总量
- * @Param: [behospitalCodeInfoList, totalMap, improveleMap]
- * @return: void
- * @Author: cy
- * @Date: 2021/12/3
- */
- public static void unitProcessing(List<BehospitalCodeInfo> behospitalCodeInfoList, Map<String, Long> totalMap,
- Map<String, Long> improveleMap) {
- for (BehospitalCodeInfo behospitalCodeInfo : behospitalCodeInfoList) {
- //病历下
- List<QcResultDetailInfo> qcResultDetailInfos = behospitalCodeInfo.getQcResultDetailInfos();
- //获取多病历多质控质控缺陷总量
- totalMap = getEntryTotalMap(qcResultDetailInfos, totalMap);
- //获取多病历多质控质控缺陷待改善总量
- QcResultDetailInfo qcResultDetailInfo = qcResultDetailInfos.get(qcResultDetailInfos.size() - 1);
- improveleMap = getEntryImproveleMap(qcResultDetailInfo, improveleMap);
- }
- }
- public void getEntryDefectImproveQuery(GetEntryDefectImproveVO getEntryDefectImproveVO, List<GetEntryDefectImproveDTO> getEntryDefectImproveDTO) {
- Iterator<GetEntryDefectImproveDTO> iterator = getEntryDefectImproveDTO.iterator();
- while (iterator.hasNext()) {
- boolean mark = true;
- GetEntryDefectImproveDTO kfc = iterator.next();
- if (StringUtils.isNotBlank(getEntryDefectImproveVO.getCasesName()) &&
- !kfc.getCasesName().contains(getEntryDefectImproveVO.getCasesName())) {
- iterator.remove();
- mark = false;
- }
- if (mark && StringUtils.isNotBlank(getEntryDefectImproveVO.getEntryName()) &&
- !kfc.getEntryName().contains(getEntryDefectImproveVO.getEntryName())) {
- iterator.remove();
- }
- }
- }
- /**
- * @Description:分页数据
- * @Param: [dataList, pageSize, currentPage]
- * @return: java.util.List<java.lang.String>
- * @Author: cy
- * @Date: 2021/12/2
- */
- public static <T> List<T> page(List<T> retRecords, int pageSize, int currentPage) {
- List<T> currentPageList = new ArrayList<>();
- if (retRecords != null && retRecords.size() > 0) {
- int currIdx = (currentPage > 1 ? (currentPage - 1) * pageSize : 0);
- for (int i = 0; i < pageSize && i < retRecords.size() - currIdx; i++) {
- T data = retRecords.get(currIdx + i);
- currentPageList.add(data);
- }
- }
- return currentPageList;
- }
- /**
- * 内存数据排序 使用JoSQL
- *
- * @param list
- * @param orderByString a asc,b desc
- * @return
- */
- public static <T> List<T> sortList(List<T> list, String orderByString) {
- String josql = " select * from " + list.get(0).getClass().getName() + " order by " + orderByString;
- Query query = new Query();
- try {
- query.parse(josql);
- QueryResults results = query.execute(list);
- list = results.getResults();
- } catch (QueryParseException e) {
- e.printStackTrace();
- } catch (QueryExecutionException e) {
- e.printStackTrace();
- }
- return list;
- }
- public static Map getEntryTotalMap(List<QcResultDetailInfo> qcResultDetailInfos, Map<String, Long> totalMap) {
- Set<String> totalSet = new HashSet<String>();
- for (QcResultDetailInfo qcResultDetailInfo : qcResultDetailInfos) {
- //质控下获取科室下总缺陷
- String casesEntryIds = qcResultDetailInfo.getCasesEntryIds();
- totalSet = getSetEntry(casesEntryIds, totalSet);
- }
- totalMap = getSetEntryCount(totalMap, totalSet);
- return totalMap;
- }
- public static Map getEntryImproveleMap(QcResultDetailInfo qcResultDetailInfo, Map<String, Long> improveMap) {
- Set<String> improveleSet = new HashSet<String>();
- String casesEntryIds = qcResultDetailInfo.getCasesEntryIds();
- improveleSet = getSetEntry(casesEntryIds, improveleSet);
- improveMap = getSetEntryCount(improveMap, improveleSet);
- return improveMap;
- }
- public static Set getSetEntry(String casesEntryIds, Set set) {
- if (StringUtils.isNotBlank(casesEntryIds) && !"0".equals(casesEntryIds)) {
- if (casesEntryIds.contains("、")) {
- String[] split = casesEntryIds.split("、");
- for (String id : split) {
- set.add(id);
- }
- } else {
- set.add(casesEntryIds);
- }
- }
- return set;
- }
- public static Map getSetEntryCount(Map<String, Long> map, Set<String> sets) {
- for (String set : sets) {
- if (map.containsKey(set)) {
- long count = map.get(set) + 1l;
- map.put(set, count);
- } else {
- map.put(set, 1L);
- }
- }
- return map;
- }
- public void getEntryDefectImproveByExport(HttpServletResponse response, GetEntryDefectImproveVO
- getEntryDefectImproveVO) {
- getEntryDefectImproveVO.setExportType(1L);
- getEntryDefectImproveVO.setCurrent(1L);
- getEntryDefectImproveVO.setSize(Long.MAX_VALUE);
- getEntryDefectImproveVO.setSearchCount(false);
- IPage<GetEntryDefectImproveDTO> page = getEntryDefectImprove(getEntryDefectImproveVO);
- String fileName = "条目缺陷改善统计.xls";
- ExcelUtils.exportExcel(page.getRecords(), null, "sheet1", GetEntryDefectImproveDTO.class, fileName, response, 12.8f);
- }
- public IPage<BehospitalInfoDTO> getEntryDefectImproveInner(GetEntryDefectImproveInnerVO
- getEntryDefectImproveInnerVO) {
- int current = (int) getEntryDefectImproveInnerVO.getCurrent();
- int size = (int) getEntryDefectImproveInnerVO.getSize();
- IPage<BehospitalInfoDTO> page = new Page<>();
- List<BehospitalInfoDTO> behospitalInfoDTOS = new ArrayList<>();
- entryDefectInnerSet(getEntryDefectImproveInnerVO);
- // List<GetEntryInfoDTO> entryInfo = medClickInfoService.getBaseMapper().getEntryInfo();
- List<EntryDefectImproveInner> records = medClickInfoService.getBaseMapper().getEntryDefectImproveInner(getEntryDefectImproveInnerVO);
- if (ListUtil.isNotEmpty(records) && records.size() == 1) {
- EntryDefectImproveInner entryDefectImproveInner = records.get(0);
- List<BehospitalCodeDetail> behospitalCodeDetails = entryDefectImproveInner.getBehospitalCodeInfos();
- for (BehospitalCodeDetail behospitalCodeDetail : behospitalCodeDetails) {
- List<QcResultDetailInfo> qcResultDetailInfos = behospitalCodeDetail.getQcResultDetailInfos();
- Set<String> totalSet = new HashSet<String>();
- Set<String> improveleSet = new HashSet<String>();
- for (QcResultDetailInfo qcResultDetailInfo : qcResultDetailInfos) {
- String casesEntryIds = qcResultDetailInfo.getCasesEntryIds();
- totalSet = getSetEntry(casesEntryIds, totalSet);
- }
- QcResultDetailInfo qcResultDetailInfo = qcResultDetailInfos.get(qcResultDetailInfos.size() - 1);
- if (null != qcResultDetailInfo && StringUtils.isNotBlank(qcResultDetailInfo.getCasesEntryIds())) {
- improveleSet = getSetEntry(qcResultDetailInfo.getCasesEntryIds(), improveleSet);
- }
- if ("0".equals(getEntryDefectImproveInnerVO.getTypeMark()) && totalSet.contains(getEntryDefectImproveInnerVO.getEntryId())) {
- behospitalInfoDTOS = getBehospitalInfoDTO(entryDefectImproveInner, behospitalCodeDetail, behospitalInfoDTOS);
- }
- if ("1".equals(getEntryDefectImproveInnerVO.getTypeMark()) && totalSet.contains(getEntryDefectImproveInnerVO.getEntryId())
- && !improveleSet.contains(getEntryDefectImproveInnerVO.getEntryId())) {
- behospitalInfoDTOS = getBehospitalInfoDTO(entryDefectImproveInner, behospitalCodeDetail, behospitalInfoDTOS);
- }
- if ("2".equals(getEntryDefectImproveInnerVO.getTypeMark()) && totalSet.contains(getEntryDefectImproveInnerVO.getEntryId())
- && improveleSet.contains(getEntryDefectImproveInnerVO.getEntryId())) {
- behospitalInfoDTOS = getBehospitalInfoDTO(entryDefectImproveInner, behospitalCodeDetail, behospitalInfoDTOS);
- }
- }
- }
- //导出操作
- if (getEntryDefectImproveInnerVO.getExportType() == 1L) {
- size = behospitalInfoDTOS.size();
- }
- page.setSize(size);
- page.setTotal(behospitalInfoDTOS.size());
- page.setCurrent(current);
- //分页操作
- List<BehospitalInfoDTO> behospitalInfoDTOList = page(behospitalInfoDTOS, size, current);
- if (ListUtil.isNotEmpty(behospitalInfoDTOList)) {
- //排序操作
- behospitalInfoDTOList = sortList(behospitalInfoDTOList, getEntryDefectImproveInnerVO.getAsc() != null ? getEntryDefectImproveInnerVO.getAsc() : getEntryDefectImproveInnerVO.getDesc() + " desc");
- }
- page.setRecords(behospitalInfoDTOList);
- return page;
- }
- /**
- * @Description: 数据封装
- * @Param: [entryDefectImproveInner, behospitalCodeDetail, qcResultDetailInfo, behospitalInfoDTOS]
- * @return: java.util.List<com.diagbot.dto.BehospitalInfoDTO>
- * @Author: cy
- * @Date: 2021/12/3
- */
- public List<BehospitalInfoDTO> getBehospitalInfoDTO(EntryDefectImproveInner entryDefectImproveInner, BehospitalCodeDetail behospitalCodeDetail,
- List<BehospitalInfoDTO> behospitalInfoDTOS) {
- BehospitalInfoDTO behospitalInfoDTO = new BehospitalInfoDTO();
- behospitalInfoDTO.setLevel(behospitalCodeDetail.getLevel());
- behospitalInfoDTO.setScoreRes(behospitalCodeDetail.getScoreRes());
- behospitalInfoDTO.setFileCode(behospitalCodeDetail.getFileCode());
- behospitalInfoDTO.setBehospitalCode(behospitalCodeDetail.getBehospitalCode());
- behospitalInfoDTO.setName(behospitalCodeDetail.getName());
- behospitalInfoDTO.setAge(behospitalCodeDetail.getAge());
- behospitalInfoDTO.setBehospitalDate(behospitalCodeDetail.getBehospitalDate());
- behospitalInfoDTO.setLeaveHospitalDate(behospitalCodeDetail.getLeaveHospitalDate());
- behospitalInfoDTO.setDoctorName(behospitalCodeDetail.getDoctorName());
- behospitalInfoDTO.setBehDeptName(entryDefectImproveInner.getBehDeptName());
- behospitalInfoDTO.setGradeTime(behospitalCodeDetail.getGradeTime());
- behospitalInfoDTOS.add(behospitalInfoDTO);
- return behospitalInfoDTOS;
- }
- public void getDefectImproveInnerByExport(HttpServletResponse response, GetEntryDefectImproveInnerVO
- getEntryDefectImproveInnerVO) {
- getEntryDefectImproveInnerVO.setSearchCount(false);
- getEntryDefectImproveInnerVO.setExportType(1L);
- String fileName = "条目缺陷改善统计病历列表.xls";
- IPage<BehospitalInfoDTO> page = this.getEntryDefectImproveInner(getEntryDefectImproveInnerVO);
- ExcelUtils.exportExcelUser(page.getRecords(), null, "sheet1", BehospitalInfoDTO.class, fileName, response);
- }
- /**
- * 增加全院记录
- *
- * @param records
- * @return
- */
- public GetQcClickDTO getGlobleTitle(List<GetQcClickDTO> records) {
- GetQcClickDTO item = new GetQcClickDTO();
- if (ListUtil.isEmpty(records)) {
- return null;
- }
- //缺陷总数
- Integer singleMode = records
- .stream()
- .map(GetQcClickDTO::getSingleModeNum)
- .reduce(0, Integer::sum);
- if (singleMode == null) {
- singleMode = 0;
- }
- Integer totalMode = records
- .stream()
- .map(GetQcClickDTO::getTotalModeNum)
- .reduce(0, Integer::sum);
- if (totalMode == null) {
- totalMode = 0;
- }
- item.setDeptName("全院");
- item.setSingleModeNum(singleMode);
- item.setTotalModeNum(totalMode);
- return item;
- }
- private void clickPageSet(GetQcClickVO getQcClickVO) {
- //入参验证
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
- Date startDate = null;
- Date endDate = null;
- try {
- startDate = simpleDateFormat.parse(getQcClickVO.getStartDate());
- endDate = simpleDateFormat.parse(getQcClickVO.getEndDate());
- } catch (ParseException e) {
- e.printStackTrace();
- }
- if (DateUtil.after(startDate, endDate)) {
- throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间必须小于结束时间!");
- }
- getQcClickVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
- }
- private void clickInnerPageSet(GetQcClickInnerPageVO getQcClickInnerPageVO) {
- //入参验证
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
- Date startDate = null;
- Date endDate = null;
- try {
- startDate = simpleDateFormat.parse(getQcClickInnerPageVO.getStartDate());
- endDate = simpleDateFormat.parse(getQcClickInnerPageVO.getEndDate());
- } catch (ParseException e) {
- e.printStackTrace();
- }
- if (DateUtil.after(startDate, endDate)) {
- throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间必须小于结束时间!");
- }
- getQcClickInnerPageVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
- }
- private void entryDefectSet(GetEntryDefectImproveVO getEntryDefectImproveVO) {
- getEntryDefectImproveVO.setCurrent(1L);
- getEntryDefectImproveVO.setSize(Long.MAX_VALUE);
- //入参验证
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
- Date startDate = null;
- Date endDate = null;
- try {
- startDate = simpleDateFormat.parse(getEntryDefectImproveVO.getStartDate());
- endDate = simpleDateFormat.parse(getEntryDefectImproveVO.getEndDate());
- } catch (ParseException e) {
- e.printStackTrace();
- }
- if (DateUtil.after(startDate, endDate)) {
- throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间必须小于结束时间!");
- }
- getEntryDefectImproveVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
- }
- private void entryDefectInnerSet(GetEntryDefectImproveInnerVO getEntryDefectImproveInnerVO) {
- getEntryDefectImproveInnerVO.setCurrent(1L);
- getEntryDefectImproveInnerVO.setSize(Long.MAX_VALUE);
- //入参验证
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
- Date startDate = null;
- Date endDate = null;
- try {
- startDate = simpleDateFormat.parse(getEntryDefectImproveInnerVO.getStartDate());
- endDate = simpleDateFormat.parse(getEntryDefectImproveInnerVO.getEndDate());
- } catch (ParseException e) {
- e.printStackTrace();
- }
- if (DateUtil.after(startDate, endDate)) {
- throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间必须小于结束时间!");
- }
- if (StringUtils.isNotBlank(getEntryDefectImproveInnerVO.getChTimeStart())
- && StringUtils.isNotBlank(getEntryDefectImproveInnerVO.getChTimeEnd())
- ) {
- Date chTimeStartDate = null;
- Date chTimeEndDate = null;
- try {
- chTimeStartDate = simpleDateFormat.parse(getEntryDefectImproveInnerVO.getChTimeStart());
- chTimeEndDate = simpleDateFormat.parse(getEntryDefectImproveInnerVO.getChTimeStart());
- } catch (ParseException e) {
- e.printStackTrace();
- }
- if (DateUtil.after(chTimeStartDate, chTimeEndDate)) {
- throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "病历核查开始时间必须小于结束时间!");
- }
- }
- getEntryDefectImproveInnerVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
- }
- }
|