package com.czlis.interfaceCommon.utils; import com.czlis.common.core.domain.entity.LabPat; import com.czlis.common.core.domain.entity.LabReqmain; import com.czlis.common.core.domain.entity.LabResult; import com.czlis.interfaceCommon.mapper.*; import org.apache.commons.lang3.time.DateFormatUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.util.*; @Component public class CommonUtil { @Autowired LabPatMapper labPatMapper; @Autowired ComOptMapper comOptMapper; @Autowired LabReqmainMapper labReqmainMapper; @Autowired CommonMapper commonMapper; @Autowired ComDictMapper comDictMapper; @Autowired private LabResultMapper labResultMapper; //====检验主表操作方法集合=== public LabPat getLabPatOne(Date jyrq, String yq, String ybh){ return labPatMapper.getLabPatOne(jyrq, yq, ybh); } public List getLabPatListBySqh(String sqh){return labPatMapper.getLabPatListBySqh(sqh);} public List 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);} public int getCountByKey(String jyrq, String yq,String ybh) {return labPatMapper.getCountByKey(jyrq,yq,ybh);} public String getSqhByKey(String jyrq,String yq,String ybh){return labPatMapper.getSqhByKey(jyrq,yq,ybh);} //申请单主表方法集合 public LabReqmain getLabReqmainOne(String sqh){ return labReqmainMapper.getLabReqmainOne(sqh); } //申请单明细表集合 //====检验结果表操作方法集合=== public List getLabResult(Date jyrq, String yq, String ybh, String xmdh) {return labResultMapper.getLabResult(jyrq, yq, ybh,xmdh);} public List getLabResultList(Date jyrq, String yq, String ybh) {return labResultMapper.getLabResultList(jyrq, yq, ybh);} @Transactional(rollbackFor = Exception.class) public int insertLabResult(LabResult labResult) {return labResultMapper.updateLabResult(labResult);} public List 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) public int updateLabResult(LabResult labResult) {return labResultMapper.updateLabResult(labResult);} //服务器时间方法 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");} //字典查询方法集合 public String getComDictNameById(String zdlb,String xxdh){ String zdmc = comDictMapper.getComDictNameById(zdlb,xxdh); if(zdmc == null || zdmc.equals("")){ return xxdh; }else{ return zdmc; } } public String getComDictIdByName(String zdlb,String zdmc){ String zddh = comDictMapper.getComDictIdByName(zdlb,zdmc); if(zddh == null || zddh.equals("")){ return zdmc; }else{ return zddh; } } public String getComOptValue(String yq,String xxdh){ return comOptMapper.getComOptValue(yq,xxdh); } }