潮州人医患者基础信息同步程序初始化

master
linjj 1 month ago
parent d6adfb1b44
commit 26cc054d94

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="2de87d60-c528-4d58-92b6-a028edbeb313" name="Changes" comment="潮州人医患者基础信息同步程序初始化">
<change afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/chaozhou/ArchiveSync.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/chaozhou/ArchiveSync.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/application.properties" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/application.properties" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="FxmlFile" />
<option value="Class" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="MavenImportPreferences">
<option name="generalSettings">
<MavenGeneralSettings>
<option name="localRepository" value="E:\maven\apache-maven-3.6.0\repository" />
<option name="mavenHome" value="$PROJECT_DIR$/../../../maven/apache-maven-3.6.0" />
<option name="userSettingsFile" value="E:\maven\apache-maven-3.6.0\conf\settings.xml" />
</MavenGeneralSettings>
</option>
<option name="importingSettings">
<MavenImportingSettings>
<option name="workspaceImportEnabled" value="true" />
</MavenImportingSettings>
</option>
</component>
<component name="ProjectId" id="33EG0Kd84Ww4RrSDRR2dMlkGbxW" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
"WebServerToolWindowFactoryState": "false",
"last_opened_file_path": "E:/work/2.0/powerbz",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"project.structure.last.edited": "Modules",
"project.structure.proportion": "0.15",
"project.structure.side.proportion": "0.2",
"settings.editor.selected.configurable": "MavenSettings",
"vue.rearranger.settings.migration": "true"
}
}]]></component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="E:\work\czry\archive_sync_czry\src\main\lib" />
<recent name="E:\work\czry\archive_sync_czry\src\main\resources" />
</key>
</component>
<component name="RunManager">
<configuration name="ArchiveSync" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.chaozhou.ArchiveSync" />
<module name="emr_sync_czry" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.chaozhou.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<recent_temporary>
<list>
<item itemvalue="Application.ArchiveSync" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="2de87d60-c528-4d58-92b6-a028edbeb313" name="Changes" comment="" />
<created>1758874595131</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1758874595131</updated>
<workItem from="1758874596709" duration="4359000" />
<workItem from="1758879125534" duration="1263000" />
<workItem from="1759032906185" duration="2214000" />
<workItem from="1759114610171" duration="735000" />
<workItem from="1759132080857" duration="1271000" />
<workItem from="1759216821486" duration="2217000" />
<workItem from="1760067277873" duration="3763000" />
<workItem from="1760072825544" duration="1440000" />
<workItem from="1760074295127" duration="9008000" />
<workItem from="1760334867873" duration="2201000" />
<workItem from="1760427109098" duration="837000" />
<workItem from="1760435936489" duration="150000" />
<workItem from="1760508935889" duration="137000" />
<workItem from="1761021146910" duration="12000" />
<workItem from="1761026455156" duration="8000" />
<workItem from="1761027503925" duration="45000" />
<workItem from="1761027620598" duration="35000" />
<workItem from="1761029105348" duration="172000" />
<workItem from="1762490029974" duration="2092000" />
</task>
<task id="LOCAL-00001" summary="潮州人医患者基础信息同步程序初始化">
<created>1760084026033</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1760084026033</updated>
</task>
<option name="localTasksCounter" value="2" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="潮州人医患者基础信息同步程序初始化" />
<option name="LAST_COMMIT_MESSAGE" value="潮州人医患者基础信息同步程序初始化" />
</component>
</project>

@ -33,6 +33,14 @@
<artifactId>orai18n</artifactId>
<version>21.3.0.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.32</version>
</dependency>
<!-- SQL Server JDBC -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>

