From 907641e56c2085aaa81f267946dc3e3e9fca73e7 Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期三, 18 九月 2024 09:39:02 +0800 Subject: [PATCH] 代码提交 --- ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java | 324 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 290 insertions(+), 34 deletions(-) diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java index a28df21..89d4236 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java @@ -1,13 +1,19 @@ package com.ruoyi.quartz.task; import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.google.common.reflect.TypeToken; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.enums.ServiceFromEnum; +import com.ruoyi.common.utils.DtoConversionUtils; import com.ruoyi.common.utils.RSAPublicKeyExample; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.http.HttpUtils; import com.smartor.common.SendService; import com.smartor.domain.*; -import com.smartor.mapper.ServiceSubtaskMapper; import com.smartor.mapper.ServiceTaskMapper; import com.smartor.service.*; import lombok.extern.slf4j.Slf4j; @@ -15,7 +21,18 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.Transactional; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; /** @@ -38,6 +55,8 @@ @Autowired private IServiceSubtaskService iServiceSubtaskService; + @Autowired + private PlatformTransactionManager transactionManager; @Value("${localIP}") private String localIP; @@ -45,6 +64,8 @@ @Value("${pub_key}") private String pub_key; + @Value("${thirdWXUrl}") + private String thirdWXUrl; @Value("${req_path}") private String req_path; @@ -63,6 +84,21 @@ @Autowired IBaseSmsaccountService baseSmsaccountService; + + @Autowired + IPatArchiveService patArchiveService; + + @Autowired + IPatMedInhospService patMedInhospService; + + @Autowired + IPatMedOuthospService patMedOuthospService; + + @Autowired + ISvyTaskTemplateService svyTaskTemplateService; + + @Value("${hosp_info_url}") + private String hospInfoUrl; public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) { System.out.println(StringUtils.format("鎵ц澶氬弬鏂规硶锛� 瀛楃涓茬被鍨媨}锛屽竷灏旂被鍨媨}锛岄暱鏁村瀷{}锛屾诞鐐瑰瀷{}锛屾暣褰}", s, b, l, d, i)); @@ -100,14 +136,43 @@ */ public void dealHisData() { //灏嗘偅鑰呬俊鎭�佸嚭闄€�侀棬璇婃暟鎹叏閮ㄩ噰闆� - + // 鑾峰彇褰撳墠鏃ユ湡鍜屾椂闂� + LocalDateTime endTime = LocalDateTime.now(); + // 鑾峰彇鍓嶄竴澶╃殑鏃ユ湡鍜屾椂闂� + LocalDateTime startTime = endTime.minusDays(1); + getInHospInfo("0", startTime, endTime); + getInHospInfo("1", startTime, endTime); //璋冪敤dealOupHospInfo鏁版嵁澶勭悊鏂规硶锛屽鐞嗗畬鍚庯紝灏嗏�滃嚭闄㈣〃鐨刢heck_flag=1鈥� //鑾峰彇褰撳墠鏃ユ湡 锛堢簿纭埌澶╋級寰�鍓嶆帹鐩稿簲澶╂暟锛堝湪鎸囧畾鐨勫熀纭�妯℃澘涓壘瀵瑰簲鐨勫ぉ鏁帮級锛� //寰幆鎮h�呬俊鎭紝鏍规嵁鎮h��"鍑洪櫌璇婃柇ICD鍊尖�濊幏鍙栧埌鐩稿綋鐨勬ā鏉匡紙鑾峰彇鍙栫浉搴旂殑澶╂暟锛�; //鏍规嵁鏌ヨ鍑烘潵鐨勬ā鏉匡紝鍘诲浐瀹氫换鍔★紙鍥哄畾浠诲姟锛屽凡缁忓皢妯℃澘涔熷浐瀹氫簡锛夊幓鍖归厤妯℃澘 //鏍规嵁鍖归厤鍑烘潵鐨勬ā鏉垮拰浠诲姟涓庢偅鑰呬俊鎭紝灏嗘暟鎹彃鍏ュ埌瀛愪换鍔¤〃涓� - iPatMedInhospService.dealOupHospInfo(); + } + + public void dealHisData2() { + //灏嗘偅鑰呬俊鎭�佸嚭闄€�侀棬璇婃暟鎹叏閮ㄩ噰闆� + // 鎸囧畾鐨勫紑濮嬫棩鏈� + LocalDate endDate = LocalDate.of(2024, 9, 1); + // 褰撳墠鏃ユ湡 + LocalDate currentDate = LocalDate.now(); + // 瀹氫箟鏃ユ湡鏍煎紡 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd "); + + // 浠庡紑濮嬫棩鏈熷埌褰撳墠鏃ユ湡閫愬ぉ鎵撳嵃 + for (LocalDate date = endDate; !date.isAfter(currentDate); date = date.plusDays(1)) { + System.out.println(date.format(formatter)); + getInHospInfo("0", date.minusDays(1).atStartOfDay(), date.atStartOfDay()); + getInHospInfo("1", date.minusDays(1).atStartOfDay(), date.atStartOfDay()); + } + + } + + /** + * 澶勭悊鎮h�呬俊鎭紝杩涘叆瀛愪换鍔¤〃 + */ + public void dealOutHospInfo() { + iPatMedInhospService.dealOutHospInfo(); } /** @@ -115,28 +180,62 @@ */ public void longTaskSend() { //鑾峰彇浠诲姟淇℃伅 - ServiceTask st =new ServiceTask(); + ServiceTask st = new ServiceTask(); st.setDelFlag("0"); st.setLongTask(1); List<ServiceTask> serviceTasks = serviceTaskMapper.selectServiceTaskList(st); + log.error("serviceTasks杩涙潵浜嗗悧锛焮}", serviceTasks); for (ServiceTask serviceTask : serviceTasks) { + //閫氳繃taskId,鑾峰彇鏈墽琛岀殑瀛愪换鍔′俊鎭� - ServiceSubtask serviceSubtask = new ServiceSubtask(); + ServiceSubtaskVO serviceSubtask = new ServiceSubtaskVO(); serviceSubtask.setTaskid(serviceTask.getTaskid()); serviceSubtask.setSendstate(2L); List<ServiceSubtask> selectServiceSubtaskList = iServiceSubtaskService.selectServiceSubtaskList(serviceSubtask); + log.error("selectServiceSubtaskList杩涙潵浜嗗悧锛焮}", selectServiceSubtaskList); if (CollectionUtils.isNotEmpty(selectServiceSubtaskList)) { for (ServiceSubtask serviceSubtask1 : selectServiceSubtaskList) { //濡傛灉鎮h�呯殑鍙戦�佹棩鏈熸槸浠婂ぉ锛屽垯杩涜鍙戦�� - boolean dateToday = isDateToday(serviceSubtask1.getLongSendTime()); - if (dateToday) { - CommonTaskcallMQ commonTaskcallMQ = new CommonTaskcallMQ(); - commonTaskcallMQ.setTaskid(serviceTask.getTaskid()); - commonTaskcallMQ.setPreachform(serviceSubtask1.getServiceform()); - sfHandle(commonTaskcallMQ, localIP); - //鍙戦�佸畬鎴愬悗锛屼慨鏀圭姸鎬� - serviceSubtask1.setSendstate(3L); - iServiceSubtaskService.updateServiceSubtask(serviceSubtask1); + try { + boolean dateToday = isDateToday(serviceSubtask1.getLongSendTime()); + if (dateToday) { + //鍏堝垽鏂偅鑰呮槸涓嶆槸杩樿鍙戦�� + PatArchive patArchive = patArchiveService.selectPatArchiveByPatid(serviceSubtask1.getPatid()); + if (!Objects.isNull(patArchive) && patArchive.getNotrequiredFlag() == "1") { + //涓嶉渶瑕佸彂閫� + serviceSubtask1.setResult("error"); + serviceSubtask1.setRemark(patArchive.getNotrequiredreason()); + serviceSubtask1.setSendstate(4L); + serviceSubtask1.setFinishtime(new Date()); + iServiceSubtaskService.insertServiceSubtask(serviceSubtask1); + continue; + } + + log.error("dateToday杩涙潵浜嗗悧锛焮}", dateToday); + CommonTaskcallMQ commonTaskcallMQ = new CommonTaskcallMQ(); + commonTaskcallMQ.setTaskid(serviceTask.getTaskid()); + commonTaskcallMQ.setPreachform(serviceSubtask1.getServiceform()); + commonTaskcallMQ.setSendType("2"); + Map<String, Object> map = sfHandlle(commonTaskcallMQ, localIP); + //鍙戦�佸畬鎴愬悗锛屼慨鏀圭姸鎬� + serviceSubtask1.setSendstate(3L); + if ((Boolean) map.get("succ") == false) { + serviceSubtask1.setResult("success"); + } else { + serviceSubtask1.setResult("error"); + serviceSubtask1.setRemark(map.get("msg").toString()); + } + iServiceSubtaskService.updateServiceSubtask(serviceSubtask1); + } + } catch (Exception e) { + String guid = UUID.randomUUID().toString(); + log.error("闀挎湡浠诲姟锛屽彂閫佸け璐ュ師鍥狅細{},{}", e.getMessage(), guid); + serviceSubtask1.setResult("error"); + serviceSubtask1.setRemark("绯荤粺閿欒"); + serviceSubtask1.setSendstate(5L); + serviceSubtask1.setFinishtime(new Date()); + serviceSubtask1.setGuid(guid); + iServiceSubtaskService.insertServiceSubtask(serviceSubtask1); } } } @@ -165,19 +264,20 @@ return (calendarToCheck.get(Calendar.YEAR) == todayYear && calendarToCheck.get(Calendar.MONTH) == todayMonth && calendarToCheck.get(Calendar.DAY_OF_MONTH) == todayDay); } - public void sfHandle(CommonTaskcallMQ commonTaskcallMQ, String ip) { + public Map<String, Object> sfHandlle(CommonTaskcallMQ commonTaskcallMQ, String ip) { + log.error("sfHandlle杩涙潵浜嗗悧锛焮}", commonTaskcallMQ); //鍒ゆ柇涓�涓媍ommonTaskcallMQ涓殑stopstate鏄惁涓巌vr_task涓殑涓�鑷达紝涓嶄竴鑷达紝鍒欒鏄庢槸鏆傚仠浜� ServiceTask ivrTask1 = serviceTaskMapper.selectServiceTaskByTaskid(commonTaskcallMQ.getTaskid()); if (StringUtils.isNotEmpty(commonTaskcallMQ.getPreachform())) { //濡備綍浠诲姟鍙戦�佹柟寮忎笉涓虹┖ String[] split = commonTaskcallMQ.getPreachform().split(","); - System.out.println("split鐨勫�间负锛�" + split); + log.error("split杩涙潵浜嗗悧锛焮}", split); for (String serviceFrom : split) { String descByCode = ServiceFromEnum.getDescByCode(Integer.valueOf(serviceFrom)); //杩欓噷鍙互鑰冭檻鐢ㄧ瓥鐣ユā寮忎紭鍖栦竴涓嬶紝涓嶇劧澶毦鐪嬩簡 //閫氳繃浠诲姟ID鎷垮埌鎮h�呬俊鎭� - ServiceSubtask ivrTaskcall = new ServiceSubtask(); + ServiceSubtaskVO ivrTaskcall = new ServiceSubtaskVO(); ivrTaskcall.setTaskid(commonTaskcallMQ.getTaskid()); List<ServiceSubtask> selectServiceSubtaskList = iServiceSubtaskService.selectServiceSubtaskList(ivrTaskcall); if (descByCode.equals("鐢佃瘽")) { @@ -192,7 +292,7 @@ if (commonTaskcallMQ.getSendType().equals("2")) { //璇存槑鏄珛鍗冲彂閫� String value = redisCache.getCacheObject("cache-0"); - ServiceSubtask serviceSubtask1 = new ServiceSubtask(); + ServiceSubtaskVO serviceSubtask1 = new ServiceSubtaskVO(); serviceSubtask1.setTaskid(commonTaskcallMQ.getTaskid()); List<ServiceSubtask> selectServiceSubtaskList1 = iServiceSubtaskService.selectServiceSubtaskList(serviceSubtask1); for (ServiceSubtask serviceSubtask2 : selectServiceSubtaskList1) { @@ -206,7 +306,7 @@ } else { //闈炵珛鍗冲彂閫� String value = redisCache.getCacheObject(key); - ServiceSubtask serviceSubtask1 = new ServiceSubtask(); + ServiceSubtaskVO serviceSubtask1 = new ServiceSubtaskVO(); serviceSubtask1.setTaskid(commonTaskcallMQ.getTaskid()); List<ServiceSubtask> selectServiceSubtaskList1 = iServiceSubtaskService.selectServiceSubtaskList(serviceSubtask1); for (ServiceSubtask serviceSubtask2 : selectServiceSubtaskList1) { @@ -233,10 +333,10 @@ } } else if (descByCode.equals("澶氬獟浣�")) { //澶氬獟浣� - return; + return null; } else if (descByCode.equals("绾歌川")) { //绾歌川 - return; + return null; } else if (descByCode.equals("鐭俊")) { //鐭俊 // http://localhost:8099/followvisit/particty?param1=3¶m2=348 @@ -252,7 +352,6 @@ sendMagParam.setUrl(ip + ":" + req_path + "/followvisit/particty?param1=" + taskId + "¶m2=" + patid + "¶m5=false"); Boolean aBoolean = sendService.sendMsg(sendMagParam); - //浠诲姟鍙戦�佽褰� ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord(); serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString()); @@ -262,24 +361,24 @@ serviceSubtaskRecord.setStartTime(System.currentTimeMillis()); serviceSubtaskRecord.setResult(aBoolean == true ? "鎴愬姛" : "澶辫触"); serviceSubtaskRecordService.insertServiceSubtaskRecord(serviceSubtaskRecord); + return null; } } else if (descByCode.equals("鍏紬鍙�")) { + log.error("鍏紬鍙疯繘鏉ヤ簡鍚楋紵{}", descByCode); //鍏紬鍙� RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample(); String taskId = rsaPublicKeyExample.encryptedData(ivrTask1.getTaskid().toString(), pub_key); for (ServiceSubtask serviceSubtask : selectServiceSubtaskList) { + log.error("serviceSubtask---------杩涙潵浜嗗悧锛焮}", serviceSubtask); String patid = rsaPublicKeyExample.encryptedData(serviceSubtask.getPatid().toString(), pub_key); - SendMagParam sendMagParam = new SendMagParam(); - sendMagParam.setType("5"); - sendMagParam.setUrl(ip + ":" + req_path + "/outsideChain?param1=" + taskId + "¶m2=" + patid + "¶m3=" + ivrTask1.getTaskName() + "¶m5=false"); - log.info("閾炬帴瀹屾暣璺緞锛歿}", ip + ":" + req_path + "/outsideChain?param1=" + taskId + "¶m2=" + patid + "¶m3=" + ivrTask1.getTaskName() + "¶m5=false"); - //杩欎釜妯℃澘ID鍏堝啓姝伙紝鍚庨潰鍋氭垚鍙�� - sendMagParam.setTmpCode("oG3pJHPVWpE81DmZsua_2tKwgJ97r0qz37z56ns7NB4"); - Map map = new HashMap(); - map.put("first", ivrTask1.getTaskName()); - sendMagParam.setContent(JSON.toJSONString(map)); - sendMagParam.setOpenid(serviceSubtask.getOpenid()); - Boolean aBoolean = sendService.sendMsg(sendMagParam); + String url = null; + try { + url = ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "¶m2=" + patid + "¶m3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "¶m5=false"; + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + String wxCode = getWXCode(serviceSubtask.getSfzh(), url, serviceSubtask.getTaskName(), serviceSubtask.getTaskDesc(), "鏃�"); + Map<String, Object> map = JSONObject.parseObject(wxCode, Map.class); //浠诲姟鍙戦�佽褰� ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord(); @@ -288,14 +387,156 @@ serviceSubtaskRecord.setTasktype(serviceSubtask.getType()); serviceSubtaskRecord.setPreachform("4"); serviceSubtaskRecord.setStartTime(System.currentTimeMillis()); - serviceSubtaskRecord.setResult(aBoolean == true ? "鎴愬姛" : "澶辫触"); + serviceSubtaskRecord.setResult("success"); + if (!map.isEmpty() && (Boolean) map.get("succ") == false) + serviceSubtaskRecord.setResult("error"); serviceSubtaskRecordService.insertServiceSubtaskRecord(serviceSubtaskRecord); + return map; } } //閫氱煡 MQ 娑堟伅宸茶鎺ユ敹,鍙互ACK(浠庨槦鍒椾腑鍒犻櫎)浜� 锛堣繖涓渶瑕佹牴鎹笟鍔″啀鍘诲鐞咥CK锛� } } + return null; } + + + /** + * 鑾峰嚭闄㈡偅鑰呬俊鎭� + * cry 鍑哄叆闄細 0 鍏ラ櫌 1 鍑洪櫌 + */ + @Transactional + public void getInHospInfo(String cry, LocalDateTime startTime, LocalDateTime endTime) { + // 鑾峰彇褰撳墠鏃ユ湡鍜屾椂闂� + LocalDateTime currentDateTime = LocalDateTime.now(); + // 鑾峰彇鍓嶄竴澶╃殑鏃ユ湡鍜屾椂闂� + LocalDateTime previousDateTime = currentDateTime.minusDays(1); + // 瀹氫箟鏃ユ湡鏃堕棿鏍煎紡 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.S"); + Map<String, String> req = new HashMap<>(); + if (cry.equals("1")) { + req.put("startTime", startTime.format(formatter)); + req.put("endTime", endTime.format(formatter)); + req.put("currStatus", "4"); + } else if (cry.equals("0")) { + req.put("admissStartDate", startTime.format(formatter)); + req.put("admissEndDate", endTime.format(formatter)); + req.put("currStatus", "2"); + } + Map<String, String> header = new HashMap<>(); + header.put("x-hcsb-serviceno", "IS002347"); + header.put("x-hcsb-version", "2.0"); + header.put("x-hcsb-sourcesyscode", "14"); + header.put("x-hcsb-token", "ArGE2JnHtxG/Zx5nrnGY4eOfMUJGGJokAJHigG1BrCY="); + header.put("x-hcsb-msgdate", currentDateTime.format(formatter)); + String result = HttpUtils.sendPostByHeader(hospInfoUrl, new Gson().toJson(req), header); + //鏁版嵁瑙f瀽 + Gson gson = new Gson(); + JsonObject jsonObject = gson.fromJson(result, JsonObject.class); + JsonArray resultArray = jsonObject.getAsJsonObject("data").getAsJsonArray("result"); + Type resultType = new TypeToken<List<ThiedInhospInfo>>() { + }.getType(); + List<ThiedInhospInfo> thiedInhospInfoList = gson.fromJson(resultArray, resultType); + if (CollectionUtils.isNotEmpty(thiedInhospInfoList)) { + for (ThiedInhospInfo thiedInhospInfo : thiedInhospInfoList) { + //閫氳繃韬唤璇佸彿鏌ヨ璇ユ偅鑰呭湪鎮h�呰〃鏄惁瀛樺湪 + PatArchive patArchive = new PatArchive(); + List<PatArchive> patArchives = null; + patArchive.setIdcardno(thiedInhospInfo.getPatiIdCardNo().trim()); + if (StringUtils.isNotEmpty(thiedInhospInfo.getPatiIdCardNo().trim())) { + patArchives = patArchiveService.selectPatArchiveList(patArchive); + } else { + //鎮h�呬俊鎭负绌猴紝鐩存帴 涓嬩竴涓� + continue; + } + if (CollectionUtils.isEmpty(patArchives) || patArchives.size() == 0) { + patArchive.setPatientno(thiedInhospInfo.getPatiMediaNo()); + patArchive.setSourcefrom(2); + patArchive.setPattype("2"); + if (thiedInhospInfo.getOutWayId().equals("4")) { + //濡傛灉涓�4灏辨槸姝讳骸 + patArchive.setNotrequiredFlag("1"); + patArchive.setNotrequiredreason(thiedInhospInfo.getOutWayName()); + } + patArchive.setSex(thiedInhospInfo.getPatiRecordGender().equals("鐢�") ? 1L : 2L); + patArchive.setNation(thiedInhospInfo.getPatiNation()); + patArchive.setNativePlace(thiedInhospInfo.getPatiNationality()); + patArchive.setPlaceOfResidence(thiedInhospInfo.getPatiHomeAddr()); + try { + if (StringUtils.isNotEmpty(thiedInhospInfo.getPatiBirthday())) + patArchive.setBirthdate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(thiedInhospInfo.getPatiBirthday())); + } catch (ParseException e) { + e.printStackTrace(); + } + patArchive.setAge(Long.valueOf(thiedInhospInfo.getTreateAge())); + patArchive.setAgeUnit(thiedInhospInfo.getTreatAgeunit()); + patArchive.setTelcode(thiedInhospInfo.getCompanyTelNum()); + patArchive.setRelativetelcode(thiedInhospInfo.getContactPersonPhone()); + patArchive.setDelFlag("0"); + patArchive.setCreateTime(new Date()); + patArchive.setUpdateTime(new Date()); + patArchive.setName(thiedInhospInfo.getPatiRecordName()); + patArchiveService.insertPatArchive(patArchive); + } else { + patArchive = patArchives.get(0); + } + log.error("鍏ュ弬鐨刾atArchive锛歿}", patArchive); + PatMedInhosp patMedInhosp = new PatMedInhosp(); + patMedInhosp.setPatid(patArchive.getId()); + patMedInhosp.setPatno(patArchive.getPatientno()); + patMedInhosp.setPatname(patArchive.getName()); + patMedInhosp.setNurseId(thiedInhospInfo.getNurseId()); + patMedInhosp.setNurseName(thiedInhospInfo.getNurseName()); + patMedInhosp.setSerialnum(thiedInhospInfo.getInpatientId()); + if (cry.equals("0")) { + patMedInhosp.setInhospstate("0"); + } else if (cry.equals("1")) { + patMedInhosp.setInhospstate("1"); + } + patMedInhosp.setHospitalcode(thiedInhospInfo.getAreaId()); + patMedInhosp.setIcd10code(thiedInhospInfo.getDiagIcd10()); + patMedInhosp.setDiagname(thiedInhospInfo.getDiagName()); + try { + if (StringUtils.isNotEmpty(thiedInhospInfo.getAdmissDate())) + patMedInhosp.setStarttime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(thiedInhospInfo.getAdmissDate())); + } catch (ParseException e) { + e.printStackTrace(); + } + try { + if (StringUtils.isNotEmpty(thiedInhospInfo.getOutDate())) + patMedInhosp.setEndtime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(thiedInhospInfo.getOutDate())); + } catch (ParseException e) { + e.printStackTrace(); + } + patMedInhosp.setDeptcode(thiedInhospInfo.getAdmissDeptId()); + patMedInhosp.setDeptid(thiedInhospInfo.getAdmissDeptId()); + patMedInhosp.setDeptname(thiedInhospInfo.getAdmissDeptName()); + patMedInhosp.setBedNo(thiedInhospInfo.getAdmissBedNo()); + patMedInhosp.setDelFlag("0"); +// patMedInhosp.setLeaveldeptcode(thiedInhospInfo.getCurrDeptCode()); + patMedInhosp.setLeaveldeptcode(thiedInhospInfo.getCurrDeptId()); + patMedInhosp.setLeaveldeptname(thiedInhospInfo.getCurrDeptName()); + patMedInhosp.setLeavediagname(thiedInhospInfo.getDiagName()); + patMedInhosp.setLeaveicd10code(thiedInhospInfo.getDiagIcd10()); + patMedInhosp.setDrname(thiedInhospInfo.getDoctName()); + patMedInhosp.setDrcode(thiedInhospInfo.getDoctId()); + patMedInhosp.setOutWayId(thiedInhospInfo.getOutWayId()); + patMedInhosp.setOutWayName(thiedInhospInfo.getOutWayName()); + if (cry.equals("0")) { + patMedInhosp.setSchemestatus(1L); + } else if (cry.equals("1")) { + patMedInhosp.setSchemestatus(2L); + } + patMedInhosp.setLeavehospitaldistrictid(thiedInhospInfo.getCurrWardCode()); + patMedInhosp.setLeavehospitaldistrictcode(thiedInhospInfo.getCurrWardId()); + patMedInhosp.setLeavehospitaldistrictname(thiedInhospInfo.getCurrWardName()); + patMedInhosp.setLeaveldeptid(thiedInhospInfo.getCurrDeptCode()); + patMedInhospService.insertPatMedInhosp(patMedInhosp); + + } + } + } + private String getKey() { Map<String, String> map = new HashMap<>(); @@ -324,4 +565,19 @@ } return key; } + + private String getWXCode(String idcard, String url, String taskName, String taskDesc, String submitprompt) { + XinHuaWXReq xinHuaWXReq = new XinHuaWXReq(); + xinHuaWXReq.setIdcard(idcard); + xinHuaWXReq.setUrl(url); + xinHuaWXReq.setKeyword1("娴欎腑鍖诲ぇ浜岄櫌鍑洪櫌闅忚"); + xinHuaWXReq.setKeyword2(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + xinHuaWXReq.setKeyword3(taskName); + xinHuaWXReq.setKeyword4("鐤剧梾搴峰娉ㄦ剰浜嬮」"); + + String result = HttpUtils.sendPost(thirdWXUrl, new Gson().toJson(xinHuaWXReq)); + JSONObject jsonObject = JSONObject.parseObject(result); + String code = (String) jsonObject.get("code"); + return code; + } } -- Gitblit v1.9.3