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

master
WenYongbin 1 month ago
parent 73fbdce548
commit 9361abe935

@ -30,31 +30,45 @@ public class PatientInfoSyncJob {
@XxlJob("FoShanSyPatientInfoSyncJob") @XxlJob("FoShanSyPatientInfoSyncJob")
public void foShanSyPatientInfoSyncJob() { public void foShanSyPatientInfoSyncJob() {
log.info("====================> 佛山三院基础数据同步任务开始 ==================="); log.info("====================> 佛山三院基础数据同步任务开始 ===================");
String jobConfigPath = "data-config\\job-config"; try {
String jobConfigName = "FoShanSyPatientInfoSyncJob.json"; String jobConfigPath = "data-config\\job-config";
TableJsonRead jsonReader = new TableJsonRead(); String jobConfigName = "FoShanSyPatientInfoSyncJob.json";
FoShanSyPatientInfoSyncJobConfig syncJobConfig = jsonReader.Read(jobConfigPath, jobConfigName, FoShanSyPatientInfoSyncJobConfig.class); TableJsonRead jsonReader = new TableJsonRead();
syncJobConfig = FoShanSyPatientInfoSyncJobConfig.checkAndInit(syncJobConfig); FoShanSyPatientInfoSyncJobConfig syncJobConfig = jsonReader.Read(jobConfigPath, jobConfigName, FoShanSyPatientInfoSyncJobConfig.class);
Integer pageSize = syncJobConfig.getPageSize(); syncJobConfig = FoShanSyPatientInfoSyncJobConfig.checkAndInit(syncJobConfig);
Integer pageNumber = syncJobConfig.getPageNumber(); Integer pageSize = syncJobConfig.getPageSize();
String startDate = syncJobConfig.getStartDate(); Integer pageNumber = syncJobConfig.getPageNumber();
LocalDate runLocalDate = LocalDate.now(); String startDate = syncJobConfig.getStartDate();
String runJobDate = runLocalDate.toString(); LocalDate runLocalDate = LocalDate.now();
String runJobDate = runLocalDate.toString();
patientInfoSyncService.syncInHospitalData(); log.info("====================> 佛山三院基础数据同步在院开始 ===================");
while (true) { patientInfoSyncService.syncInHospitalData();
int syscCount = patientInfoSyncService.syncDischargeData(startDate + " 00:00:00", runJobDate + " 23:59:59", pageNumber, pageSize); log.info("====================> 佛山三院基础数据同步在院结束 ===================");
if (syscCount < pageSize) {
break; 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 { private static class FoShanSyPatientInfoSyncJobConfig {

@ -23,4 +23,6 @@ public interface TBasicMapper {
int updateBatch(@Param("basicList") List<TBasic> updateList); int updateBatch(@Param("basicList") List<TBasic> updateList);
int cancelFileBySource(@Param("source")String source,@Param("patientId") String patientId); 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 * @date 2024/3/27 16:56
* @author YongBin Wen * @author YongBin Wen
*/ */
void syncInHospitalData(); void syncInHospitalData();
/**
* 退
*
* @date 2026/3/19 10:13
* @author YongBin Wen
*/
void syncCancelHospitalData();
/** /**
* *
* *
*
* @param startDateTime * @param startDateTime
* @param endDateTime * @param endDateTime
* @param pageNumber * @param pageNumber
* @param pageSize * @param pageSize
* @return int * @return int
*/ */
int syncDischargeData(String startDateTime, String endDateTime, Integer pageNumber, Integer pageSize); int syncDischargeData(String startDateTime, String endDateTime, Integer pageNumber, Integer pageSize);
void insertOrUpdate(List<TBasic> tBasicList); void insertOrUpdate(List<TBasic> tBasicList);
} }

@ -48,6 +48,14 @@ public class PatientInfoSyncServiceImpl implements PatientInfoSyncService {
convertAndSave(inHospital); 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 @Override
public int syncDischargeData(String startDateTime, String endDateTime, Integer pageNumber, Integer pageSize) { public int syncDischargeData(String startDateTime, String endDateTime, Integer pageNumber, Integer pageSize) {

@ -17,10 +17,20 @@ public interface JswzhPatientInfoViewMapper {
*/ */
List<JswzhPatientInfoView> getInHospital(); List<JswzhPatientInfoView> getInHospital();
/**
*
*
*/
List<JswzhPatientInfoView> getCancelHospital();
/** /**
* (yyyy-MM-dd HH:mm:ss) * (yyyy-MM-dd HH:mm:ss)
*
* @param startRow oracle ROWNUM * @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); 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' WHERE ZYZT = 'I'
</select> </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 id="getDischarge" resultType="com.docus.server.fsy.entity.JswzhPatientInfoView">
SELECT * FROM ( SELECT * FROM (
SELECT t.*,ROWNUM rn SELECT t.*,ROWNUM rn

@ -50,6 +50,13 @@
where patient_id = #{patientId} where patient_id = #{patientId}
and source = #{source} and source = #{source}
</update> </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"> <select id="getByJzh" resultType="com.docus.server.archive.entity.TBasic">

Loading…
Cancel
Save