Commit c6550d6ac512a468f44cb88554de853f7a3a0804
1 parent
b262a45985
Exists in
master
and in
6 other branches
秦皇岛B超手动同步和定时同步(注释这没有使用)
Showing 3 changed files with 157 additions and 1 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ViewController.java
View file @
c6550d6
| ... | ... | @@ -83,6 +83,20 @@ |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | + * 初诊B超同步接口 | |
| 87 | + * @param startDate | |
| 88 | + * @param endDate | |
| 89 | + * @return | |
| 90 | + */ | |
| 91 | + @RequestMapping(value = "/AntExChuSync", method = RequestMethod.GET) | |
| 92 | + @ResponseBody | |
| 93 | + public BaseObjectResponse AntExChuSync(@RequestParam("startDate") String startDate, | |
| 94 | + @RequestParam("endDate") String endDate ) { | |
| 95 | + BaseObjectResponse br= antenatalExaminationFacade.AntExChuSync( startDate, endDate,true ); | |
| 96 | + return br; | |
| 97 | + } | |
| 98 | + | |
| 99 | + /** | |
| 86 | 100 | * 下载初诊word |
| 87 | 101 | * |
| 88 | 102 | * @param id |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java
View file @
c6550d6
| ... | ... | @@ -4,6 +4,8 @@ |
| 4 | 4 | import com.lyms.hospitalapi.zcfy.ZcPrenatalService; |
| 5 | 5 | import com.lyms.platform.beans.MsgRequest; |
| 6 | 6 | import com.lyms.platform.biz.SequenceConstant; |
| 7 | +import com.lyms.platform.biz.dal.IAntExChuDao; | |
| 8 | +import com.lyms.platform.biz.dal.IPatientDao; | |
| 7 | 9 | import com.lyms.platform.biz.dal.ISieveDao; |
| 8 | 10 | import com.lyms.platform.biz.service.*; |
| 9 | 11 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| ... | ... | @@ -45,6 +47,8 @@ |
| 45 | 47 | import org.springframework.stereotype.Component; |
| 46 | 48 | import org.springframework.util.StopWatch; |
| 47 | 49 | |
| 50 | +import java.text.ParsePosition; | |
| 51 | +import java.text.SimpleDateFormat; | |
| 48 | 52 | import java.util.*; |
| 49 | 53 | import java.util.regex.Pattern; |
| 50 | 54 | |
| ... | ... | @@ -151,6 +155,11 @@ |
| 151 | 155 | @Autowired |
| 152 | 156 | private ISieveDao sieveDao; |
| 153 | 157 | |
| 158 | + @Autowired | |
| 159 | + private IPatientDao iPatientDao; | |
| 160 | + | |
| 161 | + @Autowired | |
| 162 | + private IAntExChuDao iAntExChuDao; | |
| 154 | 163 | /** |
| 155 | 164 | * 处理区域隐藏建档 |
| 156 | 165 | * |
| ... | ... | @@ -2210,6 +2219,124 @@ |
| 2210 | 2219 | } |
| 2211 | 2220 | } |
| 2212 | 2221 | return new BaseObjectResponse().setData(resultMap).setErrorcode(ErrorCodeConstants.SUCCESS); |
| 2222 | + } | |
| 2223 | + public static Date strToDateLong(String strDate) { | |
| 2224 | + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); | |
| 2225 | + ParsePosition pos = new ParsePosition(0); | |
| 2226 | + Date strtodate = formatter.parse(strDate, pos); | |
| 2227 | + return strtodate; | |
| 2228 | + } | |
| 2229 | + public static String getDateAfter(Date d,int day){ | |
| 2230 | + Calendar now =Calendar.getInstance(); | |
| 2231 | + now.setTime(d); | |
| 2232 | + now.set(Calendar.DATE,now.get(Calendar.DATE)-day); | |
| 2233 | + | |
| 2234 | + String strDateFormat = "yyyy-MM-dd"; | |
| 2235 | + SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat); | |
| 2236 | + return sdf.format(now.getTime()); | |
| 2237 | + } | |
| 2238 | + private static StringBuffer getStrings(String string) { | |
| 2239 | + StringBuffer stringBuffer = new StringBuffer(); | |
| 2240 | + if (StringUtils.isNotEmpty(string)) { | |
| 2241 | + string = string.replace("\\r\\n", ""); | |
| 2242 | + List<Map> recordChoiceStrlist = com.alibaba.fastjson.JSONObject.parseArray(string, Map.class); | |
| 2243 | + String strs = ""; | |
| 2244 | + for (Map<String, Object> m : recordChoiceStrlist) { | |
| 2245 | + Object examination = m.get("examination"); | |
| 2246 | + Object diagnosis = m.get("diagnosis"); | |
| 2247 | + String str = examination + "\r\n" + diagnosis + "\r\n"; | |
| 2248 | + stringBuffer.append(str); | |
| 2249 | + } | |
| 2250 | + } | |
| 2251 | + return stringBuffer; | |
| 2252 | + } | |
| 2253 | + | |
| 2254 | + public void bChaoTimerWork() { | |
| 2255 | + String startDate1 = getDateAfter(new Date(), 1); | |
| 2256 | + String endDate1 = DateUtil.getyyyy_MM_dd(new Date()); | |
| 2257 | + System.out.println("start=" + startDate1 + "end=" + endDate1); | |
| 2258 | + AntExChuSync(startDate1,endDate1,true); | |
| 2259 | + } | |
| 2260 | + | |
| 2261 | + /** | |
| 2262 | + * 初诊B超同步接口 | |
| 2263 | + * @param startDate | |
| 2264 | + * @param endDate | |
| 2265 | + * @return | |
| 2266 | + */ | |
| 2267 | + public BaseObjectResponse AntExChuSync(String startDate, String endDate,boolean b) { | |
| 2268 | + | |
| 2269 | + //1 获取2018-10-01 到 2019-09-10,秦皇岛说有的初证数据。 | |
| 2270 | + AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
| 2271 | + antExChuQuery.setCheckTimeStart(strToDateLong(startDate)); | |
| 2272 | + antExChuQuery.setCheckTimeEnd(strToDateLong(endDate)); | |
| 2273 | + antExChuQuery.setHospitalId("216"); | |
| 2274 | + antExChuQuery.setYn(YnEnums.YES.getId()); | |
| 2275 | + List<AntExChuModel> antExChu = antenatalExaminationService.queryAntExChu(antExChuQuery); | |
| 2276 | + System.out.println("获取秦皇岛初诊条数:"+antExChu.size()); | |
| 2277 | + if (CollectionUtils.isNotEmpty(antExChu)) { | |
| 2278 | + for (int i = 0; i <antExChu.size() ; i++) | |
| 2279 | + try { | |
| 2280 | + | |
| 2281 | + if (antExChu.get(i) == null || antExChu.get(i).getCheckTime() == null) { | |
| 2282 | + if(b){ | |
| 2283 | + operateLogFacade.addModifyOptLog(null, 2160001, antExChu.get(i), antExChu.get(i), OptActionEnums.ADD.getId(), "初诊产检日期为空"); | |
| 2284 | + } | |
| 2285 | + continue; | |
| 2286 | + } | |
| 2287 | + Date checkTime = antExChu.get(i).getCheckTime();//产检日期 | |
| 2288 | + | |
| 2289 | + //2 遍历初证数据,获取单个初诊数据的初证日期,根据初证日志调用接口 获取B超检查结果。更新初证B超数据。 | |
| 2290 | + Patients patients = iPatientDao.getPatient(antExChu.get(i).getParentId()); | |
| 2291 | + if (patients == null || patients.getVcCardNo() == null) { | |
| 2292 | + if(b){ | |
| 2293 | + operateLogFacade.addModifyOptLog(null, 2160002, patients, patients.getVcCardNo(), OptActionEnums.ADD.getId(), "就诊卡号为空"); | |
| 2294 | + } | |
| 2295 | + continue; | |
| 2296 | + } | |
| 2297 | + String s = null; | |
| 2298 | + String vcCardNo = patients.getVcCardNo(); | |
| 2299 | + Map<String, String> map = new HashMap<String, String>(); | |
| 2300 | + String startDate1 = getDateAfter(checkTime, 1); | |
| 2301 | + String endDate1 = DateUtil.getyyyy_MM_dd(checkTime); | |
| 2302 | + map.put("vcCardNo", vcCardNo); | |
| 2303 | + map.put("startDate", startDate1); | |
| 2304 | + map.put("endDate", endDate1); | |
| 2305 | + s = HttpClientUtil.doGet("http://localhost:9090/lis/qhdris", map, "utf-8", null); | |
| 2306 | + System.out.println("获取B超信息:" + s); | |
| 2307 | + if (("[]"==s || "[]".equals(s)) || StringUtils.isEmpty(s)) { | |
| 2308 | + if(b){ | |
| 2309 | + operateLogFacade.addModifyOptLog(null, 2160003, map, s, OptActionEnums.ADD.getId(), "获取B超信息失败或为空"); | |
| 2310 | + } | |
| 2311 | + continue; | |
| 2312 | + } | |
| 2313 | + if(StringUtils.isEmpty(antExChu.get(i).getbChao())){ | |
| 2314 | + AntExChuModel antExChuModel = antExChu.get(i); | |
| 2315 | + antExChuModel.setbChao(getStrings(s).toString()); | |
| 2316 | + iAntExChuDao.updateOneAntEx(antExChu.get(i), antExChu.get(i).getId()); | |
| 2317 | + if(b){ | |
| 2318 | + operateLogFacade.addModifyOptLog(null, 2160004, null, antExChuModel, OptActionEnums.ADD.getId(), "初诊更新B超成功"); | |
| 2319 | + } | |
| 2320 | + }else if(b){ | |
| 2321 | + operateLogFacade.addModifyOptLog(null, 2160005, null, antExChu.get(i), OptActionEnums.ADD.getId(), "无需更新B超信息"); | |
| 2322 | + } | |
| 2323 | + | |
| 2324 | + } catch (Exception e) { | |
| 2325 | + e.printStackTrace(); | |
| 2326 | + if(b){ | |
| 2327 | + operateLogFacade.addModifyOptLog(null, 2160006, null, antExChu.get(i), OptActionEnums.ADD.getId(), "初诊B超同步接口异常"); | |
| 2328 | + } | |
| 2329 | + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SYSTEM_ERROR).setErrormsg(ErrorCodeConstants.SYSTEM_ERROR_DESCRIPTION); | |
| 2330 | + } | |
| 2331 | + | |
| 2332 | + }else { | |
| 2333 | + if(b){ | |
| 2334 | + operateLogFacade.addModifyOptLog(null, 2160007, startDate, endDate, OptActionEnums.ADD.getId(), "初诊数据为空"); | |
| 2335 | + } | |
| 2336 | + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR).setErrormsg("获取"+startDate+" 到 "+endDate+",秦皇岛的初诊数据条数:"+antExChu.size()); | |
| 2337 | + } | |
| 2338 | + | |
| 2339 | + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
| 2213 | 2340 | } |
| 2214 | 2341 | |
| 2215 | 2342 |
platform-operate-api/src/main/resources/spring/applicationContext-quartz.xml
View file @
c6550d6
| ... | ... | @@ -106,7 +106,15 @@ |
| 106 | 106 | </bean> |
| 107 | 107 | |
| 108 | 108 | |
| 109 | - | |
| 109 | + <!-- 秦皇岛医院自动更新初诊B超数据--> | |
| 110 | + <bean id="qhdBchaoTimerWork" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> | |
| 111 | + <!-- 要调用的bean --> | |
| 112 | + <property name="targetObject" ref="antenatalExaminationFacade"></property> | |
| 113 | + <!-- 要调用的Method --> | |
| 114 | + <property name="targetMethod" value="bChaoTimerWork"></property> | |
| 115 | + <!-- 是否并发,false表示 如果发生错误也不影响下一次的调用 --> | |
| 116 | + <property name="concurrent" value="false"></property> | |
| 117 | + </bean> | |
| 110 | 118 | <!-- 秦皇岛医院分娩接口--> |
| 111 | 119 | <bean id="qhdFmTimerWork" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> |
| 112 | 120 | <!-- 要调用的bean --> |
| ... | ... | @@ -182,6 +190,12 @@ |
| 182 | 190 | <property name="cronExpression" value="0 0 0/1 * * ?"></property> |
| 183 | 191 | </bean> |
| 184 | 192 | |
| 193 | + <!-- 配置一个触发器 0 0 0/1 * * ?--> | |
| 194 | + <bean id="qhdBchaoTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> | |
| 195 | + <property name="jobDetail" ref="qhdBchaoTimerWork"></property> | |
| 196 | + <property name="cronExpression" value="0 0 22 * * ?"></property> | |
| 197 | + </bean> | |
| 198 | + | |
| 185 | 199 | <!-- 配置一个触发器 0 0 1 * * ?--> |
| 186 | 200 | <bean id="qhdFmHistoryTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> |
| 187 | 201 | <property name="jobDetail" ref="qhdFmHistoryTimerWork"></property> |
| ... | ... | @@ -403,6 +417,7 @@ |
| 403 | 417 | <ref bean="delSieveTrigger"/> |
| 404 | 418 | <ref bean="addSieveJobTrigger"/> |
| 405 | 419 | <ref bean="correctSieveOrderTrigger"/> |
| 420 | + <!--<ref bean="qhdBchaoTrigger"/>--> | |
| 406 | 421 | <ref bean="autoInsertIdTrigger"/> |
| 407 | 422 | <ref bean="courseTrigger"/> |
| 408 | 423 | <!-- 秦皇岛新生儿诊断--> |