批量打印 ,批量调整
This commit is contained in:
parent
6cd30879db
commit
a7b2592c0a
@ -0,0 +1,46 @@
|
||||
package com.czlis.liswork.controller.work;
|
||||
|
||||
|
||||
import com.czlis.common.core.controller.BaseController;
|
||||
import com.czlis.common.core.domain.Result;
|
||||
import com.czlis.liswork.pojo.VO.BatchInVO;
|
||||
import com.czlis.liswork.service.BatchInService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 批量输入
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/batchIn")
|
||||
@Slf4j
|
||||
@Api(tags = "批量输入")
|
||||
public class BatchInController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private BatchInService batchInService;
|
||||
|
||||
|
||||
@ApiOperation("获取模版数据")
|
||||
@GetMapping("/getInputMdl")
|
||||
public Result getInputMdl(String yq){
|
||||
return batchInService.getInputMdl(yq);
|
||||
}
|
||||
|
||||
@ApiOperation("获取模版明细数据")
|
||||
@GetMapping("/getInputMdlDetail")
|
||||
public Result getInputMdlDetail(String yq,String mbmc){
|
||||
return batchInService.getInputMdlDetail(yq,mbmc);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("确认模版数据")
|
||||
@PostMapping("/confirmInputMdl")
|
||||
public Result confirmInputMdl(@RequestBody BatchInVO batchInVO){
|
||||
batchInVO.setYhdh(getUsername());
|
||||
return batchInService.confirmInputMdl(batchInVO);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.czlis.liswork.controller.work;
|
||||
|
||||
import com.czlis.common.core.domain.Result;
|
||||
import com.czlis.liswork.pojo.VO.BatchPrintQueryVO;
|
||||
import com.czlis.liswork.pojo.VO.BatchPrintVO;
|
||||
import com.czlis.liswork.service.BatchPrintService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 批量打印
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/batchPrint")
|
||||
@Slf4j
|
||||
@Api(tags = "批量打印")
|
||||
public class BatchPrintController {
|
||||
|
||||
@Autowired
|
||||
BatchPrintService batchPrintService;
|
||||
|
||||
@ApiOperation("打印数据")
|
||||
@PostMapping("/printAll")
|
||||
public Result printAll(@RequestBody List<BatchPrintVO> batchPrintVOList){
|
||||
return batchPrintService.printAll(batchPrintVOList);
|
||||
}
|
||||
|
||||
@ApiOperation("查询需要打印的数据")
|
||||
@PostMapping("/queryList")
|
||||
public Result queryList(@RequestBody BatchPrintQueryVO batchPrintQueryVO){
|
||||
return batchPrintService.queryList(batchPrintQueryVO);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package com.czlis.liswork.mapper.work;
|
||||
|
||||
import com.czlis.liswork.pojo.VO.BatchPrintQueryVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface BatchPrintMapper {
|
||||
List<Map<String,Object>> queryList(BatchPrintQueryVO batchPrintQueryVO);
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package com.czlis.liswork.pojo.VO;
|
||||
|
||||
|
||||
import com.czlis.common.core.domain.entity.lis.LabInputmdlDetail;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class BatchInVO {
|
||||
private String yq;
|
||||
private Date jyrq;
|
||||
private String ybh;
|
||||
private String mbmc;
|
||||
private String yblx;
|
||||
private String yhdh;
|
||||
private List<LabInputmdlDetail> labInputmdlDetailList;
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.czlis.liswork.pojo.VO;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BatchPrintQueryVO {
|
||||
private Date jyrq;
|
||||
@NotBlank(message = "样本号不能为空")
|
||||
private String ybh;
|
||||
private String brly;
|
||||
private String ksdh;
|
||||
private String yq;
|
||||
private String notksdh;
|
||||
private String notbrly;
|
||||
private String fzdy;
|
||||
private String dybz;
|
||||
private String jgbz;
|
||||
private String sorttype;
|
||||
private String nobrxm;
|
||||
private String nocsjg;
|
||||
private String jgbz2;
|
||||
private String yqz;
|
||||
private String dyyx;
|
||||
private String pcyx;
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.czlis.liswork.pojo.VO;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class BatchPrintVO {
|
||||
private Date jyrq;
|
||||
private String yq;
|
||||
private String ybh;
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.czlis.liswork.service;
|
||||
|
||||
import com.czlis.common.core.domain.Result;
|
||||
import com.czlis.liswork.pojo.VO.BatchInVO;
|
||||
|
||||
public interface BatchInService {
|
||||
Result getInputMdl(String yq);
|
||||
|
||||
Result getInputMdlDetail(String yq, String mbmc);
|
||||
|
||||
Result confirmInputMdl(BatchInVO batchInVO);
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.czlis.liswork.service;
|
||||
|
||||
import com.czlis.common.core.domain.Result;
|
||||
import com.czlis.liswork.pojo.VO.BatchPrintQueryVO;
|
||||
import com.czlis.liswork.pojo.VO.BatchPrintVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BatchPrintService {
|
||||
Result printAll(List<BatchPrintVO> batchPrintVOList);
|
||||
|
||||
Result queryList(BatchPrintQueryVO batchPrintQueryVO);
|
||||
}
|
||||
@ -0,0 +1,112 @@
|
||||
package com.czlis.liswork.service.impl.work;
|
||||
|
||||
import com.czlis.common.core.domain.Result;
|
||||
import com.czlis.common.core.domain.entity.lis.LabInputmdl;
|
||||
import com.czlis.common.core.domain.entity.lis.LabInputmdlDetail;
|
||||
import com.czlis.common.core.domain.entity.lis.LabPat;
|
||||
import com.czlis.common.core.domain.entity.lis.LabResult;
|
||||
import com.czlis.common.utils.DateUtils;
|
||||
import com.czlis.interfaceCommon.utils.CommonUtil;
|
||||
import com.czlis.interfaceCommon.utils.LisUtil;
|
||||
import com.czlis.interfaceCommon.utils.LisWorkBase;
|
||||
import com.czlis.liswork.pojo.VO.BatchInVO;
|
||||
import com.czlis.liswork.service.BatchInService;
|
||||
import com.czlis.liswork.utils.LisCommonUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BatchInServiceImpl implements BatchInService {
|
||||
|
||||
@Autowired
|
||||
CommonUtil commonUtil;
|
||||
@Autowired
|
||||
LisWorkBase lisWorkBase;
|
||||
@Resource
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public Result getInputMdl(String yq) {
|
||||
List<LabInputmdl> labInputmdlList = commonUtil.getLabInputmdl(yq);
|
||||
return new Result("0","操作成功",labInputmdlList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getInputMdlDetail(String yq, String mbmc) {
|
||||
List<LabInputmdlDetail> labInputmdlDetailList = commonUtil.getLabInputmdlDetail(yq, mbmc);
|
||||
return new Result("0","查询成功!",labInputmdlDetailList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result confirmInputMdl(BatchInVO batchInVO) {
|
||||
String yq = batchInVO.getYq();
|
||||
|
||||
Result result = LisCommonUtil.changeYBHToList(batchInVO.getYbh());
|
||||
if(!result.getCode().equals("0")) return result;
|
||||
List<String> ybhList = (List) result.getData();
|
||||
List<String> resultList = new ArrayList<>();
|
||||
for (String ybh : ybhList) {
|
||||
LabPat labPatOne = commonUtil.getLabPatOne(batchInVO.getJyrq(), batchInVO.getYq(), ybh);
|
||||
if(!lisWorkBase.canmodifysample(labPatOne)) return new Result("-1","样本号:"+ybh+",没有修改权限!");
|
||||
List<LabInputmdlDetail> labInputmdlDetailList = batchInVO.getLabInputmdlDetailList();
|
||||
for (LabInputmdlDetail labInputmdlDetail : labInputmdlDetailList) {
|
||||
LabResult labResult = commonUtil.getLabResult(batchInVO.getJyrq(), yq, ybh, labInputmdlDetail.getXmdh());
|
||||
if(labResult != null){
|
||||
String csjg = LisUtil.isBank(labResult.getCsjg());
|
||||
String mrz = LisUtil.isBank(labInputmdlDetail.getMrz());
|
||||
if(csjg.equals(mrz)) continue;
|
||||
}
|
||||
LabResult labResult1 = new LabResult();
|
||||
labResult1.setJyrq(batchInVO.getJyrq());
|
||||
labResult1.setYq(yq);
|
||||
labResult1.setYbh(ybh);
|
||||
labResult1.setXmdh(labInputmdlDetail.getXmdh());
|
||||
labResult1.setCsjg(labInputmdlDetail.getMrz());
|
||||
//TODO 这里是不是需要增加一个jgbz字段 写入
|
||||
//labResult1.setJgbz("M");
|
||||
applicationContext.getBean(BatchInServiceImpl.class).updateLabResult(labResult1);
|
||||
|
||||
|
||||
//TODO 增加计算项目
|
||||
|
||||
}
|
||||
|
||||
//更新标本上传标志和操作员
|
||||
LabPat labPat = new LabPat();
|
||||
labPat.setLastuser(batchInVO.getYhdh());
|
||||
labPat.setLastdt(commonUtil.getCurrentTime());
|
||||
labPat.setJgbz("0");
|
||||
labPat.setYblx(batchInVO.getYblx());
|
||||
labPat.setJyrq(batchInVO.getJyrq());
|
||||
labPat.setYq(yq);
|
||||
labPat.setYbh(ybh);
|
||||
commonUtil.updateLabPat(labPat);
|
||||
resultList.add("样本号:"+ybh+",添加成功!");
|
||||
//写日志
|
||||
lisWorkBase.setpatLog(batchInVO.getJyrq(), yq, batchInVO.getYbh(), batchInVO.getYhdh());
|
||||
}
|
||||
|
||||
|
||||
return new Result("0","操作成功!",resultList);
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public void updateLabResult(LabResult labResult){
|
||||
String csjg = labResult.getCsjg();
|
||||
labResult.setCsjg(null);
|
||||
commonUtil.delLabResult(labResult);
|
||||
labResult.setCsjg(csjg);
|
||||
commonUtil.insertLabResult(labResult);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
package com.czlis.liswork.service.impl.work;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czlis.common.core.domain.Result;
|
||||
import com.czlis.common.core.domain.entity.lis.LabInstr;
|
||||
import com.czlis.interfaceCommon.utils.CommonUtil;
|
||||
import com.czlis.liswork.mapper.work.BatchPrintMapper;
|
||||
import com.czlis.liswork.pojo.VO.BatchPrintQueryVO;
|
||||
import com.czlis.liswork.pojo.VO.BatchPrintVO;
|
||||
import com.czlis.liswork.service.BatchPrintService;
|
||||
import com.czlis.liswork.utils.LisCommonUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BatchPrintServiceImpl implements BatchPrintService {
|
||||
|
||||
@Autowired
|
||||
CommonUtil commonUtil;
|
||||
@Autowired
|
||||
BatchPrintMapper batchPrintMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public Result printAll(List<BatchPrintVO> batchPrintVOList) {
|
||||
//TODO 直接过滤掉未审核的报告了,如果需要后面再加吧
|
||||
if(batchPrintVOList.size() <= 0) return new Result("0","没有数据可打印!");
|
||||
LabInstr labInstr = commonUtil.getLabInstr(batchPrintVOList.get(0).getYq());
|
||||
if(labInstr.getPcdyms().equals("所有标本")){
|
||||
for (BatchPrintVO batchPrintVO : batchPrintVOList) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result queryList(BatchPrintQueryVO batchPrintQueryVO) {
|
||||
int perpage = 0;
|
||||
|
||||
//校验参数
|
||||
String ybh = batchPrintQueryVO.getYbh().trim();
|
||||
|
||||
|
||||
|
||||
Result result = LisCommonUtil.changeYBHToSQL(ybh);
|
||||
if(!result.getCode().equals("0")) return result;
|
||||
ybh = result.getData().toString();
|
||||
batchPrintQueryVO.setYbh(ybh);
|
||||
//TODO 调用查询sql
|
||||
|
||||
|
||||
String yq = batchPrintQueryVO.getYq();
|
||||
String autofeedpaper = commonUtil.getComOptValue(yq, "AUTOFEEDPAPER");
|
||||
LabInstr labInstr = commonUtil.getLabInstr(yq);
|
||||
if(labInstr != null){
|
||||
perpage = labInstr.getMyhs();
|
||||
}else{
|
||||
perpage = 15;
|
||||
}
|
||||
List<Map<String, Object>> mapList = batchPrintMapper.queryList(batchPrintQueryVO);
|
||||
if(mapList.size() <= 0) return new Result("-1","没有符合条件的数据!");
|
||||
|
||||
return new Result("0","查询成功!",mapList);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
package com.czlis.liswork.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czlis.common.core.domain.Result;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LisCommonUtil {
|
||||
|
||||
public static Result changeYBHToSQL(String ybh) {
|
||||
//转换样本号
|
||||
ybh = ybh.replaceAll(",",",");
|
||||
ybh = ybh.replaceAll("--","-");
|
||||
String[] strings = StrUtil.splitToArray(ybh, ",");
|
||||
String ybhSQL = "",ybhSQL_ = "";
|
||||
for (String string : strings) {
|
||||
if(string.contains("-")){
|
||||
String[] split = StrUtil.splitToArray(string, "-");
|
||||
if(split.length != 2) return new Result("-1","样本号输入非法!");
|
||||
int start = Integer.parseInt(split[0]);
|
||||
int end = Integer.parseInt(split[1]);
|
||||
if(start > end) return new Result("-1","样本号输入非法!");
|
||||
ybhSQL_ = ybhSQL_ + " or (ybh >= '"+ start + "' and ybh <='" + end + "') ";
|
||||
}else{
|
||||
//全是,的
|
||||
ybhSQL = ybhSQL + "'" + string + "',";
|
||||
}
|
||||
}
|
||||
ybhSQL = "ybh in (" + ybhSQL + ")";
|
||||
ybh = "("+ybhSQL + ybhSQL_ + ")";
|
||||
return new Result("0","样本号转换成功!",ybh);
|
||||
}
|
||||
|
||||
public static Result changeYBHToList(String ybhStr){
|
||||
ybhStr = ybhStr.replaceAll(",",",");
|
||||
ybhStr = ybhStr.replaceAll("--","-");
|
||||
String[] strings = StrUtil.splitToArray(ybhStr, ",");
|
||||
List<String> ybhList = new ArrayList<>();
|
||||
for (String string : strings) {
|
||||
if(string.contains("-")){
|
||||
String[] split = StrUtil.splitToArray(string, "-");
|
||||
if(split.length != 2) return new Result("-1","样本号输入非法!");
|
||||
int start = Integer.parseInt(split[0]);
|
||||
int end = Integer.parseInt(split[1]);
|
||||
if(start > end) return new Result("-1","样本号输入非法!");
|
||||
for (int i = start; i <= end; i++) {
|
||||
if(!ybhList.contains(String.valueOf(i))){
|
||||
ybhList.add(String.valueOf(i));
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//全是,的
|
||||
ybhList.add( string);
|
||||
}
|
||||
}
|
||||
return new Result("0","样本号转换成功!",ybhList);
|
||||
}
|
||||
}
|
||||
33
liswork/src/main/resources/mapper/work/BatchPrintMapper.xml
Normal file
33
liswork/src/main/resources/mapper/work/BatchPrintMapper.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.czlis.liswork.mapper.work.BatchPrintMapper">
|
||||
<select id="queryList" resultType="map">
|
||||
SELECT DISTINCT lab_pat.brxm,
|
||||
lab_pat.ksdh,
|
||||
lab_pat.ch,
|
||||
lab_pat.brly,
|
||||
lab_pat.ybh,
|
||||
0 as cp_cnt,
|
||||
'1' as cp_msg,
|
||||
(select count(*) from lab_result where lab_result.yq=lab_pat.yq and lab_result.jyrq=lab_pat.jyrq and lab_result.ybh=lab_pat.ybh and result_flag in('H','L','P')) as ycjg
|
||||
FROM lab_pat where jyrq = #{jyrq} and yq = #{yq} and ${ybh} and jgbz = '2'
|
||||
<if test="nobrxm != null and nobrxm != ''"><![CDATA[and ltrim(brxm) <> '']]></if>
|
||||
<if test="dybz != null and dybz != ''"><![CDATA[and (dybz is null or dybz <> '1')]]></if>
|
||||
<if test="jgbz != null and jgbz != ''"><![CDATA[and (jgbz is null or jgbz <> '2')]]></if>
|
||||
<if test="jgbz2 != null and jgbz2 != ''"><![CDATA[and (jgbz = '2')]]></if>
|
||||
<choose>
|
||||
<when test="brly != null and brly != '' and notbrly != null and notbrly !=''"><![CDATA[and (brly is null or brly <> "'" + #{brly} + "'")]]></when>
|
||||
<when test="brly != null and brly != '' and notbrly == null"><![CDATA[and (brly = "'" + #{brly} + "'")]]></when>
|
||||
</choose>
|
||||
<choose>
|
||||
<when test="sorttype == 2">order by ksdh,ch,ybh</when>
|
||||
<when test="sorttype == 3">order by brly,ksdh,ch,ybh</when>
|
||||
<when test="sorttype == 4">order by brly,ksdh,ybh</when>
|
||||
<when test="sorttype == 5">order by ycjg,ybh</when>
|
||||
<otherwise>order by ybh</otherwise>
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user