Browse Source

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

huangzhiyong 6 years ago
parent
commit
add45f2289

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

@ -71,6 +71,7 @@ public class WechatRequestMapping {
        public static final String api_getById="/template/{id}";
        public static final String api_sendTemplateMessage="/sendTemplateMessage";
        public static final String api_test_template="/test_template";
        public static final String api_getAllTemplate="/api_getAllTemplate";
        public static final String message_success_create="wxTemplate create success";
        public static final String message_success_update="wxTemplate update success";

+ 53 - 0
server/svr-authentication/readme.md

@ -0,0 +1,53 @@
授权码模式 authorization_code
1.GET http://localhost:10260/oauth/authorize?response_type=code&client_id=uzs5G0HgTp&state=sxy&scope=read&redirect_uri=http://192.168.1.221:8010/ehr/browser/common/login/signin&ak=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDjgKCe2zFmYSjHZz93cO17A0Hj6H5XdfwP2I5Qu1UJbmhGG/wPu409r9TABXblcxC9uPVR3PJ5dPrWPLuQ/r7tq16vSa5GF4iCcSlLyx/IDA5bq8ZnafS/RjPiKDtdZAx5uCNLog9GkVHNZIhK9cS9MI4QNuOJzOXaAVwnP2wIDAQAB
    HTTP/1.1 302 Found
    Location: http://localhost:9000/info?code=Ar0mp5&state=sxy
2.POST  http://localhost:10260/oauth/token
    
    HTTP/1.1 200 OK
    Content-Type: application/json;charset=UTF-8
    Cache-Control: no-store
    Pragma: no-cache
    {
      "accessToken":"4c5c7f4f-158a-4f73-9c14-ecbe78671872",
      "tokenType":"bearer",
      "expiresIn":3600,
      "refreshToken":"4c5c7f4f-158a-4f73-9c14-ecbe78671873",
      "state":"example_value"
    }
简化模式 implicit
1.GET http://localhost:10260/oauth/authorize?response_type=token&client_id=EwC0iRSrc4&state=sxy&scope=read&ak=xxxxxxxxxxxxxxxxxxxxxxxxxxx
    HTTP/1.1 302 Found
    Location: https://www.baidu.com/#access_token=4c5c7f4f-158a-4f73-9c14-ecbe78671872&token_type=bearer&state=sxy&expires_in=2418755
   
密码模式 password
1.POST http://localhost:10260/oauth/token
    grant_type=password&username=admin&password=123456789&scope=read&client_id=uzs5G0HgTp
    HTTP/1.1 200 OK
    Content-Type: application/json;charset=UTF-8
    Cache-Control: no-store
    Pragma: no-cache
    {
      "accessToken":"8ce77011-87c9-48f3-8e4f-5cf945f047c7",
      "tokenType":"example",
      "expiresIn":3600,
      "refreshToken":"6b010e33-8bc3-4f3f-8123-66df589dc82f",
      "state":"example_value",
      "user":"admin"
     }
更新令牌 refresh_token
1.POST http://localhost:10260/oauth/token
    grant_type=refresh_token&refresh_token=6b010e33-8bc3-4f3f-8123-66df589dc82f&client_id=uzs5G0HgTp
单点登陆 sso
//A 应用发起请求
1.GET http://localhost:10260/oauth/sso?response_type=token&client_id=EwC0iRSrcS&state=sxy&scope=read&redirect_uri=https://www.jd.com?idCardNo=362321200108017313&access_token=40db969a-5fa0-444e-a0e0-36ba86e7a9ed
//B应用 验证token
2.post http://localhost:10260/oauth/sso?client_id=EwC0iRSrcS&access_token=26502c29-6ba8-4986-8feb-723b8288356d

+ 8 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyAuthorizationEndpoint.java

@ -120,6 +120,14 @@ public class WlyyAuthorizationEndpoint extends AbstractEndpoint {
        this.errorPage = errorPage;
    }
    /**
     *
     * @param model
     * @param parameters
     * @param sessionStatus
     * @param principal
     * @return
     */
    @RequestMapping(value = "/oauth/authorize", method = RequestMethod.GET)
    public ModelAndView authorize(Map<String, Object> model, @RequestParam Map<String, String> parameters,
                                  SessionStatus sessionStatus, Principal principal) {

+ 1 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -111,6 +111,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        }
        if (StringUtils.isEmpty(parameters.get("captcha"))) {
            parameters.put("grant_type", "password");
            //解密密码
//            if (parameters.get("password") != null) {
//                RSAPrivateKey rsaPrivateKey = (RSAPrivateKey)httpSession.getAttribute("privateKey");
//                parameters.put("password", RSAUtils.decryptByPrivateKey(new String(Base64.decodeBase64(parameters.get("password"))), rsaPrivateKey));

+ 7 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/wx/WxTemplateController.java

@ -28,6 +28,13 @@ public class WxTemplateController extends EnvelopRestEndpoint {
        return wxTemplateService.sendWeTempMesTest(wechatId,openid);
    }
    @PostMapping(value = WechatRequestMapping.WxTemplate.api_getAllTemplate, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "获取所有微信模板", notes = "获取所有微信模板")
    public String  getAllTemp(String wechatId) {
        return wxTemplateService.getAllTemp(wechatId);
    }
//    @PostMapping(value = WechatRequestMapping.WxTemplate.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "创建微信模版", notes = "创建微信模版")

+ 9 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WxTemplateService.java

@ -2,7 +2,9 @@ package com.yihu.jw.base.service.wx;
import com.yihu.jw.base.dao.wx.WxTemplateConfigDao;
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -33,6 +35,13 @@ public class WxTemplateService {
        return "success";
    }
    public String  getAllTemp(String wechatId){
        String url ="https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token="+wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken();
        String result = HttpUtil.sendGet(url);
        return result;
    }
//    public WxTemplateDO createWxTemplate(WxTemplateDO wxTemplate) {
//        if (StringUtils.isEmpty(wxTemplate.getTemplateId())) {

+ 27 - 18
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java

@ -238,12 +238,17 @@ public class RehabilitationManageService {
            Integer familyFinishCount1 = rehabilitationDetailDao.findItemByDoctor(signFamilyMap.get("doctor")+"",patientCode);
            Integer familyServiceCount1 = rehabilitationDetailDao.completeServiceByDoctor(signFamilyMap.get("doctor")+"",patientCode,1);
            Integer familyUnfinishCount2 = rehabilitationDetailDao.unfinishItemByDoctor(signFamilyMap.get("doctor_health")+"",patientCode,1);
            Integer familyFinishCount2 = rehabilitationDetailDao.findItemByDoctor(signFamilyMap.get("doctor_health")+"",patientCode);
            Integer familyServiceCount2 = rehabilitationDetailDao.completeServiceByDoctor(signFamilyMap.get("doctor_health")+"",patientCode,1);
            if((signFamilyMap.get("doctor")+"").equals(signFamilyMap.get("doctor_health")+"")){
                resultMap.put("signFamilyFinishItemCount",familyFinishCount1-familyUnfinishCount1);//完成项目
                resultMap.put("signFamilyServiceRecordCount",familyServiceCount1);//服务次数
            }else{
                Integer familyUnfinishCount2 = rehabilitationDetailDao.unfinishItemByDoctor(signFamilyMap.get("doctor_health")+"",patientCode,1);
                Integer familyFinishCount2 = rehabilitationDetailDao.findItemByDoctor(signFamilyMap.get("doctor_health")+"",patientCode);
                Integer familyServiceCount2 = rehabilitationDetailDao.completeServiceByDoctor(signFamilyMap.get("doctor_health")+"",patientCode,1);
            resultMap.put("signFamilyFinishItemCount",familyFinishCount1-familyUnfinishCount1+familyFinishCount2-familyUnfinishCount2);//完成项目
            resultMap.put("signFamilyServiceRecordCount",familyServiceCount1+familyServiceCount2);//服务次数
                resultMap.put("signFamilyFinishItemCount",familyFinishCount1-familyUnfinishCount1+familyFinishCount2-familyUnfinishCount2);//完成项目
                resultMap.put("signFamilyServiceRecordCount",familyServiceCount1+familyServiceCount2);//服务次数
            }
            //基础信息
            resultMap.put("hospitalName",signFamilyMap.get("hospital_name"));
@ -678,6 +683,23 @@ public class RehabilitationManageService {
        //服务医生
        //完成项目=全部的服务项目-未完成的服务项目
        List<Map<String,Object>> serviceDoctorList = new ArrayList<>();
        //全科医生和健管师要是同一个人,就显示全科医生
        if(!generalDoctor.equals(healthDoctor)){
            if(StringUtils.isNotEmpty(healthDoctor)){
                Map<String,Object> healthDoctorMap =  new HashMap<>();
                healthDoctorMap.put("type","健管师");
                healthDoctorMap.put("doctorName",healthDoctorName);
                healthDoctorMap.put("doctorCode",healthDoctor);
                Integer healthUnfinishCount = rehabilitationDetailDao.unfinishItemByDoctor(healthDoctor,patientCode,1);
                Integer healthFinishCount = rehabilitationDetailDao.findItemByDoctor(healthDoctor,patientCode);
                Integer healthServiceCount = rehabilitationDetailDao.completeServiceByDoctor(healthDoctor,patientCode,1);
                healthDoctorMap.put("finishedItem",healthFinishCount-healthUnfinishCount);
                healthDoctorMap.put("serviceCount",healthServiceCount);
                serviceDoctorList.add(healthDoctorMap);
            }
        }
        if(StringUtils.isNotEmpty(generalDoctor)){
            Map<String,Object> generalDoctorMap =  new HashMap<>();
@ -691,19 +713,6 @@ public class RehabilitationManageService {
            generalDoctorMap.put("serviceCount",generalServiceCount);
            serviceDoctorList.add(generalDoctorMap);
        }
        if(StringUtils.isNotEmpty(healthDoctor)){
            Map<String,Object> healthDoctorMap =  new HashMap<>();
            healthDoctorMap.put("type","健管师");
            healthDoctorMap.put("doctorName",healthDoctorName);
            healthDoctorMap.put("doctorCode",healthDoctor);
            Integer healthUnfinishCount = rehabilitationDetailDao.unfinishItemByDoctor(healthDoctor,patientCode,1);
            Integer healthFinishCount = rehabilitationDetailDao.findItemByDoctor(healthDoctor,patientCode);
            Integer healthServiceCount = rehabilitationDetailDao.completeServiceByDoctor(healthDoctor,patientCode,1);
            healthDoctorMap.put("finishedItem",healthFinishCount-healthUnfinishCount);
            healthDoctorMap.put("serviceCount",healthServiceCount);
            serviceDoctorList.add(healthDoctorMap);
        }
//        String specialistRelationSql = "select * from wlyy_specialist.wlyy_specialist_patient_relation where patient='"+patientCode+"' and sign_status='1' and status >=0  ";
        String specialistRelationSql = "select DISTINCT d.doctor,d.doctor_name from wlyy_specialist.wlyy_rehabilitation_plan_detail d LEFT JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p on d.plan_id=p.id where d.type=2 and  p.patient='"+patientCode+"'";