|
@@ -31,23 +31,39 @@ public class TaizDataImportApiTest {
|
|
private static String cid = "changx";
|
|
private static String cid = "changx";
|
|
|
|
|
|
private Map<String,String> caseMap = new HashMap<>();
|
|
private Map<String,String> caseMap = new HashMap<>();
|
|
-
|
|
|
|
private List<String> deletePatient = new ArrayList<>();
|
|
private List<String> deletePatient = new ArrayList<>();
|
|
|
|
|
|
|
|
+ private static Map<String, String> tableMap = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ private static void initTableMap() {
|
|
|
|
+ if (cid.equals("changx")) {
|
|
|
|
+ tableMap.put("BR_INPATIENTINFO", "BR_INPATIENTINFO_CX");//患者信息
|
|
|
|
+ tableMap.put("GI_USERINFO", "GI_USERINFO_CX"); //医生
|
|
|
|
+ tableMap.put("HI_DEPTINFO", "HI_DEPTINFO_CX");//科室
|
|
|
|
+ tableMap.put("BR_RECHOME", "BR_RECHOME_CX");//病案首页
|
|
|
|
+ tableMap.put("BR_RECDIAGNOSE", "BR_RECDIAGNOSE_CX");//病案首页--出院诊断 门急诊诊断
|
|
|
|
+ tableMap.put("BR_DOCTADVICE", "BR_DOCTADVICE_CX");//医嘱
|
|
|
|
+ tableMap.put("BR_RECOPERATION", "BR_RECOPERATION_CX");//病案首页--手术
|
|
|
|
+ } else if (cid.equals("taizhou")) {
|
|
|
|
+ tableMap.put("BR_INPATIENTINFO", "BR_INPATIENTINFO_TZ");
|
|
|
|
+ tableMap.put("GI_USERINFO", "GI_USERINFO_TZ");
|
|
|
|
+ tableMap.put("HI_DEPTINFO", "HI_DEPTINFO_TZ");
|
|
|
|
+ tableMap.put("BR_RECHOME", "BR_RECHOME_TZ");
|
|
|
|
+ tableMap.put("BR_RECDIAGNOSE", "BR_RECDIAGNOSE_TZ");
|
|
|
|
+ tableMap.put("BR_DOCTADVICE", "BR_DOCTADVICE_TZ");
|
|
|
|
+ tableMap.put("BR_RECOPERATION", "BR_RECOPERATION_CX");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
TaizDataImportApiTest test = new TaizDataImportApiTest();
|
|
TaizDataImportApiTest test = new TaizDataImportApiTest();
|
|
|
|
+ initTableMap();
|
|
//模块映射
|
|
//模块映射
|
|
test.loadModelHospital();
|
|
test.loadModelHospital();
|
|
- //长兴患者信息
|
|
|
|
- if (cid.equals("changx")) {
|
|
|
|
- test.insertPatient(test.loadOraclePatients("BR_INPATIENTINFO_CX"));
|
|
|
|
- test.insertDoctor(test.loadOracleDoctorInfos("GI_USERINFO", "HI_DEPTINFO"));
|
|
|
|
- }
|
|
|
|
- //台州患者信息
|
|
|
|
- if (cid.equals("taizhou")) {
|
|
|
|
- test.insertPatient(test.loadOraclePatients("BR_INPATIENTINFO_TZ20200330"));
|
|
|
|
- test.insertDoctor(test.loadOracleDoctorInfos("GI_USERINFO", "HI_DEPTINFO"));
|
|
|
|
- }
|
|
|
|
|
|
+ //患者信息
|
|
|
|
+ test.insertPatient(test.loadOraclePatients(tableMap.get("BR_INPATIENTINFO")));
|
|
|
|
+ test.insertDoctor(test.loadOracleDoctorInfos(tableMap.get("GI_USERINFO"), tableMap.get("HI_DEPTINFO")));
|
|
|
|
+
|
|
//病人流水号获取 病历号--->id
|
|
//病人流水号获取 病历号--->id
|
|
Map<String, String> patientMap = test.loadPatients(hospitalId);
|
|
Map<String, String> patientMap = test.loadPatients(hospitalId);
|
|
//model-->id
|
|
//model-->id
|
|
@@ -82,24 +98,30 @@ public class TaizDataImportApiTest {
|
|
|
|
|
|
private void insertPatientText(Map<String, String> patientMap, Map<String, String> modelMap) {
|
|
private void insertPatientText(Map<String, String> patientMap, Map<String, String> modelMap) {
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
-
|
|
|
|
for (Map.Entry<String, String> entry : patientMap.entrySet()) {
|
|
for (Map.Entry<String, String> entry : patientMap.entrySet()) {
|
|
List<PatientText> patientTexts = new ArrayList<>();
|
|
List<PatientText> patientTexts = new ArrayList<>();
|
|
//病人的病案首页内容
|
|
//病人的病案首页内容
|
|
- List<Map<String, String>> homePageMap = DataTest.loadHomePage("BR_RECHOME_CX", entry.getKey());
|
|
|
|
- if (homePageMap == null || homePageMap.isEmpty()) { //没病案首页直接不导入
|
|
|
|
|
|
+ List<Map<String, Object>> homePageList = DataTest.loadHomePage(tableMap.get("BR_RECHOME"), entry.getKey());
|
|
|
|
+ if (homePageList == null || homePageList.isEmpty()) { //没病案首页直接不导入
|
|
deletePatient.add(entry.getKey()); //没病案首页的患者也要删除
|
|
deletePatient.add(entry.getKey()); //没病案首页的患者也要删除
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ Map<String, Object> homePageMap = homePageList.get(0);
|
|
|
|
+ homePageMap.put("门急诊诊断", FastJsonUtils.getBeanToJson(DataTest.loadHomePageDiagnose(tableMap.get("BR_RECDIAGNOSE"), "1", entry.getKey())).replaceAll("\"", "'"));
|
|
|
|
+ homePageMap.put("出院诊断", FastJsonUtils.getBeanToJson(DataTest.loadHomePageDiagnose(tableMap.get("BR_RECDIAGNOSE"),"2", entry.getKey())).replaceAll("\"", "'"));
|
|
|
|
+ homePageMap.put("损伤、中毒外部原因", FastJsonUtils.getBeanToJson(DataTest.loadHomePageDiagnose(tableMap.get("BR_RECDIAGNOSE"),"3", entry.getKey())).replaceAll("\"", "'"));
|
|
|
|
+ homePageMap.put("病理诊断", FastJsonUtils.getBeanToJson(DataTest.loadHomePageDiagnose(tableMap.get("BR_RECDIAGNOSE"), "4", entry.getKey())).replaceAll("\"", "'"));
|
|
|
|
+ homePageMap.put("手术信息", FastJsonUtils.getBeanToJson(DataTest.loadHomePageOperation(tableMap.get("BR_RECOPERATION"), tableMap.get("GI_USERINFO"), entry.getKey())).replaceAll("\"", "'"));
|
|
|
|
+
|
|
Map<String, Object> firstPageTextMap = new HashMap<>();
|
|
Map<String, Object> firstPageTextMap = new HashMap<>();
|
|
firstPageTextMap.put("case_number", entry.getKey());
|
|
firstPageTextMap.put("case_number", entry.getKey());
|
|
firstPageTextMap.put("case_number_id", patientMap.get(entry.getKey()));
|
|
firstPageTextMap.put("case_number_id", patientMap.get(entry.getKey()));
|
|
firstPageTextMap.put("hospital_id", hospitalId);
|
|
firstPageTextMap.put("hospital_id", hospitalId);
|
|
firstPageTextMap.put("mode_id", 6);
|
|
firstPageTextMap.put("mode_id", 6);
|
|
firstPageTextMap.put("origin_mode", "病案首页");
|
|
firstPageTextMap.put("origin_mode", "病案首页");
|
|
- firstPageTextMap.put("origin_text", FastJsonUtils.getBeanToJson(homePageMap.get(0)));
|
|
|
|
|
|
+ firstPageTextMap.put("origin_text", FastJsonUtils.getBeanToJson(homePageMap));
|
|
String pagetext = "";
|
|
String pagetext = "";
|
|
- for (Map.Entry<String, String> e : homePageMap.get(0).entrySet()) {
|
|
|
|
|
|
+ for (Map.Entry<String, Object> e : homePageMap.entrySet()) {
|
|
pagetext = pagetext + "【" + e.getKey() + "】:" + e.getValue().toString() + "\n";
|
|
pagetext = pagetext + "【" + e.getKey() + "】:" + e.getValue().toString() + "\n";
|
|
}
|
|
}
|
|
firstPageTextMap.put("text", pagetext);
|
|
firstPageTextMap.put("text", pagetext);
|
|
@@ -116,8 +138,8 @@ public class TaizDataImportApiTest {
|
|
list.add(firstPageTextMap);
|
|
list.add(firstPageTextMap);
|
|
|
|
|
|
//病人医嘱信息
|
|
//病人医嘱信息
|
|
- List<Map<String, String>> docAdviceMap = DataTest.loadHomePage("BR_DOCTADVICE_CX", entry.getKey());
|
|
|
|
- for (Map<String, String> docMap : docAdviceMap) {
|
|
|
|
|
|
+ List<Map<String, Object>> docAdviceMap = DataTest.loadHomePage(tableMap.get("BR_DOCTADVICE"), entry.getKey());
|
|
|
|
+ for (Map<String, Object> docMap : docAdviceMap) {
|
|
Map<String, Object> docAdviceTextMap = new HashMap<>();
|
|
Map<String, Object> docAdviceTextMap = new HashMap<>();
|
|
docAdviceTextMap.put("case_number", entry.getKey());
|
|
docAdviceTextMap.put("case_number", entry.getKey());
|
|
docAdviceTextMap.put("case_number_id", patientMap.get(entry.getKey()));
|
|
docAdviceTextMap.put("case_number_id", patientMap.get(entry.getKey()));
|
|
@@ -126,7 +148,7 @@ public class TaizDataImportApiTest {
|
|
docAdviceTextMap.put("origin_mode", "医嘱信息");
|
|
docAdviceTextMap.put("origin_mode", "医嘱信息");
|
|
docAdviceTextMap.put("origin_text", FastJsonUtils.getBeanToJson(docMap));
|
|
docAdviceTextMap.put("origin_text", FastJsonUtils.getBeanToJson(docMap));
|
|
pagetext = "";
|
|
pagetext = "";
|
|
- for (Map.Entry<String, String> e : docMap.entrySet()) {
|
|
|
|
|
|
+ for (Map.Entry<String, Object> e : docMap.entrySet()) {
|
|
pagetext = pagetext + "【" + e.getKey() + "】:" + e.getValue().toString() + "\n";
|
|
pagetext = pagetext + "【" + e.getKey() + "】:" + e.getValue().toString() + "\n";
|
|
}
|
|
}
|
|
docAdviceTextMap.put("text", pagetext);
|
|
docAdviceTextMap.put("text", pagetext);
|
|
@@ -184,7 +206,7 @@ public class TaizDataImportApiTest {
|
|
}
|
|
}
|
|
m.put(modelId, modelId);
|
|
m.put(modelId, modelId);
|
|
}
|
|
}
|
|
- if (m.get("1") != null && m.get("2") != null && m.get("4") != null && m.get("5") != null) {
|
|
|
|
|
|
+ if (m.get("1") != null && m.get("2") != null && m.get("4") != null && (m.get("5") != null || m.get("24") != null)) {
|
|
return true;
|
|
return true;
|
|
} else {
|
|
} else {
|
|
deletePatient.add(patientTexts.get(0).getBrzyid());
|
|
deletePatient.add(patientTexts.get(0).getBrzyid());
|