diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RemoteController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RemoteController.java index f571bf8..253498b 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RemoteController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RemoteController.java @@ -306,6 +306,177 @@ public class RemoteController extends BaseController { writeString(response,"success"); } + @RequestMapping(value = "/confirmArchiveTest") + public void test(String idCard,String assistUserId){ + ArchiveDataQuery query = new ArchiveDataQuery(); + query.setIdCard(idCard); + List list = archiveDataServicer.query(query.convertToQuery()); + if (CollectionUtils.isNotEmpty(list)) { + Map map = JsonUtil.str2Obj(list.get(0).getJsonData(), HashMap.class); + String history1 = JsonUtil.obj2JsonString(map.get("history")); + Map history = JsonUtil.str2Obj(history1, Map.class); + + PatientsQuery patientsQuery = new PatientsQuery(); + patientsQuery.setYn(YnEnums.YES.getId()); + patientsQuery.setType(1); + patientsQuery.setCardNo(idCard); + patientsQuery.setDesc("true"); + patientsQuery.setSort("created"); + List patientsList = patientsService.queryPatient(patientsQuery); + Patients patients = patientsList.get(0); + + AntExcAddRequest antExcAddRequest = new AntExcAddRequest(); + antExcAddRequest.setOperaterUserId(assistUserId); + antExcAddRequest.setPid(patients.getPid()); + antExcAddRequest.setParentId(patients.getId()); + antExcAddRequest.setName(patients.getUsername()); + antExcAddRequest.setCheckTime(DateUtil.getyyyy_MM_dd_hms(new Date())); + antExcAddRequest.setProdDoctor(assistUserId); + //antExcAddRequest.setcDueWeek(cDueWeek); + + if (history.get("bp") != null) { + String bp = JsonUtil.obj2JsonString(history.get("bp")); + antExcAddRequest.setBp(JsonUtil.str2Obj(bp, Map.class)); + } + // 既往史 + if (history.get("pastHistory") != null) { + String pastHistory = JsonUtil.obj2JsonString(history.get("pastHistory")); + if (StringUtils.isNotEmpty(pastHistory)) { + Map pastHistoryMap = JsonUtil.jkstr2Obj(pastHistory, Map.class); + antExcAddRequest.setPastHistory(pastHistoryMap); + } + } + // 家族史 + if (history.get("familyHistory") != null) { + String familyHistory = JsonUtil.obj2JsonString(history.get("familyHistory")); + if (StringUtils.isNotEmpty(familyHistory)) { + Map familyHistoryMap = JsonUtil.jkstr2Obj(familyHistory, Map.class); + antExcAddRequest.setFamilyHistory(familyHistoryMap); + } + } + //个人史 + if (history.get("personalHistory") != null) { + String personalHistory = JsonUtil.obj2JsonString(history.get("personalHistory")); + if (StringUtils.isNotEmpty(personalHistory)) { + Map personalHistoryMap = JsonUtil.jkstr2Obj(personalHistory, Map.class); + antExcAddRequest.setPersonalHistory(personalHistoryMap); + } + } + //妇科手术史 + if (history.get("fksxHistory") != null) { + String fksxHistory = JsonUtil.obj2JsonString(history.get("fksxHistory")); + if (StringUtils.isNotEmpty(fksxHistory)) { + Map fksxHistoryMap = JsonUtil.jkstr2Obj(fksxHistory, Map.class); + antExcAddRequest.setFksxHistory(fksxHistoryMap); + } + } + //本次妊娠情况 + if (history.get("cestationInfo") != null) { + String cestationInfo = JsonUtil.obj2JsonString(history.get("cestationInfo")); + if (StringUtils.isNotEmpty(cestationInfo)) { + Map cestationInfoMap = JsonUtil.jkstr2Obj(cestationInfo, Map.class); + antExcAddRequest.setCestationInfo(cestationInfoMap); + } + } + //叶酸服用情况 + if (history.get("ysfyHistory") != null) { + String ysfyHistory = JsonUtil.obj2JsonString(history.get("ysfyHistory")); + if (StringUtils.isNotEmpty(ysfyHistory)) { + Map ysfyHistoryMap = JsonUtil.jkstr2Obj(ysfyHistory, Map.class); + antExcAddRequest.setYsfyHistory(ysfyHistoryMap); + } + } + //传染病史 + if (history.get("infectDiseases") != null) { + String infectDiseases = JsonUtil.obj2JsonString(history.get("infectDiseases")); + if (StringUtils.isNotEmpty(infectDiseases)) { + Map infectDiseasesMap = JsonUtil.jkstr2Obj(infectDiseases, Map.class); + antExcAddRequest.setInfectDiseases(infectDiseasesMap); + } + } + + //剖宫产次数 + if (isNotNull(history.get("planedProd"))) { + antExcAddRequest.setPlanedProd((Integer) history.get("planedProd")); + } + //顺产次数 + if (isNotNull(history.get("delivery"))) { + antExcAddRequest.setDelivery((Integer) history.get("delivery")); + } + //引产次数 + if (isNotNull(history.get("yinchan"))) { + antExcAddRequest.setYinchan((Integer) history.get("yinchan")); + } + //流产 + if (isNotNull(history.get("abortion"))) { + antExcAddRequest.setAbortion((Integer) history.get("abortion")); + } + //自然流产 + if (isNotNull(history.get("abortionZR"))) { + antExcAddRequest.setAbortionZR((Integer) history.get("abortionZR")); + } + //人工流产 + if (isNotNull(history.get("abortionRG"))) { + antExcAddRequest.setAbortionRG((Integer) history.get("abortionRG")); + } + //药物流产 + if (isNotNull(history.get("yaowu"))) { + antExcAddRequest.setYaowu((Integer) history.get("yaowu")); + } + + //孕次 + if (isNotNull(history.get("pregnancyTimes"))) { + antExcAddRequest.setPregnancyTimes((Integer) history.get("pregnancyTimes")); + } + //产次 + antExcAddRequest.setProdTime((antExcAddRequest.getDelivery() != null ? antExcAddRequest.getDelivery() : 0) + + (antExcAddRequest.getPlanedProd() != null ? antExcAddRequest.getPlanedProd() : 0) + + (antExcAddRequest.getYinchan() != null ? antExcAddRequest.getYinchan() : 0) + + (antExcAddRequest.getAbortion() != null ? antExcAddRequest.getAbortion() : 0) + ); + + if (isNotNull(history.get("yqWeight"))) { + antExcAddRequest.setYqweight(history.get("yqWeight").toString()); + antExcAddRequest.setYqWeight(history.get("yqWeight").toString()); + } + if (isNotNull(history.get("weight"))) { + antExcAddRequest.setWeight(history.get("weight").toString()); + ; + } + if (isNotNull(history.get("height"))) { + antExcAddRequest.setHeight(history.get("height").toString()); + } + if (StringUtils.isNotEmpty(antExcAddRequest.getWeight()) && StringUtils.isNotEmpty(antExcAddRequest.getHeight())) { + Double wh = Double.parseDouble(antExcAddRequest.getHeight()) / 100; + Double shen = wh * wh; + Double bmi = Double.parseDouble(antExcAddRequest.getWeight()) / shen; + antExcAddRequest.setBaricIndex(bmi + ""); + } + //指导意见 + GuidelinesQuery guidelinesQuery = new GuidelinesQuery(); + guidelinesQuery.setType(1); + guidelinesQuery.setMaxStart(5); + guidelinesQuery.setMinEnd(5); + List guidelines = guidelinesService.queryGuidelines(guidelinesQuery); + StringBuilder stringBuilder = new StringBuilder(128); + if (CollectionUtils.isNotEmpty(list)) { + for (Guidelines guideline : guidelines) { + stringBuilder.append(guideline.getCategory()).append(" ").append(guideline.getContent()).append("\r\n"); + } + antExcAddRequest.setGuide(stringBuilder.toString()); + } + + BaseResponse baseResponse = antenatalExaminationFacade.addOneAnetExChu(antExcAddRequest, Integer.valueOf(assistUserId)); + System.out.println("auto generate antexc end," + baseResponse.toString()); + } + } + + private boolean isNotNull(Object o){ + return o != null + && !"null".equals(o.toString()) + && !"".equals(o.toString()); + } + /** * 小程序预约直接建档 * @param response @@ -392,12 +563,12 @@ public class RemoteController extends BaseController { antExcAddRequest.setProdDoctor(assistUserId); antExcAddRequest.setcDueWeek(cDueWeek); - if (history.get("bp") != null) { + if (isNotNull(history.get("bp"))) { String bp = JsonUtil.obj2JsonString(history.get("bp")); antExcAddRequest.setBp(JsonUtil.str2Obj(bp, Map.class)); } // 既往史 - if (history.get("pastHistory") != null) { + if (isNotNull(history.get("pastHistory"))) { String pastHistory = JsonUtil.obj2JsonString(history.get("pastHistory")); if (StringUtils.isNotEmpty(pastHistory)) { Map pastHistoryMap = JsonUtil.jkstr2Obj(pastHistory, Map.class); @@ -405,7 +576,7 @@ public class RemoteController extends BaseController { } } // 家族史 - if (history.get("familyHistory") != null) { + if (isNotNull(history.get("familyHistory"))) { String familyHistory = JsonUtil.obj2JsonString(history.get("familyHistory")); if (StringUtils.isNotEmpty(familyHistory)) { Map familyHistoryMap = JsonUtil.jkstr2Obj(familyHistory, Map.class); @@ -413,7 +584,7 @@ public class RemoteController extends BaseController { } } //个人史 - if (history.get("personalHistory") != null) { + if (isNotNull(history.get("personalHistory"))) { String personalHistory = JsonUtil.obj2JsonString(history.get("personalHistory")); if (StringUtils.isNotEmpty(personalHistory)) { Map personalHistoryMap = JsonUtil.jkstr2Obj(personalHistory, Map.class); @@ -421,7 +592,7 @@ public class RemoteController extends BaseController { } } //妇科手术史 - if (history.get("fksxHistory") != null) { + if (isNotNull(history.get("fksxHistory"))) { String fksxHistory = JsonUtil.obj2JsonString(history.get("fksxHistory")); if (StringUtils.isNotEmpty(fksxHistory)) { Map fksxHistoryMap = JsonUtil.jkstr2Obj(fksxHistory, Map.class); @@ -429,7 +600,7 @@ public class RemoteController extends BaseController { } } //本次妊娠情况 - if (history.get("cestationInfo") != null) { + if (isNotNull(history.get("cestationInfo"))) { String cestationInfo = JsonUtil.obj2JsonString(history.get("cestationInfo")); if (StringUtils.isNotEmpty(cestationInfo)) { Map cestationInfoMap = JsonUtil.jkstr2Obj(cestationInfo, Map.class); @@ -437,7 +608,7 @@ public class RemoteController extends BaseController { } } //叶酸服用情况 - if (history.get("ysfyHistory") != null) { + if (isNotNull(history.get("ysfyHistory") )) { String ysfyHistory = JsonUtil.obj2JsonString(history.get("ysfyHistory")); if (StringUtils.isNotEmpty(ysfyHistory)) { Map ysfyHistoryMap = JsonUtil.jkstr2Obj(ysfyHistory, Map.class); @@ -445,7 +616,7 @@ public class RemoteController extends BaseController { } } //传染病史 - if (history.get("infectDiseases") != null) { + if (isNotNull(history.get("infectDiseases"))) { String infectDiseases = JsonUtil.obj2JsonString(history.get("infectDiseases")); if (StringUtils.isNotEmpty(infectDiseases)) { Map infectDiseasesMap = JsonUtil.jkstr2Obj(infectDiseases, Map.class); @@ -454,36 +625,36 @@ public class RemoteController extends BaseController { } //剖宫产次数 - if (history.get("planedProd") != null) { + if (isNotNull(history.get("planedProd"))) { antExcAddRequest.setPlanedProd((Integer) history.get("planedProd")); } //顺产次数 - if (history.get("delivery") != null) { + if (isNotNull(history.get("delivery"))) { antExcAddRequest.setDelivery((Integer) history.get("delivery")); } //引产次数 - if (history.get("yinchan") != null) { + if (isNotNull(history.get("yinchan"))) { antExcAddRequest.setYinchan((Integer) history.get("yinchan")); } //流产 - if (history.get("abortion") != null) { + if (isNotNull(history.get("abortion"))) { antExcAddRequest.setAbortion((Integer) history.get("abortion")); } //自然流产 - if (history.get("abortionZR") != null) { + if (isNotNull(history.get("abortionZR"))) { antExcAddRequest.setAbortionZR((Integer) history.get("abortionZR")); } //人工流产 - if (history.get("abortionRG") != null) { + if (isNotNull(history.get("abortionRG"))) { antExcAddRequest.setAbortionRG((Integer) history.get("abortionRG")); } //药物流产 - if (history.get("yaowu") != null) { + if (isNotNull(history.get("yaowu"))) { antExcAddRequest.setYaowu((Integer) history.get("yaowu")); } //孕次 - if (history.get("pregnancyTimes") != null) { + if (isNotNull(history.get("pregnancyTimes"))) { antExcAddRequest.setPregnancyTimes((Integer) history.get("pregnancyTimes")); } //产次 @@ -493,15 +664,14 @@ public class RemoteController extends BaseController { + (antExcAddRequest.getAbortion() != null ? antExcAddRequest.getAbortion() : 0) ); - if (history.get("yqWeight") != null) { + if (isNotNull(history.get("yqWeight"))) { antExcAddRequest.setYqweight(history.get("yqWeight").toString()); antExcAddRequest.setYqWeight(history.get("yqWeight").toString()); } - if (history.get("weight") != null) { + if (isNotNull(history.get("weight"))) { antExcAddRequest.setWeight(history.get("weight").toString()); - ; } - if (history.get("height") != null) { + if (isNotNull(history.get("height"))) { antExcAddRequest.setHeight(history.get("height").toString()); } if (StringUtils.isNotEmpty(antExcAddRequest.getWeight()) && StringUtils.isNotEmpty(antExcAddRequest.getHeight())) {