Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

wangzhinan 5 years ago
parent
commit
e8c36398a1

+ 9 - 14
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionExpressageService.java

@ -1,34 +1,24 @@
package com.yihu.jw.hospital.prescription.service;
package com.yihu.jw.hospital.prescription.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.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.sf.SfConfigDO;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.util.SFUtils;
import com.yihu.jw.hospital.prescription.service.entrance.util.SFUtils;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientKit;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.utils.sfutils.HttpClientUtils;
import com.yihu.jw.utils.sfutils.HttpClientUtils;
import com.yihu.jw.utils.sfutils.SHAUtils;
import com.yihu.jw.utils.sfutils.SHAUtils;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.ContentType;
import org.apache.http.message.BasicNameValuePair;
import org.dom4j.Document;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.Element;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionDefinition;
@ -104,10 +94,15 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti
     */
     */
    private String SFExpressPost(String xml)throws Exception{
    private String SFExpressPost(String xml)throws Exception{
        String verifyCode = SFUtils.verifyCodeSFXmlStr(xml,sf_check_word);
        String verifyCode = SFUtils.verifyCodeSFXmlStr(xml,sf_check_word);
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("xml", xml));
        params.add(new BasicNameValuePair("verifyCode", verifyCode));
        String re = HttpClientKit.post(sf_url, params, "UTF-8");
//        List<NameValuePair> params = new ArrayList<>();
//        params.add(new BasicNameValuePair("xml", xml));
//        params.add(new BasicNameValuePair("verifyCode", verifyCode));
    
        JSONObject j =  addOrder();
        j.put("xml",xml);
        j.put("verifyCode",verifyCode);
        
        String re = HttpClientUtils.doPost(sf_url, j.toJSONString(), ContentType.APPLICATION_JSON);
        return re;
        return re;
    }
    }

+ 14 - 1
business/base-service/src/main/java/com/yihu/jw/wechat/enterprise/EnterpriseService.java

@ -154,7 +154,20 @@ public class EnterpriseService {
        }
        }
        return "";
        return "";
    }
    }
    
    /**
     *
     * @param enterpriseId
     * @param doctor
     * @param appid
     * @param page
     * @param title
     * @param description (不能超过12个字符)
     * @param emphasis_first_item
     * @param content_item
     * @return
     * @throws Exception
     */
    public String sendXCXMesByDoctor(String enterpriseId, String doctor, String appid,String page, String title, String description, Boolean emphasis_first_item, String content_item)throws Exception {
    public String sendXCXMesByDoctor(String enterpriseId, String doctor, String appid,String page, String title, String description, Boolean emphasis_first_item, String content_item)throws Exception {
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);

+ 16 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/service/OauthSsoService.java

@ -124,6 +124,22 @@ public class OauthSsoService {
                    rs.put("code",1);
                    rs.put("code",1);
                    rs.put("mes","获取居民信息成功");
                    rs.put("mes","获取居民信息成功");
                    rs.put("patient",basePatientDO);
                    rs.put("patient",basePatientDO);
                    List<BasePatientWechatDo> wechatDos = basePatientWechatDao.findByWechatIdAndPatientId(appId,basePatientDO.getId());
                    if(wechatDos!=null&&wechatDos.size()>0){
                        for(BasePatientWechatDo wechatDo:wechatDos){
                            wechatDo.setOpenid(openid);
                        }
                        basePatientWechatDao.save(wechatDos);
                    }else {
                        //保存openid
                        BasePatientWechatDo wechatDo = new BasePatientWechatDo();
                        wechatDo.setOpenid(openid);
                        wechatDo.setPatientId(basePatientDO.getId());
                        wechatDo.setWechatId(appId);
                        basePatientWechatDao.save(wechatDo);
                    }
                    return rs;
                    return rs;
                }
                }

+ 44 - 6
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/FileUploadController.java

