Merge remote-tracking branch 'lis8.0/master'
This commit is contained in:
commit
f60612abbd
@ -14,7 +14,7 @@ public class LabResultMed {
|
||||
private String yq;
|
||||
private String ybh;
|
||||
private String xmdh;
|
||||
private String xh;
|
||||
private Integer xh;
|
||||
private String ywdh;
|
||||
private String mic;
|
||||
private String rad;
|
||||
@ -22,4 +22,6 @@ public class LabResultMed {
|
||||
private String jgbz;
|
||||
private String bz;
|
||||
private String txtresult;
|
||||
private String ckz;
|
||||
private String cp_bz;
|
||||
}
|
||||
|
||||
@ -10,15 +10,22 @@ import java.math.BigDecimal;
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class XmMedDetail {
|
||||
private String yq;
|
||||
private String xmdh;
|
||||
private String ywzmc;
|
||||
private String ywdh;
|
||||
private BigDecimal mic1;
|
||||
private BigDecimal mic2;
|
||||
private BigDecimal rad1;
|
||||
private BigDecimal rad2;
|
||||
private String mrz;
|
||||
private Integer xh;
|
||||
private String bz;
|
||||
|
||||
private String yq;
|
||||
private String xmdh;
|
||||
private String ywzmc;
|
||||
private String ywdh;
|
||||
private Double mic1;
|
||||
private Double mic2;
|
||||
private Double rad1;
|
||||
private Double rad2;
|
||||
private String mrz;
|
||||
private Integer xh;
|
||||
private String bz;
|
||||
private String micref;
|
||||
private String radref;
|
||||
private String sddfalg;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,15 +1,18 @@
|
||||
package com.czlis.interfaceCommon.constants;
|
||||
|
||||
/**
|
||||
* 微生物结果标识定义
|
||||
*/
|
||||
public class LabResultmedConstants {
|
||||
/**
|
||||
* lab_resultmed.jgbz定义
|
||||
*/
|
||||
public class LabResultConstants {
|
||||
/**耐药*/ public static final String resistant="R";
|
||||
/**敏感*/ public static final String sensitive="S";
|
||||
/**中介*/ public static final String middle="I";
|
||||
/**剂量依赖型敏感*/ public static final String weaksensitive="D";
|
||||
/**剂量依赖性敏感*/ public static final String weaksensitive="D";
|
||||
/**无*/ public static final String negative="N";
|
||||
}
|
||||
|
||||
//========
|
||||
/**耐药*/ public static final String resistantvalue="耐药";
|
||||
/**敏感*/ public static final String sensitivevalue="敏感";
|
||||
/**中介*/ public static final String middlevalue="中介";
|
||||
/**剂量依赖性敏感*/ public static final String weaksensitivevalue="剂量依赖性敏感";
|
||||
/**无*/ public static final String negativevalue="无";
|
||||
}
|
||||
|
||||
@ -202,7 +202,16 @@ public class LisUtil {
|
||||
String regex = "^[0-9]+(\\.[0-9]*)?|\\.[0-9]+$";
|
||||
return str.matches(regex);
|
||||
}
|
||||
|
||||
/**字符串转小数数值**/
|
||||
public static Double getDoublevalue(String str) {
|
||||
try {
|
||||
Double value = Double.valueOf(str);
|
||||
return value;
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 将包含比较运算符的字符串转换为特定格式的数值字符串
|
||||
* 不支持的格式或非数字内容将返回原值
|
||||
|
||||
@ -3,6 +3,7 @@ package com.czlis.liswork.mapper;
|
||||
import com.czlis.common.core.domain.entity.lis.BactMediumgroupdet;
|
||||
import com.czlis.common.core.domain.entity.lis.LabGermsheetNew;
|
||||
import com.czlis.common.core.domain.entity.lis.LabResultMed;
|
||||
import com.czlis.common.core.domain.entity.lis.XmMedDetail;
|
||||
import com.czlis.liswork.pojo.DTO.MediumDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -15,4 +16,7 @@ public interface LisWorkGermMapper {
|
||||
String getmediumnox(String yblx);
|
||||
List<BactMediumgroupdet> getBactMediumgroupdet(String mediumno);
|
||||
int insertmedium(LabGermsheetNew labGermsheetNew);
|
||||
List<XmMedDetail> getXmMedDetailNew(@Param("yq") String yq,@Param("xmdh") String xmdh,@Param("ywdh") String ywdh);
|
||||
List<XmMedDetail> getXmMedDetail(@Param("yq") String yq,@Param("xmdh") String xmdh,@Param("ywdh") String ywdh);
|
||||
String getXmMedDetailBZ(@Param("yq") String yq,@Param("xmdh") String xmdh);
|
||||
}
|
||||
|
||||
@ -3,11 +3,15 @@ package com.czlis.liswork.service.impl;
|
||||
import com.czlis.common.core.domain.Result;
|
||||
import com.czlis.common.core.domain.entity.lis.*;
|
||||
import com.czlis.common.utils.SecurityUtils;
|
||||
import com.czlis.interfaceCommon.constants.LabResultmedConstants;
|
||||
import com.czlis.interfaceCommon.mapper.ComDictMapper;
|
||||
import com.czlis.interfaceCommon.mapper.LabResultMedMapper;
|
||||
import com.czlis.interfaceCommon.utils.CommonUtil;
|
||||
import com.czlis.interfaceCommon.utils.LisUtil;
|
||||
import com.czlis.liswork.mapper.LisWorkGermMapper;
|
||||
import com.czlis.liswork.mapper.xtwh.XmMedgroupMapper;
|
||||
import com.czlis.liswork.pojo.DTO.MediumDTO;
|
||||
import com.czlis.liswork.pojo.HistoryResult;
|
||||
import com.czlis.liswork.service.LisWorkGermService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -15,6 +19,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@ -181,6 +186,15 @@ public class LisWorkGermServiceImpl implements LisWorkGermService {
|
||||
if(xmdh==null||"".equals(xmdh))return new Result("-1","细菌代码不允许为空");
|
||||
String ywdh=labResultmed.getYwdh();
|
||||
if(ywdh==null||"".equals(ywdh))return new Result("-1","药物代码不允许为空");
|
||||
List<XmMedDetail> xmMedDetailList =lisWorkGermMapper.getXmMedDetailNew(yq,xmdh,ywdh);
|
||||
if(xmMedDetailList.isEmpty()){
|
||||
xmMedDetailList=lisWorkGermMapper.getXmMedDetail(yq,xmdh,ywdh);
|
||||
}
|
||||
if(!xmMedDetailList.isEmpty()) {
|
||||
XmMedDetail xmMedDetail = xmMedDetailList.get(0);
|
||||
String cp_bz=lisWorkGermMapper.getXmMedDetailBZ(yq,xmdh);
|
||||
labResultmed = setmedrefs(labResultmed,xmMedDetail,cp_bz);
|
||||
}
|
||||
int sl=commonUtil.getLabResultMedCount(labResultmed);
|
||||
if(sl==0) {
|
||||
commonUtil.insertLabResultMed(labResultmed);
|
||||
@ -189,9 +203,103 @@ public class LisWorkGermServiceImpl implements LisWorkGermService {
|
||||
}
|
||||
return new Result("0","成功");
|
||||
}
|
||||
private LabResultMed setmedrefs(LabResultMed labResultmed,XmMedDetail xmMedDetail,String cp_bz){
|
||||
String mic= labResultmed.getMic();
|
||||
String rad=labResultmed.getRad();
|
||||
String sddfalg=xmMedDetail.getSddfalg();
|
||||
String jgbz= LabResultmedConstants.sensitive;
|
||||
String csjg=LabResultmedConstants.sensitivevalue;
|
||||
if(mic!=null&&!mic.isEmpty()){
|
||||
if(LisUtil.isNumber(mic)){
|
||||
Double mic0=LisUtil.getDoublevalue(mic);
|
||||
Double mic1=xmMedDetail.getMic1();
|
||||
Double mic2=xmMedDetail.getMic2();
|
||||
if(mic2!=null&&mic0>=mic2){
|
||||
jgbz=LabResultmedConstants.resistant;
|
||||
csjg=LabResultmedConstants.resistantvalue;
|
||||
}else if(mic2==null&&mic1!=null&&mic0>mic1){
|
||||
jgbz=LabResultmedConstants.resistant;
|
||||
csjg=LabResultmedConstants.resistantvalue;
|
||||
}else if(mic1!=null&&mic0>mic1){
|
||||
jgbz=LabResultmedConstants.middle;
|
||||
csjg=LabResultmedConstants.middlevalue;
|
||||
if(sddfalg!=null&&"1".equals(sddfalg)){
|
||||
jgbz=LabResultmedConstants.weaksensitive;
|
||||
csjg=LabResultmedConstants.weaksensitivevalue;
|
||||
}
|
||||
}
|
||||
}
|
||||
labResultmed.setJgbz(jgbz);
|
||||
labResultmed.setCsjg(csjg);
|
||||
labResultmed.setCkz(xmMedDetail.getMicref());
|
||||
}else if(rad!=null&&!rad.isEmpty()){
|
||||
if(LisUtil.isNumber(rad)){
|
||||
Double rad0=LisUtil.getDoublevalue(rad);
|
||||
Double rad1=xmMedDetail.getRad1();
|
||||
Double rad2=xmMedDetail.getRad2();
|
||||
if(rad1!=null&&rad0<=rad1){
|
||||
jgbz=LabResultmedConstants.resistant;
|
||||
csjg=LabResultmedConstants.resistantvalue;
|
||||
}else if(rad1==null&&rad2!=null&&rad0<rad2){
|
||||
jgbz=LabResultmedConstants.resistant;
|
||||
csjg=LabResultmedConstants.resistantvalue;
|
||||
}else if(rad2!=null&&rad0<rad2){
|
||||
jgbz=LabResultmedConstants.middle;
|
||||
csjg=LabResultmedConstants.middlevalue;
|
||||
if(sddfalg!=null&&"1".equals(sddfalg)){
|
||||
jgbz=LabResultmedConstants.weaksensitive;
|
||||
csjg=LabResultmedConstants.weaksensitivevalue;
|
||||
}
|
||||
}
|
||||
}
|
||||
labResultmed.setJgbz(jgbz);
|
||||
labResultmed.setCsjg(csjg);
|
||||
labResultmed.setCkz(xmMedDetail.getRadref());
|
||||
}
|
||||
labResultmed.setCp_bz(cp_bz);
|
||||
return labResultmed;
|
||||
}
|
||||
@Override
|
||||
public Result savemedresultall(List<LabResultMed> labResultmedlist){
|
||||
commonUtil.insertLabResultMedAll(labResultmedlist);
|
||||
public Result savemedresultall(List<LabResultMed> labResultmedlist0){
|
||||
List<LabResultMed> distinctList = labResultmedlist0.stream().collect(Collectors.toMap(
|
||||
item -> item.getJyrq() + "_" + item.getYq().trim()+"_"+item.getYbh()+"_"+item.getXmdh(),
|
||||
item -> item,(existing, replacement) -> existing)).values().stream().collect(Collectors.toList());
|
||||
for(LabResultMed labResultmed0:distinctList){
|
||||
Date jyrq=labResultmed0.getJyrq();
|
||||
if(jyrq==null)return new Result("-1","检验日期不允许为空");
|
||||
String yq=labResultmed0.getYq();
|
||||
if(yq==null||"".equals(yq))return new Result("-1","仪器不允许为空");
|
||||
String ybh=labResultmed0.getYbh();
|
||||
if(ybh==null||"".equals(ybh))return new Result("-1","样本号不允许为空");
|
||||
String xmdh=labResultmed0.getXmdh();
|
||||
if(xmdh==null||"".equals(xmdh))return new Result("-1","细菌代码不允许为空");
|
||||
List<LabResultMed> labResultmedlist=labResultmedlist0.stream().filter(det->xmdh.equals(det.getXmdh())).collect(Collectors.toList());
|
||||
List<XmMedDetail> xmMedDetailList =lisWorkGermMapper.getXmMedDetailNew(yq,xmdh,"");
|
||||
if(xmMedDetailList.isEmpty()){
|
||||
xmMedDetailList=lisWorkGermMapper.getXmMedDetail(yq,xmdh,"");
|
||||
}
|
||||
if(!xmMedDetailList.isEmpty()) {
|
||||
String cp_bz=lisWorkGermMapper.getXmMedDetailBZ(yq,xmdh);
|
||||
int xh=0;
|
||||
for(LabResultMed labResultMed:labResultmedlist){
|
||||
xh++;
|
||||
String ywdh=labResultMed.getYwdh();
|
||||
List<XmMedDetail> xmMedDetail0 = xmMedDetailList.stream().filter(detail -> ywdh.equals(detail.getYwdh())).collect(Collectors.toList());
|
||||
if(xmMedDetail0.isEmpty()) {
|
||||
XmMedDetail xmMedDetail=xmMedDetail0.get(0);
|
||||
setmedrefs(labResultMed,xmMedDetail,cp_bz);
|
||||
}
|
||||
labResultMed.setXh(xh);
|
||||
}
|
||||
}
|
||||
LabResultMed labResultMedtemp =new LabResultMed();
|
||||
labResultMedtemp.setJyrq(jyrq);
|
||||
labResultMedtemp.setYq(yq);
|
||||
labResultMedtemp.setYbh(ybh);
|
||||
labResultMedtemp.setXmdh(xmdh);
|
||||
commonUtil.delLabResultMed(labResultMedtemp);
|
||||
commonUtil.insertLabResultMedAll(labResultmedlist);
|
||||
}
|
||||
return new Result("0","成功");
|
||||
}
|
||||
@Override
|
||||
@ -209,8 +317,4 @@ public class LisWorkGermServiceImpl implements LisWorkGermService {
|
||||
commonUtil.delLabResultMed(labResultmed);
|
||||
return new Result("0","成功");
|
||||
}
|
||||
private String getmedfalg(LabResultMed labResultmed){
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,16 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.czlis.liswork.mapper.LisWorkGermMapper">
|
||||
<select id="getLabResultMedInfo" resultType="com.czlis.common.core.domain.entity.lis.LabResultMed">
|
||||
select * from lab_resultmed where jyrq = #{jyrq} and yq = #{yq}
|
||||
select a.*,
|
||||
case
|
||||
when isnull(a.mic)!='' then isnull(c.micref,d.micref)
|
||||
when isnull(a.rad)!='' then isnull(c.radref,d.radref)
|
||||
else '' end as ckz,e.bz as cp_bz from lab_resultmed a
|
||||
join xm_info b on b.yq=a.yq and b.xmdh=a.xmdh
|
||||
left join com_dict e on e.zdlb='germclass' and e.zddh=b.germclass
|
||||
left join xm_meddetail c on b.germclass=c.xmdh and c.ywdh=a.ywdh
|
||||
left join xm_meddetail d on d.ywzmc = '细菌' and d.yq=a.yq and d.ywdh=a.ywdh
|
||||
where jyrq = #{jyrq} and yq = #{yq}
|
||||
<if test="ybh != null and ybh !=''">and ybh = #{ybh}</if>
|
||||
<if test="xmdh != null and xmdh !=''">and xmdh = #{xmdh}</if>
|
||||
<if test="xh != null">and xh = #{xh}</if>
|
||||
@ -43,4 +52,43 @@
|
||||
insert into lab_germsheet_new (jyrq, yq, ybh,mediumno,sheetdate,sheetuser,medium)
|
||||
values (#{jyrq},#{yq},#{ybh},#{mediumno},#{sheetdate},#{sheetuser},#{medium})
|
||||
</insert>
|
||||
<select id="getXmMedDetail" resultType="com.czlis.common.core.domain.entity.lis.XmMedDetail">
|
||||
SELECT * FROM xm_meddetail
|
||||
WHERE yq = #{yq} And
|
||||
xmdh = #{xmdh} And
|
||||
<where>
|
||||
<if test="yq != null and yq != ''">and yq = #{yq} </if>
|
||||
</where>
|
||||
<where>
|
||||
<if test="xmdh != null and xmdh != ''">and xmdh = #{xmdh}</if>
|
||||
</where>
|
||||
<where>
|
||||
<if test="ywdh != null and ywdh != ''">and ywdh = #{ywdh}</if>
|
||||
</where>
|
||||
and ywzmc = '细菌'
|
||||
</select>
|
||||
<select id="getXmMedDetailNew" resultType="com.czlis.common.core.domain.entity.lis.XmMedDetail">
|
||||
SELECT xm_meddetail.*
|
||||
FROM xm_meddetail join xm_info on xm_info.germclass=xm_meddetail.xmdh
|
||||
<where>
|
||||
<if test="yq != null and yq != ''">and xm_info.yq = #{yq} </if>
|
||||
</where>
|
||||
<where>
|
||||
<if test="xmdh != null and xmdh != ''">and xm_info.xmdh = #{xmdh}</if>
|
||||
</where>
|
||||
<where>
|
||||
<if test="ywdh != null and ywdh != ''">and xm_meddetail.ywdh = #{ywdh}</if>
|
||||
</where>
|
||||
and xm_meddetail.yq = '_med_'
|
||||
</select>
|
||||
<select id="getXmMedDetailBZ" resultType="String">
|
||||
SELECT com_dict.bz from xm_info join com_dict
|
||||
on zdlb = 'germclass' AND zddh =xm_info.germclass
|
||||
<where>
|
||||
<if test="yq != null and yq != ''">and xm_info.yq = #{yq} </if>
|
||||
</where>
|
||||
<where>
|
||||
<if test="xmdh != null and xmdh != ''">and xm_info.xmdh = #{xmdh}</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user