主程序
This commit is contained in:
parent
939533f043
commit
8789ba6b79
@ -53,7 +53,16 @@ public class SecurityUtils {
|
||||
throw new ServiceException("获取用户账户异常", HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户姓名
|
||||
**/
|
||||
public static String getNickName() {
|
||||
try {
|
||||
return getLoginUser().getUser().getNickName();
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("获取用户姓名异常", HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取用户
|
||||
**/
|
||||
|
||||
@ -189,6 +189,7 @@ public class CommonUtil {
|
||||
}
|
||||
//ComPat
|
||||
public List<ComPat> getComPat(String brdh,String yljg){
|
||||
|
||||
return comPatMapper.getComPat(brdh,yljg);
|
||||
}
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
@ -0,0 +1,362 @@
|
||||
package com.czlis.interfaceCommon.utils;
|
||||
|
||||
import com.czlis.common.core.domain.entity.SysLoginParam;
|
||||
import com.czlis.common.core.domain.entity.lis.*;
|
||||
import com.czlis.common.utils.*;
|
||||
import com.czlis.common.utils.ip.IpUtils;
|
||||
import com.czlis.interfaceCommon.constants.LabPatConstants;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 工作站操作框架,放置一些基本方法和默认操作
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class LisWorkBase {
|
||||
@Autowired
|
||||
LoginConfigParamUtil loginConfigParamUtil;
|
||||
@Autowired
|
||||
CommonUtil commonUtil;
|
||||
/**获取当前用户工号**/
|
||||
String getusername(){return SecurityUtils.getUsername();}
|
||||
/**获取当前用户姓名**/
|
||||
String getnickname(){return SecurityUtils.getNickName();}
|
||||
/**获取当前客户端电脑IP**/
|
||||
String getIP(){
|
||||
return IpUtils.getIpAddr();
|
||||
}
|
||||
/**获取当前会话循环次数**/
|
||||
int getProblemId() {
|
||||
return JsonParamUtils.getParameterToInt("problemId", 0);
|
||||
}
|
||||
/**
|
||||
* 工作时间校验检验者审核者不允许相同 上班时间上午8点-12点下午2点到5点,周末不算
|
||||
*
|
||||
* @param labPat 病人信息
|
||||
* @return 返回0通过, 返回1不允许相同
|
||||
*/
|
||||
int checkWorkTime(LabPat labPat) {
|
||||
String yhdh = labPat.getYhdh();
|
||||
String hdys = labPat.getHdys();
|
||||
if (yhdh == null || yhdh.isEmpty()) return 0;
|
||||
if (hdys == null || hdys.isEmpty()) return 0;
|
||||
if (!yhdh.equals(hdys)) return 0;
|
||||
String sb1 = commonUtil.getHISOPT("SHTIME1");
|
||||
String sb2 = commonUtil.getHISOPT("SHTIME2");
|
||||
String sb3 = commonUtil.getHISOPT("SHTIME3");
|
||||
String sb4 = commonUtil.getHISOPT("SHTIME4");
|
||||
if ((sb1 == null || sb1.isEmpty()) && (sb2 == null || sb2.isEmpty()) && (sb3 == null || sb3.isEmpty()) && (sb4 == null || sb4.isEmpty()))
|
||||
return 0;
|
||||
Date currenttime = DateUtils.getNowDate();
|
||||
int weekDay = DateUtils.getWeekDay(currenttime);
|
||||
//周末不算
|
||||
if (weekDay == 6 || weekDay == 7) return 0;
|
||||
int lt_now = Integer.parseInt(DateUtils.time(currenttime, "HH:mm").replace(":", ""));
|
||||
if ((sb1 != null && !sb1.isEmpty()) && (sb2 != null && !sb2.isEmpty())) {
|
||||
sb1 = sb1.replace(":", "");
|
||||
sb2 = sb2.replace(":", "");
|
||||
|
||||
if (LisUtil.isTureNumber(sb1) && LisUtil.isTureNumber(sb2)) {
|
||||
int nsb1 = Integer.parseInt(sb1);
|
||||
int nsb2 = Integer.parseInt(sb2);
|
||||
if (lt_now > nsb1 && lt_now < nsb2) return 1;
|
||||
}
|
||||
}
|
||||
if ((sb3 != null && !sb3.isEmpty()) && (sb4 != null && !sb4.isEmpty())) {
|
||||
sb3 = sb3.replace(":", "");
|
||||
sb4 = sb4.replace(":", "");
|
||||
if (LisUtil.isTureNumber(sb3) && LisUtil.isTureNumber(sb4)) {
|
||||
int nsb3 = Integer.parseInt(sb3);
|
||||
int nsb4 = Integer.parseInt(sb4);
|
||||
if (lt_now > nsb3 && lt_now < nsb4) return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查报告是否计算危急值
|
||||
* @param labPat 病人信息
|
||||
* @return 返回
|
||||
*/
|
||||
boolean checknowjz(LabPat labPat) {
|
||||
//危急值标识去除原则 nowjz = true 不能算做危急值
|
||||
String brxm = labPat.getBrxm();
|
||||
if (brxm != null) {
|
||||
if (brxm.contains("质控") || brxm.contains("复查") || brxm.contains("QC") || brxm.contains("qc") || brxm.contains("软化水") || brxm.contains("锅炉水")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
String brly = labPat.getBrly();
|
||||
if (brly != null) brly = commonUtil.getComDictNameById("PT", brly);
|
||||
if (brly != null) if (brly.contains("质控")) return true;
|
||||
if (brly != null) if (brly.contains("复查")) return true;
|
||||
String ksdh = labPat.getKsdh();
|
||||
if (ksdh != null) ksdh = commonUtil.getComDictNameById("DP", ksdh);
|
||||
if (ksdh != null) return ksdh.contains("检验科");
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询明细是否有危急值标识
|
||||
*
|
||||
* @param labResultList 结果集合
|
||||
* @return 返回
|
||||
*/
|
||||
boolean getAlarmFlag(List<LabResult> labResultList) {
|
||||
boolean wjz = false;
|
||||
List<LabResult> labResultList0 = labResultList.stream().filter(xm ->xm.getAlarm_flag() != null).filter(xm -> !xm.getAlarm_flag().trim().isEmpty()).collect(Collectors.toList());
|
||||
if (!labResultList0.isEmpty()) {
|
||||
wjz = true;
|
||||
}
|
||||
return wjz;
|
||||
}
|
||||
/**
|
||||
* 操作记录日志
|
||||
*
|
||||
* @param jyrq 检验日期
|
||||
* @param yq 仪器
|
||||
* @param ybh 样本号
|
||||
* @param yhdh 用户
|
||||
* @param logtype 操作类型
|
||||
* @param logdata 备注信息
|
||||
*/
|
||||
void setComLog(Date jyrq, String yq, String ybh, String yhdh, String logtype, String logdata) {
|
||||
ComLog comLog = new ComLog();
|
||||
comLog.setJyrq(jyrq);
|
||||
comLog.setYq(yq);
|
||||
comLog.setYbh(ybh);
|
||||
comLog.setYhdh(yhdh);
|
||||
comLog.setDnmc(getIP());
|
||||
comLog.setRzbz(logtype);
|
||||
comLog.setRznr(logdata);
|
||||
comLog.setRzdt(new Date());
|
||||
commonUtil.insertComLog(comLog);
|
||||
}
|
||||
/**写入病人信息历史记录**/
|
||||
void setComPat(LabPat labPat) {
|
||||
if(labPat==null) return;
|
||||
String brdh = labPat.getBrdh();
|
||||
String brxm=labPat.getBrxm();
|
||||
if(brdh==null||brdh.isEmpty()) return;
|
||||
if(brxm==null||brxm.isEmpty()) return;
|
||||
String yljg = labPat.getYljg();
|
||||
ComPat comPat = new ComPat();
|
||||
comPat.setYljg(yljg);
|
||||
comPat.setBrdh(brdh);
|
||||
comPat.setBrxm(labPat.getBrxm());
|
||||
comPat.setBrly(labPat.getBrly());
|
||||
comPat.setKsdh(labPat.getKsdh());
|
||||
if(labPat.getNl()!=null) {
|
||||
int age = labPat.getNl();
|
||||
String unit = labPat.getNldw();
|
||||
Date sr = AgeUtils.getBirthDateByAge(age, unit);
|
||||
comPat.setSr(sr);
|
||||
}
|
||||
comPat.setFb(labPat.getFb());
|
||||
comPat.setMzh(labPat.getMzh());
|
||||
comPat.setZd(labPat.getZd());
|
||||
comPat.setCh(labPat.getCh());
|
||||
comPat.setSjys(labPat.getSjys());
|
||||
commonUtil.deleteComPat(brdh,yljg);
|
||||
commonUtil.insertComPat(comPat);
|
||||
}
|
||||
|
||||
/**
|
||||
* 报告修改记录,撤回报告需要记录
|
||||
*
|
||||
* @param jyrq 检验日期
|
||||
* @param yq 仪器
|
||||
* @param ybh 样本号
|
||||
* @param yhdh 用户
|
||||
*/
|
||||
void setpatLog(Date jyrq, String yq, String ybh, String yhdh) {
|
||||
Date xgrq = new Date();
|
||||
String ip = getIP();
|
||||
commonUtil.insertLabPatlog(jyrq, yq, ybh, xgrq, yhdh, ip);
|
||||
commonUtil.insertLabResultlog(jyrq, yq, ybh, xgrq, yhdh, ip);
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请单操作记录
|
||||
*
|
||||
* @param sqh 申请
|
||||
* @param zt 状态
|
||||
* @param yhdh 用户
|
||||
*/
|
||||
void setlabReqsteplog(String sqh, String zt, String yhdh) {
|
||||
int xh = commonUtil.getLabReqsteplogMax(sqh);
|
||||
xh = xh + 1;
|
||||
LabReqsteplog labReqsteplog = new LabReqsteplog();
|
||||
labReqsteplog.setXh(xh);
|
||||
labReqsteplog.setSqh(sqh);
|
||||
labReqsteplog.setZt(zt);
|
||||
labReqsteplog.setUserid(yhdh);
|
||||
labReqsteplog.setChangedate(new Date());
|
||||
String ip = getIP();
|
||||
labReqsteplog.setComip(ip);
|
||||
commonUtil.insertLabReqsteplog(labReqsteplog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取自动记忆字段修改值
|
||||
*
|
||||
* @param loginConfigParam 当前登录客户端信息
|
||||
* @param yq 仪器
|
||||
* @return 返回
|
||||
*/
|
||||
List<LabInputcol> getLabInputcol(SysLoginParam loginConfigParam, String yq) {
|
||||
String Current_instrid = loginConfigParam.getCurrent_instrid();
|
||||
List<LabInputcol> labInputcolList = loginConfigParam.getCurrent_labInputcol();
|
||||
if (!yq.equals(Current_instrid)) {
|
||||
loginConfigParam.setCurrent_yhdh_sybh("");
|
||||
loginConfigParam.setCurrent_yhdh_eybh("");
|
||||
loginConfigParam.setCurrent_hdys_sybh("");
|
||||
loginConfigParam.setCurrent_hdys_eybh("");
|
||||
labInputcolList = commonUtil.getLabInputcol(yq);
|
||||
loginConfigParam.setCurrent_labInputcol(labInputcolList);
|
||||
}
|
||||
return labInputcolList;
|
||||
}
|
||||
/**
|
||||
* 自动输入模板输入结果
|
||||
* @param yq 仪器
|
||||
* @param ybh 样本号
|
||||
* @return 返回
|
||||
*/
|
||||
List<LabInputmdl> chkautoinput(String yq, String ybh){
|
||||
|
||||
List<LabInputmdl> labInputmdlList;
|
||||
if("1".equals(commonUtil.getHISOPT("zdsr"))){
|
||||
labInputmdlList=commonUtil.getLabInputmdlzdsr(yq);
|
||||
}else{
|
||||
if(LisUtil.isNumber(ybh)) {
|
||||
labInputmdlList = commonUtil.getLabInputmdlzdsrybh(yq, ybh);
|
||||
}else{
|
||||
labInputmdlList=new ArrayList<>();
|
||||
}
|
||||
}
|
||||
return labInputmdlList;
|
||||
}
|
||||
/**
|
||||
* 自动输入模板输入结果
|
||||
* @param jyrq 检验日期
|
||||
* @param yq 仪器
|
||||
* @param ybh 样本号
|
||||
* @param labResultList 结果集合
|
||||
* @param mbmc 模板名称
|
||||
* @param savefalg 是否保存到数据库,空样本不存数据库,有样本存数据库
|
||||
* @return 返回
|
||||
*/
|
||||
public List<LabResult> batchinput(Date jyrq, String yq, String ybh,List<LabResult> labResultList,String mbmc,boolean savefalg){
|
||||
List<LabInputmdlDetail> labInputmdlDetailList=commonUtil.getLabInputmdlDetail(yq,mbmc);
|
||||
if(labInputmdlDetailList.isEmpty()) return labResultList;
|
||||
for(LabInputmdlDetail labInputmdlDetail:labInputmdlDetailList){
|
||||
List<LabResult> findone=labResultList.stream().filter(s->s.getXmdh().equals(labInputmdlDetail.getXmdh())).collect(Collectors.toList());
|
||||
if(findone.isEmpty()){
|
||||
LabResult labResult=new LabResult();
|
||||
labResult.setJyrq(jyrq);
|
||||
labResult.setYq(yq);
|
||||
labResult.setYbh(ybh);
|
||||
labResult.setXmdh(labInputmdlDetail.getXmdh());
|
||||
labResult.setCsjg(labInputmdlDetail.getMrz());
|
||||
labResult.setXmmc(labInputmdlDetail.getXmmc());
|
||||
if(!savefalg)labResult.setChangeflag(2);
|
||||
else {
|
||||
labResult.setChangeflag(1);
|
||||
commonUtil.updateLabResult(labResult);
|
||||
}
|
||||
labResultList.add(labResult);
|
||||
}
|
||||
}
|
||||
return labResultList;
|
||||
}
|
||||
/**创建空样本记录**/
|
||||
public LabPat loaddefault(LabPat labPat) {
|
||||
// Date jyrq = labPat.getJyrq();
|
||||
String yq = labPat.getYq();
|
||||
String ybh = labPat.getYbh();
|
||||
Date ldt_now = commonUtil.getCurrentTime();
|
||||
if (labPat.getSqsj() == null) labPat.setSqsj(ldt_now);
|
||||
if (labPat.getYljg() == null) labPat.setYljg(commonUtil.getLabInstr(yq).getYljg());
|
||||
SysLoginParam loginConfigParam = loginConfigParamUtil.getLoginConfigParam();
|
||||
String Current_instrid = loginConfigParam.getCurrent_instrid();
|
||||
List<LabInputcol> labInputcolList = loginConfigParam.getCurrent_labInputcol();
|
||||
if (!yq.equals(Current_instrid)) {
|
||||
loginConfigParam.setCurrent_yhdh_sybh("");
|
||||
loginConfigParam.setCurrent_yhdh_eybh("");
|
||||
loginConfigParam.setCurrent_hdys_sybh("");
|
||||
loginConfigParam.setCurrent_hdys_eybh("");
|
||||
labInputcolList = commonUtil.getLabInputcol(yq);
|
||||
loginConfigParam.setCurrent_labInputcol(labInputcolList);
|
||||
}
|
||||
List<LabInputcol> labInputcolList0 = labInputcolList.stream().filter(labInputcol0 -> labInputcol0.getMrz() != null && !labInputcol0.getMrz().isEmpty()).collect(Collectors.toList());
|
||||
String mrz = null;
|
||||
for (LabInputcol labInputcol : labInputcolList0) {
|
||||
if (!"!".equals(labInputcol.getZdmc())) {
|
||||
String zdmc = labInputcol.getZdmc();
|
||||
|
||||
switch (zdmc) {
|
||||
case "dysj":
|
||||
case "cyrq":
|
||||
case "sqsj":
|
||||
case "nl":
|
||||
break;
|
||||
case "yhdh":
|
||||
String yhdh0 = labPat.getYhdh();
|
||||
if (yhdh0 == null || yhdh0.isEmpty()) {
|
||||
mrz = labInputcol.getMrz();
|
||||
if (mrz != null && !mrz.isEmpty()) {
|
||||
String sybh = loginConfigParam.getCurrent_yhdh_sybh();
|
||||
String eybh = loginConfigParam.getCurrent_yhdh_eybh();
|
||||
if (!"".equals(sybh) && !"".equals(eybh) && sybh != null && eybh != null) {
|
||||
if (LisUtil.isStringBetween(ybh, sybh, eybh)) {
|
||||
labPat.setYhdh(mrz);
|
||||
}
|
||||
} else {
|
||||
labPat.setYhdh(mrz);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "hdys":
|
||||
String hdys0 = labPat.getYhdh();
|
||||
if (hdys0 == null || hdys0.isEmpty()) {
|
||||
String sybh = loginConfigParam.getCurrent_hdys_sybh();
|
||||
String eybh = loginConfigParam.getCurrent_hdys_eybh();
|
||||
if (!"".equals(sybh) && !"".equals(eybh)) {
|
||||
if (LisUtil.isStringBetween(ybh, sybh, eybh)) {
|
||||
labPat.setHdys(mrz);
|
||||
}
|
||||
} else {
|
||||
labPat.setHdys(mrz);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
String value = (String) EntityUtils.getItem(labPat, zdmc);
|
||||
if (value == null || value.isEmpty()) {
|
||||
mrz = labInputcol.getMrz();
|
||||
if (mrz != null && !mrz.isEmpty()) {
|
||||
EntityUtils.setItem(labPat, zdmc, mrz);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String yhdh = SecurityUtils.getLoginUser().getUsername();
|
||||
if (labPat.getYhdh() == null || labPat.getYhdh().isEmpty())
|
||||
labPat.setYhdh(SecurityUtils.getLoginUser().getUsername());
|
||||
labPat.setLastuser(yhdh);
|
||||
labPat.setLastdt(ldt_now);
|
||||
Integer shcs = labPat.getShcs();
|
||||
if (shcs == null) labPat.setShcs(0);
|
||||
if (labPat.getJgbz() == null) labPat.setJgbz(LabPatConstants.DEFAULT);
|
||||
return labPat;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,720 @@
|
||||
package com.czlis.interfaceCommon.utils;
|
||||
|
||||
import com.czlis.common.core.domain.Result;
|
||||
import com.czlis.common.core.domain.entity.lis.*;
|
||||
import com.czlis.interfaceCommon.constants.ComLogConstants;
|
||||
import com.czlis.interfaceCommon.constants.LabPatConstants;
|
||||
import com.czlis.interfaceCommon.constants.LabReqmainConstants;
|
||||
import com.czlis.interfaceCommon.constants.LisinterfaceNameConstants;
|
||||
import com.czlis.interfaceCommon.pojo.inter.SetReport;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
@Component
|
||||
@Slf4j
|
||||
public class LisWorkconfirm extends LisWorkcom{
|
||||
@Autowired
|
||||
CheckResultUtils checkResultUtils;
|
||||
/**
|
||||
* 初步审核
|
||||
*
|
||||
* @param jyrq
|
||||
* @param yq
|
||||
* @param ybh
|
||||
* @param hdys
|
||||
* @return
|
||||
*/
|
||||
public Result confirm1(Date jyrq, String yq, String ybh, String hdys, int problemId) {
|
||||
if (hdys == null || hdys.isEmpty()) return new Result("-1", "审核者为空,无法审核!");
|
||||
LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh);
|
||||
labPat.setHdys(hdys);
|
||||
List<LabResult> labResultList = commonUtil.getLabResultList(jyrq, yq, ybh);
|
||||
if (problemId < 3) {
|
||||
//1,审核权限校验
|
||||
if (!commonUtil.getUserPower(yq, hdys, 20)) {
|
||||
return new Result("-1", "当前核对者无权对本仪器报告审核!");
|
||||
}
|
||||
//2:数据合法性校验
|
||||
Result result0 = beforeconfirm(labPat, labResultList, 1, problemId);
|
||||
if (!"0".equals(result0.getCode())) return result0;
|
||||
}
|
||||
if (problemId < 3) problemId = 3;
|
||||
if (problemId < 4) {
|
||||
//3:数据完整保存
|
||||
labResultList = saveallresult(labPat, labResultList);
|
||||
boolean wjz = getAlarmFlag(labResultList);
|
||||
//同步主表危急值标识
|
||||
String alarmflag = labPat.getAlarmflag();
|
||||
if (("1".equals(alarmflag) && !wjz)) {
|
||||
labPat.setAlarmflag("");
|
||||
commonUtil.updateLabPat(labPat);
|
||||
} else if (("".equals(alarmflag) || alarmflag == null) && wjz) {
|
||||
labPat.setAlarmflag("1");
|
||||
commonUtil.updateLabPat(labPat);
|
||||
}
|
||||
if (wjz) {
|
||||
return new Result("4", getAlarmMsg(labResultList), 4);
|
||||
}
|
||||
}
|
||||
if (problemId < 5) problemId = 5;
|
||||
if (problemId < 6) {
|
||||
//医学审核条件判断
|
||||
Result result = chksample(labPat, labResultList, problemId);
|
||||
if (!"0".equals(result.getCode())) return result;
|
||||
}
|
||||
if (problemId < 6) problemId = 6;
|
||||
if (problemId < 99) {
|
||||
//高级医学审核条件判断
|
||||
Result result = chksamplenew(labPat, labResultList, problemId);
|
||||
if ("99".equals(result.getCode())) {
|
||||
labPat.setBz(result.getMsg());
|
||||
result.setCode("0");
|
||||
}
|
||||
if (!"0".equals(result.getCode())) return result;
|
||||
}
|
||||
if (problemId < 99) problemId = 99;
|
||||
//5:数据状态修改,异步上传接口作业创建
|
||||
Result result1 = afterconfirm1(labPat, problemId);
|
||||
if (!"0".equals(result1.getCode())) return result1;
|
||||
setComLog(jyrq, yq, ybh, hdys, ComLogConstants.LG_CK1, "");
|
||||
// String sqh=labPat.getSqh();
|
||||
// if(sqh!=null){
|
||||
// setlabReqsteplog(sqh,SampleStatusConstants.CONFIRM,hdys);
|
||||
// }
|
||||
return new Result("0", "审核成功!");
|
||||
}
|
||||
/**
|
||||
* 审核报告单全流程
|
||||
*
|
||||
* @param jyrq
|
||||
* @param yq
|
||||
* @param ybh
|
||||
* @param hdys
|
||||
* @return
|
||||
*/
|
||||
public Result confirm(Date jyrq, String yq, String ybh, String hdys, int problemId) {
|
||||
if (hdys == null || hdys.isEmpty()) return new Result("-1", "审核者为空,无法审核!");
|
||||
LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh);
|
||||
labPat.setHdys(hdys);
|
||||
List<LabResult> labResultList = commonUtil.getLabResultList(jyrq, yq, ybh);
|
||||
if (problemId < 3) {
|
||||
//1,审核权限校验
|
||||
if (!commonUtil.getUserPower(yq, hdys, 20)) {
|
||||
return new Result("-1", "当前核对者无权对本仪器报告审核!");
|
||||
}
|
||||
//2:数据合法性校验
|
||||
Result result0 = beforeconfirm(labPat, labResultList, 2, problemId);
|
||||
if (!"0".equals(result0.getCode())) return result0;
|
||||
}
|
||||
if (problemId < 3) problemId = 3;
|
||||
if (problemId < 4) {
|
||||
//3:数据完整保存
|
||||
labResultList = saveallresult(labPat, labResultList);
|
||||
boolean wjz = getAlarmFlag(labResultList);
|
||||
//同步主表危急值标识
|
||||
String alarmflag = labPat.getAlarmflag();
|
||||
if (("1".equals(alarmflag) && !wjz)) {
|
||||
labPat.setAlarmflag("");
|
||||
commonUtil.updateLabPat(labPat);
|
||||
} else if (("".equals(alarmflag) || alarmflag == null) && wjz) {
|
||||
labPat.setAlarmflag("1");
|
||||
commonUtil.updateLabPat(labPat);
|
||||
}
|
||||
if (wjz) {
|
||||
return new Result("4", getAlarmMsg(labResultList), 4);
|
||||
}
|
||||
}
|
||||
if (problemId < 5) problemId = 5;
|
||||
if (problemId < 6) {
|
||||
//医学审核条件判断
|
||||
Result result = chksample(labPat, labResultList, problemId);
|
||||
if (!"0".equals(result.getCode())) return result;
|
||||
}
|
||||
if (problemId < 6) problemId = 6;
|
||||
if (problemId < 99) {
|
||||
//高级医学审核条件判断
|
||||
Result result = chksamplenew(labPat, labResultList, problemId);
|
||||
if ("99".equals(result.getCode())) {
|
||||
labPat.setBz(result.getMsg());
|
||||
result.setCode("0");
|
||||
}
|
||||
if (!"0".equals(result.getCode())) return result;
|
||||
}
|
||||
if (problemId < 99) problemId = 99;
|
||||
//4:CA请求业务的处理
|
||||
//Result result=addCA(jyrq, yq, ybh, hdys);
|
||||
//if("0".equals(result.getCode()))return result;
|
||||
//5:数据状态修改,异步上传接口作业创建
|
||||
Result result1 = afterconfirm(labPat, problemId);
|
||||
if (!"0".equals(result1.getCode())) return result1;
|
||||
setComLog(jyrq, yq, ybh, hdys, ComLogConstants.LG_CK, "");
|
||||
String sqh = labPat.getSqh();
|
||||
if (sqh != null) {
|
||||
setlabReqsteplog(sqh, LabReqmainConstants.CONFIRM, hdys);
|
||||
}
|
||||
return new Result("0", "审核成功!");
|
||||
}
|
||||
/**
|
||||
* 审核前校验数据完整性,审核业务和初审业务都可使用
|
||||
*
|
||||
* @param labPat
|
||||
* @param labResultList
|
||||
* @param checktype
|
||||
* @param problemId
|
||||
* @return
|
||||
*/
|
||||
private Result beforeconfirm(LabPat labPat, List<LabResult> labResultList, Integer checktype, Integer problemId) {
|
||||
if (labPat == null) return new Result("-1", "病人信息为空禁止审核!");
|
||||
Date jyrq = labPat.getJyrq();
|
||||
String yq = labPat.getYq();
|
||||
String ybh = labPat.getYbh();
|
||||
String jgbz = labPat.getJgbz();
|
||||
if ("2".equals(jgbz)) return new Result("1", "报告已审核!");
|
||||
if ("5".equals(jgbz)) return new Result("-1", "已锁定报告禁止审核!");
|
||||
if (!"1".equals(jgbz) && checktype == 2) {
|
||||
String f_check1 = commonUtil.getComOptValue(yq, "f_check1");
|
||||
if ("1".equals(f_check1)) return new Result("-1", "审核前必须先初审!");
|
||||
}
|
||||
if (checktype == 2) {
|
||||
if (checkWorkTime(labPat) == 1) return new Result("-1", "核对医生不允许与检验医生相同!");
|
||||
}
|
||||
String limit_brly = commonUtil.getHISOPT("limit_brly");
|
||||
String brly = labPat.getBrly();
|
||||
if ("1".equals(limit_brly) && (brly == null || brly.isEmpty()))
|
||||
return new Result("-1", "病人类型为空,禁止审核!");
|
||||
String limit_yblx = commonUtil.getHISOPT("limit_yblx");
|
||||
String yblx = labPat.getYblx();
|
||||
if ("1".equals(limit_yblx) && (yblx == null || yblx.isEmpty()))
|
||||
return new Result("-1", "样本类型为空,禁止审核!");
|
||||
String limit_brxm = commonUtil.getHISOPT("limit_brxm");
|
||||
String brxm = labPat.getBrxm();
|
||||
if ("1".equals(limit_brxm) && (brxm == null || brxm.isEmpty()))
|
||||
return new Result("-1", "病人姓名为空,禁止审核!");
|
||||
if ((brxm == null || brxm.isEmpty()) && problemId < 1) new Result("5", "姓名为空,你确定要审核吗?", 1);
|
||||
String limit_ksdh = commonUtil.getHISOPT("limit_ksdh");
|
||||
String ksdh = labPat.getKsdh();
|
||||
if ("1".equals(limit_ksdh) && (ksdh == null || ksdh.isEmpty()))
|
||||
return new Result("-1", "科室单位为空,禁止审核!");
|
||||
String limit_patno = commonUtil.getHISOPT("limit_patno");
|
||||
String brdh = labPat.getBrdh();
|
||||
String brlyname = commonUtil.getComDictNameById("PT", brly);
|
||||
if ("1".equals(limit_patno) && (brdh == null || brdh.isEmpty())) {
|
||||
if (!"质控".equals(brlyname)) return new Result("-1", "病历号不能为空,禁止审核!");
|
||||
}
|
||||
String limit_brpatno = commonUtil.getHISOPT("limit_brpatno");
|
||||
if ("1".equals(limit_brpatno) && (brdh == null || brdh.isEmpty())) {
|
||||
if ("1".equals(brly) || "3".equals(brly)) return new Result("-1", "门诊住院的病历号不能为空,禁止审核!");
|
||||
}
|
||||
String yqdl = commonUtil.getYqdl(yq);
|
||||
if (labResultList == null || labResultList.isEmpty()) return new Result("-1", "结果为空禁止审核!");
|
||||
for (LabResult labResult : labResultList) {
|
||||
String csjg = labResult.getCsjg();
|
||||
if ("未做".equals(csjg)) {
|
||||
return new Result("-1", "还有结果为“未做”的项目,不可审核!");
|
||||
}
|
||||
if (csjg != null) {
|
||||
if (csjg.contains("ERR")) return new Result("-1", "有结果错误,不可审核!");
|
||||
if (csjg.contains("需稀释")) return new Result("-1", "有结果需稀释,不可审核!");
|
||||
if (csjg.contains("需复做")) return new Result("-1", "有结果需复做,不可审核!");
|
||||
|
||||
}
|
||||
}
|
||||
if (problemId < 2) {
|
||||
//多做结果判断
|
||||
String otherresultmsg = commonUtil.getComOptValue(yq, "otherresultmsg");
|
||||
if ("1".equals(otherresultmsg)) {
|
||||
if (!"细菌仪".equals(yqdl)) {
|
||||
int nullcount = lisWorkUtilsMapper.checkresultsqxmdh(jyrq, yq, ybh, labPat.getSqh());
|
||||
if (nullcount > 0) return new Result("5", "结果有多做的项目,是否审核?", 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
String limit_jgwxh4 = commonUtil.getHISOPT("limit_jgwxh4");
|
||||
if ("1".equals(limit_jgwxh4)) {
|
||||
int wxh = lisWorkUtilsMapper.checkresultwxh(jyrq, yq, ybh);
|
||||
if (wxh > 0) return new Result("-1", "有结果为****禁止审核!");
|
||||
}
|
||||
String sqh = labPat.getSqh();
|
||||
if (sqh != null && !sqh.isEmpty()) {
|
||||
if (!"质控".equals(brlyname)) {
|
||||
if ("1".equals(commonUtil.getHISOPT("sp_dublereport"))) {
|
||||
LabPat labPat0 = lisWorkUtilsMapper.checkdublereport(sqh, ybh);
|
||||
if (labPat0 != null) {
|
||||
String yqmc = commonUtil.getYqmc(yq);
|
||||
String msg = "该申请单已经发过结果了,禁止审核!" + LisUtil.LINE_SEPARATOR + "日期:" + commonUtil.getDateString(jyrq) + ",仪器:" + yqmc + ",样本号:" + ybh;
|
||||
return new Result("-1", msg);
|
||||
}
|
||||
} else if ("1".equals(commonUtil.getHISOPT("sp_yqdublereport"))) {
|
||||
LabPat labPat0 = lisWorkUtilsMapper.checkyqdublereport(sqh, yq, ybh);
|
||||
if (labPat0 != null) {
|
||||
String yqmc = commonUtil.getYqmc(yq);
|
||||
String msg = "该申请单已经发过结果了,禁止审核!" + LisUtil.LINE_SEPARATOR + "日期:" + commonUtil.getDateString(jyrq) + ",仪器:" + yqmc + ",样本号:" + ybh;
|
||||
return new Result("-1", msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
String Userid = labPat.getHdys();
|
||||
if (Userid == null || Userid.isEmpty()) {
|
||||
Userid = getusername();
|
||||
}
|
||||
//初审不需要调用接口
|
||||
if (checktype == 1) return new Result("0", "保存成功!");
|
||||
//调用his报告接口,检查外部接口对审核前的定制需求
|
||||
SetReport setReport = new SetReport();
|
||||
setReport.setIp(getIP());
|
||||
setReport.setJyrq(DateFormatUtils.format(jyrq, "yyyy-MM-dd"));
|
||||
setReport.setYbh(ybh);
|
||||
setReport.setUserid(Userid);
|
||||
setReport.setYq(yq.trim());
|
||||
setReport.setStatus(LisinterfaceNameConstants.REPORTSTART);
|
||||
if (!"细菌仪".equals(yqdl)) {
|
||||
if (!"1".equals(commonUtil.getHISOPT("wswcbbgbl"))) {
|
||||
String ls_cbbgyq = commonUtil.getComOptValue(yq, "cbbgyq");
|
||||
if (ls_cbbgyq != null && !ls_cbbgyq.isEmpty()) {
|
||||
String ls_ejbgyq = "EJBG" + ls_cbbgyq;
|
||||
ls_cbbgyq = "CBBG" + ls_cbbgyq;
|
||||
int count = commonUtil.getCountByKey(jyrq, ls_cbbgyq, ybh);
|
||||
if (count > 0) {
|
||||
setReport.setYq(ls_cbbgyq);
|
||||
setReport.setStatus(LisinterfaceNameConstants.REPORTCANCAL);
|
||||
Result result = lisInterfaceUtil.invokeLisInterface(LisinterfaceNameConstants.SETREPORT, setReport);
|
||||
}
|
||||
count = commonUtil.getCountByKey(jyrq, ls_ejbgyq, ybh);
|
||||
if (count > 0) {
|
||||
setReport.setYq(ls_ejbgyq);
|
||||
setReport.setStatus(LisinterfaceNameConstants.REPORTCANCAL);
|
||||
Result result = lisInterfaceUtil.invokeLisInterface(LisinterfaceNameConstants.SETREPORT, setReport);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
setReport.setYq(yq.trim());
|
||||
setReport.setStatus(LisinterfaceNameConstants.REPORTSTART);
|
||||
Result result = lisInterfaceUtil.invokeLisInterface(LisinterfaceNameConstants.SETREPORT, setReport);
|
||||
if (result.getCode().equals("5")) {
|
||||
if (problemId < 3) {
|
||||
return new Result(result.getCode(), result.getMsg(), 3);
|
||||
}
|
||||
return new Result("0", "保存成功!");
|
||||
}
|
||||
if (!result.getCode().equals("0")) return result;
|
||||
checkxpywrgjz(labPat);
|
||||
return new Result("0", "保存成功!");
|
||||
}
|
||||
/**
|
||||
* 医学审核条件判断
|
||||
*
|
||||
* @param labPat
|
||||
* @param problemId
|
||||
* @return
|
||||
*/
|
||||
private Result chksample(LabPat labPat, List<LabResult> labResultList, Integer problemId) {
|
||||
//医学审核条件判断
|
||||
if (problemId < 6) {
|
||||
String checkvalue = checkResultUtils.chksample(labPat, labResultList);
|
||||
if (checkvalue != null && !checkvalue.isEmpty()) {
|
||||
return new Result("5", checkvalue, 6);
|
||||
}
|
||||
}
|
||||
return new Result("0", "保存成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 高级医学审核条件判断
|
||||
*
|
||||
* @param labPat
|
||||
* @param problemId
|
||||
* @return
|
||||
*/
|
||||
private Result chksamplenew(LabPat labPat, List<LabResult> labResultList, Integer problemId) {
|
||||
//医学审核条件判断
|
||||
Boolean setbz = false;
|
||||
String bz = labPat.getBz();
|
||||
int startid = 6;
|
||||
//医学审核条件判断(新规则),预留99个递归ID
|
||||
if (problemId < startid) problemId = startid;
|
||||
if (problemId < 99) {
|
||||
int xh = problemId - startid;
|
||||
Map<String, Object> chksamplenewvalue = checkResultUtils.chksamplenew(labPat, labResultList, xh);
|
||||
String chkCode = (String) chksamplenewvalue.get("code");
|
||||
String chkMsg = (String) chksamplenewvalue.get("msg");
|
||||
bz = (String) chksamplenewvalue.get("bz");
|
||||
labPat.setBz(bz);
|
||||
xh = (Integer) chksamplenewvalue.get("xh");
|
||||
setbz = (Boolean) chksamplenewvalue.get("setbz");
|
||||
problemId = startid + xh;
|
||||
if ("5".equals(chkCode)) {
|
||||
if (setbz) {
|
||||
commonUtil.updateLabPat(labPat);
|
||||
}
|
||||
return new Result("5", chkMsg, problemId);
|
||||
}
|
||||
if (!"0".equals(chkCode)) return new Result(chkCode, chkMsg, problemId);
|
||||
}
|
||||
if (setbz) {
|
||||
commonUtil.updateLabPat(labPat);
|
||||
return new Result("99", bz);
|
||||
}
|
||||
return new Result("0", "保存成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核后步骤,在审核过程中,必须完成审核前校验通过,结果计算值填充,参考值结果标志危急值标志填写完成,最后使用此方法修改状态
|
||||
*
|
||||
* @param labPat
|
||||
* @param problemId
|
||||
* @return
|
||||
*/
|
||||
private Result afterconfirm(LabPat labPat, Integer problemId) {
|
||||
Date jyrq = labPat.getJyrq();
|
||||
String yq = labPat.getYq();
|
||||
String ybh = labPat.getYbh();
|
||||
String hdys = labPat.getHdys();
|
||||
String yqdl = commonUtil.getYqdl(yq);
|
||||
String itemvs = commonUtil.getHISOPT("itemvs");
|
||||
Result ret = new Result("0", "保存成功!");
|
||||
if ("1".equals(itemvs)) {
|
||||
if (!"细菌仪".equals(yqdl)) {
|
||||
String nullcount = lisWorkUtilsMapper.checkresultnosqxmdh(jyrq, yq, ybh);
|
||||
if (!"".equals(nullcount) && nullcount != null)
|
||||
ret = new Result("3", "警告!" + LisUtil.LINE_SEPARATOR + " 报告项目未对应申请项目,请进(收费项目报告项目对照)菜单维护对照:" + LisUtil.LINE_SEPARATOR + 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 (LabReqmainConstants.CANCAL.equals(zt)) return new Result("-1", "申请单已作废禁止审核!");
|
||||
labReqmain.setYqdh(yq);
|
||||
labReqmain.setSjsj(jysj);
|
||||
labReqmain.setConfirmer(hdys);
|
||||
labReqmain.setConfirmtime(Confirmdt);
|
||||
labReqmain = checklabReqmainTAT(labReqmain);
|
||||
if (!LabReqmainConstants.CANCAL.equals(zt)) labReqmain.setZt(LabReqmainConstants.CONFIRM);
|
||||
commonUtil.updateLabReqmain(labReqmain);
|
||||
Date cysj = labReqmain.getCysj();
|
||||
if (cysj != null) labPat.setCyrq(cysj);
|
||||
}
|
||||
|
||||
//调用his报告接口,完成报告同时调用外部接口任务
|
||||
SetReport setReport = new SetReport();
|
||||
setReport.setIp(getIP());
|
||||
setReport.setJyrq(DateFormatUtils.format(jyrq, "yyyy-MM-dd"));
|
||||
setReport.setYq(yq.trim());
|
||||
setReport.setYbh(ybh);
|
||||
setReport.setUserid(hdys);
|
||||
setReport.setStatus(LisinterfaceNameConstants.REPORTEND);
|
||||
Result result = lisInterfaceUtil.invokeLisInterface(LisinterfaceNameConstants.SETREPORT, setReport);
|
||||
if (result.getCode().equals("5")) {
|
||||
if (problemId < 100) {
|
||||
return new Result(result.getCode(), result.getMsg(), 100);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
if (!result.getCode().equals("0")) return result;
|
||||
//最后完成
|
||||
String finish = labPat.getFinish();
|
||||
if (!"细菌仪".equals(yqdl) && finish != null) labPat.setFinish("1");
|
||||
labPat.setJgbz(LabPatConstants.CONFIRM);
|
||||
Integer shcs = labPat.getShcs();
|
||||
if (shcs == null) shcs = 0;
|
||||
shcs = shcs + 1;
|
||||
labPat.setShcs(shcs);
|
||||
commonUtil.updateLabPat(labPat);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初步审核状态修改
|
||||
*
|
||||
* @param labPat
|
||||
* @param problemId
|
||||
* @return
|
||||
*/
|
||||
private Result afterconfirm1(LabPat labPat, Integer problemId) {
|
||||
Date jyrq = labPat.getJyrq();
|
||||
String yq = labPat.getYq();
|
||||
String ybh = labPat.getYbh();
|
||||
String hdys = labPat.getHdys();
|
||||
String yqdl = commonUtil.getYqdl(yq);
|
||||
String itemvs = commonUtil.getHISOPT("itemvs");
|
||||
Result ret = new Result("0", "保存成功!");
|
||||
if ("1".equals(itemvs)) {
|
||||
if (!"细菌仪".equals(yqdl)) {
|
||||
String nullcount = lisWorkUtilsMapper.checkresultnosqxmdh(jyrq, yq, ybh);
|
||||
if (!"".equals(nullcount) && nullcount != null)
|
||||
ret = new Result("3", "警告!" + LisUtil.LINE_SEPARATOR + " 报告项目未对应申请项目,请进(收费项目报告项目对照)菜单维护对照:" + LisUtil.LINE_SEPARATOR + nullcount);
|
||||
}
|
||||
}
|
||||
|
||||
Date Confirmdt = new Date();
|
||||
labPat.setLastdt(Confirmdt);
|
||||
labPat.setLastuser(hdys);
|
||||
String finish = labPat.getFinish();
|
||||
if (!"细菌仪".equals(yqdl) && finish != null) labPat.setFinish("1");
|
||||
labPat.setJgbz(LabPatConstants.PRELIM);
|
||||
commonUtil.updateLabPat(labPat);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请单表校验TAT时间顺序,恢复时间倒置的时间轴
|
||||
*
|
||||
* @param labReqmain
|
||||
* @return
|
||||
*/
|
||||
private LabReqmain checklabReqmainTAT(LabReqmain labReqmain) {
|
||||
if (labReqmain != null) {
|
||||
Date confirmtime = labReqmain.getConfirmtime();
|
||||
Date jysj = labReqmain.getSjsj();
|
||||
String sqh = labReqmain.getSqh();
|
||||
Date zxsj = labReqmain.getZxsj();
|
||||
Date cysj = labReqmain.getCysj();
|
||||
Date bbsjsj = labReqmain.getBbsjsj();
|
||||
Date jssj = labReqmain.getJssj();
|
||||
Date sjsj = labReqmain.getSjsj();
|
||||
if (sjsj == null&&jysj !=null) sjsj =new Date(jysj.getTime());
|
||||
if (sjsj !=null&&sjsj.after(confirmtime)&&jysj !=null) sjsj =new Date(jysj.getTime());
|
||||
if (jssj == null&&sjsj !=null) jssj =new Date(sjsj.getTime());
|
||||
if (jssj !=null&&jssj.after(confirmtime)&&sjsj !=null) jssj = new Date(sjsj.getTime());
|
||||
if (bbsjsj != null) {
|
||||
if (jysj !=null&&bbsjsj.after(jssj) && jysj.after(bbsjsj)) jssj = new Date(jysj.getTime());
|
||||
}
|
||||
if (cysj != null&&jysj !=null) {
|
||||
if (cysj.after(jssj) && jysj.after(cysj)) jssj =new Date(jysj.getTime());
|
||||
}
|
||||
if (jysj !=null&&jssj.after(sjsj)) sjsj =new Date(jysj.getTime());
|
||||
|
||||
List<LabReqsteplog> labReqsteplog = commonUtil.getLabReqsteplog(sqh);
|
||||
if (jssj !=null&&bbsjsj != null && bbsjsj.after(jssj)) {
|
||||
Date sj = new Date(jssj.getTime());
|
||||
Date finalSj = new Date(jssj.getTime());
|
||||
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 = new Date(sj.getTime());
|
||||
labReqmain.setBbsjsj(bbsjsj);
|
||||
} else {
|
||||
if(jssj !=null) bbsjsj = new Date(jssj.getTime());
|
||||
}
|
||||
if (bbsjsj != null && cysj != null && cysj.after(bbsjsj)) {
|
||||
Date sj = new Date(bbsjsj.getTime());
|
||||
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 =new Date(sj.getTime());
|
||||
labReqmain.setCysj(cysj);
|
||||
}
|
||||
if (bbsjsj != null && cysj != null && zxsj.after(cysj) && bbsjsj.after(zxsj)) {
|
||||
|
||||
Date finalSj = new Date(bbsjsj.getTime());
|
||||
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 = new Date(zxsj.getTime());
|
||||
labReqmain.setCysj(cysj);
|
||||
} else {
|
||||
if(bbsjsj != null ) cysj =new Date(bbsjsj.getTime());
|
||||
}
|
||||
if (cysj != null && zxsj != null && zxsj.after(cysj)) {
|
||||
Date sj = new Date(cysj.getTime());
|
||||
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 = new Date(sj.getTime());
|
||||
labReqmain.setZxsj(zxsj);
|
||||
}
|
||||
if (sjsj != null)labReqmain.setSjsj(sjsj);
|
||||
}
|
||||
return labReqmain;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 解除审核原因登记
|
||||
*
|
||||
* @param jyrq
|
||||
* @param yq
|
||||
* @param ybh
|
||||
* @param hdys
|
||||
* @return
|
||||
*/
|
||||
public Result unconfirmlog(Date jyrq, String yq, String ybh, String hdys, String reason) {
|
||||
if ("".equals(reason)) {
|
||||
return new Result("-1", "没写原因,解除失败!");
|
||||
}
|
||||
LisPatlog lisPatlog = new LisPatlog();
|
||||
lisPatlog.setYq(yq);
|
||||
lisPatlog.setYbh(ybh);
|
||||
lisPatlog.setXgyhdh(hdys);
|
||||
lisPatlog.setJyrq(jyrq);
|
||||
lisPatlog.setXgrq(new Date());
|
||||
lisPatlog.setBz1(reason);
|
||||
commonUtil.insertLisPatlog(lisPatlog);
|
||||
return new Result("0", "写召回原因成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤销审核报告单全流程
|
||||
*
|
||||
* @param jyrq
|
||||
* @param yq
|
||||
* @param ybh
|
||||
* @param yhdh
|
||||
* @return
|
||||
*/
|
||||
public Result unconfirm(Date jyrq, String yq, String ybh, String yhdh) {
|
||||
if (yhdh == null || yhdh.isEmpty()) return new Result("1", "操作者为空,无法解除审核!");
|
||||
int problemId = getProblemId();
|
||||
LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh);
|
||||
if (problemId < 3) {
|
||||
//1,解除审核权限校验
|
||||
if (!commonUtil.getUserPower(yq, yhdh, 10)) return new Result("-1", "当前操作者无权对本仪器报告解除审核!");
|
||||
//2:数据合法性校验
|
||||
String jgbz = labPat.getJgbz();
|
||||
if (!"2".equals(jgbz)) return new Result("1", "报告未审核,不需解除!");
|
||||
}
|
||||
if (problemId < 3) problemId = 3;
|
||||
if (problemId < 4) {
|
||||
String unconfirmlog = commonUtil.getComOptValue(yq, "unconfirmlog");
|
||||
if ("1".equals(unconfirmlog)) {
|
||||
return new Result("4", "请填写解除审核原因!", 4);
|
||||
}
|
||||
}
|
||||
if (problemId < 4) problemId = 4;
|
||||
//调用his报告接口,完成报告同时调用外部接口任务
|
||||
if (problemId < 5) {
|
||||
SetReport setReport = new SetReport();
|
||||
setReport.setIp(getIP());
|
||||
setReport.setJyrq(DateFormatUtils.format(jyrq, "yyyy-MM-dd"));
|
||||
setReport.setYq(yq.trim());
|
||||
setReport.setYbh(ybh);
|
||||
setReport.setUserid(yhdh);
|
||||
setReport.setStatus(LisinterfaceNameConstants.REPORTCANCAL);
|
||||
Result result = lisInterfaceUtil.invokeLisInterface(LisinterfaceNameConstants.SETREPORT, setReport);
|
||||
if (result.getCode().equals("5")) {
|
||||
if (problemId < 5) {
|
||||
return new Result(result.getCode(), result.getMsg(), 5);
|
||||
}
|
||||
}
|
||||
if (!result.getCode().equals("0")) return result;
|
||||
}
|
||||
if (problemId < 5) problemId = 5;
|
||||
String sqh = labPat.getSqh();
|
||||
LabReqmain labReqmain = commonUtil.getLabReqmainOne(sqh);
|
||||
if (labReqmain != null) {
|
||||
String zt = labReqmain.getZt();
|
||||
if (!LabReqmainConstants.CANCAL.equals(zt)) {
|
||||
labReqmain.setConfirmer("");
|
||||
labReqmain.setConfirmtime(null);
|
||||
if (LabReqmainConstants.CONFIRM.equals(zt)) {
|
||||
labReqmain.setZt(LabReqmainConstants.SIGNFOR);
|
||||
labReqmain.setConfirmer("");
|
||||
labReqmain.setConfirmtime(null);
|
||||
commonUtil.updateLabReqmain(labReqmain);
|
||||
}
|
||||
}
|
||||
}
|
||||
String msg = "取消成功!";
|
||||
String sp_rebackreport = commonUtil.getHISOPT("sp_rebackreport");
|
||||
if ("1".equals(sp_rebackreport)) {
|
||||
if ("1".equals(labPat.getDybz())) {
|
||||
msg = msg + LisUtil.LINE_SEPARATOR + "此报告为已打印报告,注意考虑是否追回";
|
||||
}
|
||||
LabPatwarning labPatwarning = commonUtil.getLabPatwarning(jyrq, yq, ybh);
|
||||
if (labPatwarning != null) {
|
||||
if (problemId < 6) {
|
||||
Date tzsj = labPatwarning.getTzsj();
|
||||
long sjc = LisUtil.relativeMinute(tzsj);
|
||||
if (sjc > 10) {
|
||||
return new Result("4", "此报告已发布危急值结果,并且时间超过10分钟了!" + LisUtil.LINE_SEPARATOR + "请输入撤回报告组长代号和密码", 6);
|
||||
}
|
||||
}
|
||||
//权限不足,撤回报告失败组长权限单独接口校验
|
||||
if (problemId == 6) {
|
||||
int ll_qxz = lisWorkUtilsMapper.getQXZ(yhdh);
|
||||
if (ll_qxz <= 0) {
|
||||
return new Result("-1", "权限不足,撤回报告失败!");
|
||||
}
|
||||
}
|
||||
commonUtil.deleteLabPatwarning(jyrq, yq, ybh);
|
||||
commonUtil.deleteLabResultwarning(jyrq, yq, ybh);
|
||||
}
|
||||
}
|
||||
commonUtil.deleteLabReqreportPdffile(jyrq, yq, ybh);
|
||||
labPat.setFslx("");
|
||||
labPat.setJgbz(LabPatConstants.DEFAULT);
|
||||
commonUtil.updateLabPat(labPat);
|
||||
String logdata = commonUtil.getLisPatlogbz(jyrq, yq, ybh);
|
||||
setComLog(jyrq, yq, ybh, yhdh, ComLogConstants.LG_UCK, logdata);
|
||||
setpatLog(jyrq, yq, ybh, yhdh);
|
||||
if (sqh != null) {
|
||||
setlabReqsteplog(sqh, LabReqmainConstants.START, yhdh);
|
||||
}
|
||||
if (!"取消成功!".equals(msg)) return new Result("3", msg);
|
||||
return new Result("0", msg);
|
||||
}
|
||||
|
||||
public Result unconfirm1(Date jyrq, String yq, String ybh, String yhdh) {
|
||||
if (yhdh == null || yhdh.isEmpty()) return new Result("1", "操作者为空,无法解除审核!");
|
||||
int problemId = getProblemId();
|
||||
LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh);
|
||||
if (problemId < 3) {
|
||||
//1,解除审核权限校验
|
||||
if (!commonUtil.getUserPower(yq, yhdh, 10)) return new Result("-1", "当前操作者无权对本仪器报告解除审核!");
|
||||
//2:数据合法性校验
|
||||
String jgbz = labPat.getJgbz();
|
||||
if ("2".equals(jgbz)) return new Result("1", "报告已审核,不能解除初审!");
|
||||
if (!"1".equals(jgbz)) return new Result("1", "报告未初审,不能解除初审!");
|
||||
}
|
||||
// if (problemId < 3) problemId = 3;
|
||||
|
||||
// if (problemId < 4) problemId = 4;
|
||||
|
||||
if (problemId < 5) problemId = 5;
|
||||
|
||||
labPat.setFslx("");
|
||||
labPat.setJgbz(LabPatConstants.DEFAULT);
|
||||
commonUtil.updateLabPat(labPat);
|
||||
setComLog(jyrq, yq, ybh, yhdh, ComLogConstants.LG_UCK1, "");
|
||||
return new Result("0", "取消成功!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user