缓存异步处理
This commit is contained in:
parent
9cde711a53
commit
eaadfe2eeb
@ -1,4 +1,4 @@
|
|||||||
package com.czlis.system.manager;
|
package com.czlis.common.asyncmanager;
|
||||||
|
|
||||||
import com.czlis.common.utils.Threads;
|
import com.czlis.common.utils.Threads;
|
||||||
import com.czlis.common.utils.spring.SpringUtils;
|
import com.czlis.common.utils.spring.SpringUtils;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.czlis.system.manager;
|
package com.czlis.common.asyncmanager;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -29,7 +29,7 @@ public class ComDictUtils {
|
|||||||
* 清空字典缓存
|
* 清空字典缓存
|
||||||
*/
|
*/
|
||||||
public static void clearDictCache() {
|
public static void clearDictCache() {
|
||||||
Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys("com_dict:" + "*");
|
Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(CacheConstants.COM_DICT_KEY + "*");
|
||||||
SpringUtils.getBean(RedisCache.class).deleteObject(keys);
|
SpringUtils.getBean(RedisCache.class).deleteObject(keys);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.czlis.system.aspectj;
|
package com.czlis.system.aspectj;
|
||||||
|
|
||||||
import com.czlis.common.annotation.Async;
|
import com.czlis.common.annotation.Async;
|
||||||
import com.czlis.system.manager.AsyncManager;
|
import com.czlis.common.asyncmanager.AsyncManager;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
import org.aspectj.lang.annotation.Around;
|
import org.aspectj.lang.annotation.Around;
|
||||||
@ -42,7 +42,7 @@ public class AsyncAspect {
|
|||||||
// 异步执行目标方法
|
// 异步执行目标方法
|
||||||
targetMethod.invoke(targetObject, methodArgs);
|
targetMethod.invoke(targetObject, methodArgs);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("异步执行方法失败", e);
|
log.error("异步执行{}方法失败",targetMethod, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import com.czlis.common.utils.SecurityUtils;
|
|||||||
import com.czlis.common.utils.ServletUtils;
|
import com.czlis.common.utils.ServletUtils;
|
||||||
import com.czlis.common.utils.StringUtils;
|
import com.czlis.common.utils.StringUtils;
|
||||||
import com.czlis.common.utils.ip.IpUtils;
|
import com.czlis.common.utils.ip.IpUtils;
|
||||||
import com.czlis.system.manager.AsyncManager;
|
import com.czlis.common.asyncmanager.AsyncManager;
|
||||||
import com.czlis.system.manager.factory.AsyncFactory;
|
import com.czlis.system.manager.factory.AsyncFactory;
|
||||||
import com.czlis.system.domain.SysOperLog;
|
import com.czlis.system.domain.SysOperLog;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -23,8 +23,6 @@ import org.aspectj.lang.annotation.AfterReturning;
|
|||||||
import org.aspectj.lang.annotation.AfterThrowing;
|
import org.aspectj.lang.annotation.AfterThrowing;
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
import org.aspectj.lang.annotation.Before;
|
import org.aspectj.lang.annotation.Before;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.core.NamedThreadLocal;
|
import org.springframework.core.NamedThreadLocal;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import com.czlis.common.core.domain.model.LoginUser;
|
|||||||
import com.czlis.common.utils.MessageUtils;
|
import com.czlis.common.utils.MessageUtils;
|
||||||
import com.czlis.common.utils.ServletUtils;
|
import com.czlis.common.utils.ServletUtils;
|
||||||
import com.czlis.common.utils.StringUtils;
|
import com.czlis.common.utils.StringUtils;
|
||||||
import com.czlis.system.manager.AsyncManager;
|
import com.czlis.common.asyncmanager.AsyncManager;
|
||||||
import com.czlis.system.manager.factory.AsyncFactory;
|
import com.czlis.system.manager.factory.AsyncFactory;
|
||||||
import com.czlis.system.web.service.TokenService;
|
import com.czlis.system.web.service.TokenService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|||||||
@ -3,9 +3,13 @@ package com.czlis.system.service.impl;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TimerTask;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
|
import com.czlis.common.annotation.Async;
|
||||||
|
import com.czlis.common.asyncmanager.AsyncManager;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -25,6 +29,7 @@ import com.czlis.system.service.ISysDictTypeService;
|
|||||||
* @author admin
|
* @author admin
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@Slf4j
|
||||||
public class SysDictTypeServiceImpl implements ISysDictTypeService {
|
public class SysDictTypeServiceImpl implements ISysDictTypeService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysDictTypeMapper dictTypeMapper;
|
private SysDictTypeMapper dictTypeMapper;
|
||||||
@ -37,7 +42,18 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService {
|
|||||||
*/
|
*/
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
|
TimerTask task = new TimerTask(){
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
// 异步执行目标方法
|
||||||
loadingDictCache();
|
loadingDictCache();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取系统字典失败,异步执行{}方法失败","loadingDictCache", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
AsyncManager.me().execute(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -123,8 +139,10 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService {
|
|||||||
/**
|
/**
|
||||||
* 加载字典缓存数据
|
* 加载字典缓存数据
|
||||||
*/
|
*/
|
||||||
|
@Async
|
||||||
@Override
|
@Override
|
||||||
public void loadingDictCache() {
|
public void loadingDictCache() {
|
||||||
|
System.out.println("异步执行线程:" + Thread.currentThread().getName()); // 新增此行
|
||||||
SysDictData dictData = new SysDictData();
|
SysDictData dictData = new SysDictData();
|
||||||
dictData.setStatus("0");
|
dictData.setStatus("0");
|
||||||
Map<String, List<SysDictData>> dictDataMap = dictDataMapper.selectDictDataList(dictData).stream().collect(Collectors.groupingBy(SysDictData::getDictType));
|
Map<String, List<SysDictData>> dictDataMap = dictDataMapper.selectDictDataList(dictData).stream().collect(Collectors.groupingBy(SysDictData::getDictType));
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import com.czlis.common.utils.DateUtils;
|
|||||||
import com.czlis.common.utils.MessageUtils;
|
import com.czlis.common.utils.MessageUtils;
|
||||||
import com.czlis.common.utils.StringUtils;
|
import com.czlis.common.utils.StringUtils;
|
||||||
import com.czlis.common.utils.ip.IpUtils;
|
import com.czlis.common.utils.ip.IpUtils;
|
||||||
import com.czlis.system.manager.AsyncManager;
|
import com.czlis.common.asyncmanager.AsyncManager;
|
||||||
import com.czlis.system.manager.factory.AsyncFactory;
|
import com.czlis.system.manager.factory.AsyncFactory;
|
||||||
import com.czlis.system.security.context.AuthenticationContextHolder;
|
import com.czlis.system.security.context.AuthenticationContextHolder;
|
||||||
import com.czlis.system.service.ISysConfigService;
|
import com.czlis.system.service.ISysConfigService;
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import com.czlis.common.exception.user.CaptchaExpireException;
|
|||||||
import com.czlis.common.utils.MessageUtils;
|
import com.czlis.common.utils.MessageUtils;
|
||||||
import com.czlis.common.utils.SecurityUtils;
|
import com.czlis.common.utils.SecurityUtils;
|
||||||
import com.czlis.common.utils.StringUtils;
|
import com.czlis.common.utils.StringUtils;
|
||||||
import com.czlis.system.manager.AsyncManager;
|
import com.czlis.common.asyncmanager.AsyncManager;
|
||||||
import com.czlis.system.manager.factory.AsyncFactory;
|
import com.czlis.system.manager.factory.AsyncFactory;
|
||||||
import com.czlis.system.service.ISysConfigService;
|
import com.czlis.system.service.ISysConfigService;
|
||||||
import com.czlis.system.service.ISysUserService;
|
import com.czlis.system.service.ISysUserService;
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.czlis.liswork.service.impl;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import cn.hutool.extra.pinyin.PinyinUtil;
|
import cn.hutool.extra.pinyin.PinyinUtil;
|
||||||
|
import com.czlis.common.asyncmanager.AsyncManager;
|
||||||
import com.czlis.common.core.domain.Result;
|
import com.czlis.common.core.domain.Result;
|
||||||
import com.czlis.common.utils.ComDictUtils;
|
import com.czlis.common.utils.ComDictUtils;
|
||||||
import com.czlis.common.utils.StringUtils;
|
import com.czlis.common.utils.StringUtils;
|
||||||
@ -17,6 +18,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* lis字典管理
|
* lis字典管理
|
||||||
*/
|
*/
|
||||||
@ -29,7 +32,18 @@ public class ComDictServiceImpl implements ComDictService {
|
|||||||
private ComDictMapper comDictMapper;
|
private ComDictMapper comDictMapper;
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
|
TimerTask task = new TimerTask(){
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
// 异步执行目标方法
|
||||||
loadingDictCache();
|
loadingDictCache();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取lis代码字典失败,异步执行{}方法失败","loadingDictCache", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
AsyncManager.me().execute(task);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 加载字典缓存数据
|
* 加载字典缓存数据
|
||||||
|
|||||||
@ -41,8 +41,9 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
LabReqmainMapper labReqmainMapper;
|
LabReqmainMapper labReqmainMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
LabReqdetailMapper labReqdetailMapper;
|
LabReqdetailMapper labReqdetailMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result newPatInfo(Date jyrq,String ybh, String sqh, String yq, Long userId) {
|
public Result newPatInfo(Date jyrq, String ybh, String sqh, String yq, Long userId) {
|
||||||
|
|
||||||
LabReqmain labReqmainOne = commonUtil.getLabReqmainOne(sqh);
|
LabReqmain labReqmainOne = commonUtil.getLabReqmainOne(sqh);
|
||||||
if (labReqmainOne == null) {
|
if (labReqmainOne == null) {
|
||||||
@ -58,15 +59,15 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
lisInterfaceUtil.invokeLisInterface(LisinterfaceNameConstants.GETREQINTERFACE, getReqInterface);
|
lisInterfaceUtil.invokeLisInterface(LisinterfaceNameConstants.GETREQINTERFACE, getReqInterface);
|
||||||
labReqmainOne = commonUtil.getLabReqmainOne(sqh);
|
labReqmainOne = commonUtil.getLabReqmainOne(sqh);
|
||||||
}
|
}
|
||||||
if(labReqmainOne == null) return new Result("-1","没有获取到申请单信息!");
|
if (labReqmainOne == null) return new Result("-1", "没有获取到申请单信息!");
|
||||||
String zt = labReqmainOne.getZt().trim();
|
String zt = labReqmainOne.getZt().trim();
|
||||||
//2.校验信息
|
//2.校验信息
|
||||||
//校验状态信息
|
//校验状态信息
|
||||||
Result result1 = checkZT(sqh, yq, zt);
|
Result result1 = checkZT(sqh, yq, zt);
|
||||||
if(!result1.getCode().equals("0")) return result1;
|
if (!result1.getCode().equals("0")) return result1;
|
||||||
//校验条码类别
|
//校验条码类别
|
||||||
Result result2 = checkReqClass(sqh, yq, labReqmainOne.getBgddh());
|
Result result2 = checkReqClass(sqh, yq, labReqmainOne.getBgddh());
|
||||||
if(!result2.getCode().equals("0")) return result2;
|
if (!result2.getCode().equals("0")) return result2;
|
||||||
|
|
||||||
//3.调用his上机接口,
|
//3.调用his上机接口,
|
||||||
SetReqStatus setReqStatus = new SetReqStatus();
|
SetReqStatus setReqStatus = new SetReqStatus();
|
||||||
@ -75,7 +76,7 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
setReqStatus.setUserid(userId.toString());
|
setReqStatus.setUserid(userId.toString());
|
||||||
setReqStatus.setStatus(SampleStatusConstants.SIGNFOR);
|
setReqStatus.setStatus(SampleStatusConstants.SIGNFOR);
|
||||||
Result result = lisInterfaceUtil.invokeLisInterface(LisinterfaceNameConstants.SETREQSTATUS, setReqStatus);
|
Result result = lisInterfaceUtil.invokeLisInterface(LisinterfaceNameConstants.SETREQSTATUS, setReqStatus);
|
||||||
if(!result.getCode().equals("0")) return result;
|
if (!result.getCode().equals("0")) return result;
|
||||||
|
|
||||||
//4.获取病人信息
|
//4.获取病人信息
|
||||||
DayMessage dayMessage = new DayMessage();
|
DayMessage dayMessage = new DayMessage();
|
||||||
@ -83,7 +84,7 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
dayMessage.setYljg("1");
|
dayMessage.setYljg("1");
|
||||||
dayMessage.setUserid(userId.toString());
|
dayMessage.setUserid(userId.toString());
|
||||||
dayMessage.setMsgid(LisinterfaceNameConstants.DAYMESSAGE_GETPATIENT);
|
dayMessage.setMsgid(LisinterfaceNameConstants.DAYMESSAGE_GETPATIENT);
|
||||||
String val = labReqmainOne.getBrdh()+"|"+labReqmainOne.getBrly()+"|"; //这里有个医疗机构的,没有传,要考虑
|
String val = labReqmainOne.getBrdh() + "|" + labReqmainOne.getBrly() + "|"; //这里有个医疗机构的,没有传,要考虑
|
||||||
dayMessage.setMsg(val);
|
dayMessage.setMsg(val);
|
||||||
|
|
||||||
//5.保存数据
|
//5.保存数据
|
||||||
@ -93,7 +94,7 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
//6.写日志
|
//6.写日志
|
||||||
|
|
||||||
|
|
||||||
return new Result("0","");
|
return new Result("0", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -101,58 +102,58 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Result checkZT(String sqh,String yq,String zt){
|
private Result checkZT(String sqh, String yq, String zt) {
|
||||||
if(zt.equals("9")) return new Result("-1","当前条码已经作废,不允许上机!");
|
if (zt.equals("9")) return new Result("-1", "当前条码已经作废,不允许上机!");
|
||||||
String SP_GETTOWREQOK = commonUtil.getComOptValue("HISOPT", "SP_GETTOWREQOK"); //申请单禁止重复上机
|
String SP_GETTOWREQOK = commonUtil.getComOptValue("HISOPT", "SP_GETTOWREQOK"); //申请单禁止重复上机
|
||||||
String SP_GETTOWREQOKYQ = commonUtil.getComOptValue("HISOPT", "SP_GETTOWREQOKYQ");//申请单禁止同仪器重复上机
|
String SP_GETTOWREQOKYQ = commonUtil.getComOptValue("HISOPT", "SP_GETTOWREQOKYQ");//申请单禁止同仪器重复上机
|
||||||
if(zt.equals("2")){
|
if (zt.equals("2")) {
|
||||||
if(SP_GETTOWREQOK.equals("1")) return new Result("-1","当前条码已经上机!");
|
if (SP_GETTOWREQOK.equals("1")) return new Result("-1", "当前条码已经上机!");
|
||||||
if(SP_GETTOWREQOKYQ.equals("1")){
|
if (SP_GETTOWREQOKYQ.equals("1")) {
|
||||||
List<LabPat> labPatList = commonUtil.getLabPatListBySqh(sqh);
|
List<LabPat> labPatList = commonUtil.getLabPatListBySqh(sqh);
|
||||||
for (LabPat labPat : labPatList) {
|
for (LabPat labPat : labPatList) {
|
||||||
String yq1 = labPat.getYq();
|
String yq1 = labPat.getYq();
|
||||||
if(yq.equals(yq1)) return new Result("-1","该条码已经在当前仪器上机,不允许重复上机!");
|
if (yq.equals(yq1)) return new Result("-1", "该条码已经在当前仪器上机,不允许重复上机!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Result("0","校验成功!");
|
return new Result("0", "校验成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Result checkReqClass(String sqh,String yq,String bgddh){
|
private Result checkReqClass(String sqh, String yq, String bgddh) {
|
||||||
String value = commonUtil.getComOptValue(yq, "chkreqclass");
|
String value = commonUtil.getComOptValue(yq, "chkreqclass");
|
||||||
if(!value.equals("1")) return new Result("0","");
|
if (!value.equals("1")) return new Result("0", "");
|
||||||
LabInstrvsreqclass labInstrvsreqclass = new LabInstrvsreqclass();
|
LabInstrvsreqclass labInstrvsreqclass = new LabInstrvsreqclass();
|
||||||
labInstrvsreqclass.setYq(yq);
|
labInstrvsreqclass.setYq(yq);
|
||||||
List<LabInstrvsreqclass> labInstrvsreqclassList = labInstrvsreqclassMapper.getLabInstrvsreqclassList(labInstrvsreqclass);
|
List<LabInstrvsreqclass> labInstrvsreqclassList = labInstrvsreqclassMapper.getLabInstrvsreqclassList(labInstrvsreqclass);
|
||||||
if(labInstrvsreqclassList.size() > 0){
|
if (labInstrvsreqclassList.size() > 0) {
|
||||||
List<LabInstrvsreqclass> collect = labInstrvsreqclassList.stream().filter(labInstrvsreqclass1 -> labInstrvsreqclass1.getBgddh().equals(bgddh)).collect(Collectors.toList());
|
List<LabInstrvsreqclass> collect = labInstrvsreqclassList.stream().filter(labInstrvsreqclass1 -> labInstrvsreqclass1.getBgddh().equals(bgddh)).collect(Collectors.toList());
|
||||||
List<LabInstrvsreqclass> collect1 = labInstrvsreqclassList.stream().filter(labInstrvsreqclass1 -> labInstrvsreqclass1.getBgddh().equals("MZ_" + bgddh)).collect(Collectors.toList());
|
List<LabInstrvsreqclass> collect1 = labInstrvsreqclassList.stream().filter(labInstrvsreqclass1 -> labInstrvsreqclass1.getBgddh().equals("MZ_" + bgddh)).collect(Collectors.toList());
|
||||||
if(collect.size() > 0) return new Result("0","");
|
if (collect.size() > 0) return new Result("0", "");
|
||||||
if(collect1.size() > 0) return new Result("0","");
|
if (collect1.size() > 0) return new Result("0", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
Long count = lisWorkOperMapper.checkReqClass(sqh, yq);
|
Long count = lisWorkOperMapper.checkReqClass(sqh, yq);
|
||||||
if(count > 0) {
|
if (count > 0) {
|
||||||
return new Result("0","");
|
return new Result("0", "");
|
||||||
}else{
|
} else {
|
||||||
return new Result("1","");
|
return new Result("1", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Result saveReqInfo(String userId,String sqh,LabReqmain labReqmain,String yq,Date jyrq,String ybh){
|
public Result saveReqInfo(String userId, String sqh, LabReqmain labReqmain, String yq, Date jyrq, String ybh) {
|
||||||
//修改状态和时间
|
//修改状态和时间
|
||||||
updateLabReqmainZT(userId,sqh);
|
updateLabReqmainZT(userId, sqh);
|
||||||
//保存lab_pat表信息
|
//保存lab_pat表信息
|
||||||
LabPat labPat = new LabPat();
|
LabPat labPat = new LabPat();
|
||||||
labPat.setJyrq(commonUtil.getCurrentTime());
|
labPat.setJyrq(commonUtil.getCurrentTime());
|
||||||
labPat.setYq(yq);
|
labPat.setYq(yq);
|
||||||
labPat.setYbh(ybh);
|
labPat.setYbh(ybh);
|
||||||
labPat.setYblx(commonUtil.getComDictIdByName("BT",labReqmain.getYblx()));
|
labPat.setYblx(commonUtil.getComDictIdByName("BT", labReqmain.getYblx()));
|
||||||
labPat.setKsdh(commonUtil.getComDictIdByName("DP",labReqmain.getKsdh()));
|
labPat.setKsdh(commonUtil.getComDictIdByName("DP", labReqmain.getKsdh()));
|
||||||
labPat.setSjys(userId);
|
labPat.setSjys(userId);
|
||||||
labPat.setBrdh(labReqmain.getBrdh());
|
labPat.setBrdh(labReqmain.getBrdh());
|
||||||
labPat.setBrxm(labReqmain.getBrxm());
|
labPat.setBrxm(labReqmain.getBrxm());
|
||||||
@ -169,7 +170,7 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
labPat.setJgbz("0");
|
labPat.setJgbz("0");
|
||||||
labPat.setZd(labReqmain.getZd());
|
labPat.setZd(labReqmain.getZd());
|
||||||
labPat.setCyrq(labReqmain.getCysj());
|
labPat.setCyrq(labReqmain.getCysj());
|
||||||
labPat.setJymd(LisUtil.substringByGbkWidth(labReqmain.getJymd(),0,50));
|
labPat.setJymd(LisUtil.substringByGbkWidth(labReqmain.getJymd(), 0, 50));
|
||||||
labPat.setLastuser(userId);
|
labPat.setLastuser(userId);
|
||||||
labPat.setLastdt(commonUtil.getCurrentTime());
|
labPat.setLastdt(commonUtil.getCurrentTime());
|
||||||
labPat.setShcs(0);
|
labPat.setShcs(0);
|
||||||
@ -179,161 +180,171 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
labPat.setAddr(labReqmain.getAddr());
|
labPat.setAddr(labReqmain.getAddr());
|
||||||
labPat.setLstd(labReqmain.getLstd());
|
labPat.setLstd(labReqmain.getLstd());
|
||||||
commonUtil.insertLabPat(labPat);
|
commonUtil.insertLabPat(labPat);
|
||||||
return new Result("0","保存成功!");
|
return new Result("0", "保存成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updateLabReqmainZT(String userId,String sqh){
|
public void updateLabReqmainZT(String userId, String sqh) {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("userId",userId);
|
map.put("userId", userId);
|
||||||
map.put("sqh",sqh);
|
map.put("sqh", sqh);
|
||||||
labReqmainMapper.updateLabReqmainZT(map);
|
labReqmainMapper.updateLabReqmainZT(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审核报告单全流程
|
* 审核报告单全流程
|
||||||
|
*
|
||||||
* @param jyrq
|
* @param jyrq
|
||||||
* @param yq
|
* @param yq
|
||||||
* @param ybh
|
* @param ybh
|
||||||
* @param hdys
|
* @param hdys
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Result check2(Date jyrq, String yq, String ybh, String hdys){
|
public Result check2(Date jyrq, String yq, String ybh, String hdys) {
|
||||||
//1,审核权限校验
|
//1,审核权限校验
|
||||||
if(!commonUtil.getUserPower(yq,hdys,20))return new Result("-1","当前核对者无权对本仪器报告审核!");
|
if (!commonUtil.getUserPower(yq, hdys, 20)) return new Result("-1", "当前核对者无权对本仪器报告审核!");
|
||||||
//2:数据合法性校验
|
//2:数据合法性校验
|
||||||
Result result=beforecheck2(jyrq, yq, ybh, hdys);
|
Result result = beforecheck2(jyrq, yq, ybh, hdys);
|
||||||
if("0".equals(result.getCode()))return result;
|
if ("0".equals(result.getCode())) return result;
|
||||||
//3:数据完整性校验
|
//3:数据完整性校验
|
||||||
result= saveallresult(jyrq, yq, ybh);
|
result = saveallresult(jyrq, yq, ybh);
|
||||||
if("0".equals(result.getCode()))return result;
|
if ("0".equals(result.getCode())) return result;
|
||||||
//4:CA请求业务的处理
|
//4:CA请求业务的处理
|
||||||
//Result result=addCA(jyrq, yq, ybh, hdys);
|
//Result result=addCA(jyrq, yq, ybh, hdys);
|
||||||
//if("0".equals(result.getCode()))return result;
|
//if("0".equals(result.getCode()))return result;
|
||||||
//5:数据状态修改,异步上传接口作业创建
|
//5:数据状态修改,异步上传接口作业创建
|
||||||
//Result result=aftercheck2(jyrq, yq, ybh, hdys);
|
//Result result=aftercheck2(jyrq, yq, ybh, hdys);
|
||||||
//if("0".equals(result.getCode()))return result;
|
//if("0".equals(result.getCode()))return result;
|
||||||
return new Result("0","保存成功!");
|
return new Result("0", "保存成功!");
|
||||||
}
|
}
|
||||||
public Result beforecheck2(Date jyrq, String yq, String ybh, String hdys){
|
|
||||||
if(hdys==null || "".equals(hdys) ) new Result("-1","审核者为空,无法审核!");
|
public Result beforecheck2(Date jyrq, String yq, String ybh, String hdys) {
|
||||||
LabPat labPat=commonUtil.getLabPatOne(jyrq, yq, ybh);
|
if (hdys == null || "".equals(hdys)) new Result("-1", "审核者为空,无法审核!");
|
||||||
if(labPat==null)return new Result("-1","病人信息为空禁止审核!");
|
LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh);
|
||||||
String jgbz=labPat.getJgbz();
|
if (labPat == null) return new Result("-1", "病人信息为空禁止审核!");
|
||||||
if("2".equals(jgbz)) new Result("0","保存成功!");
|
String jgbz = labPat.getJgbz();
|
||||||
if("5".equals(jgbz)) return new Result("-1","已锁定报告禁止审核!");
|
if ("2".equals(jgbz)) new Result("0", "保存成功!");
|
||||||
if(!"1".equals(jgbz)){
|
if ("5".equals(jgbz)) return new Result("-1", "已锁定报告禁止审核!");
|
||||||
String f_check1=commonUtil.getComOptValue(yq,"f_check1");
|
if (!"1".equals(jgbz)) {
|
||||||
if("1".equals(f_check1)) return new Result("-1","审核前必须先初审!");
|
String f_check1 = commonUtil.getComOptValue(yq, "f_check1");
|
||||||
|
if ("1".equals(f_check1)) return new Result("-1", "审核前必须先初审!");
|
||||||
}
|
}
|
||||||
String brxm=labPat.getBrxm();
|
String brxm = labPat.getBrxm();
|
||||||
if(brxm==null || "".equals(brxm) ) new Result("-1","姓名为空禁止审核!");
|
if (brxm == null || "".equals(brxm)) new Result("-1", "姓名为空禁止审核!");
|
||||||
List<LabResult> labResultList =commonUtil.getLabResultList(jyrq, yq, ybh);
|
List<LabResult> labResultList = commonUtil.getLabResultList(jyrq, yq, ybh);
|
||||||
if(labResultList==null)return new Result("-1","结果为空禁止审核!");
|
if (labResultList == null) return new Result("-1", "结果为空禁止审核!");
|
||||||
for (LabResult labResult : labResultList) {
|
for (LabResult labResult : labResultList) {
|
||||||
String csjg=labResult.getCsjg();
|
String csjg = labResult.getCsjg();
|
||||||
if ("未做".equals(csjg)) {
|
if ("未做".equals(csjg)) {
|
||||||
return new Result("-1","还有结果为“未做”的项目,不可审核!");
|
return new Result("-1", "还有结果为“未做”的项目,不可审核!");
|
||||||
}
|
}
|
||||||
if(csjg!=null ) {
|
if (csjg != null) {
|
||||||
if(csjg.contains("ERR"))return new Result("-1","有结果错误,不可审核!");
|
if (csjg.contains("ERR")) return new Result("-1", "有结果错误,不可审核!");
|
||||||
if(csjg.contains("需稀释"))return new Result("-1","有结果需稀释,不可审核!");
|
if (csjg.contains("需稀释")) return new Result("-1", "有结果需稀释,不可审核!");
|
||||||
if(csjg.contains("需复做"))return new Result("-1","有结果需复做,不可审核!");
|
if (csjg.contains("需复做")) return new Result("-1", "有结果需复做,不可审核!");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Result("0","保存成功!");
|
return new Result("0", "保存成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存所有结果的修正值,涉及:空结果清除,计算项目添加,添加单位,添加申请项目编码,参考值重新计算更新,结果标志重新计算更新,危急值标志计算更新
|
* 保存所有结果的修正值,涉及:空结果清除,计算项目添加,添加单位,添加申请项目编码,参考值重新计算更新,结果标志重新计算更新,危急值标志计算更新
|
||||||
|
*
|
||||||
* @param jyrq
|
* @param jyrq
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Result saveallresult(Date jyrq, String yq, String ybh){
|
public Result saveallresult(Date jyrq, String yq, String ybh) {
|
||||||
//清除空白结果
|
//清除空白结果
|
||||||
String keepnodataitem=commonUtil.getComOptValue(yq,"keepnodataitem");
|
String keepnodataitem = commonUtil.getComOptValue(yq, "keepnodataitem");
|
||||||
if(!"1".equals(keepnodataitem)){
|
if (!"1".equals(keepnodataitem)) {
|
||||||
commonUtil.delNullLabResult(jyrq, yq, ybh);
|
commonUtil.delNullLabResult(jyrq, yq, ybh);
|
||||||
}
|
}
|
||||||
//查询病人信息
|
//查询病人信息
|
||||||
LabPat labPat=commonUtil.getLabPatOne(jyrq, yq, ybh);
|
LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh);
|
||||||
//计算项目更新
|
//计算项目更新
|
||||||
calcsample(labPat);
|
calcsample(labPat);
|
||||||
//保存最新参考值结果标志
|
//保存最新参考值结果标志
|
||||||
saverefs(labPat);
|
saverefs(labPat);
|
||||||
//补写结果表申请单项目编号
|
//补写结果表申请单项目编号
|
||||||
setItemSqxmdh(jyrq, yq, ybh,labPat.getSqh());
|
setItemSqxmdh(jyrq, yq, ybh, labPat.getSqh());
|
||||||
return new Result("0","保存成功!");
|
return new Result("0", "保存成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结果表补充申请单项目代码
|
* 结果表补充申请单项目代码
|
||||||
|
*
|
||||||
* @param jyrq
|
* @param jyrq
|
||||||
* @param yq
|
* @param yq
|
||||||
* @param ybh
|
* @param ybh
|
||||||
*/
|
*/
|
||||||
public void setItemSqxmdh(Date jyrq, String yq, String ybh){
|
public void setItemSqxmdh(Date jyrq, String yq, String ybh) {
|
||||||
String sqh=commonUtil.getSqhByKey(jyrq,yq,ybh);
|
String sqh = commonUtil.getSqhByKey(jyrq, yq, ybh);
|
||||||
if (sqh==null || "".equals(sqh)) {}else{
|
if (sqh == null || "".equals(sqh)) {
|
||||||
setItemSqxmdh(jyrq, yq, ybh,sqh);
|
} else {
|
||||||
|
setItemSqxmdh(jyrq, yq, ybh, sqh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//内部使用
|
//内部使用
|
||||||
private void setItemSqxmdh(Date jyrq, String yq, String ybh, String sqh){
|
private void setItemSqxmdh(Date jyrq, String yq, String ybh, String sqh) {
|
||||||
if (sqh==null || "".equals(sqh)) {}else{
|
if (sqh == null || "".equals(sqh)) {
|
||||||
int sl=labReqdetailMapper.getCountByKey(sqh);
|
} else {
|
||||||
if(sl==1){
|
int sl = labReqdetailMapper.getCountByKey(sqh);
|
||||||
String sqxmdh=lisWorkOperMapper.selectSqxmdh(sqh);
|
if (sl == 1) {
|
||||||
lisWorkOperMapper.updatelabresultsqxmdhall(jyrq,yq,ybh,sqxmdh);
|
String sqxmdh = lisWorkOperMapper.selectSqxmdh(sqh);
|
||||||
}else{
|
lisWorkOperMapper.updatelabresultsqxmdhall(jyrq, yq, ybh, sqxmdh);
|
||||||
lisWorkOperMapper.updatelabresultsqxmdh(jyrq,yq,ybh,sqh);
|
} else {
|
||||||
|
lisWorkOperMapper.updatelabresultsqxmdh(jyrq, yq, ybh, sqh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算项目增加及重新计算
|
* 计算项目增加及重新计算
|
||||||
|
*
|
||||||
* @param jyrq
|
* @param jyrq
|
||||||
* @param yq
|
* @param yq
|
||||||
* @param ybh
|
* @param ybh
|
||||||
*/
|
*/
|
||||||
public Result calcsample(Date jyrq, String yq, String ybh){
|
public Result calcsample(Date jyrq, String yq, String ybh) {
|
||||||
LabPat labPat=commonUtil.getLabPatOne(jyrq, yq, ybh);
|
LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh);
|
||||||
calcsample(labPat);
|
calcsample(labPat);
|
||||||
return new Result("0","保存成功!");
|
return new Result("0", "保存成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
//内部使用
|
//内部使用
|
||||||
private void calcsample(LabPat labPat){
|
private void calcsample(LabPat labPat) {
|
||||||
Date jyrq=labPat.getJyrq();
|
Date jyrq = labPat.getJyrq();
|
||||||
String yq=labPat.getYq();
|
String yq = labPat.getYq();
|
||||||
String ybh=labPat.getYbh();
|
String ybh = labPat.getYbh();
|
||||||
List<ResultCalcDTO> resultCalcDTO=lisWorkOperMapper.getResultCalc(jyrq,yq,ybh);
|
List<ResultCalcDTO> resultCalcDTO = lisWorkOperMapper.getResultCalc(jyrq, yq, ybh);
|
||||||
String xmdhold="";
|
String xmdhold = "";
|
||||||
for (ResultCalcDTO resultCalc : resultCalcDTO) {
|
for (ResultCalcDTO resultCalc : resultCalcDTO) {
|
||||||
String jsgs=resultCalc.getJsgs();
|
String jsgs = resultCalc.getJsgs();
|
||||||
String xmdh= resultCalc.getJsxm();
|
String xmdh = resultCalc.getJsxm();
|
||||||
if(!xmdhold.equals(xmdh)) {
|
if (!xmdhold.equals(xmdh)) {
|
||||||
xmdhold = xmdh;
|
xmdhold = xmdh;
|
||||||
String sex=labPat.getBrxb().trim();
|
String sex = labPat.getBrxb().trim();
|
||||||
if( "1".equals(sex))sex="男";
|
if ("1".equals(sex)) sex = "男";
|
||||||
if( "2".equals(sex))sex="女";
|
if ("2".equals(sex)) sex = "女";
|
||||||
double age = AgeUtils.getDecimalAge(AgeUtils.getBirthDateByAge(labPat.getNl(), labPat.getNldw()));
|
double age = AgeUtils.getDecimalAge(AgeUtils.getBirthDateByAge(labPat.getNl(), labPat.getNldw()));
|
||||||
Map<String, String> variables = new HashMap<>();
|
Map<String, String> variables = new HashMap<>();
|
||||||
variables.put("SEX", sex); // 示例值
|
variables.put("SEX", sex); // 示例值
|
||||||
variables.put("AGE", String.valueOf(age));
|
variables.put("AGE", String.valueOf(age));
|
||||||
String result=CalcUtils.getValueFromCalc(jsgs,variables);
|
String result = CalcUtils.getValueFromCalc(jsgs, variables);
|
||||||
if (result != null && !result.trim().isEmpty()) {
|
if (result != null && !result.trim().isEmpty()) {
|
||||||
//插入结果值
|
//插入结果值
|
||||||
LabResult labResult=commonUtil.getLabResult(jyrq,yq,ybh,xmdh);
|
LabResult labResult = commonUtil.getLabResult(jyrq, yq, ybh, xmdh);
|
||||||
if(labResult==null){
|
if (labResult == null) {
|
||||||
labResult=new LabResult();
|
labResult = new LabResult();
|
||||||
labResult.setJyrq(jyrq);
|
labResult.setJyrq(jyrq);
|
||||||
labResult.setYq(yq);
|
labResult.setYq(yq);
|
||||||
labResult.setYbh(ybh);
|
labResult.setYbh(ybh);
|
||||||
labResult.setXmdh(xmdh);
|
labResult.setXmdh(xmdh);
|
||||||
labResult.setCsjg(result);
|
labResult.setCsjg(result);
|
||||||
commonUtil.insertLabResult(labResult);
|
commonUtil.insertLabResult(labResult);
|
||||||
}else{
|
} else {
|
||||||
labResult.setCsjg(result);
|
labResult.setCsjg(result);
|
||||||
commonUtil.updateLabResult(labResult);
|
commonUtil.updateLabResult(labResult);
|
||||||
}
|
}
|
||||||
@ -341,30 +352,33 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算项目参考值结果异常标志
|
* 计算项目参考值结果异常标志
|
||||||
|
*
|
||||||
* @param jyrq
|
* @param jyrq
|
||||||
* @param yq
|
* @param yq
|
||||||
* @param ybh
|
* @param ybh
|
||||||
*/
|
*/
|
||||||
public Result saverefs(Date jyrq, String yq, String ybh){
|
public Result saverefs(Date jyrq, String yq, String ybh) {
|
||||||
LabPat labPat=commonUtil.getLabPatOne(jyrq, yq, ybh);
|
LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh);
|
||||||
saverefs(labPat);
|
saverefs(labPat);
|
||||||
return new Result("0","保存成功!");
|
return new Result("0", "保存成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算项目参考值结果异常标志(内部使用)
|
* 计算项目参考值结果异常标志(内部使用)
|
||||||
|
*
|
||||||
* @param labPat
|
* @param labPat
|
||||||
* @return 返回值0正常,1有危急值明细存在
|
* @return 返回值0正常, 1有危急值明细存在
|
||||||
*/
|
*/
|
||||||
private int saverefs(LabPat labPat){
|
private int saverefs(LabPat labPat) {
|
||||||
Date jyrq=labPat.getJyrq();
|
Date jyrq = labPat.getJyrq();
|
||||||
String yq=labPat.getYq();
|
String yq = labPat.getYq();
|
||||||
String ybh=labPat.getYbh();
|
String ybh = labPat.getYbh();
|
||||||
String yqdl=lisWorkOperMapper.selectYqdl(yq);
|
String yqdl = lisWorkOperMapper.selectYqdl(yq);
|
||||||
boolean lb_setbj=true,lb_wjz=false;
|
boolean lb_setbj = true, lb_wjz = false;
|
||||||
if(!"细菌仪".equals(yqdl)) {
|
if (!"细菌仪".equals(yqdl)) {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("jyrq", jyrq);
|
map.put("jyrq", jyrq);
|
||||||
map.put("yq", yq);
|
map.put("yq", yq);
|
||||||
@ -376,52 +390,53 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
String retCode = String.valueOf(map.get("retcode"));
|
String retCode = String.valueOf(map.get("retcode"));
|
||||||
String retMsg = String.valueOf(map.get("retmsg"));
|
String retMsg = String.valueOf(map.get("retmsg"));
|
||||||
log.info("调用存储过程{}返回值:{},{}", "sp_setrefs", retCode, retMsg);
|
log.info("调用存储过程{}返回值:{},{}", "sp_setrefs", retCode, retMsg);
|
||||||
if (retCode == null || "".equals(retCode) || "-1".equals(retCode)) lb_setbj=false;
|
if (retCode == null || "".equals(retCode) || "-1".equals(retCode)) lb_setbj = false;
|
||||||
List<LabResult> labResultList=commonUtil.getLabResultList(jyrq, yq, ybh);
|
List<LabResult> labResultList = commonUtil.getLabResultList(jyrq, yq, ybh);
|
||||||
for (LabResult labResult : labResultList) {
|
for (LabResult labResult : labResultList) {
|
||||||
String csjg=labResult.getCsjg();
|
String csjg = labResult.getCsjg();
|
||||||
boolean lb_nummode=LisUtil.isTureNumber(csjg);
|
boolean lb_nummode = LisUtil.isTureNumber(csjg);
|
||||||
String ygzq = labResult.getYgzq();
|
String ygzq = labResult.getYgzq();
|
||||||
String ygzd = labResult.getYgzd();
|
String ygzd = labResult.getYgzd();
|
||||||
//当结果为数值并且与周期诊断无关,计算存储过程保存成功后,只进行危急值判断
|
//当结果为数值并且与周期诊断无关,计算存储过程保存成功后,只进行危急值判断
|
||||||
if(lb_nummode && lb_setbj && !"Y".equals(ygzd) && !"Y".equals(ygzq)){
|
if (lb_nummode && lb_setbj && !"Y".equals(ygzd) && !"Y".equals(ygzq)) {
|
||||||
int wjz=alarmcondition(labPat,labResult);
|
int wjz = alarmcondition(labPat, labResult);
|
||||||
if(wjz!=-1){//危急值标识特殊判断存在时优先使用特殊结果
|
if (wjz != -1) {//危急值标识特殊判断存在时优先使用特殊结果
|
||||||
String resultalarmflag=labResult.getAlarmFlag();
|
String resultalarmflag = labResult.getAlarmFlag();
|
||||||
if(("".equals(resultalarmflag) && lb_wjz)) {
|
if (("".equals(resultalarmflag) && lb_wjz)) {
|
||||||
String jgbz=labResult.getJgbz();
|
String jgbz = labResult.getJgbz();
|
||||||
if(jgbz==null ||!"L".equals(jgbz)) jgbz="H";
|
if (jgbz == null || !"L".equals(jgbz)) jgbz = "H";
|
||||||
labResult.setAlarmFlag(jgbz);
|
labResult.setAlarmFlag(jgbz);
|
||||||
commonUtil.updateLabResult(labResult);
|
commonUtil.updateLabResult(labResult);
|
||||||
}else if(!"".equals(resultalarmflag) && !lb_wjz){
|
} else if (!"".equals(resultalarmflag) && !lb_wjz) {
|
||||||
labResult.setAlarmFlag("");
|
labResult.setAlarmFlag("");
|
||||||
commonUtil.updateLabResult(labResult);
|
commonUtil.updateLabResult(labResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String resultalarmflag1=labResult.getAlarmFlag();
|
String resultalarmflag1 = labResult.getAlarmFlag();
|
||||||
if(!"".equals(resultalarmflag1) && resultalarmflag1!=null)lb_wjz=true;
|
if (!"".equals(resultalarmflag1) && resultalarmflag1 != null) lb_wjz = true;
|
||||||
}else {
|
} else {
|
||||||
int wjz = setrefs( labPat, labResult);
|
int wjz = setrefs(labPat, labResult);
|
||||||
if (wjz == 1) lb_wjz = true;
|
if (wjz == 1) lb_wjz = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//危急值标识去除原则
|
//危急值标识去除原则
|
||||||
String brxm=labPat.getBrxm();
|
String brxm = labPat.getBrxm();
|
||||||
if(brxm.contains("质控")||brxm.contains("复查")||brxm.contains("QC")||brxm.contains("qc")||brxm.contains("软化水")||brxm.contains("锅炉水")){
|
if (brxm.contains("质控") || brxm.contains("复查") || brxm.contains("QC") || brxm.contains("qc") || brxm.contains("软化水") || brxm.contains("锅炉水")) {
|
||||||
lb_wjz=false;
|
lb_wjz = false;
|
||||||
};
|
}
|
||||||
String brly=labPat.getBrly();
|
;
|
||||||
brly=commonUtil.getComDictNameById("PT",brly);
|
String brly = labPat.getBrly();
|
||||||
if(brly.contains("质控"))lb_wjz=false;
|
brly = commonUtil.getComDictNameById("PT", brly);
|
||||||
String ksdh=labPat.getKsdh();
|
if (brly.contains("质控")) lb_wjz = false;
|
||||||
ksdh=commonUtil.getComDictNameById("DP",ksdh);
|
String ksdh = labPat.getKsdh();
|
||||||
if(ksdh.contains("检验科"))lb_wjz=false;
|
ksdh = commonUtil.getComDictNameById("DP", ksdh);
|
||||||
|
if (ksdh.contains("检验科")) lb_wjz = false;
|
||||||
//同步主表危急值标识
|
//同步主表危急值标识
|
||||||
String alarmflag=labPat.getAlarmflag();
|
String alarmflag = labPat.getAlarmflag();
|
||||||
if(("1".equals(alarmflag) && !lb_wjz)){
|
if (("1".equals(alarmflag) && !lb_wjz)) {
|
||||||
labPat.setAlarmflag("1");
|
labPat.setAlarmflag("1");
|
||||||
commonUtil.updateLabPat(labPat);
|
commonUtil.updateLabPat(labPat);
|
||||||
}else if(("".equals(alarmflag)||alarmflag==null) && lb_wjz){
|
} else if (("".equals(alarmflag) || alarmflag == null) && lb_wjz) {
|
||||||
labPat.setAlarmflag("");
|
labPat.setAlarmflag("");
|
||||||
commonUtil.updateLabPat(labPat);
|
commonUtil.updateLabPat(labPat);
|
||||||
}
|
}
|
||||||
@ -432,28 +447,29 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 明细结果计算参考值异常标志危急值标志并更新
|
* 明细结果计算参考值异常标志危急值标志并更新
|
||||||
|
*
|
||||||
* @param labPat
|
* @param labPat
|
||||||
* @param labResult
|
* @param labResult
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private int setrefs(LabPat labPat,LabResult labResult){
|
private int setrefs(LabPat labPat, LabResult labResult) {
|
||||||
String yq=labPat.getYq();
|
String yq = labPat.getYq();
|
||||||
String resultflag="M",wjzflag="";
|
String resultflag = "M", wjzflag = "";
|
||||||
int wjz=0;
|
int wjz = 0;
|
||||||
String xmdh=labResult.getXmdh();
|
String xmdh = labResult.getXmdh();
|
||||||
String csjg=labResult.getCsjg();
|
String csjg = labResult.getCsjg();
|
||||||
if (csjg == null || csjg.trim().isEmpty()) return 0;
|
if (csjg == null || csjg.trim().isEmpty()) return 0;
|
||||||
String csjgnew=LisUtil.getOverNumber(csjg.trim());
|
String csjgnew = LisUtil.getOverNumber(csjg.trim());
|
||||||
boolean lb_nummode=LisUtil.isNumber(csjgnew);
|
boolean lb_nummode = LisUtil.isNumber(csjgnew);
|
||||||
//当结果为数值时计算上下限
|
//当结果为数值时计算上下限
|
||||||
if(lb_nummode) {
|
if (lb_nummode) {
|
||||||
XmInfo xmInfo = commonUtil.getXmInfo(yq, xmdh);
|
XmInfo xmInfo = commonUtil.getXmInfo(yq, xmdh);
|
||||||
String dw = xmInfo.getDw();
|
String dw = xmInfo.getDw();
|
||||||
String refs = xmInfo.getDyckz();
|
String refs = xmInfo.getDyckz();
|
||||||
Double ckxx = xmInfo.getCkxx();
|
Double ckxx = xmInfo.getCkxx();
|
||||||
Double cksx = xmInfo.getCksx();
|
Double cksx = xmInfo.getCksx();
|
||||||
Double llimit=xmInfo.getLlimit();
|
Double llimit = xmInfo.getLlimit();
|
||||||
Double hlimit=xmInfo.getHlimit();
|
Double hlimit = xmInfo.getHlimit();
|
||||||
String ygxb = xmInfo.getYgxb();
|
String ygxb = xmInfo.getYgxb();
|
||||||
String ygnl = xmInfo.getYgnl();
|
String ygnl = xmInfo.getYgnl();
|
||||||
String ygbb = xmInfo.getYgbb();
|
String ygbb = xmInfo.getYgbb();
|
||||||
@ -498,42 +514,43 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
map.put("slzq", slzq);
|
map.put("slzq", slzq);
|
||||||
xmRef = commonUtil.getXmRefValue(map);
|
xmRef = commonUtil.getXmRefValue(map);
|
||||||
}
|
}
|
||||||
if(xmRef !=null){
|
if (xmRef != null) {
|
||||||
ckxx=xmRef.getCkxx();
|
ckxx = xmRef.getCkxx();
|
||||||
cksx=xmRef.getCksx();
|
cksx = xmRef.getCksx();
|
||||||
refs=xmRef.getDyck();
|
refs = xmRef.getDyck();
|
||||||
Double alterxx=xmRef.getAlterxx();
|
Double alterxx = xmRef.getAlterxx();
|
||||||
Double altersx=xmRef.getAltersx();
|
Double altersx = xmRef.getAltersx();
|
||||||
if(alterxx != null)llimit=alterxx;
|
if (alterxx != null) llimit = alterxx;
|
||||||
if(altersx != null)hlimit=altersx;
|
if (altersx != null) hlimit = altersx;
|
||||||
}
|
}
|
||||||
if(lb_nummode){
|
if (lb_nummode) {
|
||||||
//数值型结果判断
|
//数值型结果判断
|
||||||
Double csjgnum = Double.valueOf(csjgnew);
|
Double csjgnum = Double.valueOf(csjgnew);
|
||||||
if(ckxx != null)if(csjgnum<ckxx)resultflag="L";
|
if (ckxx != null) if (csjgnum < ckxx) resultflag = "L";
|
||||||
if(cksx != null)if(csjgnum>cksx)resultflag="H";
|
if (cksx != null) if (csjgnum > cksx) resultflag = "H";
|
||||||
int wjzf=alarmcondition(labPat,labResult);
|
int wjzf = alarmcondition(labPat, labResult);
|
||||||
if(wjzf==-1) {
|
if (wjzf == -1) {
|
||||||
if(llimit != null)if(csjgnum<llimit)wjzflag="L";
|
if (llimit != null) if (csjgnum < llimit) wjzflag = "L";
|
||||||
if(hlimit != null)if(csjgnum>hlimit)wjzflag="H";
|
if (hlimit != null) if (csjgnum > hlimit) wjzflag = "H";
|
||||||
}else if(wjzf==1) {
|
} else if (wjzf == 1) {
|
||||||
wjzflag=resultflag;
|
wjzflag = resultflag;
|
||||||
}
|
}
|
||||||
if(!"".equals(wjzflag))wjz=1;
|
if (!"".equals(wjzflag)) wjz = 1;
|
||||||
}else{
|
} else {
|
||||||
//文字型结果判断
|
//文字型结果判断
|
||||||
String jgbzold=labResult.getJgbz();
|
String jgbzold = labResult.getJgbz();
|
||||||
String lmtflag =getitemlmtflag(yq,xmdh,csjg);
|
String lmtflag = getitemlmtflag(yq, xmdh, csjg);
|
||||||
if("P".equals(jgbzold) && (csjg.indexOf("阳")>=0 || csjg.indexOf("+")>=0 || csjg.indexOf(":")>=0 ) && (lmtflag == null || lmtflag.trim().isEmpty())) lmtflag="P";
|
if ("P".equals(jgbzold) && (csjg.indexOf("阳") >= 0 || csjg.indexOf("+") >= 0 || csjg.indexOf(":") >= 0) && (lmtflag == null || lmtflag.trim().isEmpty()))
|
||||||
resultflag=lmtflag;
|
lmtflag = "P";
|
||||||
if("J".equals(lmtflag))wjzflag = "H";
|
resultflag = lmtflag;
|
||||||
|
if ("J".equals(lmtflag)) wjzflag = "H";
|
||||||
}
|
}
|
||||||
int wjzf=alarmcondition(labPat,labResult);
|
int wjzf = alarmcondition(labPat, labResult);
|
||||||
if(wjzf==1) wjzflag="H";//满足特定危机值条件
|
if (wjzf == 1) wjzflag = "H";//满足特定危机值条件
|
||||||
if(wjzf==0) wjzflag="";//存在特定危机值条件,但不满足不提示
|
if (wjzf == 0) wjzflag = "";//存在特定危机值条件,但不满足不提示
|
||||||
//小数保留位数计算
|
//小数保留位数计算
|
||||||
Integer xsws= xmInfo.getXsws();
|
Integer xsws = xmInfo.getXsws();
|
||||||
if(xsws>=0) csjg=LisUtil.round(csjg,xsws);
|
if (xsws >= 0) csjg = LisUtil.round(csjg, xsws);
|
||||||
labResult.setCsjg(csjg);
|
labResult.setCsjg(csjg);
|
||||||
labResult.setDw(dw);
|
labResult.setDw(dw);
|
||||||
labResult.setRefs(refs);
|
labResult.setRefs(refs);
|
||||||
@ -543,99 +560,102 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
|
|
||||||
commonUtil.updateLabResult(labResult);
|
commonUtil.updateLabResult(labResult);
|
||||||
}
|
}
|
||||||
if(!"".equals(wjzflag))wjz=1;
|
if (!"".equals(wjzflag)) wjz = 1;
|
||||||
return wjz;
|
return wjz;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*特定条件危急值判断
|
* 特定条件危急值判断
|
||||||
|
*
|
||||||
* @param labPat
|
* @param labPat
|
||||||
* @param labResult
|
* @param labResult
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private int alarmcondition(LabPat labPat,LabResult labResult){
|
private int alarmcondition(LabPat labPat, LabResult labResult) {
|
||||||
boolean lb_fcb=false,lb_hasval=false;
|
boolean lb_fcb = false, lb_hasval = false;
|
||||||
String csjg=labResult.getCsjg();
|
String csjg = labResult.getCsjg();
|
||||||
if (csjg == null || csjg.trim().isEmpty()) return -1;
|
if (csjg == null || csjg.trim().isEmpty()) return -1;
|
||||||
String yq=labPat.getYq();
|
String yq = labPat.getYq();
|
||||||
String xmdh=labResult.getXmdh();
|
String xmdh = labResult.getXmdh();
|
||||||
List<XmAlarmdetail> getXmAlarmdetail=commonUtil.getXmAlarmdetail(yq,xmdh);
|
List<XmAlarmdetail> getXmAlarmdetail = commonUtil.getXmAlarmdetail(yq, xmdh);
|
||||||
if(getXmAlarmdetail==null)return -1;
|
if (getXmAlarmdetail == null) return -1;
|
||||||
String brxm="";
|
String brxm = "";
|
||||||
String brdh="";
|
String brdh = "";
|
||||||
String ksdh=labPat.getKsdh();
|
String ksdh = labPat.getKsdh();
|
||||||
String ksdh1=commonUtil.getComDictIdByName("BT",ksdh);
|
String ksdh1 = commonUtil.getComDictIdByName("BT", ksdh);
|
||||||
if (ksdh1 != null && !ksdh1.trim().isEmpty()) ksdh=ksdh1;
|
if (ksdh1 != null && !ksdh1.trim().isEmpty()) ksdh = ksdh1;
|
||||||
String ybzt=labPat.getYbzt();
|
String ybzt = labPat.getYbzt();
|
||||||
String ybzt1=commonUtil.getComDictIdByName("ST",ybzt);
|
String ybzt1 = commonUtil.getComDictIdByName("ST", ybzt);
|
||||||
if (ybzt1 != null && !ybzt1.trim().isEmpty()) ybzt=ybzt1;
|
if (ybzt1 != null && !ybzt1.trim().isEmpty()) ybzt = ybzt1;
|
||||||
String zd=labPat.getZd();
|
String zd = labPat.getZd();
|
||||||
for(XmAlarmdetail xmAlarmdetail :getXmAlarmdetail){
|
for (XmAlarmdetail xmAlarmdetail : getXmAlarmdetail) {
|
||||||
String samplecondition=xmAlarmdetail.getSamplecondition();
|
String samplecondition = xmAlarmdetail.getSamplecondition();
|
||||||
lb_fcb=false;
|
lb_fcb = false;
|
||||||
if (samplecondition.toLowerCase().contains("[初报]")) {
|
if (samplecondition.toLowerCase().contains("[初报]")) {
|
||||||
Map<String,Object> map=new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("xmdh", xmdh);
|
map.put("xmdh", xmdh);
|
||||||
map.put("jyrq", labPat.getJyrq());
|
map.put("jyrq", labPat.getJyrq());
|
||||||
if (samplecondition.toLowerCase().contains("brxm"))brxm=labPat.getBrxm();
|
if (samplecondition.toLowerCase().contains("brxm")) brxm = labPat.getBrxm();
|
||||||
if (samplecondition.toLowerCase().contains("brdh"))brdh=labPat.getBrdh();
|
if (samplecondition.toLowerCase().contains("brdh")) brdh = labPat.getBrdh();
|
||||||
map.put("brxm", brxm);
|
map.put("brxm", brxm);
|
||||||
map.put("brdh", brdh);
|
map.put("brdh", brdh);
|
||||||
int limitcount=lisWorkOperMapper.getLimitCount(map);
|
int limitcount = lisWorkOperMapper.getLimitCount(map);
|
||||||
if(limitcount>0)lb_fcb=true;
|
if (limitcount > 0) lb_fcb = true;
|
||||||
samplecondition = samplecondition.replace("'brxm'", "1");
|
samplecondition = samplecondition.replace("'brxm'", "1");
|
||||||
samplecondition = samplecondition.replace("'brdh'", "1");
|
samplecondition = samplecondition.replace("'brdh'", "1");
|
||||||
samplecondition = samplecondition.replace("[初报]", "[CB]");
|
samplecondition = samplecondition.replace("[初报]", "[CB]");
|
||||||
}
|
}
|
||||||
|
|
||||||
labPat.setYblx(commonUtil.getComDictIdByName("BT",labPat.getYblx()));
|
labPat.setYblx(commonUtil.getComDictIdByName("BT", labPat.getYblx()));
|
||||||
labPat.setKsdh(commonUtil.getComDictIdByName("DP",labPat.getKsdh()));
|
labPat.setKsdh(commonUtil.getComDictIdByName("DP", labPat.getKsdh()));
|
||||||
samplecondition=samplecondition.replace("[科室]", "[DEPT]");
|
samplecondition = samplecondition.replace("[科室]", "[DEPT]");
|
||||||
samplecondition=samplecondition.replace("[诊断]", "[DIAG]");
|
samplecondition = samplecondition.replace("[诊断]", "[DIAG]");
|
||||||
samplecondition=samplecondition.replace("[样本状态]", "[YBZT]");
|
samplecondition = samplecondition.replace("[样本状态]", "[YBZT]");
|
||||||
Map<String, String> variables = new HashMap<>();
|
Map<String, String> variables = new HashMap<>();
|
||||||
variables.put("ZB", "1");
|
variables.put("ZB", "1");
|
||||||
variables.put("DEPT", ksdh);
|
variables.put("DEPT", ksdh);
|
||||||
variables.put("DIAG", zd);
|
variables.put("DIAG", zd);
|
||||||
variables.put("YBZT", ybzt);
|
variables.put("YBZT", ybzt);
|
||||||
samplecondition="if((" + samplecondition + ") ,1,0)";
|
samplecondition = "if((" + samplecondition + ") ,1,0)";
|
||||||
String result=CalcUtils.getValueFromCalc(samplecondition,variables);
|
String result = CalcUtils.getValueFromCalc(samplecondition, variables);
|
||||||
if("1".equals( result)){
|
if ("1".equals(result)) {
|
||||||
if(lb_fcb)return 0;
|
if (lb_fcb) return 0;
|
||||||
lb_hasval=true;
|
lb_hasval = true;
|
||||||
String resultcondition = xmAlarmdetail.getResultcondition();
|
String resultcondition = xmAlarmdetail.getResultcondition();
|
||||||
resultcondition=resultcondition.replace("[结果]", "[RESULT]");
|
resultcondition = resultcondition.replace("[结果]", "[RESULT]");
|
||||||
Map<String, String> variables1 = new HashMap<>();
|
Map<String, String> variables1 = new HashMap<>();
|
||||||
variables1.put("RESULT", csjg);
|
variables1.put("RESULT", csjg);
|
||||||
resultcondition="if((" + resultcondition + ") ,1,0)";
|
resultcondition = "if((" + resultcondition + ") ,1,0)";
|
||||||
String result1=CalcUtils.getValueFromCalc(resultcondition,variables1);
|
String result1 = CalcUtils.getValueFromCalc(resultcondition, variables1);
|
||||||
if("1".equals( result1))return 1;
|
if ("1".equals(result1)) return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( lb_hasval)return 0;
|
if (lb_hasval) return 0;
|
||||||
else return -1;
|
else return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取常用取值结果标志
|
* 获取常用取值结果标志
|
||||||
|
*
|
||||||
* @param yq
|
* @param yq
|
||||||
* @param xmdh
|
* @param xmdh
|
||||||
* @param csjg
|
* @param csjg
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getitemlmtflag(String yq,String xmdh,String csjg){
|
public String getitemlmtflag(String yq, String xmdh, String csjg) {
|
||||||
String jgbz="";
|
String jgbz = "";
|
||||||
if (csjg == null || csjg.isEmpty()) {
|
if (csjg == null || csjg.isEmpty()) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
String csjg1="",csjg2="";
|
String csjg1 = "", csjg2 = "";
|
||||||
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("\\((.*?)\\)");
|
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("\\((.*?)\\)");
|
||||||
java.util.regex.Matcher matcher = pattern.matcher(csjg);
|
java.util.regex.Matcher matcher = pattern.matcher(csjg);
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
csjg1=matcher.group(1);
|
csjg1 = matcher.group(1);
|
||||||
}
|
}
|
||||||
int index = csjg.indexOf(",");
|
int index = csjg.indexOf(",");
|
||||||
if(index == -1)csjg2= StringUtils.substring(csjg,index+1);
|
if (index == -1) csjg2 = StringUtils.substring(csjg, index + 1);
|
||||||
jgbz=commonUtil.getXmRefJgbz(yq,xmdh,csjg,csjg1,csjg2);
|
jgbz = commonUtil.getXmRefJgbz(yq, xmdh, csjg, csjg1, csjg2);
|
||||||
if (jgbz == null) {
|
if (jgbz == null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user