From d7fd24cda7b8b5124fca826fa4301cdb3acdb6b5 Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期二, 19 八月 2025 17:46:52 +0800 Subject: [PATCH] 代码提交 --- smartor/src/main/java/com/smartor/config/RobotPhoneUtils.java | 6 smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java | 525 +++++++++++++++++++++++++ smartor/src/main/java/com/smartor/service/IServiceSLTDHealthcareRecordService.java | 56 ++ ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml | 2 ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml | 22 + smartor/src/main/java/com/smartor/domain/ServiceSLTDInhospResDTO.java | 22 ruoyi-admin/src/main/resources/application.yml | 3 mysql_fix_commands.sql | 0 /dev/null | 373 ----------------- smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java | 2 smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml | 126 +++--- smartor/src/test/java/com/smartor/service/ServiceSLTDHealthcareRecordServiceTest.java | 0 smartor/src/main/java/com/smartor/domain/ServiceSLTDInhospReqVO.java | 14 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceExternalController.java | 5 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSLTDHealthcareRecordController.java | 73 +++ ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java | 14 ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java | 2 ruoyi-admin/src/main/resources/application-ls.yml | 2 smartor/src/main/resources/mapper/smartor/SysUserMapper.xml | 4 19 files changed, 781 insertions(+), 470 deletions(-) diff --git a/mysql_fix_commands.sql b/mysql_fix_commands.sql new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/mysql_fix_commands.sql diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceExternalController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceExternalController.java index b696c11..e60751b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceExternalController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceExternalController.java @@ -351,7 +351,6 @@ - private Map<String, Object> returnParam(Boolean b, Map dataMap) { Map yeWuXX = (Map) dataMap.get("YeWuXX"); String XiaoXiID = (String) yeWuXX.get("XiaoXiID"); @@ -372,4 +371,8 @@ return map; } + + + + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSLTDExternalController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSLTDExternalController.java deleted file mode 100644 index 0b3864b..0000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSLTDExternalController.java +++ /dev/null @@ -1,373 +0,0 @@ -package com.ruoyi.web.controller.smartor; - -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.smartor.domain.ServiceQueryFocus; -import com.smartor.domain.ServiceQueryInfo; -import com.smartor.domain.ServiceTaskInfo; -import com.smartor.service.IServiceExternalService; -import com.smartor.service.ISvyTaskSingleService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -/** - * 鐪佺珛鍚屽痉鏁版嵁閲囬泦璋冪敤鎺ュ彛Controller - * - * @author smartor - * @date 2024-12-10 - */ -@Slf4j -@Api(description = "鐪佺珛鍚屽痉鏁版嵁閲囬泦璋冪敤鎺ュ彛") -@RestController -@RequestMapping("/smartor/serviceSLTDExternal") -public class ServiceSLTDExternalController extends BaseController { - @Autowired - private IServiceExternalService serviceExternalService; - @Autowired - private ISvyTaskSingleService svyTaskSingleService; - - /** - * 閫氱敤鎺ュ彛 - */ - @ApiOperation("閫氱敤鎺ュ彛") - @PostMapping("/generalInterface") - public Map<String, Object> generalInterface(@RequestBody Map dataMap) { - Boolean aBoolean = true; - - try { - aBoolean = serviceExternalService.generalInterface(dataMap); - } catch (Exception e) { - e.printStackTrace(); - log.error("serviceExternal---generalInterface鍑哄紓甯镐簡锛歿}", e.getMessage()); - aBoolean = false; - } - return returnParam(aBoolean, dataMap); - } - - /** - * 鏂板浣撴浠诲姟杩涘瓙浠诲姟 - */ - @ApiOperation("鏂板浣撴浠诲姟杩涘瓙浠诲姟") - @PostMapping("/generalInterfaceAddTask") - public AjaxResult generalInterfaceAddTask(@RequestBody ServiceTaskInfo serviceTaskInfo) { - log.info("------serviceTaskInfo鐨勫�间负锛歿}", serviceTaskInfo); - Integer res = 0; - try { - res = svyTaskSingleService.insertTaskInfo(serviceTaskInfo); - } catch (Exception e) { - e.printStackTrace(); - log.error("serviceExternal---generalInterfaceAddTask鍑哄紓甯镐簡锛歿}", e.getMessage()); - } - return toAjax(res); - } - - - /** - * 360鎮h�呬俊鎭幏鍙� - */ - @ApiOperation("360鎮h�呬俊鎭幏鍙�") - @PostMapping("/query360PatInfo") - public Map query360PatInfo(@RequestBody ServiceQueryInfo serviceQueryInfo) { - log.info("------serviceQueryInfo鐨勫叆鍙備负锛歿}", serviceQueryInfo); - Map map = null; - try { - map = svyTaskSingleService.query360PatInfo(serviceQueryInfo); - } catch (Exception e) { - e.printStackTrace(); - log.error("query360PatInfo---query360PatInfo锛歿}", e.getMessage()); - } - return map; - } - - /** - * 鍖诲槺鐭ヨ瘑鎻愮ず - */ - @ApiOperation("鍖诲槺鐭ヨ瘑鎻愮ず") - @PostMapping("/focus") - public Map focus(@RequestBody ServiceQueryFocus serviceQueryFocus) { - Map map = null; - try { - map = svyTaskSingleService.focus(serviceQueryFocus); - } catch (Exception e) { - e.printStackTrace(); - log.error("query360PatInfo---query360PatInfo锛歿}", e.getMessage()); - } - return map; - } - - - /** - * 鏂板绉戝淇℃伅 - */ - @ApiOperation("鏂板绉戝淇℃伅") - @PostMapping("/addDeptInfo") - public Map<String, Object> addDeptInfo(@RequestBody Map dataMap) { - Boolean aBoolean = true; - try { - aBoolean = serviceExternalService.addDeptInfo(dataMap); - } catch (Exception e) { - e.printStackTrace(); - log.error("serviceExternal---addDeptInfo鍑哄紓甯镐簡锛歿}", e.getMessage()); - aBoolean = false; - } - return returnParam(aBoolean, dataMap); - } - - /** - * 鏂板绉戝淇℃伅 - */ - @ApiOperation("鏂板鐢ㄦ埛淇℃伅") - @PostMapping("/addUserInfo") - public Map<String, Object> addUserInfo(@RequestBody Map dataMap) { - Boolean aBoolean = true; - try { - aBoolean = serviceExternalService.addUserInfo(dataMap); - } catch (Exception e) { - e.printStackTrace(); - log.error("serviceExternal---addUserInfo鍑哄紓甯镐簡锛歿}", e.getMessage()); - aBoolean = false; - } - return returnParam(aBoolean, dataMap); - - } - - - /** - * 鏂板鏈烘瀯淇℃伅 - */ - @ApiOperation("鏂板鏈烘瀯淇℃伅") - @PostMapping("/addOrganInfo") - public Map<String, Object> addOrganInfo(@RequestBody Map dataMap) { - Boolean aBoolean = true; - try { - aBoolean = serviceExternalService.addOrganInfo(dataMap); - } catch (Exception e) { - e.printStackTrace(); - log.error("serviceExternal---addOrganInfo鍑哄紓甯镐簡锛歿}", e.getMessage()); - aBoolean = false; - } - return returnParam(aBoolean, dataMap); - } - - /** - * 鏂板鍏ラ櫌淇℃伅 - */ - @ApiOperation("鏂板鍏ラ櫌淇℃伅") - @PostMapping("/addInHospInfo") - public Map<String, Object> addInHospInfo(@RequestBody Map dataMap) { - Boolean aBoolean = true; - try { - aBoolean = serviceExternalService.addInHospInfo(dataMap); - } catch (Exception e) { - e.printStackTrace(); - log.error("serviceExternal---addInHospInfo锛歿}", e.getMessage()); - aBoolean = false; - } - return returnParam(aBoolean, dataMap); - } - - /** - * 鍙栨秷鍏ラ櫌鐧昏淇℃伅 - */ - @ApiOperation("鍙栨秷鍏ラ櫌鐧昏淇℃伅") - @PostMapping("/cancelInHospInfo") - public Map<String, Object> cancelInHospInfo(@RequestBody Map dataMap) { - Boolean aBoolean = true; - try { - aBoolean = serviceExternalService.cancelInHospInfo(dataMap); - } catch (Exception e) { - e.printStackTrace(); - log.error("serviceExternal---cancelInHospInfo锛歿}", e.getMessage()); - aBoolean = false; - } - return returnParam(aBoolean, dataMap); - } - - /** - * 鏂板鍑洪櫌鐧昏淇℃伅 - */ - @ApiOperation("鏂板鍑洪櫌鐧昏淇℃伅") - @PostMapping("/addOutHospInfo") - public Map<String, Object> addOutHospInfo(@RequestBody Map dataMap) { - Boolean aBoolean = true; - try { - aBoolean = serviceExternalService.addOutHospInfo(dataMap); - } catch (Exception e) { - e.printStackTrace(); - log.error("serviceExternal---addOutHospInfo锛歿}", e.getMessage()); - aBoolean = false; - } - return returnParam(aBoolean, dataMap); - } - - /** - * - */ - @ApiOperation("鏂板鍑洪櫌璁板綍鐧昏淇℃伅") - @PostMapping("/addOutHospJLInfo") - public Map<String, Object> addOutHospJLInfo(@RequestBody Map dataMap) { - Boolean aBoolean = true; - try { - aBoolean = serviceExternalService.addOutHospJLInfo(dataMap); - } catch (Exception e) { - e.printStackTrace(); - log.error("serviceExternal---addOutHospJLInfo锛歿}", e.getMessage()); - aBoolean = false; - } - return returnParam(aBoolean, dataMap); - } - - /** - * 鍙栨秷鍑洪櫌鐧昏淇℃伅 - */ - @ApiOperation("鍙栨秷鍑洪櫌鐧昏淇℃伅") - @PostMapping("/cancelOutHospInfo") - public Map<String, Object> cancelOutHospInfo(@RequestBody Map dataMap) { - Boolean aBoolean = true; - try { - aBoolean = serviceExternalService.cancelOutHospInfo(dataMap); - } catch (Exception e) { - e.printStackTrace(); - log.error("serviceExternal---cancelOutHospInfo锛歿}", e.getMessage()); - aBoolean = false; - } - return returnParam(aBoolean, dataMap); - } - - /** - * 鏂板鍑洪櫌鐧昏淇℃伅 - */ - @ApiOperation("鏂板棰勫嚭闄㈢櫥璁颁俊鎭�") - @PostMapping("/addPreOutHospInfo") - public Map<String, Object> addPreOutHospInfo(@RequestBody Map dataMap) { - Boolean aBoolean = true; - try { - aBoolean = serviceExternalService.addPreOutHospInfo(dataMap); - } catch (Exception e) { - e.printStackTrace(); - log.error("serviceExternal---addPreOutHospInfo锛歿}", e.getMessage()); - aBoolean = false; - } - return returnParam(aBoolean, dataMap); - } - - /** - * 鏂板瀹屾垚鎺ヨ瘖淇℃伅 - */ - @ApiOperation("鏂板瀹屾垚鎺ヨ瘖淇℃伅") - @PostMapping("/addFinshJZInfo") - public Map<String, Object> addFinshJZInfo(@RequestBody Map dataMap) { - Boolean aBoolean = true; - try { - aBoolean = serviceExternalService.addFinshJZInfo(dataMap); - } catch (Exception e) { - e.printStackTrace(); - log.error("serviceExternal---addFinshJZInfo锛歿}", e.getMessage()); - aBoolean = false; - } - return returnParam(aBoolean, dataMap); - } - - /** - * 鏂板瀹屾垚鎺ヨ瘖淇℃伅 - */ - @ApiOperation("鏂板鐤剧梾淇℃伅") - @PostMapping("/addDiseaseInfo") - public Map<String, Object> addDiseaseInfo(@RequestBody Map dataMap) { - Boolean aBoolean = true; - try { - aBoolean = serviceExternalService.addDiseaseInfo(dataMap); - } catch (Exception e) { - e.printStackTrace(); - log.error("serviceExternal---addDiseaseInfo锛歿}", e.getMessage()); - aBoolean = false; - } - return returnParam(aBoolean, dataMap); - } - - /** - * 鏂板鐥呭尯淇℃伅 - */ - @ApiOperation("鏂板鐥呭尯淇℃伅") - @PostMapping("/addWardAreaInfo") - public Map<String, Object> addWardAreaInfo(@RequestBody Map dataMap) { - Boolean aBoolean = true; - try { - aBoolean = serviceExternalService.addWardAreaInfo(dataMap); - } catch (Exception e) { - e.printStackTrace(); - log.error("serviceExternal---addWardAreaInfo锛歿}", e.getMessage()); - aBoolean = false; - } - return returnParam(aBoolean, dataMap); - } - - - /** - * 妫�鏌ョ敵璇锋湇鍔�/妫�鏌ヤ慨鏀规湇鍔� - */ - @ApiOperation("妫�鏌ョ敵璇锋湇鍔�") - @PostMapping("/addInspectService") - public Map<String, Object> addInspectService(@RequestBody Map dataMap) { - Boolean aBoolean = true; - try { - aBoolean = serviceExternalService.addInspectService(dataMap); - } catch (Exception e) { - e.printStackTrace(); - log.error("serviceExternal---addInspectService锛歿}", e.getMessage()); - aBoolean = false; - } - return returnParam(aBoolean, dataMap); - } - - /** - * 妫�鏌ユ姤鍛婃湇鍔� - */ - @ApiOperation("妫�鏌ユ姤鍛婃湇鍔�") - @PostMapping("/addInspectBGService") - public Map<String, Object> addInspectBGService(@RequestBody Map dataMap) { - Boolean aBoolean = true; - try { - aBoolean = serviceExternalService.addInspectBGService(dataMap); - } catch (Exception e) { - e.printStackTrace(); - log.error("serviceExternal---addInspectBGService锛歿}", e.getMessage()); - aBoolean = false; - } - return returnParam(aBoolean, dataMap); - } - - - - - private Map<String, Object> returnParam(Boolean b, Map dataMap) { - Map yeWuXX = (Map) dataMap.get("YeWuXX"); - String XiaoXiID = (String) yeWuXX.get("XiaoXiID"); - - Map<String, Object> map = new HashMap<>(); - if (b) { - map.put("Code", "0"); - map.put("Message", "success"); - } else { - map.put("Code", "500"); - map.put("Message", "error"); - } - - Map<String, Object> map2 = new HashMap<>(); - map2.put("XiaoXiID", XiaoXiID); - map2.put("ChuangJianSJ", new Date()); - map.put("Data", map2); - return map; - } - -} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSLTDHealthcareRecordController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSLTDHealthcareRecordController.java new file mode 100644 index 0000000..0c7d3f1 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSLTDHealthcareRecordController.java @@ -0,0 +1,73 @@ +package com.ruoyi.web.controller.smartor; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.smartor.domain.ServiceSLTDInhospReqVO; +import com.smartor.domain.ServiceSLTDInhospResDTO; +import com.smartor.service.IServiceSLTDHealthcareRecordService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 鐪佺珛鍚屽痉鍋ュ悍璁板綍鏌ヨController + * + * @author smartor + * @date 2025-08-14 + */ +@Slf4j +@Api(description = "鐪佺珛鍚屽痉鍋ュ悍璁板綍鏌ヨ鎺ュ彛") +@RestController +@RequestMapping("/smartor/sltdHealthcareRecord") +public class ServiceSLTDHealthcareRecordController extends BaseController { + + @Autowired + private IServiceSLTDHealthcareRecordService serviceSLTDHealthcareRecordService; + + /** + * 鏌ヨ鍦ㄩ櫌鎮h�呭仴搴疯褰曞垪琛� + */ + @ApiOperation("鏌ヨ鍦ㄩ櫌鎮h�呭仴搴疯褰曞垪琛�") + @PostMapping("/queryHealthcareRecordList") + public AjaxResult queryHealthcareRecordList(@RequestBody ServiceSLTDInhospReqVO reqVO) { + try { + log.info("銆恞ueryHealthcareRecordList銆戞帴鏀跺埌鏌ヨ璇锋眰锛屽弬鏁帮細{}", reqVO); + + List<ServiceSLTDInhospResDTO> resultList = serviceSLTDHealthcareRecordService.queryHealthcareRecordList(reqVO); + + log.info("銆恞ueryHealthcareRecordList銆戞煡璇㈡垚鍔燂紝杩斿洖{}鏉¤褰�", resultList.size()); + return AjaxResult.success(resultList); + + } catch (Exception e) { + log.error("銆恞ueryHealthcareRecordList銆戞煡璇㈠紓甯革紝璇锋眰鍙傛暟锛歿}", reqVO, e); + return AjaxResult.error("鏌ヨ鍋ュ悍璁板綍澶辫触锛�" + e.getMessage()); + } + } + + /** + * 閲囬泦鍖婚櫌鐢ㄦ埛淇℃伅 + */ + @ApiOperation("閲囬泦鍖婚櫌鐢ㄦ埛淇℃伅") + @PostMapping("/queryHospUserInfoList") + public AjaxResult queryHospUserInfoList(@RequestBody ServiceSLTDInhospReqVO reqVO) { + try { + log.info("銆恞ueryHealthcareRecordList銆戞帴鏀跺埌鏌ヨ璇锋眰锛屽弬鏁帮細{}", reqVO); + + Boolean b = serviceSLTDHealthcareRecordService.queryHospUserInfoList(reqVO); + + log.info("銆恞ueryHospUserInfoList銆戞煡璇㈡垚鍔燂紝鏄惁鎴愬姛锛歿}", b); + return AjaxResult.success(b); + + } catch (Exception e) { + log.error("銆恞ueryHospUserInfoList銆戞煡璇㈠紓甯革紝璇锋眰鍙傛暟锛歿}", reqVO, e); + return AjaxResult.error("鏌ヨ鍋ュ悍璁板綍澶辫触锛�" + e.getMessage()); + } + } +} diff --git a/ruoyi-admin/src/main/resources/application-ls.yml b/ruoyi-admin/src/main/resources/application-ls.yml index ab23ded..df59ee3 100644 --- a/ruoyi-admin/src/main/resources/application-ls.yml +++ b/ruoyi-admin/src/main/resources/application-ls.yml @@ -177,7 +177,7 @@ req_path: 8093 #localIP: https://wx.lihusmart.com #涓芥按澶栭摼璇锋眰IP鍜岀鍙e彿 -localIP: http://221.12.19.26 +localIP: https://221.12.19.26 #鑾峰彇鎮h�呬俊鎭疷RL(鍗庡崜鎻愪緵) hosp_info_url: http://esb-core-rest.wowjoy.cn/esb/exchange diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 42f8831..0eef77e 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -149,3 +149,6 @@ #涓嶉渶瑕佽繘琛岄暱鏈熶换鍔$殑鏈烘瀯 noLongTask: 47231022633110211A2101, + +#鐪佺珛鍚屽痉鍙栨暟鎹叕鍏辨帴鍙� +sltd_pub_path: "http://open-tdyy.cfuture.shop/kapi/gw-api/" diff --git a/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml b/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml index 1e3c73f..aa07c57 100644 --- a/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml +++ b/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml @@ -12,7 +12,7 @@ <!-- 閰嶇疆榛樿鐨勬墽琛屽櫒.SIMPLE灏辨槸鏅�氭墽琛屽櫒;REUSE鎵ц鍣ㄤ細閲嶇敤棰勫鐞嗚鍙�(prepared statements);BATCH鎵ц鍣ㄥ皢閲嶇敤璇彞骞舵墽琛屾壒閲忔洿鏂� --> <setting name="defaultExecutorType" value="SIMPLE" /> <!-- 鎸囧畾 MyBatis 鎵�鐢ㄦ棩蹇楃殑鍏蜂綋瀹炵幇 --> - <setting name="logImpl" value="STDOUT_LOGGING" /> +<!-- <setting name="logImpl" value="STDOUT_LOGGING" />--> <!-- 浣跨敤椹煎嘲鍛藉悕娉曡浆鎹㈠瓧娈� --> <!-- <setting name="mapUnderscoreToCamelCase" value="true"/> --> </settings> diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java index f868860..769e468 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java @@ -84,6 +84,20 @@ private String title; /** + * 閮ㄩ棬缂栫爜 + */ + @ApiModelProperty(value = "閮ㄩ棬缂栫爜") + @Excel(name = "閮ㄩ棬缂栫爜") + private String deptCode; + + /** + * 閮ㄩ棬鍚嶇О + */ + @ApiModelProperty(value = "閮ㄩ棬鍚嶇О") + @Excel(name = "閮ㄩ棬鍚嶇О") + private String deptName; + + /** * 鐢ㄦ埛閭 */ @ApiModelProperty(value = "鐢ㄦ埛閭") diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index e7fb845..a6a27d1 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -108,7 +108,7 @@ // 杩囨护璇锋眰 .authorizeRequests() // 瀵逛簬鐧诲綍login 娉ㄥ唽register 楠岃瘉鐮乧aptchaImage 鍏佽鍖垮悕璁块棶 - .antMatchers("/login", "/register", "/captchaImage", "/qrcode/generateStaticHtml", "/qrcode/getQRcode", "/qrcode/getFormDate", "/chat", "/system/file/admin/uploadFile", "/smartor/dingtalk/sendNotification", "/patient/read/patientInfo", "/socket", "/API_ESB_Service", "/API_ESB_Service/Run", "/magic/web/**", "/smartor/serviceSubtask/phoneCallBack", "/smartor/serviceSubtask/taskPull", "/smartor/serviceSubtask/phoneCallBackYQ", "/smartor/robot/callstatus", "/smartor/robot/aidialog", "/smartor/robot/cdrinfo", "/getToken", "/smartor/subtaskAnswer/getQuestionCache", "/smartor/subtaskAnswer/saveQuestionCache", "/smartor/servicetask/getScriptInfoByCondition", "/smartor/subtaskAnswer/saveQuestionAnswer", "/smartor/import/download", "/smartor/serviceSubtask/recordAccept", "/smartor/outPath/getInfoByParam", "/smartor/serviceExternal/addDeptInfo", "/smartor/serviceExternal/**", "/sso/**").permitAll() + .antMatchers("/login", "/register", "/captchaImage", "/qrcode/generateStaticHtml", "/qrcode/getQRcode", "/qrcode/getFormDate", "/chat", "/system/file/admin/uploadFile", "/smartor/dingtalk/sendNotification", "/patient/read/patientInfo", "/socket", "/API_ESB_Service", "/API_ESB_Service/Run", "/magic/web/**", "/smartor/serviceSubtask/phoneCallBack", "/smartor/serviceSubtask/taskPull", "/smartor/serviceSubtask/phoneCallBackYQ", "/smartor/robot/callstatus", "/smartor/robot/aidialog", "/smartor/robot/cdrinfo", "/getToken", "/smartor/subtaskAnswer/getQuestionCache", "/smartor/subtaskAnswer/saveQuestionCache", "/smartor/servicetask/getScriptInfoByCondition", "/smartor/subtaskAnswer/saveQuestionAnswer", "/smartor/import/download", "/smartor/serviceSubtask/recordAccept", "/smartor/outPath/getInfoByParam", "/smartor/serviceExternal/addDeptInfo", "/smartor/serviceExternal/**", "/sso/**","/smartor/sltdHealthcareRecord/**").permitAll() // 闈欐�佽祫婧愶紝鍙尶鍚嶈闂� .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll().antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() // 闄や笂闈㈠鐨勬墍鏈夎姹傚叏閮ㄩ渶瑕侀壌鏉冭璇� diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index 867caed..464b361 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -25,6 +25,8 @@ <result property="idCard" column="id_card"/> <result property="createTime" column="create_time"/> <result property="updateBy" column="update_by"/> + <result property="deptCode" column="dept_code"/> + <result property="deptName" column="dept_name"/> <result property="title" column="title"/> <result property="birthday" column="birthday"/> <result property="jobPhone" column="job_phone"/> @@ -68,6 +70,8 @@ u.user_name, u.user_type, u.nick_name, + u.dept_code, + u.dept_name, u.title, u.his_user_id, u.job_phone, @@ -110,6 +114,8 @@ u.nick_name, u.user_name, u.email,u.id_card, u.avatar, + u.dept_name, + u.dept_code, u.birthday, u.job_phone, u.phonenumber, u.sex, u.status, @@ -141,6 +147,12 @@ <if test="birthday != null and birthday != ''"> AND u.birthday = #{birthday} </if> + <if test="deptName != null and deptName != ''"> + AND u.dept_name = #{deptName} + </if> + <if test="deptCode != null and deptCode != ''"> + AND u.dept_code = #{deptCode} + </if> <if test="hisUserId != null and hisUserId != ''"> AND u.his_user_id = #{hisUserId} </if> @@ -167,6 +179,8 @@ u.user_type, u.nick_name, u.email, + u.dept_code, + u.dept_name, u.birthday, u.job_phone, u.phonenumber, u.status,u.id_card, @@ -199,6 +213,8 @@ u.email, u.his_user_id, u.title, + u.dept_code, + u.dept_name, u.job_phone, u.birthday, u.phonenumber, u.status,u.id_card, @@ -293,6 +309,8 @@ <if test="birthday != null ">birthday,</if> <if test="hisUserId != null and hisUserId != ''">his_user_id,</if> <if test="orgid != null and orgid != ''">orgid,</if> + <if test="deptCode != null and deptCode != ''">dept_code,</if> + <if test="deptName != null and deptName != ''">dept_name,</if> create_time )values( <if test="userId != null and userId != ''">#{userId},</if> @@ -317,6 +335,8 @@ <if test="birthday != null and birthday != ''">#{birthday},</if> <if test="hisUserId != null and hisUserId != ''">#{hisUserId},</if> <if test="orgid != null and orgid != ''">#{orgid},</if> + <if test="deptCode != null and deptCode != ''">#{deptCode},</if> + <if test="deptName != null and deptName != ''">#{deptName},</if> sysdate() ) </insert> @@ -351,6 +371,8 @@ <if test="hisUserId != null and hisUserId != ''"> his_user_id = #{hisUserId}, </if> + <if test="deptCode != null and deptCode != ''">dept_code=#{deptCode},</if> + <if test="deptName != null and deptName != ''">dept_name=#{deptName},</if> update_time = sysdate() </set> where user_id = #{userId} diff --git a/smartor/src/main/java/com/smartor/config/RobotPhoneUtils.java b/smartor/src/main/java/com/smartor/config/RobotPhoneUtils.java index f21ef80..73b11f8 100644 --- a/smartor/src/main/java/com/smartor/config/RobotPhoneUtils.java +++ b/smartor/src/main/java/com/smartor/config/RobotPhoneUtils.java @@ -4,23 +4,17 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.ruoyi.common.utils.HttpUtil; -import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.http.HttpEntity; import com.ruoyi.common.utils.sign.Md5Utils; -import com.smartor.domain.robot.RobotData; -import com.smartor.domain.robot.RobotDataConfig; import com.smartor.domain.robot.RobotIdlenumVO; import com.smartor.domain.robot.RobotScritpTemplateVO; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; -import org.springframework.stereotype.Component; -import javax.mail.Multipart; import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; -import java.util.UUID; @Configuration public class RobotPhoneUtils { diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSLTDInhospReqVO.java b/smartor/src/main/java/com/smartor/domain/ServiceSLTDInhospReqVO.java index ddfbcb8..b786b49 100644 --- a/smartor/src/main/java/com/smartor/domain/ServiceSLTDInhospReqVO.java +++ b/smartor/src/main/java/com/smartor/domain/ServiceSLTDInhospReqVO.java @@ -13,14 +13,14 @@ private String orgId; @ApiModelProperty(value = "闄㈠尯ID") - private Long campusId; + private Long campusIds; @ApiModelProperty(value = "鎮h�呭鍚� 蹇呭~涓�涓�") - private String patientNamex0; + private String patientName; @ApiModelProperty(value = "韬唤璇佸彿 蹇呭~涓�涓�") - private String idCardNox0; + private String idCardNo; @ApiModelProperty(value = "鐥呭尯id 蹇呭~涓�涓�") private Long areaId; @@ -35,7 +35,7 @@ private String healthcareRecordNo; @ApiModelProperty(value = "璇婄枟璁板綍鍙烽泦鍚�") - private List<String> healthcareRecordNoListx0; + private List<String> healthcareRecordNoList; @ApiModelProperty(value = "鐥呭巻鍙� 蹇呭~涓�涓�") private String medicalRecordNo; @@ -53,13 +53,13 @@ private String startHeadTime; @ApiModelProperty(value = "鍏ラ櫌鏃堕棿-缁撴潫鏃堕棿 yyyy-MM-dd") - private String startTailTimex0; + private String startTailTime; @ApiModelProperty(value = "鍑洪櫌鏃堕棿-寮�濮嬫椂闂� yyyy-MM-dd") - private String preOutHospitalHeadDatex0; + private String preOutHospitalHeadDate; @ApiModelProperty(value = "鍑洪櫌鏃堕棿-缁撴潫鏃堕棿 yyyy-MM-dd") - private String preOutHospitalTailDatex0; + private String preOutHospitalTailDate; @ApiModelProperty(value = "灏辫瘖鏃堕棿-寮�濮嬫椂闂� : 闂ㄨ瘖璇婄枟璁板綍涓哄彿婧愭椂闂� 浣忛櫌璇婄枟璁板綍涓哄叆闄㈢櫥璁版椂闂� yyyy-MM-dd") private String encounterTimeStart; diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSLTDInhospResDTO.java b/smartor/src/main/java/com/smartor/domain/ServiceSLTDInhospResDTO.java index f7ece7c..c8cf65d 100644 --- a/smartor/src/main/java/com/smartor/domain/ServiceSLTDInhospResDTO.java +++ b/smartor/src/main/java/com/smartor/domain/ServiceSLTDInhospResDTO.java @@ -97,13 +97,13 @@ private String encounterTime; @ApiModelProperty(value = "鍏ラ櫌鏃堕棿") - private String startTimex0; + private String startTime; @ApiModelProperty(value = "鍑洪櫌鏃堕棿") - private String preOutHospitalDatex0; + private String preOutHospitalDate; @ApiModelProperty(value = "缁撶畻鏃堕棿") - private String outHospitalSettleDatex0; + private String outHospitalSettleDate; @ApiModelProperty(value = "璇婃柇缂栫爜: 鏈灏辫瘖鎮h�呮墍鏈夎瘖鏂搴旂殑icd缂栫爜锛岄�氳繃鈥溿�佲�濆垎闅�") private String diagnosisCode; @@ -132,8 +132,8 @@ @ApiModelProperty(value = "璇婄枟鍛ㄦ湡ID") private Long healthcarePeriodId; - @ApiModelProperty(value = "鏈�鏂颁竴娆″叆闄㈡椂闂� 涓庡垱寤烘椂闂翠竴鑷磝0") - private String lastEncounterTimex0; + @ApiModelProperty(value = "鏈�鏂颁竴娆″叆闄㈡椂闂� 涓庡垱寤烘椂闂翠竴鑷�") + private String lastEncounterTime; @ApiModelProperty(value = "涓荤鎶ゅ+ID") private Long chiefNurseId; @@ -204,18 +204,6 @@ @ApiModelProperty(value = "璐圭敤閲戦") private Double billAmount; - - @ApiModelProperty(value = "鍏ラ櫌鏃堕棿") - private String startTime; - - @ApiModelProperty(value = "鏈�杩戜竴娆″氨璇婃椂闂�") - private String lastEncounterTime; - - @ApiModelProperty(value = "棰勫嚭闄㈡椂闂�") - private String preOutHospitalDate; - - @ApiModelProperty(value = "鍑洪櫌缁撶畻鏃堕棿") - private String outHospitalSettleDate; @ApiModelProperty(value = "鐥呭巻鏂囦欢鐘舵��") private Integer medicalRecordFileStatus; diff --git a/smartor/src/main/java/com/smartor/service/IServiceSLTDHealthcareRecordService.java b/smartor/src/main/java/com/smartor/service/IServiceSLTDHealthcareRecordService.java new file mode 100644 index 0000000..f8aafc2 --- /dev/null +++ b/smartor/src/main/java/com/smartor/service/IServiceSLTDHealthcareRecordService.java @@ -0,0 +1,56 @@ +package com.smartor.service; + +import com.smartor.domain.ServiceSLTDInhospReqVO; +import com.smartor.domain.ServiceSLTDInhospResDTO; + +import java.util.List; + +/** + * 鐪佺珛鍚屽痉鍋ュ悍璁板綍鏌ヨService鎺ュ彛 + * + * @author smartor + * @date 2025-08-14 + */ +public interface IServiceSLTDHealthcareRecordService { + + /** + * 閲囬泦鍦ㄩ櫌鎮h�呭嚭鍏ラ櫌銆侀棬鎬ヨ瘖淇℃伅 + * + * @param reqVO 鏌ヨ璇锋眰鍙傛暟 + * @return 鍋ュ悍璁板綍鍒楄〃 + * 鍙傝�� + * { + * "orgId": 20001001, + * "campusIds": 30001002, + * "startHeadTime":"2025-08-14", + * "startTailTime":"2025-08-14", + * "healthcareRecordTypeList":["FH0108.01"], + * "subjectCode": null, + * "healthcareRecordNo":null, + * "orgSubjectCode": null, + * "deptDimensions": null, + * "serviceScopes": null, + * "inpatientArea": null, + * "status": null + * } + */ + List<ServiceSLTDInhospResDTO> queryHealthcareRecordList(ServiceSLTDInhospReqVO reqVO); + + /** + * 閲囬泦鍖婚櫌鐢ㄦ埛淇℃伅 + * + * @param reqVO + * @return 鍙傝�� + * { + * "orgId": 20001001, + * "campusIds": 30001002, + * "unitIds": null, + * "relationType": null, + * "searchText": null, + * "status": 1 + * } + */ + Boolean queryHospUserInfoList(ServiceSLTDInhospReqVO reqVO); + + +} diff --git a/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java index dbf6662..24b91ee 100644 --- a/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java +++ b/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java @@ -682,6 +682,8 @@ serviceSubtask.setSex(patArchive.getSex()); serviceSubtask.setAge(patArchive.getAge()); serviceSubtask.setSendstate(2L); + serviceSubtask.setManagementDoctor(patMedInhosp1.getManagementDoctor()); + serviceSubtask.setManagementDoctorCode(patMedInhosp1.getManagementDoctorCode()); serviceSubtask.setStarttime(patMedInhosp1.getStarttime()); serviceSubtask.setEndtime(patMedInhosp1.getEndtime()); serviceSubtask.setServiceType(serviceTask.getServiceType()); diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java new file mode 100644 index 0000000..b087f29 --- /dev/null +++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java @@ -0,0 +1,525 @@ +package com.smartor.service.impl; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.http.HttpUtils; +import com.smartor.domain.*; +import com.smartor.mapper.PatMedOuthospMapper; +import com.smartor.mapper.SysUser2Mapper; +import com.smartor.mapper.SysUserImportMapper; +import com.smartor.service.IPatArchiveService; +import com.smartor.service.IPatMedInhospService; +import com.smartor.service.IServiceSLTDHealthcareRecordService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.lang.reflect.Array; +import java.lang.reflect.Type; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; + +@Slf4j +@Service +public class ServiceSLTDHealthcareRecordServiceImpl implements IServiceSLTDHealthcareRecordService { + + private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; + private static final String APP_KEY = "ak-zUMiOWhqXiJQWPB1pCbz0pjr"; + + @Autowired + private IPatArchiveService patArchiveService; + + @Autowired + private IPatMedInhospService patMedInhospService; + + @Autowired + private PatMedOuthospMapper patMedOuthospMapper; + + @Autowired + private SysUser2Mapper sysUser2Mapper; + + @Value("${sltd_pub_path}") + private String sltdPubPath; + + @Override + public List<ServiceSLTDInhospResDTO> queryHealthcareRecordList(ServiceSLTDInhospReqVO reqVO) { + log.info("銆恞ueryHealthcareRecordList銆戝紑濮嬭皟鐢ㄧ渷绔嬪悓寰峰仴搴疯褰曟煡璇㈡帴鍙o紝璇锋眰鍙傛暟锛歿}", reqVO); + try { + Map<String, Object> requestParams = buildRequestParams(reqVO); + Map<String, String> headers = buildRequestHeaders(); + String result = HttpUtils.sendPostByHeader(sltdPubPath + "osj/hbos-thirdparty-integration/standard/common/healthcareRecord/dtcQueryHealthcareRecordList", new Gson().toJson(requestParams), headers); + log.info("銆恞ueryHealthcareRecordList銆戞帴鍙e搷搴旂粨鏋滐細{}", result); + + String cry = determineCry(reqVO); + return parseResponseData(result, reqVO.getHealthcareRecordTypeList().get(0), cry); + } catch (Exception e) { + log.error("銆恞ueryHealthcareRecordList銆戣皟鐢ㄧ渷绔嬪悓寰峰仴搴疯褰曟煡璇㈡帴鍙e紓甯革紝璇锋眰鍙傛暟锛歿}", reqVO, e); + throw new RuntimeException("璋冪敤鐪佺珛鍚屽痉鍋ュ悍璁板綍鏌ヨ鎺ュ彛澶辫触", e); + } + } + + /** + * 閲囬泦鍖婚櫌鐢ㄦ埛淇℃伅 + * + * @param reqVO + * @return + */ + @Override + public Boolean queryHospUserInfoList(ServiceSLTDInhospReqVO reqVO) { + Map<String, Object> requestParams = buildRequestParams(reqVO); + Map<String, String> headers = buildRequestHeaders(); + String result = HttpUtils.sendPostByHeader(sltdPubPath + "osj/hbos-thirdparty-integration/standard/common/healthcareRecord/dtcQueryHealthcareRecordList", new Gson().toJson(requestParams), headers); + log.info("銆恞ueryHealthcareRecordList銆戞帴鍙e搷搴旂粨鏋滐細{}", result); + List<Map<String, Object>> dataList = getDataList(result); + for (Map<String, Object> dataItem : dataList) { + SysUser sysUser = new SysUser(); + sysUser.setUserName(getStringValue(dataItem, "accountNo")); + sysUser.setNickName(getStringValue(dataItem, "name")); + List diagnosisObjList = (List<?>) dataItem.get("qualifications"); + if (CollectionUtils.isNotEmpty(diagnosisObjList)) { + for (Object diagnosis : diagnosisObjList) { + if (diagnosis instanceof Map) { + Map<String, Object> diagnosisMap = (Map<String, Object>) diagnosis; + String professionalTitleName = getStringValue(diagnosisMap, "professionalTitleName"); + if (professionalTitleName.contains("鍖诲笀")) sysUser.setUserType("鍖荤敓"); + if (professionalTitleName.contains("鎶�")) sysUser.setUserType("鎶ゅ+"); + sysUser.setTitle(getStringValue(diagnosisMap, "professionalTitleName")); + } + } + } + sysUser.setDeptCode(getStringValue(dataItem, "accountNo")); + sysUser.setDeptName(getStringValue(dataItem, "personnelDeptName")); + sysUser.setPhonenumber(getStringValue(dataItem, "telephone")); + //璁剧疆鎬у埆 + String genderName = getStringValue(dataItem, "genderName"); + if ("鐢�".equals(genderName)) sysUser.setSex("0"); + else if ("濂�".equals(genderName)) sysUser.setSex("1"); + else sysUser.setSex("2"); + + sysUser.setCreateTime(new Date()); + sysUser.setUpdateTime(new Date()); + sysUser.setUpdateBy("admin"); + sysUser.setCreateBy("admin"); + + sysUser2Mapper.insertUser(sysUser); + } + + return true; + } + + private String determineCry(ServiceSLTDInhospReqVO reqVO) { + if (reqVO.getHealthcareRecordTypeList().contains("FH0108.02")) { + if (reqVO.getStartHeadTime() != null && reqVO.getStartTailTime() != null) { + return "0"; + } else if (reqVO.getPreOutHospitalHeadDate() != null && reqVO.getPreOutHospitalTailDate() != null) { + return "1"; + } + } + return null; + } + + private Map<String, Object> buildRequestParams(ServiceSLTDInhospReqVO reqVO) { + Map<String, Object> params = new HashMap<>(); + if (reqVO.getOrgId() != null) { + params.put("orgId", Long.parseLong(reqVO.getOrgId())); + } + if (reqVO.getCampusIds() != null) { + params.put("campusIds", reqVO.getCampusIds()); + } + if (reqVO.getStartHeadTime() != null) { + params.put("startHeadTime", reqVO.getStartHeadTime()); + } + if (reqVO.getStartTailTime() != null) { + params.put("startTailTime", reqVO.getStartTailTime()); + } + if (reqVO.getHealthcareRecordTypeList() != null && !reqVO.getHealthcareRecordTypeList().isEmpty()) { + params.put("healthcareRecordTypeList", reqVO.getHealthcareRecordTypeList()); + } + params.put("subjectCode", reqVO.getPatientName()); + params.put("healthcareRecordNo", reqVO.getHealthcareRecordNo()); + params.put("orgSubjectCode", reqVO.getIdCardNo()); + if (reqVO.getDeptIdList() != null && !reqVO.getDeptIdList().isEmpty()) { + params.put("deptDimensions", reqVO.getDeptIdList()); + } + params.put("serviceScopes", null); + params.put("inpatientArea", null); + params.put("status", reqVO.getStatusList() != null && !reqVO.getStatusList().isEmpty() ? reqVO.getStatusList() : null); + return params; + } + + private Map<String, String> buildRequestHeaders() { + Map<String, String> headers = new HashMap<>(); + headers.put("Content-Type", "application/json"); + headers.put("app-key", APP_KEY); + return headers; + } + + private List<ServiceSLTDInhospResDTO> parseResponseData(String result, String type, String cry) { + try { + + List<Map<String, Object>> dataList = getDataList(result); + List<ServiceSLTDInhospResDTO> resultList = new ArrayList<>(); + for (Map<String, Object> dataItem : dataList) { + resultList.add(convertToDTO(dataItem)); + } + log.info("銆恜arseResponseData銆戞垚鍔熻В鏋恵}鏉″仴搴疯褰曟暟鎹�", resultList.size()); + + processResultList(resultList, type, cry); + return resultList; + } catch (Exception e) { + log.error("銆恜arseResponseData銆戣В鏋愬搷搴旀暟鎹紓甯革紝鍝嶅簲鍐呭锛歿}", result, e); + throw new RuntimeException("瑙f瀽鍝嶅簲鏁版嵁澶辫触", e); + } + } + + public List<Map<String, Object>> getDataList(String result) { + Gson gson = new Gson(); + Type mapType = new TypeToken<Map<String, Object>>() { + }.getType(); + Map<String, Object> responseMap = gson.fromJson(result, mapType); + + Number codeObj = (Number) responseMap.get("code"); + if (codeObj == null || codeObj.intValue() != 200) { + log.error("銆恜arseResponseData銆戞帴鍙h繑鍥炲け璐ワ紝鍝嶅簲鐮侊細{}锛屽搷搴斿唴瀹癸細{}", codeObj, result); + throw new RuntimeException("鎺ュ彛璋冪敤澶辫触锛屽搷搴旂爜锛�" + codeObj); + } + + Object dataObj = responseMap.get("data"); + if (dataObj == null) { + log.warn("銆恜arseResponseData銆戞帴鍙h繑鍥炴暟鎹负绌�"); + return new ArrayList<>(); + } + + String dataJson = gson.toJson(dataObj); + Type listType = new TypeToken<List<Map<String, Object>>>() { + }.getType(); + List<Map<String, Object>> dataList = gson.fromJson(dataJson, listType); + return dataList; + } + + private void processResultList(List<ServiceSLTDInhospResDTO> resultList, String type, String cry) { + switch (type) { + case "FH0108.01": + log.info("銆恜arseResponseData銆戣В鏋愰棬璇婃暟鎹�"); + outHospitalDate(resultList); + break; + case "FH0108.02": + log.info("銆恜arseResponseData銆戣В鏋愪綇闄㈡暟鎹�"); + inHospitalDate(resultList, cry); + break; + case "FH0108.03": + log.info("銆恜arseResponseData銆戣В鏋愭�ヨ瘖鏁版嵁"); + outHospitalDate(resultList); + break; + default: + log.warn("銆恜arseResponseData銆戞湭鐭ョ殑鏁版嵁绫诲瀷锛歿}", type); + break; + } + } + + private Boolean outHospitalDate(List<ServiceSLTDInhospResDTO> resultList) { + for (ServiceSLTDInhospResDTO dto : resultList) { + PatArchive patArchive = processPatientArchive(dto); + PatMedOuthosp patMedOuthosp = buildPatMedOuthosp(dto, patArchive); + patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp); + } + return true; + } + + private PatMedOuthosp buildPatMedOuthosp(ServiceSLTDInhospResDTO dto, PatArchive patArchive) { + PatMedOuthosp patMedOuthosp = new PatMedOuthosp(); + patMedOuthosp.setOuthospno(dto.getHealthcareRecordNo()); + patMedOuthosp.setSerialnum(dto.getHealthcareRecordNo()); + patMedOuthosp.setPatid(patArchive.getId()); + patMedOuthosp.setPatname(patArchive.getName()); + patMedOuthosp.setPatno(patArchive.getPatientno()); + patMedOuthosp.setDeptcode("" + dto.getDeptId()); + patMedOuthosp.setDeptname(dto.getDeptName()); + patMedOuthosp.setDiagname(dto.getDiagnosisName()); + patMedOuthosp.setIcd10code(dto.getDiagnosisCode()); + patMedOuthosp.setDrcode("" + dto.getDoctorId()); + patMedOuthosp.setDrname(dto.getDoctorName()); + patMedOuthosp.setAdmitdate(parseDate(dto.getLastEncounterTime())); + patMedOuthosp.setSchemestatus(1L); + patMedOuthosp.setMainsuit(dto.getDiagnosisName()); + patMedOuthosp.setHpi(null); + patMedOuthosp.setCreateTime(new Date()); + return patMedOuthosp; + } + + private Date parseDate(String dateStr) { + try { + return new SimpleDateFormat(DATE_FORMAT).parse(dateStr); + } catch (ParseException e) { + log.warn("銆恜arseDate銆戣В鏋愭棩鏈熷け璐ワ細{}", dateStr, e); + return null; + } + } + + private Boolean inHospitalDate(List<ServiceSLTDInhospResDTO> resultList, String cry) { + for (ServiceSLTDInhospResDTO dto : resultList) { + PatArchive patArchive = processPatientArchive(dto); + processPatientInhospInfo(dto, patArchive, cry); + } + return true; + } + + private void processPatientInhospInfo(ServiceSLTDInhospResDTO dto, PatArchive patArchive, String cry) { + PatMedInhosp patMedInhosp = buildPatientInhospInfo(dto, patArchive, cry); + PatMedInhosp queryInhosp = new PatMedInhosp(); + queryInhosp.setPatno(patArchive.getPatientno()); + queryInhosp.setSerialnum(patMedInhosp.getSerialnum()); + List<PatMedInhosp> existingInhosps = patMedInhospService.selectPatMedInhospList(queryInhosp); + + if (CollectionUtils.isNotEmpty(existingInhosps)) { + patMedInhosp.setInhospid(existingInhosps.get(0).getInhospid()); + patMedInhospService.updatePatMedInhosp(patMedInhosp); + log.debug("銆恜rocessPatientInhospInfo銆戞洿鏂颁綇闄俊鎭紝鎮h�呯紪鍙凤細{}锛屾祦姘村彿锛歿}", patArchive.getPatientno(), patMedInhosp.getSerialnum()); + } else { + patMedInhospService.insertPatMedInhosp(patMedInhosp); + log.debug("銆恜rocessPatientInhospInfo銆戞柊澧炰綇闄俊鎭紝鎮h�呯紪鍙凤細{}锛屾祦姘村彿锛歿}", patArchive.getPatientno(), patMedInhosp.getSerialnum()); + } + } + + private PatMedInhosp buildPatientInhospInfo(ServiceSLTDInhospResDTO dto, PatArchive patArchive, String cry) { + PatMedInhosp patMedInhosp = new PatMedInhosp(); + patMedInhosp.setPatid(patArchive.getId()); + patMedInhosp.setPatno(patArchive.getPatientno()); + patMedInhosp.setPatname(patArchive.getName()); + patMedInhosp.setNurseId(dto.getChiefNurseId() == null ? "" : dto.getChiefNurseId().toString()); + patMedInhosp.setNurseName(dto.getChiefNurseName()); + patMedInhosp.setSerialnum(dto.getHealthcareRecordNo()); + patMedInhosp.setFuflag("1"); + patMedInhosp.setInhospstate("0".equals(cry) ? "0" : "1"); + patMedInhosp.setHospitalcode(dto.getOrgId()); + patMedInhosp.setBedNo(dto.getBedNumber()); + patMedInhosp.setStarttime(parseDate(dto.getStartTime())); + patMedInhosp.setEndtime(parseDate(dto.getPreOutHospitalDate())); + + if ("1".equals(cry)) { + setDischargeInfo(patMedInhosp, dto); + } else { + setAdmissionInfo(patMedInhosp, dto); + } + + patMedInhosp.setDrname(dto.getDoctorName()); + patMedInhosp.setDrcode("" + dto.getDoctorId()); + patMedInhosp.setSchemestatus("0".equals(cry) ? 1L : 2L); + patMedInhosp.setDelFlag("0"); + patMedInhosp.setOrgid("1"); + return patMedInhosp; + } + + private void setDischargeInfo(PatMedInhosp patMedInhosp, ServiceSLTDInhospResDTO dto) { + patMedInhosp.setLeaveldeptcode("" + dto.getDeptId()); + patMedInhosp.setLeaveldeptname(dto.getDeptName()); + patMedInhosp.setLeavediagname(dto.getMainDischargeDiagnosis() == null ? null : dto.getMainDischargeDiagnosis().getDiagnosisDictName()); + patMedInhosp.setLeaveicd10code(dto.getMainDischargeDiagnosis() == null ? null : dto.getMainDischargeDiagnosis().getDiagnosisDictCode()); + patMedInhosp.setOutWayId(null); + patMedInhosp.setOutWayName(null); + patMedInhosp.setLeavehospitaldistrictid("" + dto.getAreaId()); + patMedInhosp.setLeavehospitaldistrictcode("" + dto.getAreaId()); + patMedInhosp.setLeavehospitaldistrictname(dto.getAreaName()); + patMedInhosp.setLeaveldeptid("" + dto.getDeptId()); + } + + private void setAdmissionInfo(PatMedInhosp patMedInhosp, ServiceSLTDInhospResDTO dto) { + patMedInhosp.setDeptcode("" + dto.getDeptId()); + patMedInhosp.setDeptname(dto.getDeptName()); + patMedInhosp.setDiagname(dto.getAdmissionDiagnosisName()); + patMedInhosp.setIcd10code(dto.getAdmissionDiagnosisCode()); + patMedInhosp.setHospitaldistrictid("" + dto.getAreaId()); + patMedInhosp.setHospitaldistrictcode("" + dto.getAreaId()); + patMedInhosp.setHospitaldistrictname(dto.getAreaName()); + } + + private PatArchive processPatientArchive(ServiceSLTDInhospResDTO dto) { + PatArchive queryArchive = new PatArchive(); + queryArchive.setIdcardno(dto.getIdCardNo().trim()); + List<PatArchive> existingArchives = patArchiveService.selectPatArchiveList(queryArchive); + + PatArchive patArchive = buildPatientArchive(dto); + + if (CollectionUtils.isEmpty(existingArchives)) { + patArchiveService.insertPatArchive(patArchive); + log.debug("銆恜rocessPatientArchive銆戞柊澧炴偅鑰呮。妗堬紝鎮h�呯紪鍙凤細{}", patArchive.getPatientno()); + } else { + patArchive.setId(existingArchives.get(0).getId()); + patArchiveService.updateArchive(patArchive); + log.debug("銆恜rocessPatientArchive銆戞洿鏂版偅鑰呮。妗堬紝鎮h�呯紪鍙凤細{}", patArchive.getPatientno()); + } + + return patArchive; + } + + private PatArchive buildPatientArchive(ServiceSLTDInhospResDTO dto) { + PatArchive patArchive = new PatArchive(); + patArchive.setPatientno(dto.getMedicalRecordNo()); + patArchive.setIdcardno(dto.getIdCardNo().trim()); + patArchive.setName(dto.getPatientName()); + patArchive.setSourcefrom(2); + patArchive.setPattype("2"); + patArchive.setSex("鐢�".equals(dto.getGender()) ? 1L : 2L); + patArchive.setNation(dto.getNation()); + patArchive.setNativePlace(dto.getNativePlace()); + patArchive.setPlaceOfResidence(dto.getAddress()); + patArchive.setBirthdate(parseDate(dto.getBirthday())); + patArchive.setTelcode(dto.getPhone()); + if (CollectionUtils.isNotEmpty(dto.getResidentContactInfos())) { + patArchive.setRelativetelcode(dto.getResidentContactInfos().get(0).getTelecom()); + } + patArchive.setDelFlag("0"); + patArchive.setCreateTime(new Date()); + patArchive.setUpdateTime(new Date()); + return patArchive; + } + + private ServiceSLTDInhospResDTO convertToDTO(Map<String, Object> dataItem) { + ServiceSLTDInhospResDTO dto = new ServiceSLTDInhospResDTO(); + dto.setOrgId(getStringValue(dataItem, "orgId")); + dto.setHealthcareRecordId(getLongValue(dataItem, "healthcareRecordId")); + dto.setHealthcareRecordNo(getStringValue(dataItem, "healthcareRecordNo")); + dto.setPatientId(getLongValue(dataItem, "patientId")); + dto.setPatientName(getStringValue(dataItem, "patientName")); + dto.setPinyin(getStringValue(dataItem, "pinyin")); + dto.setNation(getStringValue(dataItem, "nation")); + dto.setIdCardNo(getStringValue(dataItem, "idCardNo")); + dto.setHealthcareRecordTimes(getIntegerValue(dataItem, "healthcareRecordTimes")); + dto.setHospitalizationNumber(getIntegerValue(dataItem, "hospitalizationNumber")); + dto.setMedicalCardId(getLongValue(dataItem, "medicalCardId")); + dto.setMedicalCardType(getStringValue(dataItem, "medicalCardType")); + dto.setMedicalCardTypeName(getStringValue(dataItem, "medicalCardTypeName")); + dto.setMedicalCardNo(getStringValue(dataItem, "medicalCardNo")); + dto.setMedicalRecordNo(getStringValue(dataItem, "medicalRecordNo")); + dto.setGender(getStringValue(dataItem, "gender")); + dto.setGenderCode(getStringValue(dataItem, "genderCode")); + dto.setAge(getStringValue(dataItem, "age")); + dto.setBirthday(getStringValue(dataItem, "birthday")); + dto.setPhone(getStringValue(dataItem, "phone")); + dto.setEducation(getStringValue(dataItem, "education")); + dto.setEducationCode(getStringValue(dataItem, "educationCode")); + dto.setNeonatal(getBooleanValue(dataItem, "neonatal")); + dto.setMarriage(getStringValue(dataItem, "marriage")); + dto.setMarriageCode(getStringValue(dataItem, "marriageCode")); + dto.setOccupationType(getStringValue(dataItem, "occupationType")); + dto.setOccupationTypeCode(getStringValue(dataItem, "occupationTypeCode")); + dto.setNativePlace(getStringValue(dataItem, "nativePlace")); + dto.setAreaId(getLongValue(dataItem, "areaId")); + dto.setAreaName(getStringValue(dataItem, "areaName")); + dto.setRoomId(getLongValue(dataItem, "roomId")); + dto.setRoomNumber(getStringValue(dataItem, "roomNumber")); + dto.setBedId(getLongValue(dataItem, "bedId")); + dto.setBedNumber(getStringValue(dataItem, "bedNumber")); + dto.setEncounterTime(getStringValue(dataItem, "encounterTime")); + dto.setStartTime(getStringValue(dataItem, "startTime")); + dto.setPreOutHospitalDate(getStringValue(dataItem, "preOutHospitalDate")); + dto.setLastEncounterTime(getStringValue(dataItem, "lastEncounterTime")); + dto.setDiagnosisCode(getStringValue(dataItem, "diagnosisCode")); + dto.setDiagnosisName(getStringValue(dataItem, "diagnosisName")); + dto.setHealthcareRecordStatus(getStringValue(dataItem, "healthcareRecordStatus")); + dto.setHealthcareType(getStringValue(dataItem, "healthcareType")); + dto.setDeptId(getLongValue(dataItem, "deptId")); + dto.setDeptName(getStringValue(dataItem, "deptName")); + dto.setDoctorId(getLongValue(dataItem, "doctorId")); + dto.setDoctorName(getStringValue(dataItem, "doctorName")); + dto.setHealthcarePeriodId(getLongValue(dataItem, "healthcarePeriodId")); + dto.setChiefNurseId(getLongValue(dataItem, "chiefNurseId")); + dto.setChiefNurseName(getStringValue(dataItem, "chiefNurseName")); + dto.setCostCategoryName(getStringValue(dataItem, "costCategoryName")); + dto.setCostCategoryCode(getStringValue(dataItem, "costCategoryCode")); + dto.setCostNatureName(getStringValue(dataItem, "costNatureName")); + dto.setCostNatureCode(getStringValue(dataItem, "costNatureCode")); + dto.setFurtherConsultationStatus(getIntegerValue(dataItem, "furtherConsultationStatus")); + + Object contactsObj = dataItem.get("residentContactInfos"); + if (contactsObj instanceof List) { + dto.setResidentContactInfos(parseContacts((List<?>) contactsObj)); + } + + Object diagnosisObj = dataItem.get("diagnosisList"); + if (diagnosisObj instanceof List) { + dto.setDiagnosisList(parseDiagnosis((List<?>) diagnosisObj)); + } + + return dto; + } + + private List<ServiceSLTDContactsResDTO> parseContacts(List<?> contactsList) { + List<ServiceSLTDContactsResDTO> contacts = new ArrayList<>(); + for (Object contactObj : contactsList) { + if (contactObj instanceof Map) { + Map<String, Object> contactMap = (Map<String, Object>) contactObj; + ServiceSLTDContactsResDTO contact = new ServiceSLTDContactsResDTO(); + contact.setName(getStringValue(contactMap, "name")); + contact.setRelationshipCode(getStringValue(contactMap, "relationshipCode")); + contact.setRelationship(getStringValue(contactMap, "relationship")); + contact.setTelecom(getStringValue(contactMap, "telecom")); + contact.setCurrentAddress(getStringValue(contactMap, "currentAddress")); + contacts.add(contact); + } + } + return contacts; + } + + private List<ServiceSLTDDiagnosisResDTO> parseDiagnosis(List<?> diagnosisList) { + List<ServiceSLTDDiagnosisResDTO> diagnosis = new ArrayList<>(); + for (Object diagnosisObj : diagnosisList) { + if (diagnosisObj instanceof Map) { + Map<String, Object> diagnosisMap = (Map<String, Object>) diagnosisObj; + ServiceSLTDDiagnosisResDTO diag = new ServiceSLTDDiagnosisResDTO(); + diag.setDiagnosisDictCode(getStringValue(diagnosisMap, "diagnosisDictCode")); + diag.setDiagnosisDictName(getStringValue(diagnosisMap, "diagnosisDictName")); + diag.setDiagnosisCategory(getStringValue(diagnosisMap, "diagnosisCategory")); + diag.setRecordType(getIntegerValue(diagnosisMap, "recordType")); + diag.setIsMainDiagnosis(getIntegerValue(diagnosisMap, "isMainDiagnosis")); + diagnosis.add(diag); + } + } + return diagnosis; + } + + private String getStringValue(Map<String, Object> map, String key) { + Object value = map.get(key); + return value != null ? value.toString() : null; + } + + private Long getLongValue(Map<String, Object> map, String key) { + Object value = map.get(key); + if (value == null) return null; + if (value instanceof Number) { + return ((Number) value).longValue(); + } + try { + return Long.parseLong(value.toString()); + } catch (NumberFormatException e) { + return null; + } + } + + private Integer getIntegerValue(Map<String, Object> map, String key) { + Object value = map.get(key); + if (value == null) return null; + if (value instanceof Number) { + return ((Number) value).intValue(); + } + try { + return Integer.parseInt(value.toString()); + } catch (NumberFormatException e) { + return null; + } + } + + private Boolean getBooleanValue(Map<String, Object> map, String key) { + Object value = map.get(key); + if (value == null) return null; + if (value instanceof Boolean) { + return (Boolean) value; + } + return Boolean.parseBoolean(value.toString()); + } +} diff --git a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml index 4441177..986f899 100644 --- a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml +++ b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml @@ -76,68 +76,68 @@ <sql id="selectPatMedInhospVo"> select inhospid, - patname, - fuflag, - management_doctor, - management_doctor_code, - fudate, - fuperiod, - futypecode, - futypedesc, - fuadvice, - fuspecialadvice, - remark, - guid, - operator, - operator_id, - out_way_id, - out_way_name, - nurse_id, - nurse_name, - deptcheck_flag, - wardcheck_flag, - diagcheck_flag, - inhospstate, - patno, - long_task_reason, - inhospno, - serialnum, - hospitalname, - hospitalcode, - hospitaldistrictcode, - hospitaldistrictname, - icd10code, - diagname, - starttime, - endtime, - deptcode, - deptname, - roomno, - bed_no, - orgid, - del_flag, - update_by, - update_time, - create_by, - create_time, - isupload, - upload_time, - patid, - leavediagname, - leaveicd10code, - drcode, - drname, - schemestatus, - generalschemestatus, - leaveldeptcode, - leaveldeptname, - hospitaldistrictid, - leavehospitaldistrictcode, - leavehospitaldistrictname, - leavehospitaldistrictid, - deptid, - leaveldeptid, - schemetime + patname, + fuflag, + management_doctor, + management_doctor_code, + fudate, + fuperiod, + futypecode, + futypedesc, + fuadvice, + fuspecialadvice, + remark, + guid, + operator, + operator_id, + out_way_id, + out_way_name, + nurse_id, + nurse_name, + deptcheck_flag, + wardcheck_flag, + diagcheck_flag, + inhospstate, + patno, + long_task_reason, + inhospno, + serialnum, + hospitalname, + hospitalcode, + hospitaldistrictcode, + hospitaldistrictname, + icd10code, + diagname, + starttime, + endtime, + deptcode, + deptname, + roomno, + bed_no, + orgid, + del_flag, + update_by, + update_time, + create_by, + create_time, + isupload, + upload_time, + patid, + leavediagname, + leaveicd10code, + drcode, + drname, + schemestatus, + generalschemestatus, + leaveldeptcode, + leaveldeptname, + hospitaldistrictid, + leavehospitaldistrictcode, + leavehospitaldistrictname, + leavehospitaldistrictid, + deptid, + leaveldeptid, + schemetime from pat_med_inhosp </sql> @@ -419,7 +419,7 @@ SELECT GROUP_CONCAT(d.tagname, ', ') FROM pat_archivetag d WHERE d.patid = #{patid} - AND d.del_flag = 0 + AND d.del_flag = 0 </select> diff --git a/smartor/src/main/resources/mapper/smartor/SysUserMapper.xml b/smartor/src/main/resources/mapper/smartor/SysUserMapper.xml index a5369ee..6de8bc6 100644 --- a/smartor/src/main/resources/mapper/smartor/SysUserMapper.xml +++ b/smartor/src/main/resources/mapper/smartor/SysUserMapper.xml @@ -280,6 +280,8 @@ <if test="hisUserId != null and hisUserId != ''">his_user_id,</if> <if test="guid != null and guid != ''">guid,</if> <if test="orgid != null and orgid != ''">orgid,</if> + <if test="deptCode != null and deptCode != ''">dept_code,</if> + <if test="deptName != null and deptName != ''">dept_name,</if> create_time )values( <if test="userId != null and userId != ''">#{userId},</if> @@ -305,6 +307,8 @@ <if test="hisUserId != null and hisUserId != ''">#{hisUserId},</if> <if test="guid != null and guid != ''">#{guid},</if> <if test="orgid != null and orgid != ''">#{orgid},</if> + <if test="deptCode != null and deptCode != ''">#{deptCode},</if> + <if test="deptName != null and deptName != ''">#{deptName},</if> sysdate() ) </insert> diff --git a/smartor/src/test/java/com/smartor/service/ServiceSLTDHealthcareRecordServiceTest.java b/smartor/src/test/java/com/smartor/service/ServiceSLTDHealthcareRecordServiceTest.java new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/smartor/src/test/java/com/smartor/service/ServiceSLTDHealthcareRecordServiceTest.java -- Gitblit v1.9.3