推送的宝宝报告,全部推给母亲

3.2.4.44
wyb 2 years ago
parent c180f59401
commit 00fa67521a

@ -1,6 +1,8 @@
package com.docus.server;
import cn.hutool.extra.spring.SpringUtil;
import com.docus.server.collection.service.ITBasicService;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
@ -21,6 +23,9 @@ public class AppRunBootstrap {
props.setProperty("UseSunHttpHandler", "true");
System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
SpringApplication.run(AppRunBootstrap.class, args);
ITBasicService basicService = SpringUtil.getBean(ITBasicService.class);
System.out.println(basicService.getIsBabyBasic("039baa8c5a8243fd93ec58a5517b5e6"));
System.out.println(basicService.getSdRyParentPatientInfo("00048819bea942f590368415d38cf41x"));
}
}

@ -58,4 +58,32 @@ public interface TBasicMapper{
* @return db
*/
Integer saveNisRemoveFilesCount(@Param("patientId") String patientId,@Param("count") int removeCount);
/**
*
* @param patientId
* @return
*/
String getSdRyIndex(@Param("patientId") String patientId);
/**
*
* @param babyIndex
* @return
*/
String getParentSdRyIndex(@Param("babyIndex")String babyIndex);
/**
*
* @param sdRyIndex
* @return
*/
String getPatientIdBySdRyIndex(@Param("sdRyIndex")String sdRyIndex);
/**
*
* @param patientId
* @return
*/
TBasic getByPatientId(@Param("patientId") String patientId);
}

@ -1,6 +1,7 @@
package com.docus.server.collection.service;
import com.docus.server.collection.dto.TBasicDto;
import com.docus.server.collection.entity.TBasic;
public interface ITBasicService {
@ -10,4 +11,18 @@ public interface ITBasicService {
public void updateAdmissTBasic(TBasicDto dto) throws Exception;
/**
*
* @param babyPatientId
* @return
*/
TBasic getSdRyParentPatientInfo(String babyPatientId);
/**
*
* B
* @param patientId
* @return
*/
boolean getIsBabyBasic(String patientId);
}

@ -275,6 +275,34 @@ public class TBasicServiceImpl implements ITBasicService {
tBasicMapper.update(tBasic);
tBasicMapper.updateExtend(tBasicExtend);
}
@Override
public TBasic getSdRyParentPatientInfo(String babyPatientId) {
// 宝宝索引
String babyIndex=tBasicMapper.getSdRyIndex(babyPatientId);
if (Func.isBlank(babyIndex)){
return null;
}
// 宝宝索引查妈妈索引
String parentSdRyIndex= tBasicMapper.getParentSdRyIndex(babyIndex);
if(Func.isBlank(parentSdRyIndex)){
return null;
}
// 通过索引查病案主键
String parentPatientId=tBasicMapper.getPatientIdBySdRyIndex(parentSdRyIndex);
if(Func.isBlank(parentPatientId)){
return null;
}
// 通过病案主键查基础信息
return tBasicMapper.getByPatientId(parentPatientId);
}
@Override
public boolean getIsBabyBasic(String patientId) {
TBasic tBasic= tBasicMapper.getByPatientId(patientId);
return Func.isNotEmpty(tBasic) && Func.isNotBlank(tBasic.getInpatientNo()) && tBasic.getInpatientNo().toUpperCase().contains("B");
}
}

