|
@@ -0,0 +1,155 @@
|
|
|
+package com.diagbot.facade.supple;
|
|
|
+
|
|
|
+import com.diagbot.dto.RespDTO;
|
|
|
+import com.diagbot.entity.BehospitalInfo;
|
|
|
+import com.diagbot.entity.DoctorAdvice;
|
|
|
+import com.diagbot.entity.MedicalRecord;
|
|
|
+import com.diagbot.facade.ViewFacade;
|
|
|
+import com.diagbot.facade.data.ABehospitalInfoFacade;
|
|
|
+import com.diagbot.facade.data.ADoctorAdviceFacade;
|
|
|
+import com.diagbot.facade.data.AMedicalRecordFacade;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
+import com.diagbot.util.TZDBConn;
|
|
|
+import com.diagbot.vo.data.XyHomePageVo;
|
|
|
+import com.diagbot.vo.supple.SuppleVO;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Component
|
|
|
+@Slf4j
|
|
|
+public class SupplementFacade {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ABehospitalInfoFacade aBehospitalInfoFacade;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ADoctorAdviceFacade aDoctorAdviceFacade;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AMedicalRecordFacade aMedicalRecordFacade;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ViewFacade viewFacade;
|
|
|
+
|
|
|
+ private TZDBConn tzDBConn = new TZDBConn();
|
|
|
+
|
|
|
+ public RespDTO supplementData(SuppleVO suppleVO){
|
|
|
+ if(StringUtil.isNotEmpty(suppleVO.getBehospitalCode()) && suppleVO.getBehospitalCode().contains("_")){
|
|
|
+ //将病历号分开后进行数据获取
|
|
|
+ String[] codes=suppleVO.getBehospitalCode().split("_");
|
|
|
+ suppleVO.setBehospitalCode(codes[0]);
|
|
|
+ suppleVO.setBehospitalNum(codes[1]);
|
|
|
+ }
|
|
|
+
|
|
|
+ //同步病人住院登记信息
|
|
|
+ supplementBehospital(suppleVO);
|
|
|
+
|
|
|
+ //同步病人医嘱
|
|
|
+ supplementAdvice(suppleVO);
|
|
|
+
|
|
|
+ supplementRecord(suppleVO);
|
|
|
+
|
|
|
+ //获取病案首页
|
|
|
+ XyHomePageVo xyHomePageVo = new XyHomePageVo();
|
|
|
+ xyHomePageVo.setBehospitalCode(suppleVO.getBehospitalCode());
|
|
|
+ xyHomePageVo.setHospitalId("35");
|
|
|
+ xyHomePageVo.setFileCode(suppleVO.getBehospitalNum());
|
|
|
+ xyHomePageVo.setDockModeType("0");
|
|
|
+ viewFacade.getHomePageByView(xyHomePageVo);
|
|
|
+
|
|
|
+ return RespDTO.onSuc(null);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description:通过病历号进行数据补录-病人住院登记信息
|
|
|
+ * @Author:liuqq
|
|
|
+ * @time: ${DATE} ${TIME}
|
|
|
+ **/
|
|
|
+ public void supplementBehospital(SuppleVO suppleVO){
|
|
|
+ try{
|
|
|
+ List<BehospitalInfo> behospitalInfoList = new ArrayList<>();
|
|
|
+ //病历号由“病历号_病历次数”拼接而成
|
|
|
+ String sql="select * from admission_pat_regist where 1=1 ";
|
|
|
+ if(StringUtil.isNotEmpty(suppleVO.getBehospitalCode())){
|
|
|
+ sql+=" and behospitalCode='"+ suppleVO.getBehospitalCode() +"'";
|
|
|
+ }
|
|
|
+ if(StringUtil.isNotEmpty(suppleVO.getBehospitalNum())){
|
|
|
+ sql+=" and behospitalNum='"+ suppleVO.getBehospitalNum() +"'";
|
|
|
+ }
|
|
|
+
|
|
|
+ behospitalInfoList=tzDBConn.getBehospitalInfo(sql);
|
|
|
+ aBehospitalInfoFacade.execute(behospitalInfoList);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("病历数据刷新异常"+e.getMessage(),new Throwable());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description:通过病历号进行数据补录-医嘱
|
|
|
+ * @Author:liuqq
|
|
|
+ * @time: ${DATE} ${TIME}
|
|
|
+ **/
|
|
|
+ public void supplementAdvice(SuppleVO suppleVO){
|
|
|
+ try{
|
|
|
+ List<DoctorAdvice> adviceList = new ArrayList<>();
|
|
|
+ //病历号由“病历号_病历次数”拼接而成
|
|
|
+ String sql="select * from doctor_order where 1=1 ";
|
|
|
+ if(StringUtil.isNotEmpty(suppleVO.getBehospitalCode())){
|
|
|
+ sql+=" and behospitalCode='"+ suppleVO.getBehospitalCode() +"'";
|
|
|
+ }
|
|
|
+ if(StringUtil.isNotEmpty(suppleVO.getBehospitalNum())){
|
|
|
+ sql+=" and behospitalNum='"+ suppleVO.getBehospitalNum() +"'";
|
|
|
+ }
|
|
|
+
|
|
|
+ adviceList=tzDBConn.getDoctorAdvice(sql);
|
|
|
+ aDoctorAdviceFacade.execute(adviceList);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("病历数据刷新异常"+e.getMessage(),new Throwable());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description:通过病历号进行数据补录-病历
|
|
|
+ * @Author:liuqq
|
|
|
+ * @time: ${DATE} ${TIME}
|
|
|
+ **/
|
|
|
+ public void supplementRecord(SuppleVO suppleVO){
|
|
|
+ try{
|
|
|
+ List<MedicalRecord> medicalRecordList = new ArrayList<>();
|
|
|
+ //病历号由“病历号_病历次数”拼接而成
|
|
|
+ String sql="select * from record_list where 1=1 ";
|
|
|
+ if(StringUtil.isNotEmpty(suppleVO.getBehospitalCode())){
|
|
|
+ sql+=" and behospitalCode='"+ suppleVO.getBehospitalCode() +"'";
|
|
|
+ }
|
|
|
+ if(StringUtil.isNotEmpty(suppleVO.getBehospitalNum())){
|
|
|
+ sql+=" and behospitalNum='"+ suppleVO.getBehospitalNum() +"'";
|
|
|
+ }
|
|
|
+
|
|
|
+ medicalRecordList = tzDBConn.getMedicalRecord(sql);
|
|
|
+ if (medicalRecordList.size() > 0) {
|
|
|
+ aMedicalRecordFacade.execute(medicalRecordList);
|
|
|
+ medicalRecordList.forEach(s -> {
|
|
|
+ //获取文书详情
|
|
|
+ String recId = s.getRecId();
|
|
|
+ //截取rec_id後面的_次數跟接口相對潁上
|
|
|
+ int inedx = s.getRecId().lastIndexOf("_");
|
|
|
+ s.setRecId(s.getRecId().substring(0, inedx));
|
|
|
+ viewFacade.getRecordContent(recId);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("病历数据刷新异常"+e.getMessage(),new Throwable());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|