From c9ab52e29d8f399b90017dd3bec22106445f1491 Mon Sep 17 00:00:00 2001 From: zjh <1084500556@qq.com> Date: 星期二, 28 五月 2024 18:05:44 +0800 Subject: [PATCH] zjh 2024/05/28-1 --- ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiController.java | 168 ++++++++++++++++++++++++++++ ltkj-framework/src/main/java/com/ltkj/framework/config/SecurityConfig.java | 2 ltkj-admin/src/main/java/com/ltkj/web/wxUtils/HttpClientUtils.java | 78 +++++++++++- ltkj-admin/src/test/java/ImageTextExtractor.java | 8 ltkj-hosp/src/main/java/com/ltkj/hosp/hisDto/OutpinimpapplyDto.java | 40 ++++++ ltkj-hosp/src/main/java/com/ltkj/hosp/hisDto/OutpinregapplyDto.java | 23 +++ 6 files changed, 306 insertions(+), 13 deletions(-) diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiController.java new file mode 100644 index 0000000..c469ff3 --- /dev/null +++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiController.java @@ -0,0 +1,168 @@ +package com.ltkj.web.controller.his; + + +import com.ltkj.common.core.controller.BaseController; +import com.ltkj.common.core.domain.AjaxResult; +import com.ltkj.common.core.page.TableDataInfo; +import com.ltkj.common.utils.http.HttpUtils; +import com.ltkj.hosp.domain.DictSsdm; +import com.ltkj.hosp.domain.TjCustomer; +import com.ltkj.hosp.hisDto.OutpinimpapplyDto; +import com.ltkj.hosp.hisDto.OutpinregapplyDto; +import com.ltkj.hosp.service.ITjCustomerService; +import com.ltkj.web.wxUtils.HttpClientUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@Api(tags = "AAAAA-----HISAPI鐩稿叧鎺ュ彛鏂囨。") +@RestController +@RequestMapping("/api/His") +public class HisApiController extends BaseController { + @Autowired + private ITjCustomerService tjCustomerService; + + private static final String HIS_URL = "https://mock.mengxuegu.com/mock/664d3dbce45d2156fa209c80/example/api/His/HisRequest"; + + @PostMapping("/Outpincreateapply") + @ApiOperation(value = "鏂板/淇敼闂ㄨ瘖娉ㄥ唽淇℃伅") + public AjaxResult Outpincreateapply(@RequestBody TjCustomer customer) { + Map<String, Object> map = new HashMap<>(); + if (null != customer.getCusId()) { + map.put("pationid", customer.getCusId()); + } else { + map.put("pationid", null); + } + map.put("brxm", customer.getCusName()); + map.put("brxb", customer.getCusSex()); + map.put("csrq", customer.getCusBrithday()); + map.put("brnl", customer.getAge()); + map.put("brnldw", customer.getAgeUnit()); + map.put("addr", customer.getAddr()); + map.put("gzdw", null); + map.put("dwdz", null); + map.put("lxr", customer.getCusName()); + map.put("lxrdh", customer.getCusPhone()); + map.put("lxrgx", "鏈汉"); + map.put("sfzh", customer.getCusIdcard()); + map.put("jhrxm", null); + map.put("jhrsfzh", null); + map.put("mz", customer.getCusNational()); + map.put("zy", customer.getCareer()); + map.put("fbbm", null); + map.put("czy", customer.getCreateBy()); + map.put("jkkkh", customer.getIndexCard()); + map.put("mindex_id", customer.getIndexCard()); + String post = HttpClientUtils.sendPost(HIS_URL, map); + return AjaxResult.success(post); + } + + + @PostMapping("/Outpinconapply") + @ApiOperation(value = "闂ㄨ瘖鍖荤敓鎺ヨ瘖") + public AjaxResult Outpinconapply(@RequestParam @ApiParam(value = "灏辫瘖鍙�") String jzh, + @ApiParam(value = "鎺ヨ瘖鏃ユ湡") @RequestParam Date jzrq, + @ApiParam(value = "鎺ヨ瘖鍖诲笀") @RequestParam String jzysbm) { + Map<String, Object> map = new HashMap<>(); + map.put("jzh",jzh); + map.put("jzrq",jzrq); + map.put("jzysbm",jzysbm); + String post = HttpClientUtils.sendPost(HIS_URL, map); + return AjaxResult.success(post); + } + + + @PostMapping("/Outpinunconapply") + @ApiOperation(value = "闂ㄨ瘖鍖荤敓鍙栨秷鎺ヨ瘖") + public AjaxResult Outpinunconapply(@RequestParam @ApiParam(value = "灏辫瘖鍙�") String jzh, + @ApiParam(value = "鎺ヨ瘖鏃ユ湡") @RequestParam Date jzrq, + @ApiParam(value = "鎺ヨ瘖鍖诲笀") @RequestParam String jzysbm) { + Map<String, Object> map = new HashMap<>(); + map.put("jzh",jzh); + map.put("jzrq",jzrq); + map.put("jzysbm",jzysbm); + String post = HttpClientUtils.sendPost(HIS_URL, map); + return AjaxResult.success(post); + } + + @PostMapping("/Outpinimpapply") + @ApiOperation(value = "鏂板/淇敼闂ㄨ瘖璇婃柇") + public AjaxResult Outpinimpapply(@RequestBody OutpinimpapplyDto dto ) { + Map<String, Object> map = new HashMap<>(); + map.put("his_registration_id",dto.getHisRegistrationId()); + map.put("mzzdid",dto.getMzzdid()); + map.put("sqysbm",dto.getSqysbm()); + map.put("mzksbm",dto.getMzksbm()); + map.put("fbrq",dto.getFbrq()); + map.put("zdrq",dto.getZdrq()); + map.put("czybm",dto.getCzybm()); + map.put("czyksbm",dto.getCzyksbm()); + map.put("zs",dto.getZs()); + map.put("bs",dto.getBs()); + map.put("clyz",dto.getClyz()); + map.put("jws",dto.getJws()); + map.put("tgjc",dto.getTgjc()); + map.put("gms",dto.getGms()); + map.put("jbbm",dto.getJbbm()); + map.put("jbbm1",dto.getJbbm1()); + map.put("jbbm2",dto.getJbbm2()); + map.put("tw",dto.getTw()); + map.put("mb",dto.getMb()); + map.put("hx",dto.getHx()); + map.put("bp",dto.getBp()); + map.put("fzbz",dto.getFzbz()); + map.put("hzqx",dto.getHzqx()); + map.put("sfqc",dto.getSfqc()); + map.put("qchs",dto.getQchs()); + map.put("sfqj",dto.getSfqj()); + map.put("ckrq",dto.getCkrq()); + String post = HttpClientUtils.sendPost(HIS_URL, map); + return AjaxResult.success(post); + } + + + @PostMapping("/Outpinmesapply") + @ApiOperation(value = "闂ㄨ瘖棰勪氦鏀惰垂") + public AjaxResult Outpinmesapply(@RequestParam @ApiParam(value = "闂ㄨ瘖鎮h�� ID") String pationid, + @ApiParam(value = "鎿嶄綔鍛�") @RequestParam String czybm, + @ApiParam(value = "鏀粯绫诲瀷缂栫爜") @RequestParam String zflxbm, + @ApiParam(value = "棰勪氦閲戦") @RequestParam int yjje) { + Map<String, Object> map = new HashMap<>(); + map.put("pationid",pationid); + map.put("czybm",czybm); + map.put("zflxbm",zflxbm); + map.put("yjje",yjje); + String post = HttpClientUtils.sendPost(HIS_URL, map); + return AjaxResult.success(post); + } + + + @PostMapping("/Outpinregapply") + @ApiOperation(value = "鏂板/淇敼闂ㄨ瘖鎸傚彿鐢宠") + public AjaxResult Outpinregapply(@RequestBody OutpinregapplyDto dao) { + Map<String, Object> map = new HashMap<>(); + map.put("pationid",dao.getPationid()); + map.put("his_registration_id",dao.getHisRegistrationId()); + map.put("sqysbm",dao.getSqysbm()); + map.put("mzksbm",dao.getMzksbm()); + map.put("czybm",dao.getCzybm()); + map.put("sfjz",dao.getSfjz()); + map.put("ghzlbm",dao.getGhzlbm()); + map.put("ywckbm",dao.getYwckbm()); + map.put("sflstd",dao.getSflstd()); + map.put("ghrq",dao.getGhrq()); + String post = HttpClientUtils.sendPost(HIS_URL, map); + return AjaxResult.success(post); + } + + +} diff --git a/ltkj-admin/src/main/java/com/ltkj/web/wxUtils/HttpClientUtils.java b/ltkj-admin/src/main/java/com/ltkj/web/wxUtils/HttpClientUtils.java index 6b8b492..6412b31 100644 --- a/ltkj-admin/src/main/java/com/ltkj/web/wxUtils/HttpClientUtils.java +++ b/ltkj-admin/src/main/java/com/ltkj/web/wxUtils/HttpClientUtils.java @@ -21,8 +21,8 @@ import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.springframework.stereotype.Component; - import java.io.*; +import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; import java.util.List; @@ -31,6 +31,7 @@ /** * httpClient 宸ュ叿绫� + * * @create 2019-02-10 涓嬪崍 2:49 */ @Component @@ -46,20 +47,24 @@ /** * 闈欐�佸唴閮ㄧ被---浣滅敤锛氬崟渚嬩骇鐢熺被鐨勫疄渚� - * @author Administrator * + * @author Administrator */ private static class LazyHolder { private static final HttpClientUtils INSTANCE = new HttpClientUtils(); } - HttpClientUtils(){} - public static HttpClientUtils getInstance(){ + + HttpClientUtils() { + } + + public static HttpClientUtils getInstance() { return LazyHolder.INSTANCE; } /** * 鍙戦�� post璇锋眰 + * * @param httpUrl 鍦板潃 */ public String sendHttpPost(String httpUrl) { @@ -69,8 +74,9 @@ /** * 鍙戦�� post璇锋眰 + * * @param httpUrl 鍦板潃 - * @param params 鍙傛暟(鏍煎紡:key1=value1&key2=value2) + * @param params 鍙傛暟(鏍煎紡:key1=value1&key2=value2) */ public String sendHttpPost(String httpUrl, String params) { HttpPost httpPost = new HttpPost(httpUrl);// 鍒涘缓httpPost @@ -85,10 +91,59 @@ return sendHttpPost(httpPost); } + + public static String sendPost(String httpUrl, Map<String, Object> maps) { + + try { + // 1. 鍒涘缓 URL 瀵硅薄 + URL url = new URL(httpUrl); + // 2. 鍒涘缓 HttpURLConnection 瀵硅薄 + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + + // 3. 璁剧疆璇锋眰鏂规硶涓� POST + connection.setRequestMethod("POST"); + + // 4. 璁剧疆 Content-Type 澶撮儴瀛楁 + connection.setRequestProperty("Content-Type", "application/json"); + + // 5. 璁剧疆鍏朵粬璇锋眰澶撮儴瀛楁锛堝彲閫夛級 +// connection.setRequestProperty("Authorization", "Bearer token"); +// connection.setRequestProperty("User-Agent", "Mozilla/5.0"); + + // 6. 鍚戞湇鍔″櫒鍙戦�佹暟鎹� + String requestBody = maps.toString(); + byte[] postData = requestBody.getBytes("UTF-8"); + connection.setDoOutput(true); + try (OutputStream outputStream = connection.getOutputStream()) { + outputStream.write(postData); + } + + // 7. 鑾峰彇鍝嶅簲鐮� + int responseCode = connection.getResponseCode(); + + // 8. 鑾峰彇鍝嶅簲鏁版嵁 + try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) { + String line; + StringBuilder response = new StringBuilder(); + while ((line = reader.readLine()) != null) { + response.append(line); + } + System.out.println(response.toString()); + connection.disconnect(); + return response.toString(); + } + } catch (IOException e) { + e.printStackTrace(); + } + + return null; + } + /** * 鍙戦�� post璇锋眰 + * * @param httpUrl 鍦板潃 - * @param maps 鍙傛暟 + * @param maps 鍙傛暟 */ public String sendHttpPost(String httpUrl, Map<String, String> maps) { HttpPost httpPost = new HttpPost(httpUrl);// 鍒涘缓httpPost @@ -105,8 +160,10 @@ return sendHttpPost(httpPost); } + /** * 鍙戦�丳ost璇锋眰 + * * @param httpPost * @return */ @@ -123,12 +180,12 @@ long execStart = System.currentTimeMillis(); response = httpClient.execute(httpPost); long execEnd = System.currentTimeMillis(); - System.out.println("=================鎵цpost璇锋眰鑰楁椂锛�"+(execEnd-execStart)+"ms"); + System.out.println("=================鎵цpost璇锋眰鑰楁椂锛�" + (execEnd - execStart) + "ms"); long getStart = System.currentTimeMillis(); entity = response.getEntity(); responseContent = EntityUtils.toString(entity, "UTF-8"); long getEnd = System.currentTimeMillis(); - System.out.println("=================鑾峰彇鍝嶅簲缁撴灉鑰楁椂锛�"+(getEnd-getStart)+"ms"); + System.out.println("=================鑾峰彇鍝嶅簲缁撴灉鑰楁椂锛�" + (getEnd - getStart) + "ms"); } catch (Exception e) { e.printStackTrace(); } finally { @@ -149,6 +206,7 @@ /** * 鍙戦�� get璇锋眰 + * * @param httpUrl */ public String sendHttpGet(String httpUrl) { @@ -158,6 +216,7 @@ /** * 鍙戦�� get璇锋眰Https + * * @param httpUrl */ public String sendHttpsGet(String httpUrl) { @@ -167,6 +226,7 @@ /** * 鍙戦�丟et璇锋眰 + * * @param httpGet * @return */ @@ -206,6 +266,7 @@ /** * 鍙戦�丟et璇锋眰Https + * * @param httpGet * @return */ @@ -244,6 +305,7 @@ /** * 鍙戦�亁ml鏁版嵁 + * * @param url * @param xmlData * @return diff --git a/ltkj-admin/src/test/java/ImageTextExtractor.java b/ltkj-admin/src/test/java/ImageTextExtractor.java index b7724b9..91abc91 100644 --- a/ltkj-admin/src/test/java/ImageTextExtractor.java +++ b/ltkj-admin/src/test/java/ImageTextExtractor.java @@ -27,13 +27,13 @@ } public static void main(String[] args) throws IOException { - String imagePath = "C:\\Users\\w\\Pictures\\Saved Pictures\\a.png"; + String imagePath = "C:\\Users\\w\\Pictures\\Camera Roll\\a.png"; String extractedText = extractTextFromImage(imagePath); System.out.println(extractedText); System.out.println("============================================================"); - String imagePath1 = "C:\\Users\\w\\Pictures\\Saved Pictures\\b.png"; - String extractedText1 = extractTextFromImage(imagePath1); - System.out.println(extractedText1); +// String imagePath1 = "C:\\Users\\w\\Pictures\\Saved Pictures\\b.png"; +// String extractedText1 = extractTextFromImage(imagePath1); +// System.out.println(extractedText1); } } diff --git a/ltkj-framework/src/main/java/com/ltkj/framework/config/SecurityConfig.java b/ltkj-framework/src/main/java/com/ltkj/framework/config/SecurityConfig.java index 43788f2..ecdb727 100644 --- a/ltkj-framework/src/main/java/com/ltkj/framework/config/SecurityConfig.java +++ b/ltkj-framework/src/main/java/com/ltkj/framework/config/SecurityConfig.java @@ -108,7 +108,7 @@ // 杩囨护璇锋眰 .authorizeRequests() // 瀵逛簬鐧诲綍login 娉ㄥ唽register 楠岃瘉鐮乧aptchaImage 鍏佽鍖垮悕璁块棶 - .antMatchers("/login", "/register", "/captchaImage","/cus/**","/getCaptchaConfigKey","/report/jmreport/**","/sqlserver/getdata/**").permitAll() + .antMatchers("/login", "/register", "/captchaImage","/cus/**","/getCaptchaConfigKey","/report/jmreport/**","/sqlserver/getdata/**","/api/His/**").permitAll() .antMatchers("/common/uploadImgExe","/common/listExeVal").permitAll() // 闈欐�佽祫婧愶紝鍙尶鍚嶈闂� .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/hisDto/OutpinimpapplyDto.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/hisDto/OutpinimpapplyDto.java new file mode 100644 index 0000000..1580bef --- /dev/null +++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/hisDto/OutpinimpapplyDto.java @@ -0,0 +1,40 @@ +package com.ltkj.hosp.hisDto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +@Data +public class OutpinimpapplyDto { + private String hisRegistrationId; + private Integer mzzdid; + private String sqysbm; + private String mzksbm; + @JsonFormat(pattern = "yyyy-mm-dd hh:mm:ss") + private Date fbrq; + @JsonFormat(pattern = "yyyy-mm-dd hh:mm:ss") + private Date zdrq; + private String czybm; + private String czyksbm; + private String zs; + private String bs; + private String clyz; + private String jws; + private String tgjc; + private String gms; + private String jbbm; + private String jbbm1; + private String jbbm2; + private Integer tw; + private Integer mb; + private String hx; + private String bp; + private String fzbz; + private String hzqx; + private String sfqc; + private String qchs; + private String sfqj; + @JsonFormat(pattern = "yyyy-mm-dd hh:mm:ss") + private Date ckrq; +} diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/hisDto/OutpinregapplyDto.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/hisDto/OutpinregapplyDto.java new file mode 100644 index 0000000..47f95a2 --- /dev/null +++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/hisDto/OutpinregapplyDto.java @@ -0,0 +1,23 @@ +package com.ltkj.hosp.hisDto; + + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +@Data +public class OutpinregapplyDto { + + private String pationid; + private String hisRegistrationId; + private String sqysbm; + private String mzksbm; + private String czybm; + private String sfjz; + private String ghzlbm; + private String ywckbm; + private String sflstd; + @JsonFormat(pattern = "yyyy-mm-dd") + private Date ghrq; +} -- Gitblit v1.8.0