@ -59,9 +59,27 @@ public class FileUploadController extends EnvelopRestEndpoint {
    public ObjEnvelop<UploadVO> uploadImg(@ApiParam(value = "文件", required = true)
    public ObjEnvelop<UploadVO> uploadImg(@ApiParam(value = "文件", required = true)
                                       @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
                                       @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
        // 得到文件的完整名称  xxx.txt
        // 得到文件的完整名称  xxx.txt
        String originalFilename = file.getOriginalFilename();
        InputStream inputStream = file.getInputStream();
        UploadVO uploadVO = fileUploadService.uploadImg(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
//        String originalFilename = file.getOriginalFilename();
//        InputStream inputStream = file.getInputStream();
//        UploadVO uploadVO = fileUploadService.uploadImg(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
//        return success("上传成功", uploadVO);
        UploadVO uploadVO = new UploadVO();
        if (isClose.equalsIgnoreCase("1")){
            Map<String, Object> map = fileUploadService.uploadImg(file);
            uploadVO.setFullUri(map.get("accessory").toString());
        }else if(isClose.equals("2")){
            //内网上传
            String rs = fileUploadService.request(remote_inner_url,file,null);
            logger.info(rs);
            JSONObject json = JSON.parseObject(rs);
            uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
        }else {
            // 得到文件的完整名称  xxx.txt
            String originalFilename = file.getOriginalFilename();
            InputStream inputStream = file.getInputStream();
            uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
        }
        return success("上传成功", uploadVO);
        return success("上传成功", uploadVO);
    }
    }
@ -70,10 +88,30 @@ public class FileUploadController extends EnvelopRestEndpoint {
    @ApiOperation(value = "文件流上传附件", notes = "文件流上传附件")
    @ApiOperation(value = "文件流上传附件", notes = "文件流上传附件")
    public ObjEnvelop<UploadVO> uploadAttachment(@ApiParam(value = "文件", required = true)
    public ObjEnvelop<UploadVO> uploadAttachment(@ApiParam(value = "文件", required = true)
                                       @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
                                       @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
        String originalFilename = file.getOriginalFilename();
        InputStream inputStream = file.getInputStream();
        UploadVO uploadVO = fileUploadService.uploadAttachment(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
//        String originalFilename = file.getOriginalFilename();
//        InputStream inputStream = file.getInputStream();
//
//    UploadVO uploadVO = fileUploadService.uploadAttachment(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
//        return success("上传成功", uploadVO);
        UploadVO uploadVO = new UploadVO();
        if (isClose.equalsIgnoreCase("1")){
            Map<String, Object> map = fileUploadService.uploadImg(file);
            uploadVO.setFullUri(map.get("accessory").toString());
        }else if(isClose.equals("2")){
            //内网上传
            String rs = fileUploadService.request(remote_inner_url,file,null);
            logger.info(rs);
            JSONObject json = JSON.parseObject(rs);
            uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
        }else {
            // 得到文件的完整名称  xxx.txt
            String originalFilename = file.getOriginalFilename();
            InputStream inputStream = file.getInputStream();
            uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
        }
        return success("上传成功", uploadVO);
        return success("上传成功", uploadVO);
//        return uploadStream(file);
    }
    }
//    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM)
//    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM)

+ 28 - 5
svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java

@ -73,7 +73,7 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
        userDO.setLoginFailureCount(0);
        userDO.setLoginFailureCount(0);
        String password = userDO.getPassword();
        String password = userDO.getPassword();
        if (StringUtils.isEmpty(password)) {
        if (StringUtils.isEmpty(password)) {
            password = userDO.getIdcard().substring(0, 5);
            password = userDO.getIdcard().substring(userDO.getIdcard().length()-6,userDO.getIdcard().length());
        }
        }
        userDO.setPassword(MD5.md5Hex(password + "{" + userDO.getSalt() + "}"));
        userDO.setPassword(MD5.md5Hex(password + "{" + userDO.getSalt() + "}"));
        return userDao.save(userDO);
        return userDao.save(userDO);
@ -92,7 +92,7 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
        userDO.setLoginFailureCount(0);
        userDO.setLoginFailureCount(0);
        String password = userDO.getPassword();
        String password = userDO.getPassword();
        if (StringUtils.isEmpty(password)) {
        if (StringUtils.isEmpty(password)) {
            password = userDO.getMobile().substring(0, 5);
            password = userDO.getMobile().substring(userDO.getMobile().length()-6, userDO.getMobile().length());
        }
        }
        userDO.setPassword(MD5.md5Hex(password + "{" + userDO.getSalt() + "}"));
        userDO.setPassword(MD5.md5Hex(password + "{" + userDO.getSalt() + "}"));
        return userDao.save(userDO);
        return userDao.save(userDO);
@ -272,7 +272,7 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
        }
        }
        JSONObject returnMsg = new JSONObject();
        JSONObject returnMsg = new JSONObject();
        returnMsg.put("username",userDO.getUsername());
        returnMsg.put("username",userDO.getUsername());
        returnMsg.put("password",userDO.getSalt());
        returnMsg.put("password",userDO.getIdcard().substring(userDO.getIdcard().length()-6,userDO.getIdcard().length()));
        result.put("response", ConstantUtils.SUCCESS);
        result.put("response", ConstantUtils.SUCCESS);
        result.put("msg", returnMsg);
        result.put("msg", returnMsg);
        return result;
        return result;
@ -440,9 +440,32 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
            result.put("msg","user not exist for id : " + userId);
            result.put("msg","user not exist for id : " + userId);
            return result;
            return result;
        }
        }
        registerWithIdcard(user);
//        registerWithIdcard(user);
        String idcard = user.getIdcard();
        String mobile = user.getMobile();
        String password = null;
        if(!StringUtils.isEmpty(password)&&idcard.length()>10){
            password = idcard.substring(idcard.length()-6,idcard.length());
        }else if(!StringUtils.isEmpty(mobile)&&mobile.length()>=11){
            password = mobile.substring(mobile.length()-6,mobile.length());
        }
        if(StringUtils.isEmpty(password)){
            result.put("response", ConstantUtils.FAIL);
            result.put("msg","idcard or moblie not exist : " + userId);
            return result;
        }
        user.setSalt(randomString(5));
        user.setEnabled(true);
        user.setLocked(false);
        user.setLoginFailureCount(0);
        user.setPassword(MD5.md5Hex(password + "{" + user.getSalt() + "}"));
        userDao.save(user);
        result.put("response",ConstantUtils.SUCCESS);
        result.put("response",ConstantUtils.SUCCESS);
        result.put("msg", user.getSalt());
        result.put("msg", password);
        return result;
        return result;
    }
    }

+ 32 - 11
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java

@ -95,6 +95,12 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	@Value("${wlyy.url}")
	@Value("${wlyy.url}")
	private String wlyyUrl;
	private String wlyyUrl;
	
	
	@Value("${qywx.url}")
	private String qywxUrl;
	
	@Value("${qywx.id}")
	private String qywxId;
	
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.records)
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.records)
	@ApiOperation(value = "患者咨询记录查询")
	@ApiOperation(value = "患者咨询记录查询")
	public Envelop records(
	public Envelop records(
@ -411,21 +417,36 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			BasePatientDO p = basePatientDao.findById(re.getString("patient"));
			BasePatientDO p = basePatientDao.findById(re.getString("patient"));
			//发送企业号推送
			//发送企业号推送
			try{
			try{
				String url = "https://hlwyy.xmzsh.com/hlwyy/ims-app-web/#/onlineChat/chatroom?rstitle="+p.getName()+"%20专家咨询&type=1&sessionId="+re.getString("sessiond_id");
				logger.info("发送企业号url:"+url);
				enterpriseService.sendMKMesByMobile("zsyy",d.getMobile(),"您的专家咨询有新的消息,请您尽快回复[查看详情]("+url+")");
				
				
				if("zsyy".equals(qywxId)){
					String url = qywxUrl+"/ims-app-web/#/onlineChat/chatroom?rstitle="+p.getName()+"%20专家咨询&type="+type+"&sessionId="+re.getString("sessiond_id");
					logger.info("发送企业号url:"+url);
					enterpriseService.sendMKMesByMobile(qywxId,d.getMobile(),"您的专家咨询有新的消息,请您尽快回复[查看详情]("+url+")");
				}else if("xm_xzzx_wx".equals(qywxId)){
					String roomUrl = "pages/doctor/onlineChat/chatroom?rstitle="+p.getName()+"%20专家咨询&type="+type+"&sessionId="+re.getString("sessiond_id");
					logger.info("发送企业号url:"+roomUrl);
					enterpriseService.sendXCXMesByDoctor(qywxId,
							re.getString("doctor"),
							"wx53f6bb4ac081d840",
							roomUrl,
							p.getName()+"%20专家咨询","您的专家咨询有新的消息",false,"");
				}else{}
				
				
			}catch (Exception e){
			}catch (Exception e){
				logger.info("发送企业号失败"+e.toString());
				logger.info("发送企业号失败"+e.toString());
			}
			}
			//发送厦门i健康智能推送
			try{
				String wxurl = wlyyUrl+"/im/common/message/sendDoctorTemplateByDoctorIdcard?sessionId="+p.getId()+"_"+d.getId()+"_1&sessionType=1&from="+p.getId()+"&content="+URLEncoder.encode(symptoms)+"&businessType=1&doctor_idcard="+d.getIdcard()+"&patientName="+URLEncoder.encode(p.getName())+"&url=1";
				logger.info("发送厦门i健康智能推送url:"+wxurl);
				wlyyBusinessService.sendDoctorTemplateByDoctorIdcard(wxurl);
			}catch (Exception e){
				logger.info("发送厦门i健康智能失败"+e.toString());
			if(!"zsyy".equals(qywxId) && !"xm_xzzx_wx".equals(qywxId)){
				//发送厦门i健康智能推送
				try{
					String wxurl = wlyyUrl+"/im/common/message/sendDoctorTemplateByDoctorIdcard?sessionId="+p.getId()+"_"+d.getId()+"_1&sessionType=1&from="+p.getId()+"&content="+URLEncoder.encode(symptoms)+"&businessType=1&doctor_idcard="+d.getIdcard()+"&patientName="+URLEncoder.encode(p.getName())+"&url=1";
					logger.info("发送厦门i健康智能推送url:"+wxurl);
					wlyyBusinessService.sendDoctorTemplateByDoctorIdcard(wxurl);
				}catch (Exception e){
					logger.info("发送厦门i健康智能失败"+e.toString());
				}
			}
			}
		}
		}
		return success("操作成功", consult);
		return success("操作成功", consult);
	}
	}