@ -6,6 +6,8 @@ import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.infrastructure.web.api.ResultCode;
import com.docus.server.collection.entity.TBasic;
import com.docus.server.collection.service.ITBasicService;
import com.docus.server.report.api.DownPlatformService;
import com.docus.server.report.api.dto.ReportDownDto;
import com.docus.server.report.api.dto.ReportDownPatientDto;
@ -24,10 +26,7 @@ import sun.misc.BASE64Encoder;
import javax.annotation.Resource;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
*
@ -43,12 +42,31 @@ public class ReportDownListener {
@Resource
private AfReportRecordMapper afReportRecordMapper;
@Resource
private ITBasicService itBasicService;
@EventListener
@Async("threadPoolExecutor")
public void threePartyPushReportDown(ThreePartyPushReportDownEvent threePartyPushReportDownEvent) {
// 根据任务id获取上报记录信息
AfReportRecord afReportRecord = afReportRecordMapper.getReportRecordInfoByTaskId(threePartyPushReportDownEvent.getTaskId());
// 病案是否是婴儿
boolean isBaby = itBasicService.getIsBabyBasic(afReportRecord.getPatientId());
if (isBaby) {
// 如果是婴儿查找母亲的信息
TBasic parentPatientInfo = itBasicService.getSdRyParentPatientInfo(afReportRecord.getPatientId());
if (Objects.isNull(parentPatientInfo)) {
log.warn("住院号:{},住院次数:{},病案主键:{} 是婴儿病案,未关联查询到母亲信息,不进行下载!", afReportRecord.getInpatientNo(), afReportRecord.getAdmissTimes(), afReportRecord.getPatientId());
return;
}
// 婴儿的报告要推给母亲,修改为母亲信息
afReportRecord.setPatientId(parentPatientInfo.getPatientId());
afReportRecord.setInpatientNo(parentPatientInfo.getInpatientNo());
afReportRecord.setAdmissTimes(parentPatientInfo.getAdmissTimes());
afReportRecord.setJzh(parentPatientInfo.getJzh());
}
// 组织基础信息数据
ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto(afReportRecord);
@ -75,7 +93,6 @@ public class ReportDownListener {
}
@EventListener
@Async("threadPoolExecutor")
public void taskConsumptionReporDown(TaskConsumptionReportDownEvent taskConsumptionReportDownEvent) {
@ -102,17 +119,16 @@ public class ReportDownListener {
}
public static void main(String[] args) throws IOException {
BASE64Encoder encoder = new BASE64Encoder();
String url="http://192.168.161.102:9291/api/downplatform/scansionReportBatch";
String url = "http://192.168.161.102:9291/api/downplatform/scansionReportBatch";
// String url="http://127.0.0.1:9291/api/downplatform/scansionReportBatch";
Map<String, Object> bodyMap=new HashMap<>();
Map<String, Object> patientMap=new HashMap<>();
patientMap.put("patientid","8099350542");
List<Map<String, Object>> scanfiles=new ArrayList<>();
Map<String, Object> bodyMap = new HashMap<>();
Map<String, Object> patientMap = new HashMap<>();
patientMap.put("patientid", "8099350542");
List<Map<String, Object>> scanfiles = new ArrayList<>();
// FileInputStream inputStream = new FileInputStream("d://wyb.png");
@ -130,31 +146,30 @@ public class ReportDownListener {
// scanfile1Map.put("serialnum","嘉时测试图片1");
FileInputStream inputStream2 = new FileInputStream("d://jianli_02.jpg");
System.out.println(inputStream2.available());
byte[] bytes2 = new byte[inputStream2.available()];
inputStream2.read(bytes2,0,inputStream2.available());
inputStream2.read(bytes2, 0, inputStream2.available());
inputStream2.close();
String base642 = encoder.encode(bytes2);
Map<String, Object> scanfile2Map=new HashMap<>();
scanfile2Map.put("assortid","docustestAssortID");
scanfile2Map.put("downurl",base642);
scanfile2Map.put("filestoragetype",1);
scanfile2Map.put("filetitle","嘉时测试图片2");
scanfile2Map.put("filetype","2");
scanfile2Map.put("serialnum","嘉时测试图片2");
Map<String, Object> scanfile2Map = new HashMap<>();
scanfile2Map.put("assortid", "docustestAssortID");
scanfile2Map.put("downurl", base642);
scanfile2Map.put("filestoragetype", 1);
scanfile2Map.put("filetitle", "嘉时测试图片2");
scanfile2Map.put("filetype", "2");
scanfile2Map.put("serialnum", "嘉时测试图片2");
//
// scanfiles.add(scanfile1Map);
scanfiles.add(scanfile2Map);
bodyMap.put("patient",patientMap);
bodyMap.put("ip","wybtest");
bodyMap.put("collectorid","docus测试扫描");
bodyMap.put("scanfiles",scanfiles);
bodyMap.put("scanusercode","docus测试");
bodyMap.put("scanusername","docus测试");
bodyMap.put("patient", patientMap);
bodyMap.put("ip", "wybtest");
bodyMap.put("collectorid", "docus测试扫描");
bodyMap.put("scanfiles", scanfiles);
bodyMap.put("scanusercode", "docus测试");
bodyMap.put("scanusername", "docus测试");
HttpRequest post = HttpUtil.createPost(url);
post.timeout(5 * 1000);
post.header("Content-Type", "application/json; charset=utf-8");

@ -177,4 +177,24 @@
from `docus_medicalrecord`.`t_basic_extend`
WHERE patient_id=#{patientId}
</select>
<select id="getSdRyIndex" resultType="java.lang.String">
select sdry_index
from `docus_medicalrecord`.`t_basic_extend`
WHERE patient_id=#{patientId}
</select>
<select id="getParentSdRyIndex" resultType="java.lang.String">
SELECT mom_id
FROM `docus_medicalrecord`.`t_maternal_infant_relationship`
where baby_id=#{babyIndex}
</select>
<select id="getPatientIdBySdRyIndex" resultType="java.lang.String">
select patient_id
from `docus_medicalrecord`.`t_basic_extend`
WHERE sdry_index=#{sdRyIndex}
</select>
<select id="getByPatientId" resultType="com.docus.server.collection.entity.TBasic">
select *
from `docus_medicalrecord`.`t_basic`
where patient_id=#{patientId}
</select>
</mapper>

Loading…
Cancel
Save