报告查询接口
This commit is contained in:
parent
bfa73c1deb
commit
0e8942ee71
@ -1,9 +1,12 @@
|
|||||||
package com.transitPlatForm.transitPF.controller;
|
package com.transitPlatForm.transitPF.controller;
|
||||||
|
|
||||||
import com.transitPlatForm.common.core.controller.BaseController;
|
import com.transitPlatForm.common.core.controller.BaseController;
|
||||||
|
import com.transitPlatForm.common.core.domain.Result;
|
||||||
|
import com.transitPlatForm.common.core.domain.entity.reg.RegReportFile;
|
||||||
import com.transitPlatForm.common.core.page.TableDataInfo;
|
import com.transitPlatForm.common.core.page.TableDataInfo;
|
||||||
import com.transitPlatForm.transitPF.mapper.RegLisReportMapper;
|
import com.transitPlatForm.transitPF.mapper.RegLisReportMapper;
|
||||||
import com.transitPlatForm.transitPF.pojo.RegGetReportsList;
|
import com.transitPlatForm.transitPF.pojo.RegGetReportsList;
|
||||||
|
import com.transitPlatForm.transitPF.service.RegLisReportService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -12,6 +15,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -26,6 +30,8 @@ public class RegLisReportController extends BaseController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
RegLisReportMapper regLisReportMapper;
|
RegLisReportMapper regLisReportMapper;
|
||||||
|
@Resource
|
||||||
|
private RegLisReportService regLisReportService;
|
||||||
|
|
||||||
@ApiOperation("检验报告数据")
|
@ApiOperation("检验报告数据")
|
||||||
@GetMapping("/lisReportList")
|
@GetMapping("/lisReportList")
|
||||||
@ -37,14 +43,23 @@ public class RegLisReportController extends BaseController {
|
|||||||
|
|
||||||
@ApiOperation("获取报告明细数据")
|
@ApiOperation("获取报告明细数据")
|
||||||
@GetMapping("/reportDetail")
|
@GetMapping("/reportDetail")
|
||||||
public List<Map<String,Object>> getLisReportDetail(String bgdh){
|
public Result getLisReportDetail(String bgdh){
|
||||||
return regLisReportMapper.getLisReportDetail(bgdh);
|
List<Map<String, Object>> lisReportDetailList = regLisReportMapper.getLisReportDetail(bgdh);
|
||||||
|
return new Result("0", "查询成功!", lisReportDetailList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("获取细菌报告数据")
|
@ApiOperation("获取细菌报告明细数据")
|
||||||
@GetMapping("/reportDetailMed")
|
@GetMapping("/reportDetailMed")
|
||||||
public List<Map<String,Object>> getRegGetresultmed(String bgdh,String xmdh){
|
public Result getRegGetresultmed(String bgdh,String xmdh){
|
||||||
return regLisReportMapper.getRegGetresultmed(bgdh,xmdh);
|
List<Map<String, Object>> regGetresultmedList = regLisReportMapper.getRegGetresultmed(bgdh, xmdh);
|
||||||
|
return new Result("0","查询成功!",regGetresultmedList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("打印报告单")
|
||||||
|
@GetMapping("/printLisReport")
|
||||||
|
public Result printLisReport(String bgdh){
|
||||||
|
//RegReportFile regReportFile = regLisReportMapper.getRegReportFile(bgdh);
|
||||||
|
return regLisReportService.printLisReport(bgdh);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.transitPlatForm.transitPF.controller;
|
package com.transitPlatForm.transitPF.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.transitPlatForm.common.annotation.Anonymous;
|
import com.transitPlatForm.common.annotation.Anonymous;
|
||||||
import com.transitPlatForm.common.core.controller.BaseController;
|
import com.transitPlatForm.common.core.controller.BaseController;
|
||||||
import com.transitPlatForm.common.core.domain.Result;
|
import com.transitPlatForm.common.core.domain.Result;
|
||||||
@ -38,6 +39,10 @@ public class RegTransitSampleController extends BaseController {
|
|||||||
@GetMapping("/querySample")
|
@GetMapping("/querySample")
|
||||||
public TableDataInfo getQuerySample(RegTransitSample regTransitSample) {
|
public TableDataInfo getQuerySample(RegTransitSample regTransitSample) {
|
||||||
startPage();
|
startPage();
|
||||||
|
String dateStart = DateUtil.format(regTransitSample.getDateStart(), "yyyy-MM-dd") + " 00:00:00";
|
||||||
|
String dateEnd = DateUtil.format(regTransitSample.getDateEnd(), "yyyy-MM-dd") + " 23:59:59";
|
||||||
|
regTransitSample.setDateStart(DateUtil.parse(dateStart,"yyyy-MM-dd HH:mm:ss"));
|
||||||
|
regTransitSample.setDateEnd(DateUtil.parse(dateEnd,"yyyy-MM-dd HH:mm:ss"));
|
||||||
List<RegTransitSample> regTransitSampleList = regTransitSampleService.getRegTransitSample(regTransitSample);
|
List<RegTransitSample> regTransitSampleList = regTransitSampleService.getRegTransitSample(regTransitSample);
|
||||||
return getDataTable(regTransitSampleList);
|
return getDataTable(regTransitSampleList);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.transitPlatForm.transitPF.mapper;
|
package com.transitPlatForm.transitPF.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.transitPlatForm.common.core.domain.entity.reg.RegReportFile;
|
||||||
import com.transitPlatForm.transitPF.pojo.RegGetReportsList;
|
import com.transitPlatForm.transitPF.pojo.RegGetReportsList;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@ -11,4 +12,5 @@ public interface RegLisReportMapper {
|
|||||||
List<Map<String, Object>> getLisReportList(RegGetReportsList regGetReportsList);
|
List<Map<String, Object>> getLisReportList(RegGetReportsList regGetReportsList);
|
||||||
List<Map<String,Object>> getLisReportDetail(String bgdh);
|
List<Map<String,Object>> getLisReportDetail(String bgdh);
|
||||||
List<Map<String, Object>> getRegGetresultmed(@Param("bgdh") String bgdh ,@Param("xmdh") String xmdh);
|
List<Map<String, Object>> getRegGetresultmed(@Param("bgdh") String bgdh ,@Param("xmdh") String xmdh);
|
||||||
|
RegReportFile getRegReportFile(String bgdh);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,9 @@
|
|||||||
|
package com.transitPlatForm.transitPF.service;
|
||||||
|
|
||||||
|
import com.transitPlatForm.common.core.domain.Result;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface RegLisReportService {
|
||||||
|
Result printLisReport(String bgdh);
|
||||||
|
}
|
||||||
@ -144,7 +144,7 @@ public class RegHospitalServiceImpl implements RegHospitalService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertHospital(RegHospital hospital) {
|
public int insertHospital(RegHospital hospital) {
|
||||||
return regHospitalUtil.updateHospital(hospital);
|
return regHospitalUtil.insertHospital(hospital);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -154,7 +154,6 @@ public class RegHospitalServiceImpl implements RegHospitalService {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateHospital(RegHospital Hospital) {
|
public int updateHospital(RegHospital Hospital) {return regHospitalUtil.updateHospital(Hospital);
|
||||||
return hospitalMapper.updateHospital(Hospital);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,23 @@
|
|||||||
|
package com.transitPlatForm.transitPF.service.impl;
|
||||||
|
|
||||||
|
import com.transitPlatForm.common.core.domain.Result;
|
||||||
|
import com.transitPlatForm.common.core.domain.entity.reg.RegReportFile;
|
||||||
|
import com.transitPlatForm.transitPF.mapper.RegLisReportMapper;
|
||||||
|
import com.transitPlatForm.transitPF.service.RegLisReportService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class RegLisReportServiceImpl implements RegLisReportService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
RegLisReportMapper regLisReportMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result printLisReport(String bgdh) {
|
||||||
|
RegReportFile regReportFile = regLisReportMapper.getRegReportFile(bgdh);
|
||||||
|
return new Result("0","查询成功",regReportFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -18,7 +18,7 @@ public class RegHospitalUtil {
|
|||||||
private SysDeptMapper deptMapper;
|
private SysDeptMapper deptMapper;
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int updateHospital(RegHospital hospital){
|
public int insertHospital(RegHospital hospital){
|
||||||
//新增部门数据
|
//新增部门数据
|
||||||
SysDept sysDept = new SysDept();
|
SysDept sysDept = new SysDept();
|
||||||
sysDept.setParentId(202L);
|
sysDept.setParentId(202L);
|
||||||
@ -35,8 +35,15 @@ public class RegHospitalUtil {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public int updateHospital(RegHospital regHospital){
|
||||||
|
//修改部门数据
|
||||||
|
SysDept sysDept = new SysDept();
|
||||||
|
sysDept.setDeptId(Long.parseLong(regHospital.getDept()));
|
||||||
|
sysDept.setStatus(regHospital.getStatus());
|
||||||
|
sysDept.setDeptName(regHospital.getHospitalName());
|
||||||
|
deptMapper.updateDept(sysDept);
|
||||||
|
return hospitalMapper.updateHospital(regHospital);
|
||||||
|
|
||||||
// public String getDeptId(String hospitalName){
|
}
|
||||||
// deptMapper.selectDeptList()
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,159 @@
|
|||||||
|
package com.transitPlatForm.transitPF.service.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.codec.Base64;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.transitPlatForm.common.config.RuoYiConfig;
|
||||||
|
import com.transitPlatForm.common.core.domain.Result;
|
||||||
|
import com.transitPlatForm.common.core.domain.entity.reg.RegReportFile;
|
||||||
|
import com.transitPlatForm.common.utils.file.FileUtils;
|
||||||
|
import com.transitPlatForm.interfaceCommon.utils.LisUtil;
|
||||||
|
import com.transitPlatForm.interfaceCommon.utils.PdfPaperConverter;
|
||||||
|
import com.transitPlatForm.interfaceCommon.utils.ReportUtil;
|
||||||
|
import com.transitPlatForm.transitPF.mapper.RegLisReportMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class RegLisReportUtil {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
RegLisReportMapper regLisReportMapper;
|
||||||
|
@Autowired
|
||||||
|
ReportUtil reportUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打印报告单
|
||||||
|
* @param bgdhList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Result printReport(List<String> bgdhList) {
|
||||||
|
List<Map<String,Object>> bgdhBase64List = new ArrayList<>();
|
||||||
|
List<String> mergeBgdhList = new ArrayList<>();
|
||||||
|
int j = 0;
|
||||||
|
for (String bgdh : bgdhList) {
|
||||||
|
String[] stringParam = StrUtil.splitToArray(bgdh, "|");
|
||||||
|
if(stringParam.length != 3) return new Result("-1","传入的报告单号不对!"+ Arrays.toString(stringParam));
|
||||||
|
RegReportFile regReportFile = regLisReportMapper.getRegReportFile(bgdh);
|
||||||
|
if(regReportFile == null) return new Result("-1","没有找到对应的pdf报告信息!");
|
||||||
|
|
||||||
|
String base64PDF = regReportFile.getReport();
|
||||||
|
if(base64PDF == null || base64PDF.equals("")) continue;
|
||||||
|
mergeBgdhList.add(bgdh);
|
||||||
|
}
|
||||||
|
//log.info("bgdhBase64List:"+bgdhBase64List);
|
||||||
|
//过滤A4的报告单
|
||||||
|
List<Map<String, Object>> collectA4 = bgdhBase64List.stream().filter(bgdhBase64 -> bgdhBase64.get("pageType").equals("A4")).collect(Collectors.toList());
|
||||||
|
for (Map<String, Object> stringObjectMap : collectA4) {
|
||||||
|
mergeBgdhList.add(stringObjectMap.get("data").toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
//过滤A5格式报告单
|
||||||
|
List<Map<String, Object>> collectA5 = bgdhBase64List.stream().filter(bgdhBase64 -> bgdhBase64.get("pageType").equals("A5")).collect(Collectors.toList());
|
||||||
|
//其中有可能格式虽然是A5,实际尺寸是A4,需要进行处理
|
||||||
|
for (Map<String, Object> stringObjectMap : collectA5) {
|
||||||
|
String bas64Str = stringObjectMap.get("data").toString();
|
||||||
|
if(!PdfPaperConverter.isBase64PdfA4(bas64Str)) continue;
|
||||||
|
try {
|
||||||
|
String base64_A5 = PdfPaperConverter.convertBase64PdfToA5IfConfigured(bas64Str, "A5");
|
||||||
|
stringObjectMap.put("data", base64_A5);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("裁剪pdf出错:",e);
|
||||||
|
return new Result("0","裁剪pdf出错!"+e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//log.info("collectA5:"+collectA5);
|
||||||
|
|
||||||
|
//对A5格式的报告单进行排序
|
||||||
|
collectA5.sort(new Comparator<Map<String, Object>>() {
|
||||||
|
@Override
|
||||||
|
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
|
||||||
|
String brdh1 = o1.get("brdh").toString().trim() ;
|
||||||
|
String brdh2 = o2.get("brdh").toString().trim() ;
|
||||||
|
int i = brdh1.compareTo(brdh2);
|
||||||
|
if(i == 0){
|
||||||
|
Date confirmdt1 = (Date) o1.get("confirmdt");
|
||||||
|
Date confirmdt2 = (Date) o2.get("confirmdt");
|
||||||
|
return confirmdt1.compareTo(confirmdt2);
|
||||||
|
}else{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//合并A5格式的pdf为A4格式
|
||||||
|
String A5BlankStr = "";
|
||||||
|
for (int i = 0; i < collectA5.size(); i++) {
|
||||||
|
if(i+1 >= collectA5.size()){
|
||||||
|
//代表到了最后一个单数,把这个A5格式的先转换成A4格式的pdf
|
||||||
|
try {
|
||||||
|
A5BlankStr = reportUtil.convertA5ToA4Blank(collectA5.get(i).get("data").toString());
|
||||||
|
//旋转90度,把之前的文件变成pdf
|
||||||
|
String path2 = RuoYiConfig.getProfile() +"/config/static/printPDF/"+UUID.randomUUID().toString()+".pdf";
|
||||||
|
String path3 = RuoYiConfig.getProfile() +"/config/static/printPDF/"+UUID.randomUUID().toString()+".pdf";
|
||||||
|
cn.hutool.core.codec.Base64.decodeToFile(A5BlankStr,new File(path2));
|
||||||
|
reportUtil.rotatePdf90Degrees(path2,path3,1);
|
||||||
|
A5BlankStr = cn.hutool.core.codec.Base64.encode(new File(path3));
|
||||||
|
//删除文件
|
||||||
|
FileUtils.deleteFile(path2);
|
||||||
|
FileUtils.deleteFile(path3);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("把A5格式的pdf增加空白变成A4格式的pdf失败:",e);
|
||||||
|
}
|
||||||
|
mergeBgdhList.add(A5BlankStr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
String path = RuoYiConfig.getProfile() +"/config/static/printPDF/"+UUID.randomUUID().toString()+".pdf";
|
||||||
|
String path1 = RuoYiConfig.getProfile() +"/config/static/printPDF/"+UUID.randomUUID().toString()+".pdf";
|
||||||
|
try {
|
||||||
|
reportUtil.mergePdfsHorizontally(collectA5.get(i).get("data").toString(),collectA5.get(i+1).get("data").toString(),path);
|
||||||
|
//旋转90度
|
||||||
|
reportUtil.rotatePdf90Degrees(path,path1,1);
|
||||||
|
File file = new File(path1);
|
||||||
|
mergeBgdhList.add(cn.hutool.core.codec.Base64.encode(file));
|
||||||
|
//删除文件
|
||||||
|
FileUtils.deleteFile(path);
|
||||||
|
FileUtils.deleteFile(path1);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("合并报告单出错:",e);
|
||||||
|
return new Result("-1","合并报告单出错"+e.getMessage());
|
||||||
|
}
|
||||||
|
i=i+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
String encode = "";
|
||||||
|
try {
|
||||||
|
//合并成一个pdf交给前端
|
||||||
|
String pdfName = UUID.randomUUID().toString();
|
||||||
|
String path = RuoYiConfig.getProfile() +"/config/static/printPDF/"+pdfName+".pdf";
|
||||||
|
LisUtil.mergeToFile(mergeBgdhList,path);
|
||||||
|
//String httpPath = reportUtil.getPrintURL(pdfName);
|
||||||
|
//转成base64字符串
|
||||||
|
File file = new File(path);
|
||||||
|
encode = Base64.encode(file);
|
||||||
|
//删除pdf文件
|
||||||
|
FileUtils.deleteFile(path);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
//log.error("合并pdf:{}报告失败:{}",bgdh,e);
|
||||||
|
return new Result("-1",e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改打印标志
|
||||||
|
// for (String string : bgdh) {
|
||||||
|
// updatePrintStatus(string);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
return new Result("0","打印成功!",encode);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -25,4 +25,8 @@
|
|||||||
<if test="xmdh != null and xmdh !=''">and xmdh = #{xmdh}</if>
|
<if test="xmdh != null and xmdh !=''">and xmdh = #{xmdh}</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getRegReportFile" resultType="com.transitPlatForm.common.core.domain.entity.reg.RegReportFile">
|
||||||
|
select * from reg_report_file where ReportNo = #{bgdh}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
x
Reference in New Issue
Block a user