feat:佛山三院基础数据同步添加作废

master
WenYongbin 1 month ago
parent 73fbdce548
commit 9361abe935

@ -30,31 +30,45 @@ public class PatientInfoSyncJob {
@XxlJob("FoShanSyPatientInfoSyncJob")
public void foShanSyPatientInfoSyncJob() {
log.info("====================> 佛山三院基础数据同步任务开始 ===================");
String jobConfigPath = "data-config\\job-config";
String jobConfigName = "FoShanSyPatientInfoSyncJob.json";
TableJsonRead jsonReader = new TableJsonRead();
FoShanSyPatientInfoSyncJobConfig syncJobConfig = jsonReader.Read(jobConfigPath, jobConfigName, FoShanSyPatientInfoSyncJobConfig.class);
syncJobConfig = FoShanSyPatientInfoSyncJobConfig.checkAndInit(syncJobConfig);
Integer pageSize = syncJobConfig.getPageSize();
Integer pageNumber = syncJobConfig.getPageNumber();
String startDate = syncJobConfig.getStartDate();
LocalDate runLocalDate = LocalDate.now();
String runJobDate = runLocalDate.toString();
patientInfoSyncService.syncInHospitalData();
while (true) {
int syscCount = patientInfoSyncService.syncDischargeData(startDate + " 00:00:00", runJobDate + " 23:59:59", pageNumber, pageSize);
if (syscCount < pageSize) {
break;
try {
String jobConfigPath = "data-config\\job-config";
String jobConfigName = "FoShanSyPatientInfoSyncJob.json";
TableJsonRead jsonReader = new TableJsonRead();
FoShanSyPatientInfoSyncJobConfig syncJobConfig = jsonReader.Read(jobConfigPath, jobConfigName, FoShanSyPatientInfoSyncJobConfig.class);
syncJobConfig = FoShanSyPatientInfoSyncJobConfig.checkAndInit(syncJobConfig);
Integer pageSize = syncJobConfig.getPageSize();
Integer pageNumber = syncJobConfig.getPageNumber();
String startDate = syncJobConfig.getStartDate();
LocalDate runLocalDate = LocalDate.now();
String runJobDate = runLocalDate.toString();
log.info("====================> 佛山三院基础数据同步在院开始 ===================");
patientInfoSyncService.syncInHospitalData();
log.info("====================> 佛山三院基础数据同步在院结束 ===================");
log.info("====================> 佛山三院基础数据同步出院开始 ===================");
while (true) {
int syscCount = patientInfoSyncService.syncDischargeData(startDate + " 00:00:00", runJobDate + " 23:59:59", pageNumber, pageSize);
if (syscCount < pageSize) {
break;
}
pageNumber += 1;
}
pageNumber += 1;
log.info("====================> 佛山三院基础数据同步出院结束 ===================");
log.info("====================> 佛山三院基础数据同步退院开始 ===================");
patientInfoSyncService.syncCancelHospitalData();
log.info("====================> 佛山三院基础数据同步退院结束 ===================");
// 下次同步则开始多同步一天,防止时间差引起同步缺漏 例如 10分钟同步一次 导致 23:50:01 出院未同步到
String nexRunStartDate = runLocalDate.plusDays(-1).toString();
syncJobConfig.setPageNumber(1);
syncJobConfig.setStartDate(nexRunStartDate);
jsonReader.Save(jobConfigPath, jobConfigName, Func.toJson(syncJobConfig));
log.info("====================> 佛山三院基础数据同步任务结束 ===================");
}catch (Exception e){
log.info("====================> 佛山三院基础数据同步任务异常 ==================="+e.getMessage(),e);
}
// 下次同步则开始多同步一天,防止时间差引起同步缺漏 例如 10分钟同步一次 导致 23:50:01 出院未同步到
String nexRunStartDate = runLocalDate.plusDays(-1).toString();
syncJobConfig.setPageNumber(1);
syncJobConfig.setStartDate(nexRunStartDate);
jsonReader.Save(jobConfigPath, jobConfigName, Func.toJson(syncJobConfig));
log.info("====================> 佛山三院基础数据同步任务结束 ===================");
}
private static class FoShanSyPatientInfoSyncJobConfig {

@ -23,4 +23,6 @@ public interface TBasicMapper {
int updateBatch(@Param("basicList") List<TBasic> updateList);
int cancelFileBySource(@Param("source")String source,@Param("patientId") String patientId);
int cancelBasicByJzhs(@Param("jzhs") List<String> jzhs);
}

@ -12,20 +12,33 @@ public interface PatientInfoSyncService {
/**
*
*
* @date 2024/3/27 16:56
* @author YongBin Wen
*/
void syncInHospitalData();
/**
* 退
*
* @date 2026/3/19 10:13
* @author YongBin Wen
*/
void syncCancelHospitalData();
/**
*
*
*
* @param startDateTime
* @param endDateTime
* @param pageNumber
* @param pageSize
* @param endDateTime
* @param pageNumber
* @param pageSize
* @return int
*/
int syncDischargeData(String startDateTime, String endDateTime, Integer pageNumber, Integer pageSize);
void insertOrUpdate(List<TBasic> tBasicList);
}

@ -48,6 +48,14 @@ public class PatientInfoSyncServiceImpl implements PatientInfoSyncService {
convertAndSave(inHospital);
}
@Override
public void syncCancelHospitalData() {
List<JswzhPatientInfoView> cancelHospital = jswzhPatientInfoViewMapper.getCancelHospital();
if(Func.isNotEmpty(cancelHospital)){
List<String> cancelJzhs = cancelHospital.stream().map(JswzhPatientInfoView::getJZH).collect(Collectors.toList());
tBasicMapper.cancelBasicByJzhs(cancelJzhs);
}
}
@Override
public int syncDischargeData(String startDateTime, String endDateTime, Integer pageNumber, Integer pageSize) {

@ -17,10 +17,20 @@ public interface JswzhPatientInfoViewMapper {
*/
List<JswzhPatientInfoView> getInHospital();
/**
*
*
*/
List<JswzhPatientInfoView> getCancelHospital();
/**
* (yyyy-MM-dd HH:mm:ss)
*
* @param startRow oracle ROWNUM
* @param endRow oracle ROWNUM ()
* @param endRow oracle ROWNUM ()
*/
List<JswzhPatientInfoView> getDischarge(@Param("disDateBegin") String disDateBegin, @Param("disDateEnd") String disDateEnd, @Param("startRow") int startRow, @Param("endRow") int endRow);
}

@ -13,6 +13,12 @@
WHERE ZYZT = 'I'
</select>
<select id="getCancelHospital" resultType="com.docus.server.fsy.entity.JswzhPatientInfoView">
SELECT <include refid="JswzhPatientInfoViewField"/>
FROM VIEW_JSWZH_PATIENT_INFO
WHERE ZYZT = 'N'
</select>
<select id="getDischarge" resultType="com.docus.server.fsy.entity.JswzhPatientInfoView">
SELECT * FROM (
SELECT t.*,ROWNUM rn

@ -50,6 +50,13 @@
where patient_id = #{patientId}
and source = #{source}
</update>
<update id="cancelBasicByJzhs">
UPDATE `docus_medicalrecord`.`t_basic` SET is_cancel=1
WHERE jzh in
<foreach collection="jzhs" item="jzh" open="(" close=")" separator=",">
#{jzh}
</foreach>
</update>
<select id="getByJzh" resultType="com.docus.server.archive.entity.TBasic">

Loading…
Cancel
Save