|
@@ -7,6 +7,8 @@ import com.diagbot.dto.data.AMedicalRecordDTO;
|
|
|
import com.diagbot.dto.data.AMrContentDTO;
|
|
|
import com.diagbot.entity.*;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
+import com.diagbot.enums.ModeIdEnum;
|
|
|
+import com.diagbot.facade.BasHospitalInfoFacade;
|
|
|
import com.diagbot.facade.BehospitalInfoFacade;
|
|
|
import com.diagbot.facade.ModelHospitalFacade;
|
|
|
import com.diagbot.facade.QcTypeFacade;
|
|
@@ -17,6 +19,9 @@ import com.diagbot.util.DateUtil;
|
|
|
import com.diagbot.util.ReadProperties;
|
|
|
import com.diagbot.util.TZDBConn;
|
|
|
import com.diagbot.vo.AnalyzeRunVO;
|
|
|
+import com.diagbot.vo.MedrecVo;
|
|
|
+import com.diagbot.vo.QueryVo;
|
|
|
+import com.diagbot.vo.data.AColumnContentVO;
|
|
|
import com.diagbot.vo.data.AMedicalRecordVO;
|
|
|
import com.diagbot.vo.data.AMrContentVO;
|
|
|
import com.google.common.collect.Lists;
|
|
@@ -58,6 +63,9 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
|
|
|
@Autowired
|
|
|
private ReadProperties readProperties;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private BasHospitalInfoFacade basHospitalInfoFacade;
|
|
|
+
|
|
|
private TZDBConn tzDBConn = new TZDBConn();
|
|
|
|
|
|
/**
|
|
@@ -105,6 +113,44 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 入参结构拼接-仅支持接口对接的方式
|
|
|
+ * @param aMrContentVO
|
|
|
+ */
|
|
|
+ public void splicingParam(AMrContentVO aMrContentVO){
|
|
|
+ QueryVo queryVo=new QueryVo();
|
|
|
+ List<MedrecVo> medreclist= Lists.newArrayList();
|
|
|
+
|
|
|
+ List<AColumnContentVO> content=Lists.newArrayList();
|
|
|
+ aMrContentVO.getRecords().stream().forEach(s -> {
|
|
|
+ queryVo.setHospitalId(s.getHospitalId().toString());
|
|
|
+ queryVo.setCid(basHospitalInfoFacade.getHosCode(s.getHospitalId()));
|
|
|
+
|
|
|
+ Long modeId=initModeId(s.getHospitalId(),s.getRecTitle());
|
|
|
+ s.getContents().stream().forEach(item->{
|
|
|
+ //拼接入参用于结构化解析
|
|
|
+ AColumnContentVO aColumnContentVO=new AColumnContentVO();
|
|
|
+ aColumnContentVO.setModeId(modeId);
|
|
|
+ aColumnContentVO.setStandModelName(ModeIdEnum.getName(Integer.parseInt(modeId.toString())));
|
|
|
+ aColumnContentVO.setRecId(s.getRecId());
|
|
|
+ aColumnContentVO.setRecTypeId(s.getRecTypeId());
|
|
|
+ aColumnContentVO.setRecTitle(s.getRecTitle());
|
|
|
+ aColumnContentVO.setXmlText(item.getXmlText());
|
|
|
+
|
|
|
+ content.add(aColumnContentVO);
|
|
|
+ });
|
|
|
+ Map<String, Object> map=new HashMap<String, Object>();
|
|
|
+ map.put("content",content);
|
|
|
+ MedrecVo medrecVo=new MedrecVo();
|
|
|
+ medrecVo.setTitle(ModeIdEnum.getName(Integer.parseInt(modeId.toString())));
|
|
|
+ medrecVo.setContent(map);
|
|
|
+ medreclist.add(medrecVo);
|
|
|
+ });
|
|
|
+ queryVo.setMedrec(medreclist);
|
|
|
+
|
|
|
+ columnFacade.analyseRec(queryVo);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 运行质控-通过接口更新病历记录
|
|
|
* @param aMrContentVO
|
|
@@ -137,6 +183,9 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
|
|
|
aMedicalRecordContentFacade.executeMrRecordContent(s.getContents());
|
|
|
});
|
|
|
|
|
|
+ //数据解析
|
|
|
+ splicingParam(aMrContentVO);
|
|
|
+
|
|
|
//评分后返回结构体
|
|
|
return mrIng(aMrContentVO);
|
|
|
|
|
@@ -222,38 +271,13 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
|
|
|
qcAbnormal.setGmtCreate(new Date());
|
|
|
qcAbnormalList.add(qcAbnormal);
|
|
|
}else if(modeId==Long.valueOf("1")){
|
|
|
-
|
|
|
BehospitalInfo behospitalInfo = behospitalInfoFacade.getOne(new QueryWrapper<BehospitalInfo>()
|
|
|
.eq("behospital_code", s.getBehospitalCode())
|
|
|
.eq("hospital_id", s.getHospitalId()), false);
|
|
|
if(behospitalInfo!=null){
|
|
|
//如果病人住院信息存在,更新对应的qc_type_id
|
|
|
- Long qcTypeId=Long.valueOf("0");
|
|
|
- QcType qcType=qcTypeFacade.getOne(new QueryWrapper<QcType>()
|
|
|
- .eq("name",s.getRecTitle())
|
|
|
- .eq("hospital_id", s.getHospitalId())
|
|
|
- .eq("is_deleted",IsDeleteEnum.N), false);
|
|
|
- if(qcType!=null){
|
|
|
- behospitalInfo.setQcTypeId(qcType.getId());
|
|
|
- }else{
|
|
|
- //新增类型到qc_type表中
|
|
|
- QcType qctype=new QcType();
|
|
|
- qctype.setHospitalId(s.getHospitalId());
|
|
|
- qctype.setName(s.getRecTitle());
|
|
|
- qctype.setGmtCreate(new Date());
|
|
|
-
|
|
|
- Long id=qcTypeFacade.saveT(qctype);
|
|
|
- behospitalInfo.setQcTypeId(id);
|
|
|
-
|
|
|
- //新增类型到监测表中
|
|
|
- QcAbnormal qcAbnormal=new QcAbnormal();
|
|
|
- qcAbnormal.setHospitalId(s.getHospitalId());
|
|
|
- qcAbnormal.setBehospitalCode(s.getBehospitalCode());
|
|
|
- qcAbnormal.setType(2);
|
|
|
- qcAbnormal.setDescription(s.getRecTitle());
|
|
|
- qcAbnormal.setGmtCreate(new Date());
|
|
|
- qcAbnormalList.add(qcAbnormal);
|
|
|
- }
|
|
|
+ Long qcTypeId=initQcTypeId(s);
|
|
|
+ behospitalInfo.setQcTypeId(qcTypeId);
|
|
|
behospitalInfoList.add(behospitalInfo);
|
|
|
}
|
|
|
}
|
|
@@ -286,6 +310,30 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 初始化质控类型ID
|
|
|
+ * @param medicalRecord
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Long initQcTypeId(MedicalRecord medicalRecord){
|
|
|
+ Long qcTypeId=Long.valueOf("0");
|
|
|
+ QcType qcType=qcTypeFacade.getOne(new QueryWrapper<QcType>()
|
|
|
+ .eq("name", medicalRecord.getRecTitle())
|
|
|
+ .eq("hospital_id", medicalRecord.getHospitalId())
|
|
|
+ .eq("is_deleted",IsDeleteEnum.N));
|
|
|
+ if(qcType!=null && qcType.getDefaultModule()==0){
|
|
|
+ qcTypeId=qcType.getId();
|
|
|
+ }else{
|
|
|
+ QcType qcTypeStand=qcTypeFacade.getOne(new QueryWrapper<QcType>()
|
|
|
+ .eq("default_module", 1)
|
|
|
+ .eq("hospital_id", medicalRecord.getHospitalId())
|
|
|
+ .eq("is_deleted",IsDeleteEnum.N));
|
|
|
+ if(qcTypeStand!=null){
|
|
|
+ qcTypeId=qcTypeStand.getId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return qcTypeId;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 初始化模型ID
|
|
@@ -306,4 +354,23 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
|
|
|
return modeId;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 初始化模型ID
|
|
|
+ * @param medicalRecord
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Long initModeId(Long hospitalId,String recTitle){
|
|
|
+ Long modeId=Long.valueOf("0");
|
|
|
+ QueryWrapper<ModelHospital> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.eq("hospital_id",hospitalId);
|
|
|
+ wrapper.eq("hospital_model_name",recTitle);
|
|
|
+ ModelHospital mode=modelHospitalFacade.getOne(wrapper, false);
|
|
|
+ if(mode!=null){
|
|
|
+ modeId=mode.getStandModelId();
|
|
|
+ }else{
|
|
|
+ modeId=Long.valueOf("0");
|
|
|
+ }
|
|
|
+ return modeId;
|
|
|
+ }
|
|
|
+
|
|
|
}
|