feat: 广州中西医结合医院,质控患者数据同步
parent
b9b5e52f2b
commit
b12083d2a1
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"startDate": "2024-08-21",
|
||||||
|
"errorDays": 30,
|
||||||
|
"url": "http://192.168.12.121:3000/ws/service?wsdl",
|
||||||
|
"namespaceUri": "http://ws.sie.com",
|
||||||
|
"operationName": "service",
|
||||||
|
"param": "flow=HIS_SQL_IN_PATIENT_01,app=JS_MR_DOC"
|
||||||
|
}
|
@ -0,0 +1,72 @@
|
|||||||
|
package com.docus.server.archive.converter;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.docus.server.archive.entity.TBasic;
|
||||||
|
import com.docus.server.archive.utils.PinYinUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author YongBin Wen
|
||||||
|
* @date 2024/8/23 11:03
|
||||||
|
*/
|
||||||
|
public class GzZxyJhPatientInfoConverter {
|
||||||
|
public static List<TBasic> convertTbasic(String result) {
|
||||||
|
List<JSONObject> parseArray = JSONArray.parseArray(result, JSONObject.class);
|
||||||
|
List<TBasic> tBasicList = new ArrayList<>();
|
||||||
|
for (JSONObject jsonObject : parseArray) {
|
||||||
|
String jzh = jsonObject.getString("INPATIENT_NO");
|
||||||
|
if (StrUtil.isBlank(jzh)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String inpatientNo = jsonObject.getString("PATIENT_NO");
|
||||||
|
String name = jsonObject.getString("NAME");
|
||||||
|
Integer admissTimes = jsonObject.getInteger("IN_TIMES");
|
||||||
|
String idCard = jsonObject.getString("IDENNO");
|
||||||
|
Date admissDate = jsonObject.getDate("IN_DATE");
|
||||||
|
String admissDept = jsonObject.getString("IN_DEPT_CODE");
|
||||||
|
String admissDeptName = jsonObject.getString("IN_DEPT_NAME");
|
||||||
|
Date disDate = jsonObject.getDate("OUT_DATE");
|
||||||
|
String disDept = jsonObject.getString("OUT_DEPT_CODE");
|
||||||
|
String disDeptName = jsonObject.getString("OUT_DEPT_NAME");
|
||||||
|
String groundingNo = jsonObject.getString("CASE_LIST_NO");
|
||||||
|
String attending = jsonObject.getString("HOUSE_DOC_CODE");
|
||||||
|
String attendingName = jsonObject.getString("HOUSE_DOC_NAME");
|
||||||
|
String sexName = jsonObject.getString("SEX_NAME");
|
||||||
|
String bedNo = jsonObject.getString("BED_NO");
|
||||||
|
String zgName = jsonObject.getString("ZG_NAME");
|
||||||
|
String linkmanTel = jsonObject.getString("LINKMAN_TEL");
|
||||||
|
|
||||||
|
TBasic tBasic = new TBasic();
|
||||||
|
tBasic.setJzh(jzh);
|
||||||
|
tBasic.setInpatientNo(inpatientNo);
|
||||||
|
tBasic.setName(name);
|
||||||
|
tBasic.setNameSpell(PinYinUtil.getFirstSpell(name));
|
||||||
|
tBasic.setAdmissTimes(admissTimes);
|
||||||
|
tBasic.setIdCard(idCard);
|
||||||
|
tBasic.setAdmissDate(admissDate);
|
||||||
|
tBasic.setAdmissDept(admissDept);
|
||||||
|
tBasic.setAdmissDeptName(admissDeptName);
|
||||||
|
tBasic.setDisDate(disDate);
|
||||||
|
tBasic.setDisDept(disDept);
|
||||||
|
tBasic.setDisDeptName(disDeptName);
|
||||||
|
tBasic.setGroundingNo(groundingNo);
|
||||||
|
tBasic.setAttending(attending);
|
||||||
|
tBasic.setAttendingName(attendingName);
|
||||||
|
tBasic.setSexName(sexName);
|
||||||
|
tBasic.setSex("男".equals(sexName) ? "1" : "2");
|
||||||
|
tBasic.setBedNo(bedNo);
|
||||||
|
tBasic.setIsDead("死亡".equals(zgName) ? 1 : 0);
|
||||||
|
tBasic.setTelphone(linkmanTel);
|
||||||
|
tBasicList.add(tBasic);
|
||||||
|
}
|
||||||
|
return tBasicList;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.docus.server.archive.rpc;
|
||||||
|
|
||||||
|
import com.docus.server.archive.rpc.dto.HisSqlInPatient01Dto;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author YongBin Wen
|
||||||
|
* @date 2024/8/23 13:58
|
||||||
|
*/
|
||||||
|
public interface GzZxyJhBasicDataService {
|
||||||
|
String getHisSqlInPatient01(HisSqlInPatient01Dto hisSqlInPatient01Dto);
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.docus.server.archive.rpc.dto;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author YongBin Wen
|
||||||
|
* @date 2024/8/23 14:03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class HisSqlInPatient01Dto {
|
||||||
|
@JSONField(name = "PATIENT_NO")
|
||||||
|
private String PATIENT_NO;
|
||||||
|
@JSONField(name = "BEGIN_TIME")
|
||||||
|
private String BEGIN_TIME;
|
||||||
|
@JSONField(name = "END_TIME")
|
||||||
|
private String END_TIME;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package com.docus.server.archive.rpc.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.docus.infrastructure.core.utils.TableJsonRead;
|
||||||
|
import com.docus.server.archive.rpc.GzZxyJhBasicDataService;
|
||||||
|
import com.docus.server.archive.rpc.dto.HisSqlInPatient01Dto;
|
||||||
|
import com.docus.server.archive.utils.JaxWsDynamicClientUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author YongBin Wen
|
||||||
|
* @date 2024/8/23 13:58
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class GzZxyJhBasicDataServiceImpl implements GzZxyJhBasicDataService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getHisSqlInPatient01(HisSqlInPatient01Dto hisSqlInPatient01Dto) {
|
||||||
|
String jobConfigPath = "data-config\\job-config";
|
||||||
|
String jobConfigName = "GzZxyJhQcPatientInfoSyncJob.json";
|
||||||
|
TableJsonRead jsonReader = new TableJsonRead();
|
||||||
|
JSONObject syncJobConfig = jsonReader.Read(jobConfigPath, jobConfigName, JSONObject.class);
|
||||||
|
String url = syncJobConfig.getString("url");
|
||||||
|
String namespaceUri = syncJobConfig.getString("namespaceUri");
|
||||||
|
String operationName = syncJobConfig.getString("operationName");
|
||||||
|
String param1 = syncJobConfig.getString("param");
|
||||||
|
String param2 = JSONObject.toJSONString(hisSqlInPatient01Dto);
|
||||||
|
String[] params = {param1, param2};
|
||||||
|
String result = JaxWsDynamicClientUtil.send(url, namespaceUri, operationName, params);
|
||||||
|
log.info("广州中西医结合查询基础数据参数 {} 获取数据:{}", param2, result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.docus.server.archive.utils;
|
||||||
|
|
||||||
|
import com.docus.infrastructure.core.exception.BaseException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author YongBin Wen
|
||||||
|
* @date 2024/8/23 11:35
|
||||||
|
*/
|
||||||
|
public class MethodRetryUtil {
|
||||||
|
private final static Logger logger = LoggerFactory.getLogger(MethodRetryUtil.class);
|
||||||
|
|
||||||
|
public static <T> boolean retry(Consumer<T> consumer, T param, int retries, int timeoutMillis) {
|
||||||
|
if (retries <= 0) {
|
||||||
|
throw new BaseException("重试次数需要大于0");
|
||||||
|
}
|
||||||
|
for (int i = 1; i <= retries; i++) {
|
||||||
|
try {
|
||||||
|
consumer.accept(param);
|
||||||
|
logger.info("重试操作成功,进行了 {} 次重试",i);
|
||||||
|
return true;
|
||||||
|
} catch (Exception rex) {
|
||||||
|
logger.error("重试操作失败,尝试第" + (i + 1) + "次重试," + rex.getMessage(), rex);
|
||||||
|
try {
|
||||||
|
TimeUnit.MILLISECONDS.sleep(timeoutMillis);
|
||||||
|
} catch (InterruptedException exc) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
AtomicInteger i=new AtomicInteger(-1);
|
||||||
|
System.out.println(retry(n -> {
|
||||||
|
System.out.println(2 / n);
|
||||||
|
}, 0, 10, 500));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue