Procházet zdrojové kódy

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

wangzhinan před 5 roky
rodič
revize
894b74a40a

+ 26 - 0
business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorService.java

@ -10,6 +10,7 @@ import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import net.sf.json.JSONObject;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
@ -21,6 +22,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.Random;
@Service
public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDao> {
@ -251,4 +253,28 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        baseDoctorDao.updateStatus(doctorId,status);
    }
    public Boolean updateDoctorPw(String id,String pw){
        BaseDoctorDO doctorDO = baseDoctorDao.findOne(id);
        //认证信息设置
        String salt = randomString(5);
        doctorDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
        doctorDO.setSalt(salt);
        baseDoctorDao.save(doctorDO);
        return true;
    }
    public String randomString(int length) {
        String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        StringBuffer buffer = new StringBuffer();
        Random random = new Random();
        for(int i = 0; i < length; ++i) {
            int pos = random.nextInt(str.length());
            buffer.append(str.charAt(pos));
        }
        return buffer.toString();
    }
}

+ 16 - 5
business/base-service/src/main/java/com/yihu/jw/file_upload/FileUploadService.java

@ -3,7 +3,6 @@ package com.yihu.jw.file_upload;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.fastdfs.FastDFSUtil;
import com.yihu.jw.exception.business.file_upload.*;
import com.yihu.jw.hospital.prescription.service.PrescriptionExpressageService;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
@ -23,9 +22,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.activation.MimetypesFileTypeMap;
import java.io.*;
import java.net.URLDecoder;
import java.nio.charset.Charset;
@ -206,7 +204,7 @@ public class FileUploadService {
    
    
    /**
     * 调用健康上传语音文件
     * 调用健康上传语音文件.
     * @param voices_Path
     * @return
     * @throws Exception
@ -217,10 +215,21 @@ public class FileUploadService {
        FastDFSUtil fastDFSUtil = new FastDFSUtil();
        String fileUrls = "";
        File f = new File(voices_Path);
        logger.info("语音文件转换file");
        if (f.exists()) {
            logger.info("语音文件转换file-start");
            FileInputStream input = new FileInputStream(f);
            MultipartFile multipartFile = new MockMultipartFile("file", f.getName(), "text/plain", IOUtils.toByteArray(input));
            String fileContenType = "text/plain";
            try {
                logger.info("获取文件类型--开始");
                fileContenType = new MimetypesFileTypeMap().getContentType(f);
                logger.info("获取文件类型--成功--fileContenType:"+fileContenType);
            } catch (Exception e) {
                logger.info("获取文件类型--失败:"+e.getMessage());
            }
            
            MultipartFile multipartFile = new MockMultipartFile("file", f.getName(), fileContenType, IOUtils.toByteArray(input));
            logger.info("语音文件转换file-转换-multipartFile");
            long size = multipartFile.getSize();
            if(size<=0){
//                map.put("uploadStatus",1);//size小于0
@ -238,11 +247,13 @@ public class FileUploadService {
//            map.put("accessoryUrl",null);//
//            return map;
//        }
            logger.info("语音文件转换file-转换-multipartFile-成功,开始调用i健康接口上传文件");
            String response = request(wlyyUrl + "/upload/chat", multipartFile, null);
            org.json.JSONObject rs = new org.json.JSONObject(response);
            Integer status = (Integer) rs.get("status");
            if (status == 200) {
                url = rs.get("urls") + "";
                logger.info("开始调用i健康接口上传文件成功:url:"+url);
//                map.put("uploadStatus", 0);//文件类型正确
//                map.put("accessory", url);//
                return url;

+ 13 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -869,12 +869,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            sql+= " AND h.org_code = '"+orgCode+"'";
        }
        if(StringUtils.isNotBlank(chargeType)){
            sql+=" AND d.charge_type ='"+chargeType+"'";
            if("all".equals(chargeType)){
                //查询全部号源
            }else{
                sql+=" AND d.charge_type ='"+chargeType+"'";
            }
        }else{
            sql+=" AND d.charge_type is not null ";
        }
        if(StringUtils.isNotBlank(outpatientType)){
            sql+=" AND d.outpatient_type like'%"+outpatientType+"%'";
            if("all".equals(outpatientType)){
                //查询全部权限
            }else{
                sql+=" AND d.outpatient_type like'%"+outpatientType+"%'";
            }
        }else{
            sql+=" AND d.outpatient_type is not null ";
        }
@ -896,6 +904,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    " AND t.start_time <='"+endDate+"'"+
                    " )";
        }
        logger.info("findDoctorByHospitalAndDept sql:"+sql);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list!=null&&list.size()>0&&StringUtils.isNotBlank(doctorCode)){

+ 4 - 2
business/base-service/src/main/java/com/yihu/jw/wechat/service/WechatInfoService.java

@ -58,7 +58,7 @@ public class WechatInfoService {
     */
    public String getJsapi_ticketByToken(String wxId) throws Exception {
        try {
            
            System.out.println("getJsapi_ticketByToken="+wxId);
            Iterable<JsApiTicket> jsapiTickets = null;
            WxWechatDO wxWechat = null;
            
@ -88,12 +88,13 @@ public class WechatInfoService {
            }else{
                token = wxAccessTokenService.getWxAccessTokenById(wxId).getAccessToken();
            }
            
            System.out.println("getticket_token:"+token);
            if (token != null) {
                String token_url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket";
                String params = "access_token=" + token + "&type=jsapi";
                String result = HttpUtil.sendGet(token_url, params);
                JSONObject json = new JSONObject(result);
                System.out.println("getticket:"+result);
                if (json.has("ticket")) {
                    String ticket = json.get("ticket").toString();
                    String expires_in = json.get("expires_in").toString();
@ -115,6 +116,7 @@ public class WechatInfoService {
                return null;
            }
        } catch (Exception e) {
            System.out.println(e.getMessage());
            throw new Exception(e.getMessage());
        }
    }

+ 3 - 2
business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java

@ -393,6 +393,7 @@ public class WlyyBusinessService {
                        org.setTownName(h.getString("townName"));
                        org.setType("1");
                        org.setWinNo("-1");
                        org.setDel("1");
                        baseOrgDao.save(org);
                        addCount++;
                    }
@ -439,7 +440,7 @@ public class WlyyBusinessService {
            logger.info("doctors size:"+doctors.size());
            if(doctors!=null&&doctors.size()>0){
                //获取全部职称
                //获取全部职称.
                List<Map<String,Object>> dutys = findDutys();
                for(int i=0;i<doctors.size();i++){
@ -487,7 +488,7 @@ public class WlyyBusinessService {
                                doctor.setCityName(doctorJson.getString("cityName"));
                                doctor.setExpertise(doctorJson.getString("expertise"));
                                doctor.setIntroduce(doctorJson.getString("introduce"));
                                doctor.setOutpatientType("zj");
                                //认证信息设置
                                String salt = randomString(5);
                                String pw = idcard.substring(idcard.length() - 6);

+ 32 - 23
business/es-service/src/main/java/com/yihu/jw/es/es/ElasticFactory.java

@ -19,6 +19,7 @@ import java.util.Arrays;
import java.util.concurrent.TimeUnit;
/**
 * 中山医院版本
 * Created by chenweida on 2017/6/5.
 */
@ -34,6 +35,8 @@ public class ElasticFactory {
    private String clusterName;
    @Value("${es.securityUser}")
    private String securityUser;
    @Value("${es.pwflag}")
    private String pwflag;
//-----------------------------------jestClient----------------------------------------
    /**
@ -75,7 +78,12 @@ public class ElasticFactory {
    public Client getTransportClient() {
        try {
            initTranClient();
            //1需要加密初始化
            if("1".equals(pwflag)){
                initTranClientPw();
            }else {
                initTranClient();
            }
            return transportClient;
        } catch (Exception e) {
            e.printStackTrace();
@ -85,37 +93,36 @@ public class ElasticFactory {
    /**
     * 9300
     *
     * 互联网医院版本需要密码
     * @throws UnknownHostException
     */
//    private synchronized void initTranClient() throws UnknownHostException {
//        if (transportClient == null) {
//            String[] hosts = tHost.split(",");
//            Settings settings = Settings.settingsBuilder()
//                    // .put("client.transport.sniff", true)//开启嗅探功能
//                    .put("cluster.name", StringUtils.isEmpty(clusterName) ? "jkzl" : clusterName)//默认集群名字是jkzl
//                    .build();
//
//            transportClient = TransportClient.builder().settings(settings).build();
//
//            for (String oneHost : hosts) {
//                String[] hostAndport = oneHost.split(":");
//                transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(hostAndport[0]), Integer.valueOf(hostAndport[1])));
//            }
//        }
//    }
    private synchronized void initTranClientPw() throws Exception {
        if (transportClient == null) {
            String[] hosts = tHost.split(",");
            Settings settings = getSettings();
            transportClient = TransportClient.builder().addPlugin(ShieldPlugin.class).settings(settings).build();
            for (String oneHost : hosts) {
                String[] hostAndport = oneHost.split(":");
                transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(hostAndport[0]), Integer.valueOf(hostAndport[1])));
            }
        }
    }
    /**
     * 9300
     *
     * 厦门I健康版本不需要密码
     * @throws UnknownHostException
     */
    private synchronized void initTranClient() throws Exception {
    private synchronized void initTranClient() throws UnknownHostException {
        if (transportClient == null) {
            String[] hosts = tHost.split(",");
            Settings settings = getSettings();
            transportClient = TransportClient.builder().addPlugin(ShieldPlugin.class).settings(settings).build();
            Settings settings = Settings.settingsBuilder()
                    // .put("client.transport.sniff", true)//开启嗅探功能
                    .put("cluster.name", StringUtils.isEmpty(clusterName) ? "jkzl" : clusterName)//默认集群名字是jkzl
                    .build();
            transportClient = TransportClient.builder().settings(settings).build();
            for (String oneHost : hosts) {
                String[] hostAndport = oneHost.split(":");
                transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(hostAndport[0]), Integer.valueOf(hostAndport[1])));
@ -123,6 +130,7 @@ public class ElasticFactory {
        }
    }
    /**
     * 配置连接
     * @return
@ -136,5 +144,6 @@ public class ElasticFactory {
        settingBuilder.put("transport.address.list", tHost);
        return settingBuilder.build();
    }
}

+ 10 - 2
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -569,6 +569,7 @@ public class ImService {
		String voiceIds = "";
		try {
			String voices = request.getParameter("voices");
			System.out.println("voices"+voices);
			if (org.apache.commons.lang3.StringUtils.isEmpty(voices)) {
				return voices;
			}
@ -602,12 +603,17 @@ public class ImService {
	public String saveVoiceToDisk(String mediaId,String wechat_appid) throws Exception {
		// 文件保存的临时路径
		String tempPath = upload_temp_path + File.separator;
		System.out.println("tempPath:"+tempPath);
		// 拼接年月日路径
		String datePath = DateUtil.getStringDate("yyyy") + File.separator + DateUtil.getStringDate("MM") + File.separator + DateUtil.getStringDate("dd") + File.separator;
		System.out.println("datePath:"+datePath);
		// 重命名文件
		String fileBase =  DateUtil.dateToStr(new Date(), DateUtil.YYYYMMDDHHMMSS) + "_" + new Random().nextInt(1000);
		System.out.println("fileBase:"+fileBase);
		String newFileName = fileBase+ ".amr";
		String mp3FileName  = fileBase + ".mp3";
		System.out.println("newFileName:"+newFileName);
		System.out.println("mp3FileName:"+mp3FileName);
		// 保存路径
		File uploadFile = new File(tempPath + datePath + newFileName);
		
@ -626,9 +632,11 @@ public class ImService {
			}
			String amrFilePath = tempPath+datePath+newFileName;
			String Mp3FilePath = tempPath+datePath+mp3FileName;
			fileUtil.changeToMp3(amrFilePath,Mp3FilePath);
			System.out.println("amrFilePath:"+amrFilePath);
			System.out.println("Mp3FilePath:"+Mp3FilePath);
//			fileUtil.changeToMp3(amrFilePath,Mp3FilePath);
			// 返回保存路径
			return Mp3FilePath;
			return amrFilePath;
		} catch (IOException e) {
			e.printStackTrace();
		} finally {

+ 1 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -660,6 +660,7 @@ public class BaseHospitalRequestMapping {
        public static final String queryById  = "/queryById";
        public static final String update  = "/update";
        public static final String updateStatus  = "/updateStatus";
        public static final String updateDoctorPw  = "/updateDoctorPw";
    }
    /**

+ 8 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/config/DoctorServiceEndPoint.java

@ -96,4 +96,12 @@ public class DoctorServiceEndPoint extends EnvelopRestEndpoint {
        return success("修改成功");
    }
    @PostMapping(value = BaseHospitalRequestMapping.DoctorSetting.updateDoctorPw)
    @ApiOperation(value = "修改医生账号密码")
    public Envelop updateDoctorPw(@ApiParam(name = "id", value = "医生ID")
                                  @RequestParam(value = "id", required = true)String id,
                                  @ApiParam(name = "pw", value = "密码")
                                  @RequestParam(value = "pw", required = true)String pw)throws Exception{
        return success(baseDoctorService.updateDoctorPw(id,pw));
    }
}

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

@ -234,16 +234,19 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
		//处理语音文件
		if(!org.springframework.util.StringUtils.isEmpty(wechat_appid)){
			String path = imService.fetchWxVoices(wechat_appid);
			logger.info("voice_path:"+path);
			JSONObject obj = new JSONObject();
			String voiceurl = "";
			// 将临时语音拷贝到正式存储路径下
			if (org.apache.commons.lang3.StringUtils.isNotEmpty(path)) {
				if("xm_ihealth_wx".equals(wechat_appid)){
					content = fileUploadService.uploadWxVoice(path);
					logger.info("voice_wx_type:"+wechat_appid);
					voiceurl = fileUploadService.uploadWxVoice(path);
//					uploadVO.setFullUri(map.get("accessory").toString());
				}else{
					content = fileUtil.copyTempVoice(path,fastdfs_file_url);
					voiceurl = fileUtil.copyTempVoice(path,fastdfs_file_url);
				}
				obj.put("path", path);
				obj.put("path", voiceurl);
				obj.put("times", times);
				content = obj.toString();
			}
@ -488,7 +491,8 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	                       @RequestParam(value = "pageUrl", required = true)String pageUrl,
	                       @ApiParam(name = "wxId", value = "微信id")
	                       @RequestParam(value = "wxId", required = true)String wxId) throws Exception {
		
		logger.info("pageUrl="+pageUrl);
		logger.info("wxId="+wxId);
		String ticket = wechatInfoService.getJsapi_ticketByToken(wxId);
		WxWechatDO wxWechatDO = wechatDao.findById(wxId);
		Map<Object, Object> map = new HashMap<Object, Object>();
@ -496,7 +500,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			String noncestr = UUID.randomUUID().toString();
			long timestamp = System.currentTimeMillis() / 1000;
			String url = pageUrl;
			logger.info("getSign.url="+url);
			String str = "jsapi_ticket=" + ticket + "&noncestr=" + noncestr + "&timestamp=" + timestamp + "&url=" + url;
			logger.info("getSign.str="+str);
			// sha1加密
			String signature = SHA1(str);
			map.put("noncestr", noncestr);

+ 8 - 0
svr/svr-internet-hospital/src/main/resources/application.yml

@ -133,6 +133,7 @@ im:
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_test
  type:
@ -196,6 +197,7 @@ im:
  data_base_name: im_internet_hospital
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_test
  type:
@ -266,6 +268,7 @@ im:
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_prod
  type:
@ -349,6 +352,7 @@ FileTempPath:
  voice_path : /var/local/upload/voice
  chat_file_path : /var/local/upload/chat
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_test
  type:
@ -422,6 +426,7 @@ FileTempPath:
  voice_path : /var/local/upload/voice
  chat_file_path : /var/local/upload/chat
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_test
  type:
@ -493,6 +498,7 @@ FileTempPath:
  voice_path : /var/local/upload/voice
  chat_file_path : /var/local/upload/chat
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_test
  type:
@ -562,6 +568,7 @@ FileTempPath:
  voice_path : /var/local/upload/voice
  chat_file_path : /var/local/upload/chat
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_prod
  type:
@ -637,6 +644,7 @@ testPattern:
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
es:
  pwflag: 0 # 1需要密码,0不需要密码
  index:
    Statistics: hlw_quota_prod
  type: