|
@@ -1,19 +1,33 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.diagbot.dto.BehospitalCodeInfo;
|
|
|
import com.diagbot.dto.BehospitalInfoDTO;
|
|
|
import com.diagbot.dto.DeptBaseDTO;
|
|
|
+import com.diagbot.dto.EntryDefectImprove;
|
|
|
import com.diagbot.dto.ExportExcelBehospitalDTO;
|
|
|
import com.diagbot.dto.ExportExcelDTO;
|
|
|
import com.diagbot.dto.GetEntryDefectImproveDTO;
|
|
|
+import com.diagbot.dto.GetEntryInfoDTO;
|
|
|
import com.diagbot.dto.GetQcClickDTO;
|
|
|
import com.diagbot.dto.GetQcClickInnerPageDTO;
|
|
|
+import com.diagbot.dto.HomePageNumDTO;
|
|
|
+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.QcresultDetailService;
|
|
|
import com.diagbot.service.impl.MedClickInfoServiceImpl;
|
|
|
+import com.diagbot.service.impl.QcresultDetailServiceImpl;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.DateUtil;
|
|
|
import com.diagbot.util.ExcelUtils;
|
|
@@ -36,7 +50,12 @@ 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;
|
|
|
|
|
|
|
|
@@ -54,6 +73,14 @@ public class DataAnalysisFacade {
|
|
|
@Autowired
|
|
|
private QcresultInfoFacade qcresultInfoFacade;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private QcresultDetailFacade qcresultDetailFacade;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MedQcresultClickService medQcresultClickService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private BehospitalInfoFacade behospitalInfoFacade;
|
|
|
|
|
|
/**
|
|
|
* @Description:医生质控信息次数
|
|
@@ -70,13 +97,47 @@ public class DataAnalysisFacade {
|
|
|
.eq(QcresultInfo::getBehospitalCode, medClickInfoVO.getBehospitalCode())
|
|
|
.eq(QcresultInfo::getIsDeleted, IsDeleteEnum.N.getKey())
|
|
|
.select(QcresultInfo::getId).one();
|
|
|
- if(null == qcresultInfo || null == qcresultInfo.getId()
|
|
|
- ){
|
|
|
+ if (null == qcresultInfo || null == qcresultInfo.getId()
|
|
|
+ ) {
|
|
|
throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "内部参数异常");
|
|
|
}
|
|
|
medClickInfo.setQcresultInfoId(qcresultInfo.getId());
|
|
|
medClickInfo.setGmtCreate(new Date());
|
|
|
- return medClickInfoService.save(medClickInfo);
|
|
|
+ medClickInfoService.save(medClickInfo);
|
|
|
+ BehospitalInfo behospitalInfo = behospitalInfoFacade.lambdaQuery()
|
|
|
+ .eq(BehospitalInfo::getHospitalId, medClickInfoVO.getHospitalId())
|
|
|
+ .eq(BehospitalInfo::getBehospitalCode, medClickInfoVO.getBehospitalCode())
|
|
|
+ .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.setQcresultInfoId(qcresultInfo.getId());
|
|
|
+ medQcresultClick.setCasesEntryIds(sbFir.toString());
|
|
|
+ medQcresultClickService.save(medQcresultClick);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
public List<DeptBaseDTO> getQcClickDeptList(BasDeptInfoVO basDeptInfoVO) {
|
|
@@ -85,14 +146,14 @@ public class DataAnalysisFacade {
|
|
|
List<MedClickInfo> deptList = medClickInfoService.lambdaQuery()
|
|
|
.eq(MedClickInfo::getHospitalId, hospitalId)
|
|
|
.eq(MedClickInfo::getIsDeleted, IsDeleteEnum.N.getKey())
|
|
|
- .like(MedClickInfo::getDeptName,basDeptInfoVO.getInputStr())
|
|
|
+ .like(MedClickInfo::getDeptName, basDeptInfoVO.getInputStr())
|
|
|
.select(MedClickInfo::getDeptId, MedClickInfo::getDeptName)
|
|
|
.groupBy(MedClickInfo::getDeptId)
|
|
|
.groupBy(MedClickInfo::getDeptName)
|
|
|
.list();
|
|
|
- if(ListUtil.isNotEmpty(deptList)){
|
|
|
+ if (ListUtil.isNotEmpty(deptList)) {
|
|
|
for (MedClickInfo kfc : deptList) {
|
|
|
- if(null == kfc){
|
|
|
+ if (null == kfc) {
|
|
|
return deptDTO;
|
|
|
}
|
|
|
DeptBaseDTO deptBaseDTO = new DeptBaseDTO();
|
|
@@ -103,6 +164,7 @@ public class DataAnalysisFacade {
|
|
|
}
|
|
|
return deptDTO;
|
|
|
}
|
|
|
+
|
|
|
public List<GetQcClickDTO> getQcClick(GetQcClickVO getQcClickVO) {
|
|
|
clickPageSet(getQcClickVO);
|
|
|
List<GetQcClickDTO> records = medClickInfoService.getBaseMapper().getQcClick(getQcClickVO);
|
|
@@ -129,7 +191,7 @@ public class DataAnalysisFacade {
|
|
|
return records;
|
|
|
}
|
|
|
|
|
|
- public void getQcClickInnerPageByExport(HttpServletResponse response,GetQcClickInnerPageVO getQcClickInnerPageVO) {
|
|
|
+ public void getQcClickInnerPageByExport(HttpServletResponse response, GetQcClickInnerPageVO getQcClickInnerPageVO) {
|
|
|
getQcClickInnerPageVO.setCurrent(1L);
|
|
|
getQcClickInnerPageVO.setSize(Long.MAX_VALUE);
|
|
|
getQcClickInnerPageVO.setSearchCount(false);
|
|
@@ -139,148 +201,304 @@ public class DataAnalysisFacade {
|
|
|
}
|
|
|
|
|
|
public IPage<GetEntryDefectImproveDTO> getEntryDefectImprove(GetEntryDefectImproveVO getEntryDefectImproveVO) {
|
|
|
- entryDefectSet(getEntryDefectImproveVO);
|
|
|
- IPage<GetEntryDefectImproveDTO> records = medClickInfoService.getBaseMapper().getEntryDefectImprove(getEntryDefectImproveVO);
|
|
|
- return records;
|
|
|
- }
|
|
|
-
|
|
|
- public void getEntryDefectImproveByExport(HttpServletResponse response,GetEntryDefectImproveVO getEntryDefectImproveVO) {
|
|
|
+ long size = getEntryDefectImproveVO.getSize();
|
|
|
+ long current = getEntryDefectImproveVO.getCurrent();
|
|
|
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);
|
|
|
- }
|
|
|
+ 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();
|
|
|
+ for (BehospitalCodeInfo behospitalCodeInfo : behospitalCodeInfoList) {
|
|
|
+ //病历下
|
|
|
+ List<QcResultDetailInfo> qcResultDetailInfos = behospitalCodeInfo.getQcResultDetailInfos();
|
|
|
+ //获取科室下质控缺陷总量
|
|
|
+ totalMap = getEntryTotalMap(qcResultDetailInfos, totalMap);
|
|
|
+ //质控下获取科室下待改善总缺陷
|
|
|
+ QcResultDetailInfo qcResultDetailInfo = qcResultDetailInfos.get(qcResultDetailInfos.size() - 1);
|
|
|
+ improveleMap = getEntryImproveleMap(qcResultDetailInfo, improveleMap);
|
|
|
+ }
|
|
|
|
|
|
+ for (Map.Entry<String, Long> stringLongEntry : totalMap.entrySet()) {
|
|
|
+ GetEntryDefectImproveDTO getEntryDefectImprove = new GetEntryDefectImproveDTO();
|
|
|
+ getEntryDefectImprove.setDeptId(entryDefectImprove.getDeptId());
|
|
|
+ getEntryDefectImprove.setDeptName(entryDefectImprove.getDeptName());
|
|
|
+ getEntryDefectImprove.setEntryId(stringLongEntry.getKey());
|
|
|
+ entryInfo.parallelStream().filter(kfc->kfc.getEntryId().equals(stringLongEntry.getKey())).forEach(
|
|
|
+ obj->{
|
|
|
+ getEntryDefectImprove.setCasesId(obj.getCasesId());
|
|
|
+ getEntryDefectImprove.setCasesName(obj.getCasesName());
|
|
|
+ getEntryDefectImprove.setEntryName(obj.getEntryName());
|
|
|
+ }
|
|
|
+ );
|
|
|
+ getEntryDefectImprove.setTotalNum(stringLongEntry.getValue());
|
|
|
+ if(improveleMap.containsKey(stringLongEntry.getKey())){
|
|
|
+ getEntryDefectImprove.setImproveleNum(improveleMap.get(stringLongEntry.getKey()));
|
|
|
+ }
|
|
|
+ getEntryDefectImprove.setHandleNum(getEntryDefectImprove.getTotalNum()-getEntryDefectImprove.getImproveleNum());
|
|
|
+ getEntryDefectImproveDTO.add(getEntryDefectImprove);
|
|
|
+ }
|
|
|
+ System.out.println("getEntryDefectImproveDTO = " + getEntryDefectImproveDTO);
|
|
|
+ }
|
|
|
|
|
|
- public IPage<BehospitalInfoDTO> getEntryDefectImproveInner(GetEntryDefectImproveInnerVO getEntryDefectImproveInnerVO) {
|
|
|
- entryDefectInnerSet(getEntryDefectImproveInnerVO);
|
|
|
- IPage<BehospitalInfoDTO> records = medClickInfoService.getBaseMapper().getEntryDefectImproveInner(getEntryDefectImproveInnerVO);
|
|
|
- return records;
|
|
|
+
|
|
|
+ //导出操作
|
|
|
+ if(getEntryDefectImproveVO.getExportType()==1L){
|
|
|
+ size = getEntryDefectImproveDTO.size();
|
|
|
+ }
|
|
|
+ page.setSize(size);
|
|
|
+ page.setTotal(getEntryDefectImproveDTO.size());
|
|
|
+ page.setCurrent(current);
|
|
|
+ List<GetEntryDefectImproveDTO> getEntryDefectImproveDTOS = indexPaging(getEntryDefectImproveDTO, current, size);
|
|
|
+ String orderByAsc = null;
|
|
|
+ String orderByDesc = null;
|
|
|
+ for (Object order : getEntryDefectImproveVO.getOrders()) {
|
|
|
+ OrderItem e = (OrderItem) order;
|
|
|
+ String column = e.getColumn();
|
|
|
+ boolean asc = e.isAsc();
|
|
|
+ if(asc){
|
|
|
+ orderByAsc= column;
|
|
|
+ }else{
|
|
|
+ orderByDesc=column;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ // getEntryDefectImproveDTOS= sortList(getEntryDefectImproveDTOS, orderByAsc != null ? orderByAsc : orderByDesc);
|
|
|
+ page.setRecords(getEntryDefectImproveDTOS);
|
|
|
+ return new Page<>();
|
|
|
}
|
|
|
+ public List<GetEntryDefectImproveDTO> indexPaging(List<GetEntryDefectImproveDTO> retRecords ,long current,long size){
|
|
|
+ //数据返回索引处理
|
|
|
+ if(0 == current){
|
|
|
+ current = 1;
|
|
|
+ }
|
|
|
+ int startIndex = ((int)current -1)*10;
|
|
|
+ int endIndex = startIndex + (int) size;
|
|
|
|
|
|
- public void getDefectImproveInnerByExport(HttpServletResponse response,GetEntryDefectImproveInnerVO getEntryDefectImproveInnerVO) {
|
|
|
- entryDefectInnerSet(getEntryDefectImproveInnerVO);
|
|
|
- getEntryDefectImproveInnerVO.setCurrent(1L);
|
|
|
- getEntryDefectImproveInnerVO.setSize(Long.MAX_VALUE);
|
|
|
- getEntryDefectImproveInnerVO.setSearchCount(false);
|
|
|
- String fileName = "条目缺陷改善统计病历列表.xls";
|
|
|
- List<ExportExcelDTO> record = medClickInfoService.getBaseMapper().getDefectImproveInnerByExport(getEntryDefectImproveInnerVO);
|
|
|
- record.stream().forEach(kfc->{
|
|
|
- List<ExportExcelBehospitalDTO> excelBehospitalDTOS = kfc.getExcelBehospitalDTOS();
|
|
|
- Double avgScore = excelBehospitalDTOS.stream().parallel().collect(Collectors.averagingDouble(ExportExcelBehospitalDTO::getScore));
|
|
|
- kfc.setAvgScore(avgScore);
|
|
|
- });
|
|
|
- ExcelUtils.exportExcelUser(record, null, "sheet1", ExportExcelDTO.class, fileName, response);
|
|
|
+ if(retRecords.size()>1){
|
|
|
+ if( retRecords.size()-startIndex<(int)size){
|
|
|
+ retRecords = retRecords.subList(startIndex,retRecords.size());
|
|
|
+ }else{
|
|
|
+ retRecords = retRecords.subList(startIndex,endIndex );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return retRecords;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 增加全院记录
|
|
|
- *
|
|
|
- * @param records
|
|
|
+ * 内存数据排序 使用JoSQL
|
|
|
+ // * @param list
|
|
|
+ // * @param orderByString a asc,b desc
|
|
|
* @return
|
|
|
*/
|
|
|
- public GetQcClickDTO getGlobleTitle(List<GetQcClickDTO> records) {
|
|
|
- GetQcClickDTO item = new GetQcClickDTO();
|
|
|
- if (ListUtil.isEmpty(records)) {
|
|
|
- return null;
|
|
|
- }
|
|
|
|
|
|
- //缺陷总数
|
|
|
- Integer clickTol = records
|
|
|
- .stream()
|
|
|
- .map(GetQcClickDTO::getClickNum)
|
|
|
- .reduce(0, Integer::sum);
|
|
|
- if (clickTol == null) {
|
|
|
- clickTol = 0;
|
|
|
- }
|
|
|
- item.setDeptName("全院");
|
|
|
- item.setClickNum(clickTol);
|
|
|
- return item;
|
|
|
- }
|
|
|
|
|
|
- private void clickPageSet(GetQcClickVO getQcClickVO) {
|
|
|
- //入参验证
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
|
|
- Date startDate = null;
|
|
|
- Date endDate = null;
|
|
|
+/* 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 {
|
|
|
- startDate = simpleDateFormat.parse(getQcClickVO.getStartDate());
|
|
|
- endDate = simpleDateFormat.parse(getQcClickVO.getEndDate());
|
|
|
- } catch (ParseException e) {
|
|
|
+ query.parse(josql);
|
|
|
+ QueryResults results = query.execute(list);
|
|
|
+ list = results.getResults();
|
|
|
+ } catch (QueryParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (QueryExecutionException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- if (DateUtil.after(startDate,endDate)){
|
|
|
- throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间必须小于结束时间!");
|
|
|
+ return list;
|
|
|
+ }*/
|
|
|
+
|
|
|
+ public 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);
|
|
|
}
|
|
|
- getQcClickVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
|
|
|
+ totalMap = getSetEntryCount(totalMap, totalSet);
|
|
|
+ return totalMap;
|
|
|
}
|
|
|
|
|
|
- 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();
|
|
|
+ public 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 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;
|
|
|
}
|
|
|
- if (DateUtil.after(startDate,endDate)){
|
|
|
- throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间必须小于结束时间!");
|
|
|
+
|
|
|
+ public 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);
|
|
|
+ }
|
|
|
}
|
|
|
- getQcClickInnerPageVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
|
|
|
+ return map;
|
|
|
}
|
|
|
|
|
|
- private void entryDefectSet(GetEntryDefectImproveVO getEntryDefectImproveVO) {
|
|
|
- //入参验证
|
|
|
- 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();
|
|
|
+ public void getEntryDefectImproveByExport (HttpServletResponse response, GetEntryDefectImproveVO
|
|
|
+ getEntryDefectImproveVO){
|
|
|
+ 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);
|
|
|
}
|
|
|
- if (DateUtil.after(startDate,endDate)){
|
|
|
- throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间必须小于结束时间!");
|
|
|
+
|
|
|
+
|
|
|
+ public IPage<BehospitalInfoDTO> getEntryDefectImproveInner (GetEntryDefectImproveInnerVO
|
|
|
+ getEntryDefectImproveInnerVO){
|
|
|
+ entryDefectInnerSet(getEntryDefectImproveInnerVO);
|
|
|
+ IPage<BehospitalInfoDTO> records = medClickInfoService.getBaseMapper().getEntryDefectImproveInner(getEntryDefectImproveInnerVO);
|
|
|
+ return records;
|
|
|
}
|
|
|
- getEntryDefectImproveVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
|
|
|
- }
|
|
|
|
|
|
- private void entryDefectInnerSet(GetEntryDefectImproveInnerVO getEntryDefectImproveInnerVO) {
|
|
|
- //入参验证
|
|
|
- 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());
|
|
|
+ public void getDefectImproveInnerByExport (HttpServletResponse response, GetEntryDefectImproveInnerVO
|
|
|
+ getEntryDefectImproveInnerVO){
|
|
|
+ entryDefectInnerSet(getEntryDefectImproveInnerVO);
|
|
|
+ getEntryDefectImproveInnerVO.setCurrent(1L);
|
|
|
+ getEntryDefectImproveInnerVO.setSize(Long.MAX_VALUE);
|
|
|
+ getEntryDefectImproveInnerVO.setSearchCount(false);
|
|
|
+ String fileName = "条目缺陷改善统计病历列表.xls";
|
|
|
+ List<ExportExcelDTO> record = medClickInfoService.getBaseMapper().getDefectImproveInnerByExport(getEntryDefectImproveInnerVO);
|
|
|
+ record.stream().forEach(kfc -> {
|
|
|
+ List<ExportExcelBehospitalDTO> excelBehospitalDTOS = kfc.getExcelBehospitalDTOS();
|
|
|
+ Double avgScore = excelBehospitalDTOS.stream().parallel().collect(Collectors.averagingDouble(ExportExcelBehospitalDTO::getScore));
|
|
|
+ kfc.setAvgScore(avgScore);
|
|
|
+ });
|
|
|
+ ExcelUtils.exportExcelUser(record, null, "sheet1", ExportExcelDTO.class, fileName, response);
|
|
|
+ }
|
|
|
|
|
|
- } catch (ParseException e) {
|
|
|
- e.printStackTrace();
|
|
|
+ /**
|
|
|
+ * 增加全院记录
|
|
|
+ *
|
|
|
+ * @param records
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public GetQcClickDTO getGlobleTitle (List < GetQcClickDTO > records) {
|
|
|
+ GetQcClickDTO item = new GetQcClickDTO();
|
|
|
+ if (ListUtil.isEmpty(records)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ //缺陷总数
|
|
|
+ Integer clickTol = records
|
|
|
+ .stream()
|
|
|
+ .map(GetQcClickDTO::getClickNum)
|
|
|
+ .reduce(0, Integer::sum);
|
|
|
+ if (clickTol == null) {
|
|
|
+ clickTol = 0;
|
|
|
+ }
|
|
|
+ item.setDeptName("全院");
|
|
|
+ item.setClickNum(clickTol);
|
|
|
+ return item;
|
|
|
}
|
|
|
- if (DateUtil.after(startDate,endDate)){
|
|
|
- throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间必须小于结束时间!");
|
|
|
+
|
|
|
+ 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()));
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(getEntryDefectImproveInnerVO.getChTimeStart())
|
|
|
- && StringUtils.isNotBlank(getEntryDefectImproveInnerVO.getChTimeEnd())
|
|
|
- ){
|
|
|
- Date chTimeStartDate = null;
|
|
|
- Date chTimeEndDate = null;
|
|
|
+
|
|
|
+ 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){
|
|
|
+ //入参验证
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
|
|
+ Date startDate = null;
|
|
|
+ Date endDate = null;
|
|
|
try {
|
|
|
- chTimeStartDate = simpleDateFormat.parse(getEntryDefectImproveInnerVO.getChTimeStart());
|
|
|
- chTimeEndDate = simpleDateFormat.parse(getEntryDefectImproveInnerVO.getChTimeStart());
|
|
|
+ startDate = simpleDateFormat.parse(getEntryDefectImproveVO.getStartDate());
|
|
|
+ endDate = simpleDateFormat.parse(getEntryDefectImproveVO.getEndDate());
|
|
|
} catch (ParseException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- if (DateUtil.after(chTimeStartDate,chTimeEndDate)){
|
|
|
- throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "病历核查开始时间必须小于结束时间!");
|
|
|
+ if (DateUtil.after(startDate, endDate)) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间必须小于结束时间!");
|
|
|
+ }
|
|
|
+ getEntryDefectImproveVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
|
|
|
+ }
|
|
|
+
|
|
|
+ private void entryDefectInnerSet (GetEntryDefectImproveInnerVO getEntryDefectImproveInnerVO){
|
|
|
+ //入参验证
|
|
|
+ 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()));
|
|
|
}
|
|
|
- getEntryDefectImproveInnerVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
|
|
|
}
|
|
|
-}
|