+ 33 - 1
svr/svr-internet-hospital/src/main/resources/application.yml

@ -150,6 +150,10 @@ FileTempPath:
  image_path : /var/local/upload/images
  image_path : /var/local/upload/images
  voice_path : /var/local/upload/voice
  voice_path : /var/local/upload/voice
  chat_file_path : /var/local/upload/chat
  chat_file_path : /var/local/upload/chat
qywx:
  url: 2
  id: 2
---
---
spring:
spring:
  profiles: jwtest
  profiles: jwtest
@ -220,6 +224,10 @@ testPattern:
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wlyy:
wlyy:
  url: http://ehr.yihu.com/wlyy/
  url: http://ehr.yihu.com/wlyy/
qywx:
  url: 2
  id: 1
---
---
spring:
spring:
  profiles: jwprod
  profiles: jwprod
@ -292,6 +300,10 @@ testPattern:
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wlyy:
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
  url: http://www.xmtyw.cn/wlyytest/
qywx:
  url: https://hlwyy.xmzsh.com/hlwyy
  id: zsyy
---
---
spring:
spring:
  profiles: jwOracleTest
  profiles: jwOracleTest
@ -370,6 +382,10 @@ testPattern:
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wlyy:
wlyy:
  url: http://ehr.yihu.com/wlyy/
  url: http://ehr.yihu.com/wlyy/
qywx:
  url: 2
  id: 1
---
---
spring:
spring:
  profiles: jwOracleProd
  profiles: jwOracleProd
@ -448,6 +464,10 @@ testPattern:
wlyy:
wlyy:
  url: http://ehr.yihu.com/wlyy/
  url: http://ehr.yihu.com/wlyy/
qywx:
  url: 2
  id: 1
---
---
##==心脏中心 ===============================================================================
##==心脏中心 ===============================================================================
spring:
spring:
@ -519,6 +539,10 @@ testPattern:
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wlyy:
wlyy:
  url: http://ehr.yihu.com/wlyy/
  url: http://ehr.yihu.com/wlyy/
qywx:
  url: https://ih.xmheart.com/hlwyy/
  id: xm_xzzx_wx
---
---
##==心脏中心外 ===============================================================================
##==心脏中心外 ===============================================================================
spring:
spring:
@ -592,6 +616,10 @@ testPattern:
wlyy:
wlyy:
  url: http://ehr.yihu.com/wlyy/
  url: http://ehr.yihu.com/wlyy/
qywx:
  url: https://ih.xmheart.com/hlwyy/
  id: xm_xzzx_wx
---
---
##==厦门卫计委 ===============================================================================
##==厦门卫计委 ===============================================================================
spring:
spring:
@ -663,4 +691,8 @@ es:
  host:  http://172.16.100.240:9200
  host:  http://172.16.100.240:9200
  tHost: 172.16.100.240:9300
  tHost: 172.16.100.240:9300
  clusterName: jkzl
  clusterName: jkzl
  securityUser: lion:jkzlehr
  securityUser: lion:jkzlehr
qywx:
  url: 1
  id: 2