2025-06-24 18:01:25 +08:00
|
|
|
package com.czlis.interfaceCommon.utils;
|
|
|
|
|
|
2025-08-09 22:28:44 +08:00
|
|
|
import com.czlis.common.core.domain.Result;
|
|
|
|
|
import com.czlis.common.core.domain.entity.lis.*;
|
|
|
|
|
import com.czlis.common.utils.ComDictUtils;
|
|
|
|
|
import com.czlis.common.utils.ComOptionUtils;
|
2025-07-01 11:52:54 +08:00
|
|
|
import com.czlis.interfaceCommon.mapper.*;
|
2025-07-04 00:22:41 +08:00
|
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
2025-08-18 17:48:46 +08:00
|
|
|
import org.apache.ibatis.annotations.Param;
|
2025-06-24 18:01:25 +08:00
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
2025-07-01 11:52:54 +08:00
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
2025-06-24 18:01:25 +08:00
|
|
|
|
2025-07-12 12:58:41 +08:00
|
|
|
|
2025-07-01 11:52:54 +08:00
|
|
|
import java.util.*;
|
2025-06-24 18:01:25 +08:00
|
|
|
|
|
|
|
|
@Component
|
|
|
|
|
public class CommonUtil {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
LabPatMapper labPatMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
ComOptMapper comOptMapper;
|
2025-06-27 13:05:23 +08:00
|
|
|
@Autowired
|
|
|
|
|
LabReqmainMapper labReqmainMapper;
|
2025-07-01 11:52:54 +08:00
|
|
|
@Autowired
|
|
|
|
|
CommonMapper commonMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
ComDictMapper comDictMapper;
|
2025-07-04 00:22:41 +08:00
|
|
|
@Autowired
|
|
|
|
|
private LabResultMapper labResultMapper;
|
2025-07-23 14:19:57 +08:00
|
|
|
@Autowired
|
|
|
|
|
LabReqdetailMapper labReqdetailMapper;
|
2025-08-14 16:40:19 +08:00
|
|
|
@Autowired
|
|
|
|
|
ComUsrMapper comUsrMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
ComUsrpowerMapper comUsrpowerMapper;
|
2025-08-15 19:57:36 +08:00
|
|
|
@Autowired
|
|
|
|
|
XmInfoMapper xmInfoMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
XmRefMapper xmRefMapper;
|
2025-08-18 17:48:46 +08:00
|
|
|
@Autowired
|
|
|
|
|
XmValMapper xmValMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
XmAlarmdetailMapper xmAlarmdetailMapper;
|
|
|
|
|
//====检验主表操作方法集合===
|
2025-06-24 18:01:25 +08:00
|
|
|
public LabPat getLabPatOne(Date jyrq, String yq, String ybh){
|
|
|
|
|
return labPatMapper.getLabPatOne(jyrq, yq, ybh);
|
|
|
|
|
}
|
2025-07-04 00:22:41 +08:00
|
|
|
public List<LabPat> getLabPatListBySqh(String sqh){return labPatMapper.getLabPatListBySqh(sqh);}
|
|
|
|
|
public List<LabPat> getLabPatList(LabPat labPat) {return labPatMapper.getLabPat(labPat);}
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public int insertLabPat(LabPat labPat) {return labPatMapper.updateLabPat(labPat);}
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public int delLabPat(LabPat labPat){return labPatMapper.updateLabPat(labPat);}
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public int updateLabPat(LabPat labPat){return labPatMapper.updateLabPat(labPat);}
|
2025-08-09 22:28:44 +08:00
|
|
|
public int getCountByKey(Date jyrq, String yq,String ybh) {return labPatMapper.getCountByKey(jyrq,yq,ybh);}
|
|
|
|
|
public String getSqhByKey(Date jyrq,String yq,String ybh){return labPatMapper.getSqhByKey(jyrq,yq,ybh);}
|
2025-07-04 00:22:41 +08:00
|
|
|
//申请单主表方法集合
|
2025-06-27 13:05:23 +08:00
|
|
|
public LabReqmain getLabReqmainOne(String sqh){
|
|
|
|
|
return labReqmainMapper.getLabReqmainOne(sqh);
|
|
|
|
|
}
|
2025-07-04 00:22:41 +08:00
|
|
|
//申请单明细表集合
|
2025-07-01 11:52:54 +08:00
|
|
|
|
2025-07-04 00:22:41 +08:00
|
|
|
//====检验结果表操作方法集合===
|
2025-08-13 10:46:10 +08:00
|
|
|
public LabResult getLabResult(Date jyrq, String yq, String ybh, String xmdh) {return labResultMapper.getLabResult(jyrq, yq, ybh,xmdh);}
|
2025-07-04 00:22:41 +08:00
|
|
|
public List<LabResult> getLabResultList(Date jyrq, String yq, String ybh) {return labResultMapper.getLabResultList(jyrq, yq, ybh);}
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
2025-08-13 10:46:10 +08:00
|
|
|
public int insertLabResult(LabResult labResult) {return labResultMapper.insertLabResult(labResult);}
|
2025-07-04 00:22:41 +08:00
|
|
|
public List<LabResult> getresultinfo(Date jyrq, String yq, String ybh) {return labResultMapper.getLabResultList(jyrq, yq, ybh);}
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public int delLabResult(LabResult labResult) {return labResultMapper.delLabResult(labResult);}
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
2025-08-18 19:12:19 +08:00
|
|
|
public int delNullLabResult(Date jyrq, String yq, String ybh) {return labResultMapper.delNullLabResult(jyrq, yq, ybh);}
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
2025-07-04 00:22:41 +08:00
|
|
|
public int updateLabResult(LabResult labResult) {return labResultMapper.updateLabResult(labResult);}
|
2025-08-15 19:57:36 +08:00
|
|
|
//=====项目字典查询=========
|
|
|
|
|
public List<XmInfo> getXmInfoList(String yq) {return xmInfoMapper.getXmInfoList(yq);}
|
|
|
|
|
public XmInfo getXmInfo(String yq,String xmdh) {return xmInfoMapper.getXmInfo(yq,xmdh);}
|
|
|
|
|
public List<XmRef> getXmRefList(String yq) {return xmRefMapper.getXmRefList(yq);}
|
|
|
|
|
public XmRef getXmRef(String yq,String xmdh) {return xmRefMapper.getXmRef(yq,xmdh);}
|
|
|
|
|
public XmRef getXmRefValue(Map<String,Object> map) {return xmRefMapper.getXmRefValue(map);}
|
2025-08-18 17:48:46 +08:00
|
|
|
public String getXmRefJgbz(String yq,String xmdh,String csjg,String csjg1,String csjg2) {return xmValMapper.getXmValJgbz(yq,xmdh,csjg,csjg1,csjg2);}
|
|
|
|
|
public List<XmAlarmdetail> getXmAlarmdetail(String yq,String xmdh){return xmAlarmdetailMapper.getXmAlarmdetail(yq,xmdh);};
|
2025-07-01 11:52:54 +08:00
|
|
|
|
|
|
|
|
|
2025-07-04 00:22:41 +08:00
|
|
|
//服务器时间方法
|
|
|
|
|
public Date getCurrentTime(){return commonMapper.getCurrentTime();}
|
|
|
|
|
public String getCurrentDate(){return DateFormatUtils.format(commonMapper.getCurrentTime(), "yyyy-MM-dd");}
|
|
|
|
|
public String getCurrentDateTime(){return DateFormatUtils.format(commonMapper.getCurrentTime(), "yyyy-MM-dd HH:mm:ss");}
|
2025-08-01 17:34:03 +08:00
|
|
|
//字典查询单位名称
|
|
|
|
|
public String getCompany(String yljg){
|
|
|
|
|
if(yljg == null || yljg.equals(""))return getCompany();
|
|
|
|
|
String zdmc=getComDictNameById("HOS",yljg);
|
|
|
|
|
if(zdmc == null || zdmc.equals("")){
|
|
|
|
|
return yljg;
|
|
|
|
|
}else{
|
|
|
|
|
return zdmc;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public String getCompany(){
|
|
|
|
|
String zdmc=getComDictNameById("99","COMPANY");
|
|
|
|
|
if(zdmc == null || zdmc.equals("")){
|
|
|
|
|
return "";
|
|
|
|
|
}else{
|
|
|
|
|
return zdmc;
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-07-01 11:52:54 +08:00
|
|
|
|
2025-07-04 00:22:41 +08:00
|
|
|
//字典查询方法集合
|
2025-08-09 22:28:44 +08:00
|
|
|
public String getComDictNameById(String zdlb, String zddh) {
|
|
|
|
|
List<ComDict> comDictList =getDictCache(zdlb);
|
|
|
|
|
if(comDictList!=null){
|
|
|
|
|
for (ComDict dict : comDictList) {
|
|
|
|
|
if (zddh.equals(dict.getZddh())) {
|
|
|
|
|
return dict.getZdmc();
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
return comDictMapper.getComDictNameById(zdlb,zddh);
|
2025-07-01 11:52:54 +08:00
|
|
|
}
|
|
|
|
|
|
2025-08-09 22:28:44 +08:00
|
|
|
public String getComDictIdByName(String zdlb,String zdmc) {
|
|
|
|
|
List<ComDict> comDictList =getDictCache(zdlb);
|
|
|
|
|
if(comDictList!=null){
|
|
|
|
|
for (ComDict dict : comDictList) {
|
|
|
|
|
if (zdmc.equals(dict.getZdmc())) {
|
|
|
|
|
return dict.getZddh();
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
return comDictMapper.getComDictIdByName(zdlb,zdmc);
|
2025-07-01 11:52:54 +08:00
|
|
|
}
|
2025-07-04 00:22:41 +08:00
|
|
|
public String getComOptValue(String yq,String xxdh){
|
2025-08-18 18:20:58 +08:00
|
|
|
ComOpt comOpt =getOptCache(yq,xxdh);
|
|
|
|
|
if(comOpt != null) {
|
|
|
|
|
//获取到缓存,直接返回缓存中的数据
|
|
|
|
|
return comOpt.getXxqz();
|
|
|
|
|
}else{
|
|
|
|
|
//没有获取到缓存,则先从数据库中查询数据,然后再进行缓存
|
|
|
|
|
ComOpt comOpt1 = comOptMapper.getComOptOne(yq, xxdh);
|
|
|
|
|
ComOptionUtils.setOptCache(yq,xxdh,comOpt1);
|
|
|
|
|
return comOpt1.getXxqz();
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-04 00:22:41 +08:00
|
|
|
}
|
|
|
|
|
|
2025-07-23 14:19:57 +08:00
|
|
|
public List<LabReqdetail> getLabReqdetailList(String sqh){
|
|
|
|
|
return labReqdetailMapper.getLabReqdetailList(sqh);
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-09 22:28:44 +08:00
|
|
|
private List<ComDict> getDictCache(String zdlb) {
|
|
|
|
|
return ComDictUtils.getDictCache(zdlb);
|
|
|
|
|
}
|
2025-08-18 18:20:58 +08:00
|
|
|
|
|
|
|
|
private ComOpt getOptCache(String yq,String xxdh) {
|
|
|
|
|
return ComOptionUtils.getOptCache(yq,xxdh);
|
2025-08-09 22:28:44 +08:00
|
|
|
}
|
2025-07-12 12:58:41 +08:00
|
|
|
|
2025-08-09 22:28:44 +08:00
|
|
|
public Boolean getUserPower(String yq,String yhdh,int powerIdx){
|
|
|
|
|
if ("LIS".equals(yhdh)) return true;
|
|
|
|
|
if ("lis".equals(yhdh)) return true;
|
2025-08-14 16:40:19 +08:00
|
|
|
//String yhjs= commonMapper.getyhjs(yhdh);
|
|
|
|
|
List<ComUsr> comUsrList = comUsrMapper.getComUsrList(yhdh);
|
|
|
|
|
String yhjs = comUsrList.get(0).getYhjs();
|
2025-08-09 22:28:44 +08:00
|
|
|
if ("S".equals(yhjs)) return true;
|
2025-08-14 16:40:19 +08:00
|
|
|
String userPower=comUsrpowerMapper.getUserPower(yq,yhdh);
|
2025-08-09 22:28:44 +08:00
|
|
|
if(userPower==null) return false;
|
|
|
|
|
if("Y".equals(userPower.substring(powerIdx - 1,1)))return true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2025-06-24 18:01:25 +08:00
|
|
|
}
|