|
@@ -1,23 +1,25 @@
|
|
|
package com.diagbot.facade;
|
|
|
+
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.diagbot.dto.QcCasesAllDTO;
|
|
|
import com.diagbot.dto.QcCasesDTO;
|
|
|
-import com.diagbot.dto.QcHospitalInfoAllDTO;
|
|
|
+import com.diagbot.entity.CasesEntryHospital;
|
|
|
import com.diagbot.entity.QcCases;
|
|
|
import com.diagbot.entity.QcCasesEntry;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
-import com.diagbot.service.QcCasesEntryService;
|
|
|
import com.diagbot.service.QcCasesService;
|
|
|
import com.diagbot.service.impl.QcCasesServiceImpl;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.EntityUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
+import com.diagbot.vo.GetAllByHospitalVO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author wangfeng
|
|
@@ -31,6 +33,8 @@ public class QcCasesFacade extends QcCasesServiceImpl {
|
|
|
QcCasesService qcCasesService;
|
|
|
@Autowired
|
|
|
QcCacesEntryFacade qcCasesEntryService;
|
|
|
+ @Autowired
|
|
|
+ CasesEntryHospitalFacade casesEntryHospitalFacade;
|
|
|
|
|
|
public List<QcCasesAllDTO> getAlls() {
|
|
|
//查出所有病例
|
|
@@ -45,7 +49,7 @@ public class QcCasesFacade extends QcCasesServiceImpl {
|
|
|
QueryWrapper<QcCasesEntry> qcCasesEntryQuery = new QueryWrapper<>();
|
|
|
qcCasesEntryQuery
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .orderByDesc("gmt_modified");
|
|
|
+ .orderByDesc("level_no");
|
|
|
List<QcCasesEntry> dataEntry = qcCasesEntryService.list(qcCasesEntryQuery);
|
|
|
// 然后把所有病例类型放进去
|
|
|
Map<Long, List<QcCasesEntry>> map
|
|
@@ -63,6 +67,47 @@ public class QcCasesFacade extends QcCasesServiceImpl {
|
|
|
return dataNew;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public List<QcCasesAllDTO> getAllByHospital(GetAllByHospitalVO getAllByHospitalVO){
|
|
|
+ //查出所有病例
|
|
|
+ QueryWrapper<QcCases> qcCasesQuery = new QueryWrapper<>();
|
|
|
+ qcCasesQuery
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .orderByAsc("id");
|
|
|
+ List<QcCases> data = list(qcCasesQuery);
|
|
|
+ List<QcCasesAllDTO> dataNew = new ArrayList<QcCasesAllDTO>();
|
|
|
+ dataNew = BeanUtil.listCopyTo(data, QcCasesAllDTO.class);
|
|
|
+ // 查出所有病例病例类型
|
|
|
+ QueryWrapper<QcCasesEntry> qcCasesEntryQuery = new QueryWrapper<>();
|
|
|
+ qcCasesEntryQuery
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .orderByDesc("level_no");
|
|
|
+ List<QcCasesEntry> dataEntry = qcCasesEntryService.list(qcCasesEntryQuery);
|
|
|
+ // 然后把所有病例类型放进去
|
|
|
+ Map<Long, List<QcCasesEntry>> map
|
|
|
+ = EntityUtil.makeEntityListMap(dataEntry, "casesId");
|
|
|
+ //List<QcCases> data = qcCasesService.list();
|
|
|
+ //查询病例和医院的关联关系
|
|
|
+ QueryWrapper<CasesEntryHospital> casesEntryHospitalQueryWrapper = new QueryWrapper<>();
|
|
|
+ casesEntryHospitalQueryWrapper
|
|
|
+ .eq("is_deleted",IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id",getAllByHospitalVO.getHospitalId());
|
|
|
+ Map<Long,CasesEntryHospital> casesEntryHospitalMap = casesEntryHospitalFacade.list(casesEntryHospitalQueryWrapper).stream().collect(Collectors.toMap(CasesEntryHospital::getCasesEntryId,casesEntryHospital -> casesEntryHospital));
|
|
|
+ List<QcCasesEntry> tmp = new ArrayList<>();
|
|
|
+ //把模板放进文件夹中
|
|
|
+ if (dataNew.size() > 0) {
|
|
|
+ for (QcCasesAllDTO ts : dataNew) {
|
|
|
+ for (QcCasesEntry qcCasesEntry : map.get(ts.getId())) {
|
|
|
+ if(casesEntryHospitalMap.get(qcCasesEntry.getId()) != null){
|
|
|
+ tmp.add(qcCasesEntry);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ts.setQcCasesEntry(tmp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return dataNew;
|
|
|
+ }
|
|
|
+
|
|
|
public List<QcCasesDTO> getCasesAll() {
|
|
|
List<QcCases> data = qcCasesService.list();
|
|
|
List<QcCasesDTO> dataNew = new ArrayList<QcCasesDTO>();
|