浏览代码

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

yeshijie 7 年之前
父节点
当前提交
861f8d4011
共有 30 个文件被更改,包括 1282 次插入129 次删除
  1. 202 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/controller/WeixinBaseController.java
  2. 27 2
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/controller/medicine/PhysicalExaminationController.java
  3. 17 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/wlyy/patient/AccessTokenDao.java
  4. 52 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/AccessTokenService.java
  5. 1 1
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/ExamReportService.java
  6. 16 2
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PhysicalExaminationService.java
  7. 352 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/util/CommonUtil.java
  8. 173 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/util/HttpUtil.java
  9. 20 1
      patient-co-customization/patient-co-modern-medicine/src/main/resources/application.yml
  10. 1 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/yueren/YueRenController.java
  11. 98 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/SignFamily.java
  12. 2 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/family/FamilyMemberService.java
  13. 15 16
      patient-co/patient-co-statistics/src/main/resources/application.yml
  14. 24 3
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/web/quota/JobController.java
  15. 2 2
      patient-co/patient-co-wlyy-job/src/main/resources/application.yml
  16. 二进制
      patient-co/patient-co-wlyy/doc/接口文档/对外接口文档/集美健康教育/集美健康教育对外接口文档.docx
  17. 43 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/hospital/HospitalService.java
  18. 8 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java
  19. 24 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java
  20. 25 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  21. 118 69
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/DoctorService.java
  22. 7 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/gateway/GcTokenService.java
  23. 4 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/ZyDictService.java
  24. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SFUtils.java
  25. 4 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java
  26. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcHospitalController.java
  27. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcTokenController.java
  28. 24 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/doctor/GcDoctorController.java
  29. 12 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/ResultPageListModel.java
  30. 6 3
      patient-co/patient-co-wlyy/src/main/resources/application.yml

+ 202 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/controller/WeixinBaseController.java

@ -0,0 +1,202 @@
package com.yihu.mm.controller;
import com.yihu.mm.service.AccessTokenService;
import com.yihu.mm.util.CommonUtil;
import com.yihu.mm.util.HttpUtil;
import com.yihu.wlyy.entity.security.AccessToken;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.UUID;
public class WeixinBaseController extends BaseController {
	@Autowired
	private AccessTokenService accessTokenService;
	@Value("${wechat.appId}")
	private String appId;
	@Value("${wechat.appSecret}")
	private String appSecret;
	/**
	 * 获取微信的access_token
	 * 
	 * @return
	 */
	public String getAccessToken() {
		try {
			Iterable<AccessToken> accessTokens = accessTokenService.findAccessToken();
			if (accessTokens != null) {
				for (AccessToken accessToken : accessTokens) {
					if ((System.currentTimeMillis() - accessToken.getAdd_timestamp()) < (accessToken.getExpires_in() * 1000)) {
						return accessToken.getAccess_token();
					} else {
						accessTokenService.delAccessToken(accessToken);
						break;
					}
				}
			}
			String token_url = "https://api.weixin.qq.com/cgi-bin/token";
			String params = "grant_type=client_credential&appid=" + appId + "&secret=" + appSecret;
			String result = new HttpUtil().sendGet(token_url, params);
			JSONObject json = new JSONObject(result);
			if (json.has("access_token")) {
				String token = json.get("access_token").toString();
				String expires_in = json.get("expires_in").toString();
				AccessToken newaccessToken = new AccessToken();
				newaccessToken.setAccess_token(token);
				newaccessToken.setExpires_in(Long.parseLong(expires_in));
				accessTokenService.addAccessToken(newaccessToken);
				return token;
			} else {
				return null;
			}
		} catch (Exception e) {
			error(e);
			return null;
		}
	}
	/**
	 * 获取微信服务器语音
	 * 
	 * @return
	 */
	public String fetchWxVoices() {
		String voiceIds = "";
		try {
			String voices = request.getParameter("voices");
			if (StringUtils.isEmpty(voices)) {
				return voices;
			}
			String[] mediaIds = voices.split(",");
			for (String mediaId : mediaIds) {
				if (StringUtils.isEmpty(mediaId)) {
					continue;
				}
				String temp = saveVoiceToDisk(mediaId);
				if (StringUtils.isNotEmpty(temp)) {
					if (voiceIds.length() == 0) {
						voiceIds = temp;
					} else {
						voiceIds += "," + temp;
					}
				}
			}
		} catch (Exception e) {
			error(e);
		}
		return voiceIds;
	}
	/**
	 * 获取下载语音信息
	 * 
	 * @param mediaId 文件的id
	 * @throws Exception
	 */
	public String saveVoiceToDisk(String mediaId) throws Exception {
		// 文件保存的临时路径
		String tempPath = Class.class.getClass().getResource("/").getPath() + "temp/";
		// 重命名文件
		String fileBase = UUID.randomUUID().toString();
		String newFileName = fileBase+ ".amr";
		String mp3FileName  = fileBase + ".mp3";
		// 保存路径
		File uploadFile = new File(tempPath  + newFileName);
		InputStream inputStream = null;
		FileOutputStream fileOutputStream = null;
		try {
			if (!uploadFile.getParentFile().exists()) {
				uploadFile.getParentFile().mkdirs();
			}
			inputStream = getInputStream(mediaId);
			byte[] data = new byte[1024];
			int len = 0;
			fileOutputStream = new FileOutputStream(uploadFile);
			while ((len = inputStream.read(data)) != -1) {
				fileOutputStream.write(data, 0, len);
			}
			String amrFilePath = tempPath+newFileName;
			String Mp3FilePath = tempPath+mp3FileName;
			new CommonUtil().changeToMp3(amrFilePath,Mp3FilePath);
			// 返回保存路径
			return Mp3FilePath;
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (inputStream != null) {
				try {
					inputStream.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			if (fileOutputStream != null) {
				try {
					fileOutputStream.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
		return null;
	}
	/**
	 * 下载多媒体文件(请注意,视频文件不支持下载,调用该接口需http协议)
	 *
	 * @return
	 */
	public InputStream getInputStream(String mediaId) {
		String accessToken = getAccessToken();
		InputStream is = null;
		String url = "http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=" + accessToken + "&media_id=" + mediaId;
		try {
			URL urlGet = new URL(url);
			HttpURLConnection http = (HttpURLConnection) urlGet.openConnection();
			http.setRequestMethod("GET"); // 必须是get方式请求
			http.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
			http.setDoOutput(true);
			http.setDoInput(true);
			System.setProperty("sun.net.client.defaultConnectTimeout", "30000");// 连接超时30秒
			System.setProperty("sun.net.client.defaultReadTimeout", "30000"); // 读取超时30秒
			http.connect();
			// 获取文件转化为byte流
			is = http.getInputStream();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return is;
	}
	/**
	 * 获取Open
	 * @param code
	 * @return
	 * @throws Exception
     */
	public String getOpenId(String code) throws Exception {
		String token_url = "https://api.weixin.qq.com/sns/oauth2/access_token";
		String params = "appid=" + appId+ "&secret=" + appSecret + "&code=" + code + "&grant_type=authorization_code";
		String result = new HttpUtil().sendGet(token_url, params);
		JSONObject json = new JSONObject(result);
		if (json.has("openid")) {
			return json.get("openid").toString();
		} else {
			return null;
		}
	}
}

+ 27 - 2
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/controller/medicine/PhysicalExaminationController.java

@ -2,7 +2,7 @@ package com.yihu.mm.controller.medicine;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.mm.controller.BaseController;
import com.yihu.mm.controller.WeixinBaseController;
import com.yihu.mm.entity.patient.ExamReport;
import com.yihu.mm.entity.patient.PatientExam;
import com.yihu.mm.entity.patient.Report;
@ -29,7 +29,7 @@ import java.util.Map;
@CrossOrigin
@RestController
@RequestMapping(value = "/medicine/physicalExamination")
public class PhysicalExaminationController extends BaseController {
public class PhysicalExaminationController extends WeixinBaseController {
    @Value("${examCode}")
    private String examCode;
@ -181,6 +181,31 @@ public class PhysicalExaminationController extends BaseController {
        return result;
    }
    @ApiOperation(value = "获取微信文件,传到越人接口(四象采集,声音文件需要从微信接口获取)")
    @RequestMapping(value = "/dealVoice", produces="application/json;charset=UTF-8")
    @ResponseBody
    public String getFileFromWechat( @ApiParam(name = "mediaId", value = "微信媒体id", required = true)@RequestParam(required = true, name = "type") String mediaId,
                                   @ApiParam(name = "type", value = "1.脸型  2.舌像  3.声音", required = true)@RequestParam(required = true, name = "type") String type,
                                   @ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id) throws Exception {
        String voice = saveVoiceToDisk(mediaId);
        String uploadAttachment = physicalExaminationService.uploadAttachment(voice);
        JSONObject uploadResult = new JSONObject(uploadAttachment);
        if(physicalExaminationService.getSuccess(uploadResult)){
            JSONObject recordset = uploadResult.getJSONObject("recordset");
            String at_id =  recordset.get("at_id").toString();
            String at_realname = (String) recordset.get("at_realname");
            String result = physicalExaminationService.dillphoneimgdata(at_id, at_realname, type, ct_id);
            return result;
        }
        return uploadAttachment;
    }
    @ApiOperation(value = "四诊资料采集")
    @RequestMapping(value = "/dillphoneimgdata", method = RequestMethod.POST,produces="application/json;charset=UTF-8")
    @ResponseBody

+ 17 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/wlyy/patient/AccessTokenDao.java

@ -0,0 +1,17 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.mm.repository.wlyy.patient;
import com.yihu.wlyy.entity.security.AccessToken;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface AccessTokenDao extends PagingAndSortingRepository<AccessToken, Long> {
	
	@Query("select p from AccessToken p order by p.add_timestamp desc")
	Iterable<AccessToken> findAccessToken();
	
}

+ 52 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/AccessTokenService.java

@ -0,0 +1,52 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.mm.service;
import com.yihu.mm.repository.wlyy.patient.AccessTokenDao;
import com.yihu.wlyy.entity.security.AccessToken;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.utils.Clock;
/**
 * 患者基本信息类.
 * 
 * @author George
 */
@Component
@Transactional(rollbackFor = Exception.class)
public class AccessTokenService {
	@Autowired
	private AccessTokenDao accessTokenDao;
	private Clock clock = Clock.DEFAULT;
	public Iterable<AccessToken> findAccessToken() {
		return accessTokenDao.findAccessToken();
	}
	/**
	 * 添加access_token
	 * @param accessToken
	 */
	public void addAccessToken(AccessToken accessToken) {
		accessToken.setAdd_timestamp(System.currentTimeMillis());
		accessToken.setCzrq(clock.getCurrentDate());
		accessTokenDao.save(accessToken);
	}
	public void delAccessToken(AccessToken accessToken) {
		accessTokenDao.delete(accessToken);
	}
}

+ 1 - 1
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/ExamReportService.java

@ -69,7 +69,7 @@ public class ExamReportService {
            //首先通过patientCode和ctId查找是否存在报告
            examReport = findByPatientAndCtId(patientCode, ctId);
            if(examReport==null){
                //为空,调用接口存入数据库,再次获取
                //为空,调用接口存入数据库
                examReport = physicalExaminationService.saveReportDetail(patientCode, ctId);
                return examReport;
            }

+ 16 - 2
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PhysicalExaminationService.java

@ -200,11 +200,11 @@ public class PhysicalExaminationService {
        return examReport;
    }
    //查找试卷
    //上传图片到越人服务器
    public String uploadAttachment(MultipartFile file) {
        MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
        String fileName = file.getOriginalFilename();
        String filePath =Class.class.getClass().getResource("/").getPath() + "temp/" + System.currentTimeMillis() + fileName;
        String filePath =this.getClass().getResource("/").getPath() + "temp/" + System.currentTimeMillis() + fileName;
        File dest = new File(filePath);
        if (!dest.getParentFile().exists()) {
            dest.getParentFile().mkdirs();
@ -225,4 +225,18 @@ public class PhysicalExaminationService {
        return "{\"status\":500,\"msg\":\"上传文件出错\"}";
    }
    public String uploadAttachment(String filePath) {
        MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
        File dest = new File(filePath);
        RestTemplate rest = new RestTemplate();
        FileSystemResource resource = new FileSystemResource(filePath);
        param.add("file", resource);
        String postStr = rest.postForObject(yuerenApi+"/uploadattachment" , param, String.class);
        if (dest.exists() && dest.isFile()) {
            dest.delete();
        }
        return postStr.replace("exception", "msg");
    }
}

+ 352 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/util/CommonUtil.java

@ -0,0 +1,352 @@
package com.yihu.mm.util;
import it.sauronsoftware.jave.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.*;
@Component
public class CommonUtil {
    @Value("${fastDFS.fastdfs_file_url}")
    private String fastdfs_file_url;
    @Value("${server.server_url}")
    private String server_url;
    /**
     * 获取图片全路径
     *
     * @return
     */
    public  String getPhoneUrl(String url) {
        if (StringUtils.isEmpty(url)) {
            return "";
        } else {
            if (url.indexOf("http") > -1) {
                return url;
            } else {
                return server_url+ url;
            }
        }
    }
    public  String getIdcardEncode(String idcard) {
        if (idcard != null) {
            if (idcard.length() == 18) {
                return idcard.substring(0, 9) + "*******" + idcard.substring(16, 18);
            } else if (idcard.length() == 15) {
                return idcard.substring(0, 8) + "***" + idcard.substring(11, 15);
            }
        }
        return idcard;
    }
    /**
     * 对象转数组
     *
     * @param obj
     * @return
     */
    public  byte[] toByteArray(Object obj) {
        byte[] bytes = null;
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        try {
            ObjectOutputStream oos = new ObjectOutputStream(bos);
            oos.writeObject(obj);
            oos.flush();
            bytes = bos.toByteArray();
            oos.close();
            bos.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        return bytes;
    }
    /**
     * 数组转对象
     *
     * @param bytes
     * @return
     */
    public  Object toObject(byte[] bytes) {
        Object obj = null;
        try {
            ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
            ObjectInputStream ois = new ObjectInputStream(bis);
            obj = ois.readObject();
            ois.close();
            bis.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        } catch (ClassNotFoundException ex) {
            ex.printStackTrace();
        }
        return obj;
    }
    /**
     * 拷贝临时语音文件到存储目录
     *
     * @param voices
     * @return
     * @throws IOException
     */
/*
    public String copyTempVoice(String voices) throws  Exception {
        // 文件保存的临时路径
        String serverUrl = fastdfs_file_url;
        FastDFSUtil fastDFSUtil = new FastDFSUtil();
        String fileUrls = "";
        File f = new File(voices);
        if (f.exists()) {
            String fileName = f.getName();
            InputStream in = new FileInputStream(f);
            ObjectNode result = fastDFSUtil.upload(in, fileName.substring(fileName.lastIndexOf(".") + 1), "");
            in.close();
            if (result != null) {
                fileUrls += (StringUtils.isEmpty(fileUrls) ? "" : ",") + serverUrl
                        + result.get("groupName").toString().replaceAll("\"", "") + "/"
                        + result.get("remoteFileName").toString().replaceAll("\"", "");
                f.delete();
            }
        }
        return fileUrls;
    }
*/
    /**
     * double转字符串,在转int
     * double*100转int 有bug 34.3会会变成3429
     * @param d
     * @return
     */
    public static Integer doubleToInt(Double d){
        if(d==null){
            return 0;
        }
        String currency = String.valueOf(d);
        int index = currency.indexOf(".");
        int length = currency.length();
        Integer amLong = 0;
        if(index == -1){
            amLong = Integer.valueOf(currency+"00");
        }else if(length - index >= 3){
            amLong = Integer.valueOf((currency.substring(0, index+3)).replace(".", ""));
            if(length-index>3){
                if(Integer.valueOf(currency.substring(index+3,index+4))>=5){
                    amLong++;
                }
            }
        }else if(length - index == 2){
            amLong = Integer.valueOf((currency.substring(0, index+2)).replace(".", "")+0);
        }else{
            amLong = Integer.valueOf((currency.substring(0, index+1)).replace(".", "")+"00");
        }
        return amLong;
    }
    /**
     * 校验健康指标是否正常
     *
     * @param curValue    当前值
     * @param standardMax 最大标准值
     * @param standardMin 最小标准值
     * @return 0正常,1高,-1低
     */
    public  double checkHealthIndex(double curValue, double standardMax, double standardMin) {
        if (curValue <= 0) {
            return 0;
        }
        if (standardMax > 0 && curValue > standardMax) {
            return curValue;
        }
        // 低于标准值,暂不推
        // if (standardMin > 0 && curValue < standardMin) {
        // return -curValue;
        // }
        return 0;
    }
    /**
     * 上传文件到FastDFS
     *
     * @param files 临时文件
     * @return
     * @throws Exception
     */
    /*public  String copyTempImage(String files) throws Exception {
        // 文件保存的临时路径
        String tempPath = SystemConf.getInstance().getTempPath() + File.separator;
        String serverUrl = fastdfs_file_url;
        String[] fileArray = files.split(",");
        FastDFSUtil fastDFSUtil = new FastDFSUtil();
        String fileUrls = "";
        for (String file : fileArray) {
            File f = new File(tempPath + file);
            File fs = new File(tempPath + file + "_small");
            if (f.exists()) {
                String fileName = f.getName();
                InputStream in = new FileInputStream(f);
                ObjectNode result = fastDFSUtil.upload(in, fileName.substring(fileName.lastIndexOf(".") + 1), "");
                in.close();
                if (result != null) {
                    fileUrls += (StringUtils.isEmpty(fileUrls) ? "" : ",") + serverUrl
                            + result.get("groupName").toString().replaceAll("\"", "") + "/"
                            + result.get("remoteFileName").toString().replaceAll("\"", "");
                    f.delete();
                    if (fs.exists()) {
                        fs.delete();
                    }
                }
            }
        }
        return fileUrls;
    }*/
    public  void changeToMp3(String sourcePath, String targetPath) {
        File source = new File(sourcePath);
        File target = new File(targetPath);
        AudioAttributes audio = new AudioAttributes();
        Encoder encoder = new Encoder();
        audio.setCodec("libmp3lame");
        EncodingAttributes attrs = new EncodingAttributes();
        attrs.setFormat("mp3");
        attrs.setAudioAttributes(audio);
        try {
            encoder.encode(source, target, attrs);
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (InputFormatException e) {
            e.printStackTrace();
        } catch (EncoderException e) {
            e.printStackTrace();
        }
    }
    public  long getVideoTimeAndImg(String sourcePath,String targetPath) throws  Exception{
        File source = new File(sourcePath);
        Encoder encoder = new Encoder();
        MultimediaInfo m = encoder.getInfo(source);
        long ms = m.getDuration();
        if(ms<1000)return ms;
        File target = new File(targetPath);//转图片
        VideoAttributes video = new VideoAttributes();
        video.setCodec("png");//转图片
        video.setSize(new VideoSize(600, 500));
        EncodingAttributes attrs = new EncodingAttributes();
        attrs.setFormat("image2");//转图片
        attrs.setOffset(0.01f);//设置偏移位置,即开始转码位置(3秒)
        attrs.setDuration(0.01f);//设置转码持续时间(1秒)
        attrs.setVideoAttributes(video);
        encoder.encode(source, target, attrs);
        return m.getDuration();
    }
    public  void changeToMp4(String sourcePath, String targetPath) {
        File source = new File(sourcePath);
        File target = new File(targetPath);
        AudioAttributes audio = new AudioAttributes();
        //audio.setCodec("aac");
        audio.setCodec("libvorbis");
       // audio.setBitRate(new Integer(64000));
        //audio.setChannels(new Integer(1));
       // audio.setSamplingRate(new Integer(22050));
        VideoAttributes video = new VideoAttributes();
        //video.setCodec("libxvid");// 转MP4
        video.setCodec("libtheora");//
       // video.setBitRate(new Integer(240000));// 180kb/s比特率
       // video.setFrameRate(new Integer(28));// 1f/s帧频,1是目前测试比较清楚的,越大越模糊
        EncodingAttributes attrs = new EncodingAttributes();
        attrs.setFormat("ogg");// 转MP4
        attrs.setAudioAttributes(audio);
        attrs.setVideoAttributes(video);
        Encoder encoder = new Encoder();
        long beginTime = System.currentTimeMillis();
        try {
            // 获取时长
            MultimediaInfo m = encoder.getInfo(source);
            System.out.println(m.getDuration());
            System.out.println("获取时长花费时间是:" + (System.currentTimeMillis() - beginTime));
            beginTime = System.currentTimeMillis();
            encoder.encode(source, target, attrs);
            System.out.println("视频转码花费时间是:" + (System.currentTimeMillis() - beginTime));
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (InputFormatException e) {
            e.printStackTrace();
        } catch (EncoderException e) {
            e.printStackTrace();
        }
    }
    public static void main(String args[]) throws  Exception{
        System.out.print("中文".length());
        System.out.print("中文".substring(0,30));
    }
    public  String getSubString(String content,int min,int max){
        if(StringUtils.isBlank(content)){
            return "";
        }else if(content.length()<=max){
            return content;
        }else{
            return content.substring(min,max);
        }
    }
    /*public  String  saveVoiceToDisk(InputStream inputStream,String newFileName) throws Exception {
        // 文件保存的临时路径
        String tempPath = SystemConf.getInstance().getTempPath() + File.separator;
        // 拼接年月日路径
        String datePath = DateUtil.getStringDate("yyyy") + File.separator + DateUtil.getStringDate("MM") + File.separator + DateUtil.getStringDate("dd") + File.separator;
        // 保存路径
        File uploadFile = new File(tempPath + datePath + newFileName);
        FileOutputStream fileOutputStream = null;
        try {
            if (!uploadFile.getParentFile().exists()) {
                uploadFile.getParentFile().mkdirs();
            }
            byte[] data = new byte[1024];
            int len = 0;
            fileOutputStream = new FileOutputStream(uploadFile);
            while ((len = inputStream.read(data)) != -1) {
                fileOutputStream.write(data, 0, len);
            }
            // 返回保存路径
            return tempPath+datePath + newFileName;
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (inputStream != null) {
                try {
                    inputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            if (fileOutputStream != null) {
                try {
                    fileOutputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        return null;
    }*/
}

+ 173 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/util/HttpUtil.java

@ -0,0 +1,173 @@
package com.yihu.mm.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
/*
 * MD5 算法
 */
@Component
public class HttpUtil {
	private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class);
	/**
	 * 向指定URL发送GET方法的请求
	 *
	 * @param url
	 *            发送请求的URL
	 * @param param
	 *            请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
	 * @return URL 所代表远程资源的响应结果
	 */
	public  String sendGet(String url, String param) {
		String result = "";
		BufferedReader in = null;
		try {
			String urlNameString = url + "?" + param;
			URL realUrl = new URL(urlNameString);
			// 打开和URL之间的连接
			URLConnection connection = realUrl.openConnection();
			// 设置通用的请求属性
			connection.setRequestProperty("accept", "*/*");
			connection.setRequestProperty("connection", "Keep-Alive");
			connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
			// 建立实际的连接
			connection.connect();
			// 定义 BufferedReader输入流来读取URL的响应
			in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
			String line;
			while ((line = in.readLine()) != null) {
				result += line;
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (in != null) {
					in.close();
				}
			} catch (Exception e2) {
				e2.printStackTrace();
			}
		}
		return result;
	}
	/**
	 * 向指定 URL 发送POST方法的请求
	 *
	 * @param url
	 *            发送请求的 URL带上参数
	 * @param param
	 *            POST参数。
	 * @return 所代表远程资源的响应结果
	 */
	public  String sendPost(String url, String param) {
		StringBuffer buffer = new StringBuffer();
		PrintWriter out = null;
		BufferedReader in = null;
		HttpURLConnection conn = null;
		try {
			URL realUrl = new URL(url);
			// 打开和URL之间的连接
			conn = (HttpURLConnection) realUrl.openConnection();
			conn.setRequestMethod("POST");
			conn.setConnectTimeout(5000);
			conn.setDoOutput(true);
			conn.setDoInput(true);
			conn.setUseCaches(false);
			conn.setRequestProperty("Content-Type", "application/text");
			conn.setRequestProperty("accept", "*/*");
			conn.setRequestProperty("connection", "Keep-Alive");
			conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
			OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
			osw.write(param.toString());
			osw.flush();
			// 读取返回内容
			BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
			String temp;
			while ((temp = br.readLine()) != null) {
				buffer.append(temp);
				buffer.append("\n");
			}
		} catch (Exception e) {
			logger.error("push message error:", e);
		} finally {
			try {
				if (out != null) {
					out.close();
				}
				if (in != null) {
					in.close();
				}
			} catch (IOException ex) {
				ex.printStackTrace();
			}
		}
		return buffer.toString();
	}
	/**
	 * 向指定 URL 发送POST方法的请求
	 *
	 * @param url 发送请求的 URL带上参数
	 * @param param POST参数。
	 * @param charset 编码格式
	 * @return 所代表远程资源的响应结果
	 */
	public  String sendPost(String url, String param, String charset) {
		StringBuffer buffer = new StringBuffer();
		PrintWriter out = null;
		BufferedReader in = null;
		HttpURLConnection conn = null;
		try {
			URL realUrl = new URL(url);
			// 打开和URL之间的连接
			conn = (HttpURLConnection) realUrl.openConnection();
			conn.setRequestMethod("POST");
			conn.setDoOutput(true);
			conn.setDoInput(true);
			conn.setUseCaches(false);
			conn.setRequestProperty("Content-Type", "application/text");
			conn.setRequestProperty("accept", "*/*");
			conn.setRequestProperty("connection", "Keep-Alive");
			conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
			OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream(), charset);
			osw.write(param.toString());
			osw.flush();
			// 读取返回内容
			BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), charset));
			String temp;
			while ((temp = br.readLine()) != null) {
				buffer.append(temp);
				buffer.append("\n");
			}
		} catch (Exception e) {
			logger.error("push message error:", e);
		} finally {
			try {
				if (out != null) {
					out.close();
				}
				if (in != null) {
					in.close();
				}
			} catch (IOException ex) {
				ex.printStackTrace();
			}
		}
		return buffer.toString();
	}
}

+ 20 - 1
patient-co-customization/patient-co-modern-medicine/src/main/resources/application.yml

@ -3,7 +3,7 @@ server:
examCode: 84        #越人试卷编号
yuerenApi: http://172.19.103.88:9099/wlyy-manage/yueren       #越人api调用地址
#yuerenApi: http://127.0.0.1:8180/wlyy_admin/yueren    #my
security:
  basic:
    username: jkzl
@ -80,6 +80,17 @@ spring:
        password: 123456
wechat:
  appId: wx1f129f7b51701428
  appSecret: 988f005d8309ed1795939e0f042431fb
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
server:
  server_url: http://ehr.yihu.com/wlyy/
---
##正式的配置
spring:
@ -104,3 +115,11 @@ spring:
server:
  server_url: http://weixin.xmtyw.cn/wlyy-dev/
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
wechat:
  appId: wxd03f859efdf0873d
  appSecret: 2935b54b53a957d9516c920a544f2537

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/yueren/YueRenController.java

@ -71,7 +71,7 @@ public class YueRenController extends BaseController {
    public String uploadAttachment(@RequestParam MultipartFile file) {
        MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
        String fileName = file.getOriginalFilename();
        String filePath =Class.class.getClass().getResource("/").getPath() + "temp/" + System.currentTimeMillis() + fileName;
        String filePath =this.getClass().getResource("/").getPath() + "temp/" + System.currentTimeMillis() + fileName;
        File dest = new File(filePath);
        if (!dest.getParentFile().exists()) {
            dest.getParentFile().mkdirs();

+ 98 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/SignFamily.java

@ -67,6 +67,28 @@ public class SignFamily extends IdEntity {
    private Date expensesTime;//缴费时间
    //1.3.3.2新增字段
    //基卫服务类型
    private String serverType;
    //基卫服务类型名称
    private String serverTypeName;
    //基卫特殊人群类别
    private String specialPopulation;
    //基卫特殊人群类别名称
    private String specialPopulationName;
    //续签标志 1 医生续签 2 医生改签续签
    private String renewFlag;
    //转签原因
    private String renewChangeReason;
    //1.3.5新增居委会字段
    // 居委会字段id
    private String sickVillage;
    // 居委会字段名称
    private String sickVillageName;
    private Integer signPaySource;//签约支付渠道: 1线下 2线上
    //不对应字段
    private String adminTeamName;//行政团队名
    private String leaderCode;//行政团团队长code
@ -75,6 +97,9 @@ public class SignFamily extends IdEntity {
    private String patientAddress;//签约居民地址
    private String releaseSpeak;//解约说明
    public String getCode() {
        return code;
    }
@ -531,4 +556,77 @@ public class SignFamily extends IdEntity {
    public void setExpensesStatusName(String expensesStatusName) {
        this.expensesStatusName = expensesStatusName;
    }
    public String getServerType() {
        return serverType;
    }
    public void setServerType(String serverType) {
        this.serverType = serverType;
    }
    public String getServerTypeName() {
        return serverTypeName;
    }
    public void setServerTypeName(String serverTypeName) {
        this.serverTypeName = serverTypeName;
    }
    public String getSpecialPopulation() {
        return specialPopulation;
    }
    public void setSpecialPopulation(String specialPopulation) {
        this.specialPopulation = specialPopulation;
    }
    public String getSpecialPopulationName() {
        return specialPopulationName;
    }
    public void setSpecialPopulationName(String specialPopulationName) {
        this.specialPopulationName = specialPopulationName;
    }
    public String getRenewFlag() {
        return renewFlag;
    }
    public void setRenewFlag(String renewFlag) {
        this.renewFlag = renewFlag;
    }
    public String getRenewChangeReason() {
        return renewChangeReason;
    }
    public void setRenewChangeReason(String renewChangeReason) {
        this.renewChangeReason = renewChangeReason;
    }
    public String getSickVillage() {
        return sickVillage;
    }
    public void setSickVillage(String sickVillage) {
        this.sickVillage = sickVillage;
    }
    public String getSickVillageName() {
        return sickVillageName;
    }
    public void setSickVillageName(String sickVillageName) {
        this.sickVillageName = sickVillageName;
    }
    public Integer getSignPaySource() {
        return signPaySource;
    }
    public void setSignPaySource(Integer signPaySource) {
        this.signPaySource = signPaySource;
    }
}

+ 2 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/family/FamilyMemberService.java

@ -94,6 +94,7 @@ public class FamilyMemberService extends BaseService {
                        jtSign = true;
                    }
                    map1.put("statusName","已签约");
                    map1.put("expensesStatusName",sign.getExpensesStatusName());
                    String doctorCode = sign.getDoctor();
                    map1.put("doctor",doctorCode);
                    map1.put("doctorName",sign.getDoctorName());
@ -143,6 +144,7 @@ public class FamilyMemberService extends BaseService {
            map.put("doctorName",sign.getDoctorName());
            Doctor doctor = hosDoctorService.getDoctorByCode(doctorCode);
            map.put("doctorMobile",doctor.getMobile());
            map.put("expensesStatusName",sign.getExpensesStatusName());
        }
        map.put("code", p.getCode());
        map.put("name", p.getName());

+ 15 - 16
patient-co/patient-co-statistics/src/main/resources/application.yml

@ -1,5 +1,4 @@
server:
  context-path: /quota
  port: 8081
spring:
@ -111,7 +110,7 @@ redis:
---
spring:
  profiles: dev_test
  profiles: cwd
  datasource:
    primaryReadWrite:
@ -144,17 +143,17 @@ spring:
  datasource:
    primaryReadWrite:
      url: jdbc:mysql://172.17.110.160/wlyy?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: ssgg
      password: ssgg
      url: jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: linzhou
      password: linzhou
    primaryRead:
      url: jdbc:mysql://172.17.110.160/wlyy?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: ssgg
      password: ssgg
      url: jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: linzhou
      password: linzhou
    im: #im库
      url: jdbc:mysql://172.17.110.160/im_new?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: ssgg
      password: ssgg
      url: jdbc:mysql://172.17.110.160/im_new?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: linzhou
      password: linzhou
  redis:
    host: 172.19.103.88 # Redis server host.
@ -181,20 +180,20 @@ spring:
  datasource:
    primaryReadWrite:
      url: jdbc:mysql://59.61.92.94:3306/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      url: jdbc:mysql://59.61.92.90:8079/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    primaryRead:
      url: jdbc:mysql://59.61.92.94:8883/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      url: jdbc:mysql://59.61.92.90:8082/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    im: #im库:
      url: jdbc:mysql://59.61.92.94/im?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      url: jdbc:mysql://59.61.92.90:8079/im?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: im
      password: im!)123
  redis:
    host: 120.41.253.95 # Redis server host.
    host: 192.168.120.14 # Redis server host.
    port: 6380 # Redis server port.
    password: jkzl_ehr
@ -205,7 +204,7 @@ spring:
fv:
  jdbc:
    driver: com.mysql.jdbc.Driver
    url: jdbc:mysql://59.61.92.94:8883/fv?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    url: jdbc:mysql://59.61.92.90:8082/fv?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: wlyy
    password: jkzlehr@123

+ 24 - 3
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/web/quota/JobController.java

@ -359,7 +359,7 @@ public class JobController extends BaseController {
    public String reOrderExpressJob() {
        try {
            quartzHelper.startNow(SFExpressJob.class, "SFEXPRESS-REORDER", null);
            return write(200, "");
            return write(200, "启动成功");
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
@ -381,7 +381,7 @@ public class JobController extends BaseController {
        try {
            quartzHelper.startNow(ZyDictJob.class, UUID.randomUUID().toString(), null);
            return write(200, "");
            return write(200, "启动成功");
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
@ -398,7 +398,28 @@ public class JobController extends BaseController {
    public String executeSickSettleJob() {
        try {
            quartzHelper.startNow(PrescriptionExecuteSickSettleJob.class, "ZY-SICK-SETTLE", null);
            return write(200, "");
            return write(200, "启动成功");
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
    /**
     * 立即启动支付超时过期
     * @Author Linyx
     * @params method
     * @Date 2017/8/14 11:07
     * @Description:
     */
    @RequestMapping(value = "/prescriptionPayOverdueJobStartNow", method = RequestMethod.POST)
    @ApiOperation("立即启动支付超时过期")
    public String prescriptionPayOverdueJobStartNow() {
        try {
            quartzHelper.startNow(PrescriptionPayOverdueJob.class, UUID.randomUUID().toString(), null);
            return write(200, "启动成功");
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());

+ 2 - 2
patient-co/patient-co-wlyy-job/src/main/resources/application.yml

@ -175,11 +175,11 @@ spring:
  datasource:
    wlyy:
      url: jdbc:mysql://59.61.92.94:3306/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      url: jdbc:mysql://59.61.92.90:8079/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: jkzl_root
      password: jkzlehr@321465
    health:
      url: jdbc:mysql://59.61.92.94:3306/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      url: jdbc:mysql://59.61.92.90:8079/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
#      username: wlyy
#      password: jkzlehr@321465
      username: jkzl_root

二进制
patient-co/patient-co-wlyy/doc/接口文档/对外接口文档/集美健康教育/集美健康教育对外接口文档.docx


+ 43 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/hospital/HospitalService.java

@ -124,7 +124,50 @@ public class HospitalService extends BaseService {
        return hosList;
    }
    /**
     * 查询医院列表数目
     *
     * @param type
     * @param province
     * @param city
     * @param town
     * @param hospitalName
     * @return
     */
    public Integer getHospitalsAllCount(Integer type, String province, String city, String town, String hospitalName,String hospitalId) {
        String sql = "select * from dm_hospital where exists (select * from wlyy_doctor where wlyy_doctor.hospital = dm_hospital.code) ";
        List<Object> args = new ArrayList<>();
        if (type != null ) {
            sql += " and level = ? ";
            args.add(type);
        }
        if (StringUtils.isNotEmpty(province)) {
            sql += " and province = ? ";
            args.add(province);
        }
        if (StringUtils.isNotEmpty(city)) {
            sql += " and city = ? ";
            args.add(city);
        }
        if (StringUtils.isNotEmpty(town)) {
            sql += " and town = ? ";
            args.add(town);
        }
        if (StringUtils.isNotEmpty(hospitalName)) {
            sql += " and name like ? ";
            args.add("%" + hospitalName + "%");
        }
        if (StringUtils.isNotEmpty(hospitalId)) {
            sql += " and code = ? ";
            args.add(hospitalId);
        }
        List<Hospital> hosList = jdbcTemplate.query(sql, args.toArray(), new BeanPropertyRowMapper(Hospital.class));
        return hosList.size();
    }
    public List<Hospital> getHospitalsNot00(String doctorCode) {
        String sql = "SELECT " +
                "  h.* " +

+ 8 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java

@ -66,22 +66,26 @@ public class PrescriptionDispensaryCodeService extends BaseService {
        }
        List<Object> params = new ArrayList<>();//p2.*,p1.diagnosis as diagnosis ,p3.address as address
        String precriptionSql = "select p1.status , p1.diagnosis ,p3.address as address,p2.prescription_code as prescriptionCode,p2.code as dispensaryCode,p2.type  from wlyy_prescription_dispensary_code p2 " +
                " left join  wlyy_prescription p1 on p2.prescription_code=p1.code LEFT JOIN wlyy_prescription_expressage p3 on p1.code=p3.prescription_code where p1.patient=? and p2.type=?  and p2.is_Use=0 ";
                " left join  wlyy_prescription p1 on p2.prescription_code=p1.code LEFT JOIN wlyy_prescription_expressage p3 on p1.code=p3.prescription_code where p1.patient=? and p2.type=?  ";
        params.add(patientCode);
        params.add(type);
        if(status!=null){
            precriptionSql += " and p1.status = ? ";
            params.add(status);
        }else {
            precriptionSql += " and p1.status in (?,?,?)" ;
            precriptionSql += " and p1.status in (?,?,?,?,?,?)" ;
            params.add(PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
            params.add(PrescriptionLog.PrescriptionLogStatus.pay_success.getValue());
            params.add(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
            params.add(PrescriptionLog.PrescriptionLogStatus.expressageJGS.getValue());
            params.add(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
            params.add(PrescriptionLog.PrescriptionLogStatus.expressage2hospital.getValue());
            params.add(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
        }
        if(timeType!=null){
            precriptionSql +=  "and TIMESTAMPDIFF(SECOND, p2.create_Time, CURRENT_TIME) < ? ORDER BY p1.status desc ,p2.create_Time desc ";
            precriptionSql +=  "AND TIMESTAMPDIFF(SECOND, p2.create_Time, CURRENT_TIME) < ?  ";
            params.add(timeLimit);
        }
        precriptionSql += " ORDER BY p1.status asc ,p2.create_Time desc ";
        precriptionSql += " limit "+(page-1)*pagesize+","+pagesize;
        List<Map<String, Object>> result = jdbcTemplate.queryForList(precriptionSql,params.toArray());
        List<Map<String, Object>> result2 = new ArrayList<>();

+ 24 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java

@ -28,6 +28,8 @@ public class PrescriptionExpressageService {
    @Autowired
    private PrescriptionDispensaryCodeDao prescriptionDispensaryCodeDao;
    @Autowired
    private PrescriptionReviewedDao prescriptionReviewedDao;
    @Autowired
    private PrescriptionLogDao prescriptionLogDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
@ -119,7 +121,7 @@ public class PrescriptionExpressageService {
            case 3: {
                //判断是3 配送员(健管师)配送码
                // returnStatus = dispensaryCode_3(userCode, prescriptionDispensaryCode);
                returnStatus=0;
                returnStatus = 0;
                break;
            }
            default: {
@ -148,17 +150,20 @@ public class PrescriptionExpressageService {
     * @param prescriptionDispensaryCode
     * @return
     */
    private Integer dispensaryCode_1(String userCode, PrescriptionDispensaryCode prescriptionDispensaryCode) {
    private Integer dispensaryCode_1(String userCode, PrescriptionDispensaryCode prescriptionDispensaryCode) throws Exception {
        //修改处方状态为完成
        prescriptionDao.updateStatus(prescriptionDispensaryCode.getPrescriptionCode(), PrescriptionLog.PrescriptionLogStatus.finish.getValue());
        Prescription prescription = prescriptionDao.findByCode(prescriptionDispensaryCode.getPrescriptionCode());
        Date finshTime = new Date();
        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
        prescription.setFinishTime(finshTime);
        //保存配送成功的日志
        PrescriptionLog prescriptionLog = new PrescriptionLog();
        prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
        prescriptionLog.setCode(UUID.randomUUID().toString());
        prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.finish.getValue());
        prescriptionLog.setCreateTime(new Date());
        prescriptionLog.setCreateTime(finshTime);
        prescriptionLog.setFlag(1);
        prescriptionLog.setUserCode(userCode);
        prescriptionLog.setUserType(2);
@ -167,6 +172,13 @@ public class PrescriptionExpressageService {
        //修改取药码code为已经使用
        prescriptionDispensaryCode.setIsUse(1);
        //发送模板消息
        PrescriptionReviewed reviewed = prescriptionReviewedDao.findByPrescriptionCode(prescription.getCode());
        Patient patient = patientDao.findByCode(prescription.getPatient());
        String url = "prescription/html/order_tracking.html?openid=" + patient.getOpenid() + "" +
                "&code=" + prescriptionDispensaryCode.getPrescriptionCode() + "&toUser=" + patient.getCode() + "&toName=" + patient.getName();
        prescriptionNoticesService.sendMessages(prescription.getPatient(), reviewed.getDoctorName(), DateUtil.dateToStrLong(finshTime), 4, 0, url);
        return prescriptionDispensaryCode.getType();
    }
@ -187,6 +199,10 @@ public class PrescriptionExpressageService {
        prescription.setExpressageTime(expressageing);
        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
        //回填配送表的配送时间
        PrescriptionExpressage prescriptionExpressage=prescriptionExpressageDao.findByPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
        prescriptionExpressage.setExpressageTime(expressageing );
        //得到patient
        Patient patient = patientDao.findByCode(prescription.getPatient());
@ -218,7 +234,8 @@ public class PrescriptionExpressageService {
    /**
     * 配送员(健管师)配送码
     *  没用的代码
     * 没用的代码
     *
     * @param userCode
     * @param prescriptionDispensaryCode
     * @return
@ -363,7 +380,6 @@ public class PrescriptionExpressageService {
        prescriptionExpressageLogDao.save(prescriptionExpressageLog);
        //更新配送表,接收药品信息
        prescriptionExpressage.setAcceptCode(userCode);
        prescriptionExpressage.setAcceptName(userName);
@ -380,12 +396,12 @@ public class PrescriptionExpressageService {
        if (hospital.equals(prescriptionExpressage.getPatientHospitalCode())) {
            // 如果是最后服务站
            //设置配送码失效
            prescriptionDispensaryCodeDao.updateToUse(prescriptionCode,3);
            prescriptionDispensaryCodeDao.updateToUse(prescriptionCode, 3);
            //修改处方是配送完成
            Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
            prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.expressage2hospital.getValue());
            prescription.setExpressageTime(new Date());
        }else{
        } else {
            //如果不是重点服务站,更新配送表,更新配送信息是当前登陆人
            prescriptionExpressage.setExpressageCode(userCode);
            prescriptionExpressage.setExpressageName(userName);

+ 25 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -94,7 +94,7 @@ public class PrescriptionInfoService extends BaseService {
    private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class);
    /**
     * 获取处方下的详细药品
     * 获取处方下的详细药品列表
     *
     * @param prescriptionCode
     * @return
@ -407,7 +407,7 @@ public class PrescriptionInfoService extends BaseService {
                prescriptionDao.save(p);
                //审核通过模板消息
                if(isAdjustPres(p.getCode())){
                if(!isAdjustPres(p.getCode())){
                    sendRMess(p.getCode(), 1);
                }else{
                    //发送调整后处方模板并审核通过消息
@ -1209,9 +1209,29 @@ public class PrescriptionInfoService extends BaseService {
        return new JSONArray(rs);
    }
    public JSONArray getPhysicMinDose(String code) {
        StringBuffer sql = new StringBuffer("SELECT t.min_dose AS minDose,t.physic_code AS physicCode FROM zy_iv_physic_dict t WHERE t.physic_code = ?");
    public List<Map<String, Object>> getPhysicInfo(String code) {
        StringBuffer sql = new StringBuffer("SELECT " +
                " t.min_dose AS minDose, " +
                " t.physic_code AS physicCode, " +
                " t.storage_conditions AS storageConditions, " +
                " t.dose_unit AS doseUnit, " +
                " com1.`name` AS doseUnitName, " +
                " t.quantity_unit AS quantityUnit, " +
                " com2.`name` AS quantityUnitName, " +
                " t.pack_unit As packUnit, " +
                " com3.`name` As packUnitName, " +
                " pack_spec AS packSpec" +
                " FROM " +
                " zy_iv_physic_dict t, " +
                " (SELECT code,name FROM zy_common_dict WHERE dict_name = 'IV_MEASURE_UNIT_DICT') com1, " +
                " (SELECT code,name FROM zy_common_dict WHERE dict_name = 'IV_MEASURE_UNIT_DICT') com2, " +
                " (SELECT code,name FROM zy_common_dict WHERE dict_name = 'IV_MEASURE_UNIT_DICT') com3 " +
                " WHERE " +
                " com1.`code` = t.dose_unit   " +
                " AND com2.`code` = t.quantity_unit   " +
                " AND com3.`code` = t.pack_unit   " +
                " AND t.physic_code = ?");
        List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql.toString(),new Object[]{code});
        return new JSONArray(rs);
        return rs;
    }
}

+ 118 - 69
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/DoctorService.java

@ -1,10 +1,11 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.wlyy.service.common.account;
import com.yihu.wlyy.entity.organization.Hospital;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -13,6 +14,8 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.persistence.DynamicSpecifications;
@ -36,72 +39,118 @@ import java.util.*;
@Component
@Transactional(rollbackFor = Exception.class)
public class DoctorService extends TokenService {
	@Autowired
	private DoctorDao doctorDao;
	private Clock clock = Clock.DEFAULT;
	public Doctor findDoctorByCode(String code) {
		return doctorDao.findByCode(code);
	}
	public Doctor findDoctorByMobile(String mobile) {
		return doctorDao.findByMobile(mobile);
	}
	public JSONObject registerDoctor(Doctor doctor, String imei) throws Exception {
		EncodesUtil.entryptPassword(doctor);
		doctor.setCode(getCode());
		doctor.setCzrq(clock.getCurrentDate());
		Doctor temp = doctorDao.save(doctor);
		if (temp != null) {
			//生成登录tokey
			Token token = newToken(doctor.getCode(), imei, 2);
			if (token != null) {
				//生成登录信息成功
				JSONObject json = new JSONObject();
				json.put("uid", doctor.getCode());
				json.put("token", token.getToken());
				return json;
			}
		}
		return null;
	}
	/**
	 * 修改医生密码
	 */
	public void updateDoctorPwd(Doctor doctor) {
		//EncodesUtil.entryptPassword(doctor);
		doctor.setIsPasswordPrompt("1");
		doctorDao.save(doctor);
	}
	public List<Doctor> famousDoctorList(String name) {
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
		if (StringUtils.isNoneEmpty(name)) {
			name="%"+name+"%";
			return doctorDao.doctorFamousDoctorList(name);
		}else{
			return doctorDao.doctorFamousDoctorList();
		}
	}
	public List<Doctor> getDoctorFamousDoctorList(String name) {
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
		if (StringUtils.isNoneEmpty(name)) {
			name="%"+name+"%";
			return doctorDao.doctorFamousDoctorList(name);
		}else{
			return doctorDao.doctorFamousDoctorList();
		}
	}
	public Doctor findbyIdCard(String idcard) {
		return doctorDao.findbyIdCard(idcard);
	}
    @Autowired
    private DoctorDao doctorDao;
    private Clock clock = Clock.DEFAULT;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public Doctor findDoctorByCode(String code) {
        return doctorDao.findByCode(code);
    }
    public Doctor findDoctorByMobile(String mobile) {
        return doctorDao.findByMobile(mobile);
    }
    public JSONObject registerDoctor(Doctor doctor, String imei) throws Exception {
        EncodesUtil.entryptPassword(doctor);
        doctor.setCode(getCode());
        doctor.setCzrq(clock.getCurrentDate());
        Doctor temp = doctorDao.save(doctor);
        if (temp != null) {
            //生成登录tokey
            Token token = newToken(doctor.getCode(), imei, 2);
            if (token != null) {
                //生成登录信息成功
                JSONObject json = new JSONObject();
                json.put("uid", doctor.getCode());
                json.put("token", token.getToken());
                return json;
            }
        }
        return null;
    }
    /**
     * 修改医生密码
     */
    public void updateDoctorPwd(Doctor doctor) {
        //EncodesUtil.entryptPassword(doctor);
        doctor.setIsPasswordPrompt("1");
        doctorDao.save(doctor);
    }
    public List<Doctor> famousDoctorList(String name) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        if (StringUtils.isNoneEmpty(name)) {
            name = "%" + name + "%";
            return doctorDao.doctorFamousDoctorList(name);
        } else {
            return doctorDao.doctorFamousDoctorList();
        }
    }
    public List<Doctor> getDoctorFamousDoctorList(String name) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        if (StringUtils.isNoneEmpty(name)) {
            name = "%" + name + "%";
            return doctorDao.doctorFamousDoctorList(name);
        } else {
            return doctorDao.doctorFamousDoctorList();
        }
    }
    public Doctor findbyIdCard(String idcard) {
        return doctorDao.findbyIdCard(idcard);
    }
    public List<Doctor> findDoctors(String hospitalCode,String doctorName,Integer level, Integer page, Integer pagesize) {
        String sql = "select * from wlyy_doctor where del=1 and status=1   ";
        List<Object> args = new ArrayList<>();
        if (!org.springframework.util.StringUtils.isEmpty(hospitalCode)) {
            sql += " and hospital = ? ";
            args.add(hospitalCode);
        }
        if (!org.springframework.util.StringUtils.isEmpty(doctorName)) {
            sql += " and name like ? ";
            args.add("%"+doctorName+"%");
        }
        if (level!=null) {
            sql += " and level = ? ";
            args.add(level);
        }
        sql += " limit " + (page * pagesize) + "," + pagesize;
        List<Doctor> doctorList = jdbcTemplate.query(sql, args.toArray(), new BeanPropertyRowMapper(Doctor.class));
        return doctorList;
    }
    public Integer findDoctorCounts(String hospitalCode,String doctorName,Integer level) {
        String sql = "select * from wlyy_doctor where del=1 and status=1   ";
        List<Object> args = new ArrayList<>();
        if (!org.springframework.util.StringUtils.isEmpty(hospitalCode)) {
            sql += " and hospital = ? ";
            args.add(hospitalCode);
        }
        if (!org.springframework.util.StringUtils.isEmpty(doctorName)) {
            sql += " and name like ? ";
            args.add("%"+doctorName+"%");
        }
        if (level!=null) {
            sql += " and level = ? ";
            args.add(level);
        }
        List<Doctor> doctorList = jdbcTemplate.query(sql, args.toArray(), new BeanPropertyRowMapper(Doctor.class));
        return doctorList.size();
    }
}

+ 7 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/gateway/GcTokenService.java

@ -6,6 +6,7 @@ import com.yihu.wlyy.repository.gateway.GcTokenDao;
import com.yihu.wlyy.repository.gateway.GcTokenLogDao;
import com.yihu.wlyy.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -21,6 +22,8 @@ public class GcTokenService {
    private GcTokenLogDao tokenLogDao;
    @Autowired
    private GcTokenDao tokenDao;
    @Value("${accesstoken.time}")
    private Integer tokenTime;
    /**
     * 根据appid生成token
@ -44,7 +47,10 @@ public class GcTokenService {
            gc.setAppid(appid);
            gc.setCreateTime(date);
            //2小时过期
            gc.setOutTime(DateUtil.getNextMin(date, 120));
            if(tokenTime==null){
                tokenTime=2;
            }
            gc.setOutTime(DateUtil.getNextMin(date, tokenTime*60));
            gc.setAccesstoken(token);
            gc.setDel(1);
            tokenDao.save(gc);

+ 4 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/ZyDictService.java

@ -146,7 +146,8 @@ public class ZyDictService {
                " com1.`name` physicDoseUnitName, " +
                " yp.quantity_unit drugNumUnit, " +
                " com2.`name` drugNumUnitName, " +
                " yp.retail_price retailPrice " +
                " yp.retail_price retailPrice, " +
                " yp.storage_conditions storageConditions" +
                " FROM " +
                " (SELECT code,name FROM zy_common_dict WHERE dict_name = 'IV_MEASURE_UNIT_DICT') com1, " +
                " (SELECT code,name FROM zy_common_dict WHERE dict_name = 'IV_MEASURE_UNIT_DICT') com2, " +
@ -163,7 +164,8 @@ public class ZyDictService {
                "   p.pack_unit, " +
                "   p.min_dose, " +
                "   p.pack_spec," +
                "   p.retail_price " +
                "   p.retail_price," +
                "   p.storage_conditions" +
                "    FROM  " +
                "   zy_iv_physic_dict p, " +
                "  ( " +

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SFUtils.java

@ -162,9 +162,9 @@ public class SFUtils {
        xml.append("d_province='"+sfexpress_obj.getProvinceName()+"' ");
        xml.append("d_city='"+sfexpress_obj.getCityName()+"' ");
        xml.append("d_county='"+sfexpress_obj.getTownName()+"' ");
        //快件产品类别:11,医药常温
        //快件产品类别:11,医药常温,1:顺丰标快
        //付款方式:1:寄方付,2:收方付 3:第三方付
        xml.append("express_type='11' pay_method='2' >");
        xml.append("express_type='1' pay_method='2' >");
//        xml.append("express_type='11' pay_method='1' custid='9999999999'>");
        //获取订单的药品详情

+ 4 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java

@ -463,11 +463,11 @@ public class PrescriptionInfoController extends BaseController {
        }
    }
    @RequestMapping(value = "/getPhysicMinDose", method = RequestMethod.GET)
    @ApiOperation(value = "获取药品最小用量")
    public String getPhysicMinDose(String code) {
    @RequestMapping(value = "/getPhysicInfo", method = RequestMethod.GET)
    @ApiOperation(value = "获取药品信息")
    public String getPhysicInfo(String code) {
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.getPhysicMinDose(code));
            return write(200, "查询成功!", "data", prescriptionInfoService.getPhysicInfo(code));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcHospitalController.java

@ -41,12 +41,13 @@ public class GcHospitalController {
    ) {
        List<Hospital> hospitals = hospitalService.getHospitals(null, provinceId, cityId, townId, hospitalName, hospitalId, page, pageSize);
        ;
        List<HospitalModel> hospitalModels = new ArrayList<>();
        for (Hospital hospital : hospitals) {
            HospitalModel hospitalModel = new HospitalModel();
            BeanUtils.copyProperties(hospital, hospitalModel);
            hospitalModels.add(hospitalModel);
        }
        return new ResultPageListModel(page, pageSize, hospitalModels);
        return new ResultPageListModel(page, pageSize, hospitalService.getHospitalsAllCount(null, provinceId, cityId, townId, hospitalName, hospitalId), hospitalModels);
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcTokenController.java

@ -61,7 +61,7 @@ public class GcTokenController {
            return resultOneModel;
        }
        //判断appSecret
        if (appSecret.equals(clientDetails.getAppSecret())) {
        if (!appSecret.equals(clientDetails.getAppSecret())) {
            ResultOneModel resultOneModel = new ResultOneModel(null);
            resultOneModel.setCode(BaseResultModel.codeEm.error_AppSecret.getCode());
            resultOneModel.setMessage(BaseResultModel.codeEm.error_AppSecret.getMessage());

+ 24 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/doctor/GcDoctorController.java

@ -7,6 +7,7 @@ import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.web.gateway.vo.DoctorModel;
import com.yihu.wlyy.web.gateway.vo.PatientModel;
import com.yihu.wlyy.web.gateway.vo.base.ResultOneModel;
import com.yihu.wlyy.web.gateway.vo.base.ResultPageListModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -17,6 +18,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by chenweida on 2017/8/17.
 */
@ -41,6 +45,26 @@ public class GcDoctorController {
        return new ResultOneModel(doctorModel);
    }
    @RequestMapping(value = "/doctors", method = RequestMethod.GET)
    @ApiOperation("医生列表")
    public ResultPageListModel<DoctorModel> doctors(
            @ApiParam(name = "hospitalCode", value = "机构code", required = false) @RequestParam(value = "hospitalCode", required = false) String hospitalCode,
            @ApiParam(name = "name", value = "医生名称(支持模糊)", required = false) @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "level", value = "类型:1专科医生,2全科医生,3健康管理师", required = false) @RequestParam(value = "level", required = false) Integer level,
            @ApiParam(name = "page", value = "当前页(1开始)", required = false) @RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
            @ApiParam(name = "pageSize", value = "每页大小", required = false) @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize
    ) {
        List<Doctor> doctors = doctorService.findDoctors(hospitalCode, name, level, page, pageSize);
        List<DoctorModel> doctorModelList = new ArrayList<>();
        doctors.stream().forEach(one -> {
            DoctorModel doctorModel = new DoctorModel();
            BeanUtils.copyProperties(one, doctorModel);
            doctorModelList.add(doctorModel);
        });
        return new ResultPageListModel(page, pageSize, doctorService.findDoctorCounts(hospitalCode, name, level), doctorModelList);
    }
    @RequestMapping(value = "/patient", method = RequestMethod.GET)
    @ApiOperation("根据患者code查询患者信息")
    public ResultOneModel<PatientModel> patient(

+ 12 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/ResultPageListModel.java

@ -13,6 +13,8 @@ public class ResultPageListModel<T> extends BaseResultModel {
    private Integer page;
    @ApiModelProperty(value = "每页大小", required = false, access = "response")
    private Integer pageSize;
    @ApiModelProperty(value = "总数", required = false, access = "response")
    private Integer allNum;
    @ApiModelProperty(value = "返回数据", required = false, access = "response")
    private List<T> result;
@ -40,13 +42,22 @@ public class ResultPageListModel<T> extends BaseResultModel {
        this.pageSize = pageSize;
    }
    public ResultPageListModel(Integer page, Integer pageSize, List<T> result) {
    public ResultPageListModel(Integer page, Integer pageSize,Integer allNum, List<T> result) {
        this.page = page;
        this.pageSize = pageSize;
        this.result = result;
        this.allNum=allNum;
    }
    public ResultPageListModel() {
    }
    public Integer getAllNum() {
        return allNum;
    }
    public void setAllNum(Integer allNum) {
        this.allNum = allNum;
    }
}

+ 6 - 3
patient-co/patient-co-wlyy/src/main/resources/application.yml

@ -79,6 +79,10 @@ security:
    username: jkzl
    password: jkzlehr
accesstoken:
  time: 2 ##对外接的accesstoken什么周期 2小时
---
##测试的配置
spring:
@ -179,14 +183,13 @@ express:
##正式的配置
spring:
  profiles: prod
  datasource:
    wlyy:
      url: jdbc:mysql://59.61.92.94:3306/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      url: jdbc:mysql://59.61.92.90:8079/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: jkzl_root
      password: jkzlehr@321465
    health:
      url: jdbc:mysql://59.61.92.94:3306/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      url: jdbc:mysql://59.61.92.90:8079/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
#      username: wlyy
#      password: jkzlehr@321465
      username: jkzl_root