|
@@ -7,16 +7,15 @@ import ca.uhn.hl7v2.model.v24.segment.ORC;
|
|
|
import ca.uhn.hl7v2.model.v24.segment.PID;
|
|
|
import ca.uhn.hl7v2.model.v24.segment.PV1;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.ruoyi.web.work.domain.Patient;
|
|
|
import com.ruoyi.web.work.domain.Report;
|
|
|
import com.ruoyi.web.work.domain.Visit;
|
|
|
+import com.ruoyi.web.work.hl7.service.HL7PatientService;
|
|
|
import com.ruoyi.web.work.hl7.service.HL7RequestService;
|
|
|
import com.ruoyi.web.work.hl7.service.HL7ReportService;
|
|
|
-import com.ruoyi.web.work.mapper.PatientMapper;
|
|
|
+import com.ruoyi.web.work.hl7.service.HL7VisitService;
|
|
|
import com.ruoyi.web.work.mapper.ReportMapper;
|
|
|
-import com.ruoyi.web.work.mapper.VisitMapper;
|
|
|
import lombok.extern.log4j.Log4j2;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -33,10 +32,10 @@ import java.text.ParseException;
|
|
|
public class HL7ReportServiceImpl extends ServiceImpl<ReportMapper, Report> implements HL7ReportService {
|
|
|
|
|
|
@Autowired
|
|
|
- private PatientMapper patientMapper;
|
|
|
+ private HL7PatientService patientService;
|
|
|
|
|
|
@Autowired
|
|
|
- private VisitMapper visitMapper;
|
|
|
+ private HL7VisitService visitService;
|
|
|
|
|
|
@Autowired
|
|
|
private HL7RequestService obrService;
|
|
@@ -53,17 +52,13 @@ public class HL7ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impl
|
|
|
PID pid = oruR01.getPATIENT_RESULT().getPATIENT().getPID();
|
|
|
String cardId = pv1.getVisitNumber().getID().getValue(); //推送过来的数据就诊卡号
|
|
|
String wnPatId = pid.getPatientID().getID().getValue(); //卫宁患者ID
|
|
|
- String inspectionDepartmentName = orc.getOrderingFacilityName(0).getOrganizationName().getValue();//送检科室
|
|
|
- //根据患者标识符查询患者是否存在
|
|
|
- LambdaQueryWrapper<Patient> lambdaQueryWrapper = Wrappers.lambdaQuery(Patient.class).eq(Patient::getWnPatId, wnPatId);
|
|
|
- Patient entity = patientMapper.selectOne(lambdaQueryWrapper);
|
|
|
+ String inspectionDeptName = orc.getOrderingFacilityName(0).getOrganizationName().getValue();//送检科室
|
|
|
+ //根据卫宁患者标识符查询患者是否存在
|
|
|
+ Patient entity = patientService.findPatientByWnPatId(wnPatId);
|
|
|
if (entity != null){
|
|
|
- //保存当前患者的检测报告
|
|
|
- Long patientId = entity.getId(); //患者ID
|
|
|
- //根据患者id和送检科室查询是否本次就诊的检测报告
|
|
|
- LambdaQueryWrapper<Visit> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(Visit::getPatId,patientId).eq(Visit::getDepartment,inspectionDepartmentName);
|
|
|
- Visit visitEntity = visitMapper.selectOne(wrapper);
|
|
|
+ Long patId = entity.getId();//患者ID
|
|
|
+ //根据患者id和送检科室查询是否本次就诊的报告
|
|
|
+ Visit visitEntity = visitService.findVisitByPatIdAndDeptName(patId,inspectionDeptName);
|
|
|
if (visitEntity != null){
|
|
|
Long visitId = visitEntity.getId(); //就诊ID
|
|
|
//根据就诊id查询申请报告单表 如果当前报告存在更新
|
|
@@ -80,7 +75,7 @@ public class HL7ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impl
|
|
|
}else {
|
|
|
//保存本次就诊记录的检查报告orc
|
|
|
log.info("保存患者当前就诊的检查报告:{}",visitId);
|
|
|
- Long orcId = this.saveReport(patientId,visitEntity.getCardId(),orc,visitId);
|
|
|
+ Long orcId = this.saveReport(patId,visitEntity.getCardId(),orc,visitId);
|
|
|
//保存当前患者请求报告obr
|
|
|
obrService.saveRequestReportObr(oruR01,orcId);
|
|
|
log.info("保存当前存在的患者报告单完成!");
|