主业务添加代码
This commit is contained in:
parent
8b12ea09b8
commit
e48fd1cc98
@ -67,4 +67,5 @@ public class LabReqmain extends BaseEntity {
|
||||
private String jcptbz;
|
||||
private String slzq;
|
||||
private Date sjsj;
|
||||
private String yqdh;
|
||||
}
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
package com.czlis.common.core.domain.entity.lis;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
public class LabReqsteplog {
|
||||
|
||||
private String sqh;
|
||||
private Integer xh;
|
||||
private String zt;
|
||||
private String userid;
|
||||
private Date changedate;
|
||||
private Date logdate;
|
||||
private String comname;
|
||||
private String comip;
|
||||
private String bz;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.czlis.interfaceCommon.mapper;
|
||||
|
||||
import com.czlis.common.core.domain.entity.lis.LabReqmain;
|
||||
import com.czlis.common.core.domain.entity.lis.LabReqsteplog;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface LabReqsteplogMapper {
|
||||
LabReqsteplog getLabReqsteplogOne(@Param("sqh") String sqh,@Param("xh") Integer xh);
|
||||
List<LabReqsteplog> getLabReqsteplog(String sqh);
|
||||
}
|
||||
@ -48,7 +48,8 @@ public class CommonUtil {
|
||||
XmAlarmdetailMapper xmAlarmdetailMapper;
|
||||
@Autowired
|
||||
LabReqreportPdffileMapper labReqreportPdffileMapper;
|
||||
|
||||
@Autowired
|
||||
LabReqsteplogMapper labReqsteplogMapper;
|
||||
//====检验主表操作方法集合===
|
||||
public LabPat getLabPatOne(Date jyrq, String yq, String ybh) {
|
||||
return labPatMapper.getLabPatOne(jyrq, yq, ybh);
|
||||
@ -89,6 +90,9 @@ public class CommonUtil {
|
||||
public LabReqmain getLabReqmainOne(String sqh) {
|
||||
return labReqmainMapper.getLabReqmainOne(sqh);
|
||||
}
|
||||
public List<LabReqsteplog> getLabReqsteplog(String sqh) {
|
||||
return labReqsteplogMapper.getLabReqsteplog(sqh);
|
||||
}
|
||||
//申请单明细表集合
|
||||
|
||||
//====检验结果表操作方法集合===
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
<?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.interfaceCommon.mapper.LabReqsteplogMapper">
|
||||
<select id="getLabReqsteplogOne" resultType="com.czlis.common.core.domain.entity.lis.LabReqsteplog">
|
||||
select * from lab_reqsteplog where sqh = #{sqh} and xh=#{xh}
|
||||
</select>
|
||||
<select id="getLabReqsteplog" resultType="com.czlis.common.core.domain.entity.lis.LabReqsteplog">
|
||||
select * from lab_reqsteplog where sqh = #{sqh}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -54,6 +54,6 @@ public class LisWorkOperController extends BaseController {
|
||||
log.info("yq:{}", yq);
|
||||
hdys="lis";
|
||||
|
||||
return lisWorkOperService.check2(jyrq, yq, ybh, hdys);
|
||||
return lisWorkOperService.confirm(jyrq, yq, ybh, hdys);
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ public interface LisWorkOperMapper {
|
||||
List<ResultCalcDTO> getResultCalc(@Param("jyrq") Date jyrq, @Param("yq") String yq, @Param("ybh") String ybh);
|
||||
Integer getLimitCount(Map<String,Object> map);
|
||||
Integer checkresultsqxmdh(@Param("jyrq") Date jyrq,@Param("yq") String yq,@Param("ybh") String ybh,@Param("sqh") String sqh);
|
||||
String checkresultnosqxmdh(@Param("jyrq") Date jyrq,@Param("yq") String yq,@Param("ybh") String ybh);
|
||||
Integer checkresultwxh(@Param("jyrq") Date jyrq, @Param("yq") String yq, @Param("ybh") String ybh);
|
||||
LabPat checkdublereport(@Param("sqh") String sqh, @Param("ybh") String ybh);
|
||||
LabPat checkyqdublereport(@Param("sqh") String sqh,@Param("yq") String yq, @Param("ybh") String ybh);
|
||||
|
||||
@ -9,5 +9,5 @@ public interface LisWorkOperService {
|
||||
Result newPatInfo(Date jyrq,String ybh, String sqh, String yq, Long userId);
|
||||
Result changePat(LabPat labPat);
|
||||
|
||||
Result check2(Date jyrq, String yq, String ybh, String hdys);
|
||||
Result confirm(Date jyrq, String yq, String ybh, String hdys);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.czlis.liswork.service.impl;
|
||||
|
||||
|
||||
import com.czlis.common.core.domain.entity.lis.*;
|
||||
import com.czlis.common.utils.SecurityUtils;
|
||||
import com.czlis.common.utils.ServletUtils;
|
||||
import com.czlis.common.utils.StringUtils;
|
||||
import com.czlis.common.utils.ip.IpUtils;
|
||||
@ -205,7 +206,7 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
||||
* @param hdys
|
||||
* @return
|
||||
*/
|
||||
public Result check2(Date jyrq, String yq, String ybh, String hdys) {
|
||||
public Result confirm(Date jyrq, String yq, String ybh, String hdys) {
|
||||
if (hdys == null || "".equals(hdys)) new Result("-1", "审核者为空,无法审核!");
|
||||
//入参通过GET推送时使用ServletUtils.getParameterToInt获取
|
||||
//入参通过POSTJSON时使用JsonParamUtils.getParameterToInt获取
|
||||
@ -215,29 +216,43 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
||||
if (!commonUtil.getUserPower(yq, hdys, 20)) return new Result("-1", "当前核对者无权对本仪器报告审核!");
|
||||
//2:数据合法性校验
|
||||
LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh);
|
||||
Result result = beforecheck2(labPat, hdys, problemId);
|
||||
if ("0".equals(result.getCode())) return result;
|
||||
labPat.setHdys(hdys);
|
||||
Result result = beforeconfirm(labPat, problemId);
|
||||
if (!"0".equals(result.getCode())) return result;
|
||||
//3:数据完整保存
|
||||
saveallresult(jyrq, yq, ybh);
|
||||
|
||||
int wjz = saveallresult(labPat);
|
||||
//同步主表危急值标识
|
||||
String alarmflag = labPat.getAlarmflag();
|
||||
if (("1".equals(alarmflag) && wjz != 1)) {
|
||||
labPat.setAlarmflag("1");
|
||||
} else if (("".equals(alarmflag) || alarmflag == null) && wjz == 1) {
|
||||
labPat.setAlarmflag("");
|
||||
}
|
||||
//4:CA请求业务的处理
|
||||
//Result result=addCA(jyrq, yq, ybh, hdys);
|
||||
//if("0".equals(result.getCode()))return result;
|
||||
//5:数据状态修改,异步上传接口作业创建
|
||||
Result result1 = aftercheck2(jyrq, yq, ybh, hdys);
|
||||
if ("0".equals(result1.getCode())) return result1;
|
||||
Result result1 = afterconfirm(labPat, problemId);
|
||||
if (!"0".equals(result1.getCode())) return result1;
|
||||
return new Result("0", "保存成功!");
|
||||
}
|
||||
|
||||
public Result beforecheck2(Date jyrq, String yq, String ybh, String hdys) {
|
||||
/**
|
||||
* 审核前校验数据完整性,审核业务和初审业务都可使用
|
||||
*
|
||||
* @param jyrq
|
||||
* @param yq
|
||||
* @param ybh
|
||||
* @return
|
||||
*/
|
||||
public Result beforeconfirm(Date jyrq, String yq, String ybh) {
|
||||
int problemId = ServletUtils.getParameterToInt("problemId", 0);
|
||||
if (hdys == null || "".equals(hdys)) new Result("-1", "审核者为空,无法审核!");
|
||||
LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh);
|
||||
return beforecheck2(labPat, hdys, problemId);
|
||||
return beforeconfirm(labPat, problemId);
|
||||
}
|
||||
|
||||
private Result beforecheck2(LabPat labPat, String hdys, Integer problemId) {
|
||||
if (hdys == null || "".equals(hdys)) new Result("-1", "审核者为空,无法审核!");
|
||||
//内部使用
|
||||
private Result beforeconfirm(LabPat labPat, Integer problemId) {
|
||||
Date jyrq = labPat.getJyrq();
|
||||
String yq = labPat.getYq();
|
||||
String ybh = labPat.getYbh();
|
||||
@ -329,14 +344,17 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String Userid = labPat.getHdys();
|
||||
if (Userid == null || "".equals(Userid)) {
|
||||
Userid = SecurityUtils.getLoginUser().getUsername();
|
||||
}
|
||||
//调用his报告接口,检查外部接口对审核前的定制需求
|
||||
SetReport setReport = new SetReport();
|
||||
setReport.setIp(IpUtils.getIpAddr());
|
||||
setReport.setJyrq(DateFormatUtils.format(jyrq, "yyyy-MM-dd"));
|
||||
setReport.setYq(yq.trim());
|
||||
setReport.setYbh(ybh);
|
||||
setReport.setUserid(hdys);
|
||||
setReport.setUserid(Userid);
|
||||
setReport.setStatus(LisinterfaceNameConstants.REPORTSTART);
|
||||
Result result = lisInterfaceUtil.invokeLisInterface(LisinterfaceNameConstants.SETREPORT, setReport);
|
||||
if (result.getCode().equals("5")) {
|
||||
@ -349,7 +367,135 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
||||
return new Result("0", "保存成功!");
|
||||
}
|
||||
|
||||
public Result aftercheck2(Date jyrq, String yq, String ybh, String hdys) {
|
||||
/**
|
||||
* 审核后步骤,在审核过程中,必须完成审核前校验通过,结果计算值填充,参考值结果标志危急值标志填写完成,最后使用此方法修改状态
|
||||
*
|
||||
* @param jyrq
|
||||
* @param yq
|
||||
* @param ybh
|
||||
* @return
|
||||
*/
|
||||
public Result afterconfirm(Date jyrq, String yq, String ybh) {
|
||||
int problemId = ServletUtils.getParameterToInt("problemId", 0);
|
||||
LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh);
|
||||
return afterconfirm(labPat, problemId);
|
||||
}
|
||||
|
||||
//内部使用
|
||||
private Result afterconfirm(LabPat labPat, Integer problemId) {
|
||||
Date jyrq = labPat.getJyrq();
|
||||
String yq = labPat.getYq();
|
||||
String ybh = labPat.getYbh();
|
||||
String hdys = labPat.getHdys();
|
||||
String itemvs = commonUtil.getHISOPT("itemvs");
|
||||
if ("1".equals(itemvs)) {
|
||||
String yqdl = commonUtil.getYqdl(yq);
|
||||
if (!"细菌仪".equals(yqdl)) {
|
||||
String nullcount = lisWorkOperMapper.checkresultnosqxmdh(jyrq, yq, ybh);
|
||||
if (!"".equals(nullcount) && nullcount != null)
|
||||
return new Result("-1", "报告项目未对应申请项目,请进(收费项目报告项目对照)菜单维护对照:\r\n" + nullcount);
|
||||
}
|
||||
}
|
||||
|
||||
Date Confirmdt = new Date();
|
||||
labPat.setConfirmdt(Confirmdt);
|
||||
labPat.setConfirmer(hdys);
|
||||
labPat.setLastdt(Confirmdt);
|
||||
labPat.setLastuser(hdys);
|
||||
Date dysj = labPat.getDysj();
|
||||
if (dysj == null) dysj = Confirmdt;
|
||||
if (commonUtil.getDateString(dysj).equals(commonUtil.getCurrentDate())) dysj = Confirmdt;
|
||||
Date jysj = labPat.getSqsj();
|
||||
if (jysj.after(dysj)) jysj = dysj;
|
||||
labPat.setDysj(dysj);
|
||||
String sqh = labPat.getSqh();
|
||||
LabReqmain labReqmain = commonUtil.getLabReqmainOne(sqh);
|
||||
if (labReqmain != null) {
|
||||
String zt = labReqmain.getZt();
|
||||
if (SampleStatusConstants.CANCAL.equals(zt)) return new Result("-1", "申请单已作废禁止审核!");
|
||||
labReqmain.setConfirmer(hdys);
|
||||
Date confirmtime = dysj;
|
||||
labReqmain.setConfirmtime(confirmtime);
|
||||
Date zxsj = labReqmain.getZxsj();
|
||||
Date cysj = labReqmain.getCysj();
|
||||
Date bbsjsj = labReqmain.getBbsjsj();
|
||||
Date jssj = labReqmain.getJssj();
|
||||
Date sjsj = labReqmain.getSjsj();
|
||||
if (sjsj == null) sjsj = jysj;
|
||||
if (sjsj.after(confirmtime)) sjsj = jysj;
|
||||
if (jssj == null) jssj = sjsj;
|
||||
if (jssj.after(confirmtime)) jssj = sjsj;
|
||||
if (bbsjsj != null) {
|
||||
if (bbsjsj.after(jssj) && jysj.after(bbsjsj)) jssj = jysj;
|
||||
}
|
||||
if (cysj != null) {
|
||||
if (cysj.after(jssj) && jysj.after(cysj)) jssj = jysj;
|
||||
}
|
||||
if (jssj.after(sjsj)) sjsj = jysj;
|
||||
|
||||
List<LabReqsteplog> labReqsteplog = commonUtil.getLabReqsteplog(sqh);
|
||||
if (bbsjsj != null && bbsjsj.after(jssj)) {
|
||||
Date sj = jssj;
|
||||
Date finalSj = sj;
|
||||
Optional<LabReqsteplog> maxTimeEntity = labReqsteplog.stream()
|
||||
.filter(entity -> "13".equals(entity.getZt()))
|
||||
.filter(entity -> entity.getChangedate().before(finalSj))
|
||||
.max(Comparator.comparing(LabReqsteplog::getChangedate));
|
||||
if (maxTimeEntity.isPresent()) {
|
||||
sj = maxTimeEntity.get().getChangedate();
|
||||
}
|
||||
bbsjsj = sj;
|
||||
labReqmain.setBbsjsj(bbsjsj);
|
||||
} else {
|
||||
bbsjsj = jssj;
|
||||
}
|
||||
if (cysj != null && cysj.after(bbsjsj)) {
|
||||
Date sj = bbsjsj;
|
||||
Date finalSj = sj;
|
||||
Optional<LabReqsteplog> maxTimeEntity = labReqsteplog.stream()
|
||||
.filter(entity -> "12".equals(entity.getZt()))
|
||||
.filter(entity -> entity.getChangedate().before(finalSj))
|
||||
.max(Comparator.comparing(LabReqsteplog::getChangedate));
|
||||
if (maxTimeEntity.isPresent()) {
|
||||
sj = maxTimeEntity.get().getChangedate();
|
||||
}
|
||||
cysj = sj;
|
||||
labReqmain.setCysj(cysj);
|
||||
}
|
||||
if (cysj != null && zxsj.after(cysj) && bbsjsj.after(zxsj)) {
|
||||
Date sj = bbsjsj;
|
||||
Date finalSj = sj;
|
||||
Optional<LabReqsteplog> maxTimeEntity = labReqsteplog.stream()
|
||||
.filter(entity -> "12".equals(entity.getZt()))
|
||||
.filter(entity -> entity.getChangedate().before(finalSj))
|
||||
.max(Comparator.comparing(LabReqsteplog::getChangedate));
|
||||
if (maxTimeEntity.isPresent()) {
|
||||
cysj = maxTimeEntity.get().getChangedate();
|
||||
} else cysj = zxsj;
|
||||
labReqmain.setCysj(cysj);
|
||||
} else {
|
||||
cysj = bbsjsj;
|
||||
}
|
||||
if (zxsj != null && zxsj.after(cysj)) {
|
||||
Date sj = cysj;
|
||||
Date finalSj = sj;
|
||||
Optional<LabReqsteplog> maxTimeEntity = labReqsteplog.stream()
|
||||
.filter(entity -> "11".equals(entity.getZt()))
|
||||
.filter(entity -> entity.getChangedate().before(finalSj))
|
||||
.max(Comparator.comparing(LabReqsteplog::getChangedate));
|
||||
if (maxTimeEntity.isPresent()) {
|
||||
sj = maxTimeEntity.get().getChangedate();
|
||||
}
|
||||
|
||||
zxsj = sj;
|
||||
labReqmain.setZxsj(zxsj);
|
||||
}
|
||||
labReqmain.setSjsj(sjsj);
|
||||
labReqmain.setYqdh(yq);
|
||||
if (!SampleStatusConstants.CANCAL.equals(zt)) labReqmain.setZt(SampleStatusConstants.CONFIRM);
|
||||
if (cysj != null) labPat.setCyrq(cysj);
|
||||
// commonUtil.updateLabReqmain(labReqmain);
|
||||
}
|
||||
//调用his报告接口,完成报告同时调用外部接口任务
|
||||
SetReport setReport = new SetReport();
|
||||
setReport.setIp(IpUtils.getIpAddr());
|
||||
@ -359,7 +505,16 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
||||
setReport.setUserid(hdys);
|
||||
setReport.setStatus(LisinterfaceNameConstants.REPORTEND);
|
||||
Result result = lisInterfaceUtil.invokeLisInterface(LisinterfaceNameConstants.SETREPORT, setReport);
|
||||
|
||||
if (result.getCode().equals("5")) {
|
||||
if (problemId < 4) {
|
||||
return new Result(result.getCode(), result.getMsg(), 4);
|
||||
}
|
||||
return new Result("0", "保存成功!");
|
||||
}
|
||||
if (!result.getCode().equals("0")) return result;
|
||||
//最后完成
|
||||
labPat.setJgbz(ReportStatusConstants.CONFIRM);
|
||||
commonUtil.updateLabPat(labPat);
|
||||
return new Result("0", "保存成功!");
|
||||
}
|
||||
|
||||
@ -372,12 +527,21 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
||||
public Result saveallresult(Date jyrq, String yq, String ybh) {
|
||||
//查询病人信息
|
||||
LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh);
|
||||
saveallresult(labPat);
|
||||
int wjz = saveallresult(labPat);
|
||||
//同步主表危急值标识
|
||||
String alarmflag = labPat.getAlarmflag();
|
||||
if (("1".equals(alarmflag) && wjz != 1)) {
|
||||
labPat.setAlarmflag("1");
|
||||
commonUtil.updateLabPat(labPat);
|
||||
} else if (("".equals(alarmflag) || alarmflag == null) && wjz == 1) {
|
||||
labPat.setAlarmflag("");
|
||||
commonUtil.updateLabPat(labPat);
|
||||
}
|
||||
return new Result("0", "保存成功!");
|
||||
}
|
||||
|
||||
//内部使用
|
||||
private void saveallresult(LabPat labPat) {
|
||||
private int saveallresult(LabPat labPat) {
|
||||
Date jyrq = labPat.getJyrq();
|
||||
String yq = labPat.getYq();
|
||||
String ybh = labPat.getYbh();
|
||||
@ -389,10 +553,11 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
||||
//计算项目更新
|
||||
calcsample(labPat);
|
||||
//保存最新参考值结果标志
|
||||
saverefs(labPat);
|
||||
int wjz = saverefs(labPat);
|
||||
//补写结果表申请单项目编号
|
||||
String sqh = labPat.getYbh();
|
||||
if (sqh != null && !"".equals(sqh)) setItemSqxmdh(jyrq, yq, ybh, sqh);
|
||||
return wjz;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -486,7 +651,16 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
||||
*/
|
||||
public Result saverefs(Date jyrq, String yq, String ybh) {
|
||||
LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh);
|
||||
saverefs(labPat);
|
||||
int wjz = saverefs(labPat);
|
||||
//同步主表危急值标识
|
||||
String alarmflag = labPat.getAlarmflag();
|
||||
if (("1".equals(alarmflag) && wjz != 1)) {
|
||||
labPat.setAlarmflag("1");
|
||||
commonUtil.updateLabPat(labPat);
|
||||
} else if (("".equals(alarmflag) || alarmflag == null) && wjz == 1) {
|
||||
labPat.setAlarmflag("");
|
||||
commonUtil.updateLabPat(labPat);
|
||||
}
|
||||
return new Result("0", "保存成功!");
|
||||
}
|
||||
//内部使用
|
||||
@ -557,15 +731,7 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
||||
ksdh = commonUtil.getComDictNameById("DP", ksdh);
|
||||
if (ksdh.contains("检验科")) lb_wjz = false;
|
||||
//同步主表危急值标识
|
||||
String alarmflag = labPat.getAlarmflag();
|
||||
if (("1".equals(alarmflag) && !lb_wjz)) {
|
||||
labPat.setAlarmflag("1");
|
||||
commonUtil.updateLabPat(labPat);
|
||||
} else if (("".equals(alarmflag) || alarmflag == null) && lb_wjz) {
|
||||
labPat.setAlarmflag("");
|
||||
commonUtil.updateLabPat(labPat);
|
||||
}
|
||||
|
||||
if (lb_wjz) return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -16,6 +16,14 @@
|
||||
where a.xmdh not in (select b.xmdh from xm_reqitem_vs_reportitem b ,lab_reqdetail c where b.sqxmdh=c.sqxmdh and b.yq=a.yq and c.sqh=#{sqh})
|
||||
and a.yq=#{yq} and a.ybh=#{ybh} and a.jyrq=#{jyrq} AND a.xmdh NOT LIKE 'GLU%'
|
||||
|
||||
</select>
|
||||
<select id="checkresultnosqxmdh" resultType="String">
|
||||
select (select c.xmmc+ ';' from lab_result a join xm_info c on c.yq=a.yq and c.xmdh=a.xmdh and c.dylx !='3'
|
||||
where a.jyrq=b.jyrq and a.yq=b.yq and a.ybh=b.ybh and isnull(a.sqxmdh,'')='' FOR XML PATH(''))
|
||||
from lab_pat b join lab_instr on lab_instr.yqdl !='细菌仪' and lab_instr.yq=b.yq
|
||||
where b.yq =#{yq} And b.jyrq =#{jyrq} And b.ybh =#{ybh} and b.sqh !=''
|
||||
|
||||
|
||||
</select>
|
||||
<select id="checkresultwxh" resultType="Integer">
|
||||
select count(1) from lab_result,xm_info
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user