@ -30,35 +30,12 @@ public class ArchiveSync {
"AND 出院日期 < TRUNC(SYSDATE) + 1"; // 明天 00:00:00不含
// /* 读取 9 月 25 日到今天的全部病例 */
// private static final String SQL_ORA_TODAY =
// "SELECT ID号,住院号,住院次数,姓名,性别,入院时间,入院科室编码," +
// " 主管医生工号,年龄,身份证号,出院日期,当前科室编码 " +
// "FROM PORTAL_HIS.V_WZHGD_HZJCXX h " +
// "WHERE 出院日期 >= TO_DATE('2025-09-25', 'YYYY-MM-DD') " +
// "AND 出院日期 <= TRUNC(SYSDATE)";
/* SQL Server当天已归档主键 */
private static final String SQL_MSS_TODAY_KEYS =
"SELECT inp_no + '|' + CAST(visit_id AS VARCHAR) AS key1 " +
"FROM archive_master " +
"WHERE CONVERT(date, discharge_date_time) = CONVERT(date, GETDATE())";
// /* SQL Server9 月 25 日到今天已归档主键 */
// private static final String SQL_MSS_TODAY_KEYS =
// "SELECT inp_no + '|' + CAST(visit_id AS VARCHAR) AS key1 " +
// "FROM archive_master " +
// "WHERE CONVERT(date, discharge_date_time) >= '2025-09-25' " +
// "AND CONVERT(date, discharge_date_time) <= CONVERT(date, GETDATE())";
/* 写入 SQL Server */
private static final String SQL_MSS_INSERT =
"INSERT INTO archive_master " +
@ -67,6 +44,14 @@ public class ArchiveSync {
" dept_name,id_card,ArchiveState,C1) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?, '64','ljj')";
/* MySQL根据工号查询医生姓名 */
private static final String SQL_MYSQL_DOCTOR_NAME =
"SELECT name FROM power_user WHERE user_name = ?";
/* 当前最大 id */
private static final String SQL_MAX_ID = "SELECT ISNULL(MAX(id), 0) FROM archive_master";
@ -84,6 +69,7 @@ public class ArchiveSync {
while (true) {
try (Connection ora = getConn(cfg, "oracle");
Connection mss = getConn(cfg, "sqlserver");
Connection mysql = getConn(cfg, "mysql"); // 新增 MySQL 连接
PreparedStatement psOra = ora.prepareStatement(SQL_ORA_TODAY);
PreparedStatement psKeys = mss.prepareStatement(SQL_MSS_TODAY_KEYS);
PreparedStatement psMaxId = mss.prepareStatement(SQL_MAX_ID);
@ -133,7 +119,26 @@ public class ArchiveSync {
psIns.setNString(7, rs.getString("入院科室编码")); // dept_admission_to
psIns.setTimestamp(8, rs.getTimestamp("入院时间")); // admission_date_time
psIns.setTimestamp(9, rs.getTimestamp("出院日期")); // discharge_date_time
psIns.setString(10, rs.getString("主管医生工号")); // DOCTOR_IN_CHARGE
/* 查询 MySQL 获取医生姓名 */
String doctorCode = rs.getString("主管医生工号");
String doctorName = doctorCode; // 默认用编码
if (doctorCode != null && !doctorCode.trim().isEmpty()) {
try (PreparedStatement psDoctor = mysql.prepareStatement(SQL_MYSQL_DOCTOR_NAME)) {
psDoctor.setString(1, doctorCode.trim());
try (ResultSet rsDoctor = psDoctor.executeQuery()) {
if (rsDoctor.next()) {
String nameFromMysql = rsDoctor.getString("name");
// 仅当查询到非空姓名时才替换
if (nameFromMysql != null && !nameFromMysql.trim().isEmpty()) {
doctorName = nameFromMysql;
}
}
} catch (SQLException e) {
log.info("查询医生姓名失败,工号: {}", doctorCode, e);
}
}
}
psIns.setString(10, doctorName); // 将查询到的姓名存入 DOCTOR_IN_CHARGE 字段
psIns.setNString(11, rs.getString("年龄")); // SubAssort
psIns.setString(12, rs.getString("身份证号")); // id_card
psIns.setString(13, rs.getString("当前科室编码")); // dept_name

@ -7,5 +7,14 @@ sqlserver.url=jdbc:sqlserver://localhost:1433;databaseName=emr_record;encrypt=fa
sqlserver.user=sa
sqlserver.password=docus@702
# MySQL ?????
mysql.url=jdbc:mysql://localhost:3306/power?useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
mysql.user=root
mysql.password=docus702
#???????
poll.interval=300
poll.interval=300

Loading…
Cancel
Save