| | |
| | | package com.ltkj.web.controller.his; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | |
| | | return AjaxResult.error().put("result", JSONUtil.parseObj(json)); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Transactional |
| | | public AjaxResult getHISDataNew(String type, Map<String, Object> params){ |
| | | LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | String key = entry.getKey().trim().toLowerCase(); |
| | | responseColums.add(key); |
| | | } |
| | | Map<String, Object> beanToMap = BeanUtil.beanToMap(JSONUtil.parseObj(paramsJson)); |
| | | Set<Map.Entry<String, Object>> entries = beanToMap.entrySet(); |
| | | for (Map.Entry<String, Object> entry : entries) { |
| | | String key = "request_params_"+entry.getKey().trim().toLowerCase(); |
| | | if (!columns.contains(key)) |
| | | responseColums.add(key); |
| | | } |
| | | responseColums.removeAll(columns); |
| | | if (!responseColums.isEmpty()) { |
| | | for (String colum : responseColums) { |
| | |
| | | statement.executeUpdate(sql); |
| | | statement.close(); |
| | | } |
| | | if (hisApiConfig == null) |
| | | insertData(hisApiConfig, connection, jsonObject); |
| | | else insertDataNew(connection, jsonObject,hisApiConfig,paramsJson); |
| | | insertDataNew(connection, jsonObject,hisApiConfig,paramsJson); |
| | | } else { |
| | | if (hisApiConfig == null) |
| | | insertData(hisApiConfig, connection, jsonObject); |
| | | else insertDataNew(connection, jsonObject,hisApiConfig,paramsJson); |
| | | insertDataNew(connection, jsonObject,hisApiConfig,paramsJson); |
| | | } |
| | | } |
| | | |
| | |
| | | String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); |
| | | valueBuilder.append("'").append(time).append("'").append(", "); |
| | | valueBuilder.append("'").append(paramsJson).append("'").append(", "); |
| | | Map<String, Object> beanToMap = BeanUtil.beanToMap(JSONUtil.parseObj(paramsJson)); |
| | | Set<Map.Entry<String, Object>> entries = beanToMap.entrySet(); |
| | | for (Map.Entry<String, Object> entry : entries) { |
| | | String key = "request_params_"+entry.getKey().trim().toLowerCase(); |
| | | insertSqlBuilder.append(key).append(", "); |
| | | valueBuilder.append("'").append(entry.getValue().toString()).append("', "); |
| | | } |
| | | insertSqlBuilder.delete(insertSqlBuilder.length() - 2, insertSqlBuilder.length()); |
| | | valueBuilder.delete(valueBuilder.length() - 2, valueBuilder.length()); |
| | | insertSqlBuilder.append(") values (").append(valueBuilder).append(")"); |