From 371603a0eb9f3a279cf77073734e991b5851b792 Mon Sep 17 00:00:00 2001 From: sinake <sinake1@qq.com> Date: 星期五, 05 九月 2025 16:21:01 +0800 Subject: [PATCH] 市一短信接口同步服务对接 --- ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml | 26 +++--- ruoyi-admin/src/main/resources/application-hzszlyy.yml | 12 +- ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/BaseSmsaccountController.java | 35 ++++++++ ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java | 7 + ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java | 1 ruoyi-admin/src/main/resources/application-druid.yml | 47 ++++------- smartor/src/main/java/com/smartor/domain/smsVO.java | 17 ++++ ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java | 1 ruoyi-admin/src/main/resources/application.yml | 2 ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SmsController.java | 46 +++++++++++ ruoyi-common/src/main/java/com/ruoyi/common/utils/sms/smsUtils.java | 42 ++++++++++ 11 files changed, 182 insertions(+), 54 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SmsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SmsController.java new file mode 100644 index 0000000..7353768 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SmsController.java @@ -0,0 +1,46 @@ +package com.ruoyi.web.controller.common; + +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.file.FileUtils; +import com.ruoyi.common.utils.sms.smsUtils; +import com.ruoyi.framework.config.ServerConfig; +import com.smartor.domain.HtmlContentVO; +import com.smartor.domain.smsVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@RestController +@Api(description = "鐭ヤ俊鎺ュ彛") +@RequestMapping("/sms") +public class SmsController { + @Value("${xhsmsPath}") + private String xhsmsPath; + + @Value("${xhsmsAccount}") + private String xhsmsAccount; + + @Value("${xhsmsPwd}") + private String xhsmsPwd; + + /** + * @param + * @return + */ + @ApiOperation("鐭俊鍙戦��") + @PostMapping("/send") + public AjaxResult send(@RequestBody smsVO vo) { + String sendMsg=smsUtils.sendSms(xhsmsPath,xhsmsAccount,xhsmsPwd,vo.getPhone(),vo.getContent()); + return AjaxResult.success(sendMsg); + } + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/BaseSmsaccountController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/BaseSmsaccountController.java index d419716..dd4aebf 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/BaseSmsaccountController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/BaseSmsaccountController.java @@ -1,5 +1,8 @@ package com.ruoyi.web.controller.smartor.tools; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.RepeatSubmit; import com.ruoyi.common.core.controller.BaseController; @@ -7,6 +10,7 @@ import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.utils.sms.smsUtils; import com.smartor.domain.BaseSmsRequest; import com.smartor.domain.BaseSmsaccount; import com.smartor.domain.BatchBaseSmsRequest; @@ -16,6 +20,7 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @@ -34,6 +39,18 @@ public class BaseSmsaccountController extends BaseController { @Autowired private IBaseSmsaccountService baseSmsaccountService; + + @Value("${visitHosp}") + private Integer visitHosp; + + @Value("${xhsmsPath}") + private String xhsmsPath; + + @Value("${xhsmsAccount}") + private String xhsmsAccount; + + @Value("${xhsmsPwd}") + private String xhsmsPwd; /** * 鏌ヨ鐭俊璐﹀彿鍒楄〃 @@ -105,10 +122,22 @@ @PostMapping("/sendMsg") @RepeatSubmit public AjaxResult sendMsg(@RequestBody BaseSmsRequest baseSmsRequest) { - if (baseSmsaccountService.sendMsg(baseSmsRequest) == null) { - return error(); + String sendMsg=""; + if(visitHosp.equals("3")) { + try{ + JSONObject jsTemp = JSON.parseObject(baseSmsRequest.getTemplateParam()); + String content=jsTemp.getString("name"); + sendMsg= smsUtils.sendSms(xhsmsPath,xhsmsAccount,xhsmsPwd,baseSmsRequest.getPhoneNumber(),content); + } catch (Exception ex) { + return AjaxResult.error(ex.getMessage()) ; + } + return AjaxResult.success(sendMsg); + }else { + if (baseSmsaccountService.sendMsg(baseSmsRequest) == null) { + return error(); + } + return success(baseSmsaccountService.sendMsg(baseSmsRequest)); } - return success(baseSmsaccountService.sendMsg(baseSmsRequest)); } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java index 33a628c..a5e2dd6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -6,7 +6,6 @@ import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.model.LoginBody; -import com.ruoyi.common.dx.MessageSend; import com.ruoyi.common.utils.RSAPublicKeyExample; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index 497089e..6a1a1f7 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -23,24 +23,20 @@ # password: 123456 # driverClassName: com.mysql.cj.jdbc.Driver # # 鏂板崕 -# url: jdbc:mysql://192.168.100.10:3306/smartor_xinhua?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 -# username: smartor -# password: Smartor.2023 -# driverClassName: com.mysql.cj.jdbc.Driver - - # 鍏徃浜� - url: jdbc:mysql://116.62.18.175:6002/smartor_sltd?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - username: hxsoft - password: Smartor.2023 - # ob鏁版嵁搴撳瓨 -# url: jdbc:mysql://127.0.0.1:2881/smartor-lisui?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai -# username: root@sys -# password: -# driverClassName: com.mysql.cj.jdbc.Driver - # 鍏徃鏈湴 -# url: jdbc:mysql://192.168.100.10:3306/smartor_lishui?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + # url: jdbc:mysql://192.168.191.181:3308/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # username: smartor # password: Smartor.2023 + # driverClassName: com.mysql.cj.jdbc.Driver + + # 鍏徃浜� +# url: jdbc:mysql://116.62.18.175:6002/smartor_xinhua?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 +# username: hxsoft +# password: Hxerp2000 +# driverClassName: com.mysql.cj.jdbc.Driver + # 鍏徃鏈湴 + url: jdbc:mysql://192.168.100.10:3306/smartor_lishui?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: smartor + password: Smartor.2023 driverClassName: com.mysql.cj.jdbc.Driver # # 楂樻柉鏁版嵁搴撻厤缃� @@ -62,11 +58,11 @@ # password: Smartor.2023 # driverClassName: com.mysql.cj.jdbc.Driver # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴(鍏徃) - # enabled: true - # url: jdbc:sqlserver://116.62.18.175:6001;DatabaseName=iv-ywey;encrypt=false;SelectMethod=cursor - # username: sa - # password: Hxerp2000 - # driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver +# enabled: true +# url: jdbc:sqlserver://116.62.18.175:6001;DatabaseName=iv-ywey;encrypt=false;SelectMethod=cursor +# username: sa +# password: Hxerp2000 +# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴(涔変箤浜岄櫌) # enabled: true @@ -117,9 +113,8 @@ multi-statement-allow: true # redis 閰嶇疆 redis: - host: 127.0.0.1 + host: 192.168.100.10 port: 6020 - # 鏁版嵁搴撶储寮� database: 0 # 瀵嗙爜 @@ -276,8 +271,4 @@ #闅忚鍖婚櫌锛�1鏂板崕 2涓芥按 visitHosp: 2 -#澶勭悊鎶曡瘔寤鸿鐨勯儴闂ㄧ紪鐮� -dealDeptCode: 40003024 - -#鏄惁鍔犲瘑 0涓嶅姞 1鍔犲瘑 -isEncryp: 0 +isEncryp: \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/application-hzszlyy.yml b/ruoyi-admin/src/main/resources/application-hzszlyy.yml index c261d90..b79b7e4 100644 --- a/ruoyi-admin/src/main/resources/application-hzszlyy.yml +++ b/ruoyi-admin/src/main/resources/application-hzszlyy.yml @@ -176,13 +176,11 @@ #app_key_yq: ZurNHpaQLq6P55YS #鏈� 鍦� 鐭俊璇锋眰鍦板潃(杩欎釜鏈嶅姟鏄垜浠嚜宸卞啓鐨�) -#xhsmsPath: http://192.168.2.13:8092/sendSms -#鏂板崕鐭俊璇锋眰鍦板潃(杩欎釜鏈嶅姟鏄垜浠嚜宸卞啓鐨�) -xhsmsPath: http://192.16.4.220:8092/sendSms +xhsmsPath: http://192.169.140.240:8001/sms/api/sendMessageMass #甯愬彿 -xhsmsAccount: 911124 +xhsmsAccount: 300044 #鎺ュ彛瀵嗙爜 -xhsmsPwd: zW5eXe +xhsmsPwd: qj0NHDegxWhj #铏氭嫙鎺ュ叆鐮� xhsmsjrm: 1069055 @@ -215,5 +213,5 @@ #admin绠$悊鍛榰serId isAdmin: 1,2,3,4,5,6,7,8,9,10,11,12,13 -#闅忚鍖婚櫌锛�1鏂板崕 2涓芥按 -visitHosp: 2 +#闅忚鍖婚櫌锛�1鏂板崕 2涓芥按 3 鏉窞甯備竴鍖婚櫌鍚村北闄㈠尯 +visitHosp: 3 diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 842026d..ee520fe 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -74,7 +74,7 @@ # 鍥介檯鍖栬祫婧愭枃浠惰矾寰� basename: i18n/messages profiles: - active: ls + active: hzszlyy # 鏂囦欢涓婁紶 servlet: multipart: diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/sms/smsUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sms/smsUtils.java new file mode 100644 index 0000000..99a2fc2 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sms/smsUtils.java @@ -0,0 +1,42 @@ +package com.ruoyi.common.utils.sms; + + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.ruoyi.common.utils.HttpUtil; +import com.ruoyi.common.utils.sign.Md5Utils; +import org.springframework.beans.factory.annotation.Value; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +public class smsUtils { + + + /** + * 鏉窞甯備竴鍖婚櫌鍚村北闄㈠尯鎴戠煭淇℃帴鍙� + * + * @param url 鐭俊URL + * @param userName 鐭俊甯愬彿 + * @param content 鐭俊瀵嗙爜 + * @param phone 鎵嬫満鍙风粍鍚堝 13500000001,13500000002 + * @param content 鐭俊鍐呭 + * @return 涓や釜鍙傛暟鐨勫拰 + */ + public static String sendSms(String url, String userName, String passWord, String phone, String content) { + long timestamp = new Date().getTime(); + String sign = Md5Utils.hash(userName + timestamp + Md5Utils.hash(passWord)); + content = "銆愭澀宸炲競涓�鍖婚櫌鍚村北闄㈠尯銆�" + content; + String jsonMsg = "{" + + "\"userName\": \"" + userName + "\"," + + "\"content\": \"" + content + "\"," + + "\"phoneList\": [" + phone + "]," + + "\"timestamp\": " + timestamp + "," + + "\"sign\": \"" + sign + "\"" + + "}"; + return HttpUtil.postJsonRequest(url, jsonMsg); + + } +} 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 a6a27d1..921dff6 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 @@ -111,6 +111,7 @@ .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() + .antMatchers("/smartor/organization/list").permitAll() // 闄や笂闈㈠鐨勬墍鏈夎姹傚叏閮ㄩ渶瑕侀壌鏉冭璇� .anyRequest().authenticated().and().headers().frameOptions().disable(); // 娣诲姞Logout filter diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java index c73331b..80a5a2f 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java @@ -11,6 +11,7 @@ import com.smartor.mapper.*; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Service; @@ -82,6 +83,7 @@ @Override public Integer selectPatMedInhospList(PatMedInhosp patMedInhosp) { List<PatMedInhosp> patMedInhospList = chMapper.selectPatMedInhospList(patMedInhosp); + log.info("鍙悓姝ョ梾浜烘暟閲�"+patMedInhospList.size()); for (PatMedInhosp pm : patMedInhospList) { PatArchive patArchive = new PatArchive(); patArchive.setPatientno(pm.getPatno()); @@ -126,7 +128,10 @@ @Override public Boolean hnDataGather(HnDataGatherVO hnDataGatherVO) { - + if(ObjectUtils.isEmpty(hnDataGatherVO.getStartTime()) ) + hnDataGatherVO.setStartTime(new Date()); + if(ObjectUtils.isEmpty(hnDataGatherVO.getEndTime()) ) + hnDataGatherVO.setEndTime(new Date()); LocalDate startDate = hnDataGatherVO.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); LocalDate endDate = hnDataGatherVO.getEndTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); diff --git a/ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml b/ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml index 1376bcd..ab2ed3a 100644 --- a/ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml +++ b/ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml @@ -395,7 +395,7 @@ <if test="uploadTime != null ">and upload_time = #{uploadTime}</if> <if test="viptype != null ">and viptype = #{viptype}</if> <if test="pattype != null ">and pattype = #{pattype}</if> - <if test="patientno != null ">and patientno = CAST(#{patientno} AS INTEGER)</if> + <if test="patientno != null ">and patientno = #{patientno}</if> <if test="patidHis != null ">and patid_his = #{patidHis}</if> <if test="sdFlag != null ">and sd_flag = #{sdFlag}</if> <if test="ageUnit != null ">and age_unit = #{ageUnit}</if> @@ -489,17 +489,17 @@ healthy_inhosp b <where> - <if test="startOutHospTime != null ">and to_char(b.endtime,'YYMMDD') >= - to_char(#{startOutHospTime}::date,'YYMMDD') + <if test="startOutHospTime != null "> + and to_char(b.endtime, 'YYYY-MM-DD HH24:MI:SS') >=to_char(#{startOutHospTime},'YYYY-MM-DD HH24:MI:SS') </if> - <if test="endOutHospTime != null ">and to_char(b.endtime,'YYMMDD') <= - to_char(#{endOutHospTime}::date,'YYMMDD') + <if test="endOutHospTime != null "> + and to_char(b.endtime, 'YYYY-MM-DD HH24:MI:SS') <= to_char(#{endOutHospTime},'YYYY-MM-DD HH24:MI:SS') </if> - <if test="startInHospTime != null ">and to_char(b.starttime,'YYMMDD') >= - to_char(#{startInHospTime}::date,'%y%m%d') + <if test="startInHospTime != null "> + and to_char(starttime, 'YYYY-MM-DD HH24:MI:SS') >= to_char(#{startInHospTime},'YYYY-MM-DD HH24:MI:SS') </if> - <if test="endInHospTime != null ">and to_char(b.starttime,'YYMMDD') <= - to_char(#{endInHospTime}::date,'YYMMDD') + <if test="endInHospTime != null "> + and to_char(starttime, 'YYYY-MM-DD HH24:MI:SS') <=to_char(#{endInHospTime},'YYYY-MM-DD HH24:MI:SS') </if> <if test="inhospno != null ">and b.inhospno = #{inhospno}</if> <if test="fuflag != null ">and b.fuflag = #{fuflag}</if> @@ -540,11 +540,11 @@ from healthy_outhosp <where> - <if test="beginTime != null ">and to_char( admitdate,'YYMMDD') >= - to_char(#{beginTime}::date,'YYMMDD') + <if test="beginTime != null "> + and to_char(admitdate, 'YYYY-MM-DD HH24:MI:SS') >= to_char(#{beginTime}, 'YYYY-MM-DD HH24:MI:SS') </if> - <if test="endTime != null ">and to_char( admitdate,'YYMMDD') <= - to_char(#{endTime}::date,'YYMMDD') + <if test="endTime != null "> + and to_char(admitdate, 'YYYY-MM-DD HH24:MI:SS') <= to_char(#{endTime}, 'YYYY-MM-DD HH24:MI:SS') </if> </where> diff --git a/smartor/src/main/java/com/smartor/domain/smsVO.java b/smartor/src/main/java/com/smartor/domain/smsVO.java new file mode 100644 index 0000000..6295e46 --- /dev/null +++ b/smartor/src/main/java/com/smartor/domain/smsVO.java @@ -0,0 +1,17 @@ +package com.smartor.domain; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel(value = "smsVO", description = "鐭俊") +public class smsVO { + @ApiModelProperty(value = "鎵嬫満鍙�") + private String phone; + + @ApiModelProperty(value = "鐭俊鍐呭") + private String content; + + +} -- Gitblit v1.9.3