瀏覽代碼

Merge branch 'dev' of liubing/wlyy2.0 into dev

liubing 3 年之前
父節點
當前提交
cd5ff6ad90

+ 61 - 2
business/sms-service/src/main/java/com/yihu/jw/sms/service/TXYSmsService.java

@ -1,6 +1,7 @@
package com.yihu.jw.sms.service;
package com.yihu.jw.sms.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
@ -36,6 +37,8 @@ public class TXYSmsService {
    @Autowired
    @Autowired
    private StringRedisTemplate redisTemplate;
    private StringRedisTemplate redisTemplate;
    private String key = "hz_yxyzh_wx_sms";
    private String SecretId;
    private String SecretId;
    private String SecretKey;
    private String SecretKey;
    private String signName;
    private String signName;
@ -46,7 +49,6 @@ public class TXYSmsService {
     * 初始化接口参数
     * 初始化接口参数
     */
     */
    private void init(){
    private void init(){
        String key = "hz_yxyzh_wx_sms";
        if(redisTemplate.hasKey(key+ ":SecretId")){
        if(redisTemplate.hasKey(key+ ":SecretId")){
            SecretId = redisTemplate.opsForValue().get(key + ":SecretId");
            SecretId = redisTemplate.opsForValue().get(key + ":SecretId");
            SecretKey = redisTemplate.opsForValue().get(key + ":SecretKey");
            SecretKey = redisTemplate.opsForValue().get(key + ":SecretKey");
@ -56,7 +58,7 @@ public class TXYSmsService {
            return;
            return;
        }
        }
        List<WlyyHospitalSysDictDO> dictDOList = sysDictDao.findByDictName("hz_yxyzh_wx_sms");
        List<WlyyHospitalSysDictDO> dictDOList = sysDictDao.findByDictName(key);
        for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:dictDOList){
        for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:dictDOList){
            if (wlyyHospitalSysDictDO.getDictCode().equalsIgnoreCase("SecretId")){
            if (wlyyHospitalSysDictDO.getDictCode().equalsIgnoreCase("SecretId")){
                SecretId=wlyyHospitalSysDictDO.getDictValue();
                SecretId=wlyyHospitalSysDictDO.getDictValue();
@ -115,4 +117,61 @@ public class TXYSmsService {
        return "error";
        return "error";
    }
    }
    /**
     *
     * @param mobile
     * @param str {"templateCode":"VerificationCode","templateParamArr":["param1","param2","param3"]}
     * @return
     */
    public String sendMessageJson(String mobile,String str){
        try {
            init();
            Credential cred = new Credential(SecretId, SecretKey);
            JSONObject jsonObj = new JSONObject();
            try {
                jsonObj = JSONObject.parseObject(str);
                logger.info("字符串转JSONObject报错:"+str);
            }catch (Exception e){
                return "error";
            }
            String templateId = redisTemplate.opsForValue().get(key + ":"+jsonObj.getString("templateCode"));
            JSONArray templateParamArr = jsonObj.getJSONArray("templateParamArr");
            String[] templateParamSet1 = templateParamArr.toArray(new String[0]);
            HttpProfile httpProfile = new HttpProfile();
            httpProfile.setEndpoint("sms.tencentcloudapi.com");
            ClientProfile clientProfile = new ClientProfile();
            clientProfile.setHttpProfile(httpProfile);
            SmsClient client = new SmsClient(cred, "ap-nanjing", clientProfile);
            SendSmsRequest req = new SendSmsRequest();
            String[] phoneNumberSet1 = {"+86"+mobile};
            req.setPhoneNumberSet(phoneNumberSet1);
            req.setSmsSdkAppId(smsSdkAppId);
            req.setSignName(signName);
            req.setTemplateId(templateId);
            req.setTemplateParamSet(templateParamSet1);
            SendSmsResponse resp = client.SendSms(req);
            JSONObject json = JSON.parseObject(SendSmsResponse.toJsonString(resp));
            String res = json.getJSONArray("SendStatusSet").getJSONObject(0).getString("Code");
            if(!"Ok".equals(res)){
                logger.info("腾讯短信发送失败:"+SendSmsResponse.toJsonString(resp));
            }
            return res;
        }catch (TencentCloudSDKException e){
            e.printStackTrace();
            logger.info("腾讯短信报错:"+e.toString());
        }
        return "error";
    }
}
}

+ 3 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/org/BaseOrgEndpoint.java

@ -145,11 +145,13 @@ public class BaseOrgEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "codeOrName", required = false) String codeOrName,
            @RequestParam(value = "codeOrName", required = false) String codeOrName,
            @ApiParam(name = "orgStatus", value = "机构状态")
            @ApiParam(name = "orgStatus", value = "机构状态")
            @RequestParam(value = "orgStatus", required = false) String orgStatus,
            @RequestParam(value = "orgStatus", required = false) String orgStatus,
            @ApiParam(name = "orgType", value = "机构类型: 1.等级医院 2.社区医院3.养老机构 4.教育机构")
            @RequestParam(value = "orgType", required = false) String orgType,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
            @RequestParam(value = "size") int size) throws Exception {
        JSONObject result = baseOrgService.queryOrgBaseInfoList(codeOrName, orgStatus,page,size,wechatId);
        JSONObject result = baseOrgService.queryOrgBaseInfoList(codeOrName, orgStatus,orgType,page,size,wechatId);
        return success(result.getJSONArray("msg"),result.getInteger("count"),page,size);
        return success(result.getJSONArray("msg"),result.getInteger("count"),page,size);
    }
    }

+ 4 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java

@ -86,7 +86,7 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
     * @param orgStatus
     * @param orgStatus
     * @return
     * @return
     */
     */
    public JSONObject queryOrgBaseInfoList(String codeOrName,String orgStatus,int page,int size,String wechatId) throws Exception {
    public JSONObject queryOrgBaseInfoList(String codeOrName,String orgStatus,String orgType,int page,int size,String wechatId) throws Exception {
        JSONObject result = new JSONObject();
        JSONObject result = new JSONObject();
        int start = 0 == page ? page++ : (page - 1) * size;
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : page * size;
        int end = 0 == size ? 15 : page * size;
@ -151,6 +151,9 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
                if (!StringUtil.isBlank(orgStatus)){
                if (!StringUtil.isBlank(orgStatus)){
                    sql+=" and del = '"+orgStatus+"'";
                    sql+=" and del = '"+orgStatus+"'";
                }
                }
                if (!StringUtil.isBlank(orgType)){
                    sql+=" and type = '"+orgType+"'";
                }
                sql+="  ORDER BY\n" +
                sql+="  ORDER BY\n" +
                        "\tcreate_time DESC";
                        "\tcreate_time DESC";
                String finalSql = sql;
                String finalSql = sql;

+ 4 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/org/OrgEndpoint.java

@ -26,9 +26,11 @@ public class OrgEndpoint extends EnvelopRestEndpoint {
    public ListEnvelop findOrgList(@ApiParam(name = "type", value = "机构类型1. 等级医院2. 社区医院3.  养老机构")
    public ListEnvelop findOrgList(@ApiParam(name = "type", value = "机构类型1. 等级医院2. 社区医院3.  养老机构")
                                      @RequestParam(value = "type", required = false) String type,
                                      @RequestParam(value = "type", required = false) String type,
                                      @ApiParam(name = "name", value = "机构名称")
                                      @ApiParam(name = "name", value = "机构名称")
                                      @RequestParam(value = "name", required = false) String name) {
                                      @RequestParam(value = "name", required = false) String name,
                                      @ApiParam(name = "orgCode", value = "orgCode")
                                      @RequestParam(value = "orgCode", required = false) String orgCode) {
        try {
        try {
            return ListEnvelop.getSuccess("获取成功",orgService.findOrgList(type,name));
            return ListEnvelop.getSuccess("获取成功",orgService.findOrgList(type,name,orgCode));
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
            return ListEnvelop.getError("获取失败");
            return ListEnvelop.getError("获取失败");

+ 22 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultTeamService.java

@ -24,9 +24,13 @@ import com.yihu.jw.im.dao.ConsultTeamDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.sms.service.TXYSmsService;
import com.yihu.jw.sms.service.ZBSmsService;
import com.yihu.jw.utils.EntityUtils;
import com.yihu.jw.utils.EntityUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.apache.poi.ss.formula.functions.T;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
@ -67,7 +71,10 @@ public class ConsultTeamService {
    private PatientDoorCoachOrderService doorCoachOrderService;
    private PatientDoorCoachOrderService doorCoachOrderService;
    @Autowired
    @Autowired
    private PatientDoorCoachOrderService patientDoorCoachOrderService;
    private PatientDoorCoachOrderService patientDoorCoachOrderService;
    @Autowired
    private TXYSmsService txySmsService;
    private Logger logger= LoggerFactory.getLogger(ConsultTeamService.class);
    public JSONObject updateIMMsg(String sessionId,String sessionType,String msgId,String content){
    public JSONObject updateIMMsg(String sessionId,String sessionType,String msgId,String content){
        JSONObject result = new JSONObject();
        JSONObject result = new JSONObject();
@ -308,6 +315,21 @@ public class ConsultTeamService {
        String orderHospital = doorServiceOrderDO.getHospital();
        String orderHospital = doorServiceOrderDO.getHospital();
        List<Map<String,Object>> dispatcherInfoList =  doorCoachOrderService.queryDispatcherInfoByHospital(orderHospital);
        List<Map<String,Object>> dispatcherInfoList =  doorCoachOrderService.queryDispatcherInfoByHospital(orderHospital);
        for (Map<String,Object> tmp:dispatcherInfoList){
        for (Map<String,Object> tmp:dispatcherInfoList){
            //发送短信给调度员 您有一条新的上门辅导申请,请进入调度平台处理。
            BaseDoctorDO doctorDO = doctorDao.findById(tmp.get("code").toString());
            if (doctorDO.getMobile()!=null){
                JSONObject sendObj = new JSONObject();
                sendObj.put("templateCode","VerificationCode");
                JSONArray paramArr = new JSONArray();
                paramArr.add("123123123123");
                sendObj.put("templateParamArr",paramArr);
                try {
                    txySmsService.sendMessageJson(doctorDO.getMobile(),sendObj.toJSONString());
                }catch (Exception e){
                    logger.info("发送腾讯短信给调度员报错:{"+doctorDO.getMobile()+"},"+sendObj.toJSONString());
                }
            }
            participants.put(tmp.get("code").toString(), 0);
            participants.put(tmp.get("code").toString(), 0);
        }
        }
        String content = patientDO.getName() + "-发起上门辅导服务咨询";
        String content = patientDO.getName() + "-发起上门辅导服务咨询";

+ 5 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/org/BaseOrgService.java

@ -19,7 +19,7 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
    @Autowired
    @Autowired
    private BaseOrgDao orgDao;
    private BaseOrgDao orgDao;
    public List<BaseOrgDO> findOrgList(String type,String name){
    public List<BaseOrgDO> findOrgList(String type,String name,String orgCode){
        String sql = "select a.* from base_org a where a.del = 1";
        String sql = "select a.* from base_org a where a.del = 1";
        if(!StringUtil.isBlank(type)){
        if(!StringUtil.isBlank(type)){
            sql += " and a.type = '"+type+"' ";
            sql += " and a.type = '"+type+"' ";
@ -28,6 +28,10 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
            sql += " and a.name like '%"+name+"%' ";
            sql += " and a.name like '%"+name+"%' ";
        }
        }
        if(!StringUtil.isBlank(orgCode)){
            sql += " and a.code = '"+orgCode+"' ";
        }
        return jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(BaseOrgDO.class));
        return jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(BaseOrgDO.class));
    }
    }