| | |
| | | import java.io.FileNotFoundException; |
| | | import java.io.FileOutputStream; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.smartor.domain.BaseTag; |
| | | import com.smartor.domain.PatArchivetag; |
| | | import com.smartor.domain.PatUpInfoVO; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.mapper.BaseTagMapper; |
| | | import com.smartor.mapper.PatArchivetagMapper; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | |
| | | import org.apache.poi.ss.usermodel.*; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.core.parameters.P; |
| | | import org.springframework.stereotype.Service; |
| | | import com.smartor.mapper.PatArchiveMapper; |
| | | import com.smartor.domain.PatArchive; |
| | | import com.smartor.service.IPatArchiveService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | return "导出成功"; |
| | | } |
| | | |
| | | @Override |
| | | public List<PatArchive> patInfoByContion(PatArchiveReq patArchive) { |
| | | List<PatArchive> patArchives = new ArrayList<>(); |
| | | |
| | | //根据条件获取患者信息 |
| | | List<PatArchive> patArchiveList = patArchiveMapper.patInfoByContion(patArchive); |
| | | //根据患者ID进行分组 |
| | | Map<Long, List<PatArchive>> listMap = patArchiveList.stream().collect(Collectors.groupingBy(PatArchive::getPatid)); |
| | | |
| | | //对数据进行封装 |
| | | for (List<PatArchive> list : listMap.values()) { |
| | | PatArchive patArchive1 = new PatArchive(); |
| | | List<String> stringList = new ArrayList<>(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | if (i == 0) { |
| | | patArchive1 = DtoConversionUtils.sourceToTarget(list.get(0), PatArchive.class); |
| | | //将标签置空,不空也没有问题 |
| | | patArchive1.setTag(""); |
| | | } |
| | | //将查出的tag,放到patArchive1里的TagList中 |
| | | stringList.add(list.get(i).getTag()); |
| | | } |
| | | patArchive1.setTagList(stringList); |
| | | patArchives.add(patArchive1); |
| | | } |
| | | |
| | | return patArchives; |
| | | } |
| | | |
| | | @Override |
| | | public List<PatArchivetagAndPatientInfo> patTagByContion(List<Long> tagids) { |
| | | List<PatArchivetagAndPatientInfo> patArchivetagAndPatientInfos = new ArrayList<>(); |
| | | if (tagids.size() > 0) { |
| | | for (int i = 0; i < tagids.size(); i++) { |
| | | PatArchivetag patArchivetag = new PatArchivetag(); |
| | | patArchivetag.setTagid(tagids.get(i)); |
| | | //获取患者patid |
| | | List<PatArchivetag> patArchivetags1 = patArchivetagMapper.selectPatArchivetagAndBaseTagList(patArchivetag); |
| | | for (int j = 0; j < patArchivetags1.size(); j++) { |
| | | PatArchivetagAndPatientInfo patArchivetagAndPatientInfo = DtoConversionUtils.sourceToTarget(patArchivetags1.get(j), PatArchivetagAndPatientInfo.class); |
| | | PatArchive patArchive = new PatArchive(); |
| | | patArchive.setPatid(patArchivetagAndPatientInfo.getPatid()); |
| | | List<PatArchive> patArchiveList = patArchiveMapper.selectPatArchiveList(patArchive); |
| | | patArchivetagAndPatientInfo.setPatNum(patArchiveList.size()); |
| | | // patArchivetagAndPatientInfo.setPatArchives(patArchiveList); |
| | | patArchivetagAndPatientInfos.add(patArchivetagAndPatientInfo); |
| | | } |
| | | } |
| | | } else { |
| | | PatArchivetag patArchivetag = new PatArchivetag(); |
| | | //获取患者patid |
| | | List<PatArchivetag> patArchivetags1 = patArchivetagMapper.selectPatArchivetagAndBaseTagList(patArchivetag); |
| | | for (int j = 0; j < patArchivetags1.size(); j++) { |
| | | PatArchivetagAndPatientInfo patArchivetagAndPatientInfo = DtoConversionUtils.sourceToTarget(patArchivetags1.get(j), PatArchivetagAndPatientInfo.class); |
| | | PatArchive patArchive = new PatArchive(); |
| | | patArchive.setPatid(patArchivetagAndPatientInfo.getPatid()); |
| | | List<PatArchive> patArchiveList = patArchiveMapper.selectPatArchiveList(patArchive); |
| | | // patArchivetagAndPatientInfo.setPatArchives(patArchiveList); |
| | | patArchivetagAndPatientInfo.setPatNum(patArchiveList.size()); |
| | | patArchivetagAndPatientInfos.add(patArchivetagAndPatientInfo); |
| | | } |
| | | } |
| | | return patArchivetagAndPatientInfos; |
| | | } |
| | | |
| | | @Override |
| | | public List<PatArchivetagAndPatientInfo> patInfoByTag(List<Long> tagids) { |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | return null; |
| | | } |
| | | |
| | | private void getdata(Row row, PatArchive patArchive, Boolean head) { |
| | | if (head) { |
| | | row.createCell(0).setCellValue("姓名"); |