ソースを参照

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

huangwenjie 7 年 前
コミット
9f30d0aad9
68 ファイル変更2983 行追加91 行削除
  1. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java
  2. 10 10
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/SocialSecurityInfo.java
  3. 87 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/template/DoctorGuidanceTempLabel.java
  4. 19 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/template/DoctorTeamGuidanceTemplate.java
  5. 2 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/SpringSecurityConfig.java
  6. 115 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/IotDeviceController.java
  7. 1 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/filter/SessionOutTimeFilter.java
  8. 143 3
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/DeviceHealthIndexService.java
  9. 17 2
      patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/task/PushMsgTask.java
  10. 4 1
      patient-co/patient-co-doctor-assistant/src/main/resources/application-dev.yml
  11. 4 0
      patient-co/patient-co-doctor-assistant/src/main/resources/application-devtest.yml
  12. 4 0
      patient-co/patient-co-doctor-assistant/src/main/resources/application-local.yml
  13. 4 0
      patient-co/patient-co-doctor-assistant/src/main/resources/application-localtest.yml
  14. 4 0
      patient-co/patient-co-doctor-assistant/src/main/resources/application-prod.yml
  15. 4 0
      patient-co/patient-co-doctor-assistant/src/main/resources/application-test.yml
  16. 19 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java
  17. 34 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/PatientMedicareNumberJob.java
  18. 74 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/consult/ParticipantsCleanJob.java
  19. 3 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/organization/HospitalDao.java
  20. 1 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/patient/PatientDao.java
  21. 7 6
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java
  22. 28 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java
  23. 52 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/third/jw/JwPatientMedicareNumberService.java
  24. 36 5
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/web/quota/JobController.java
  25. 1 1
      patient-co/patient-co-wlyy-job/src/main/resources/application-dev.yml
  26. 1 1
      patient-co/patient-co-wlyy-job/src/main/resources/application-devtest.yml
  27. 1 1
      patient-co/patient-co-wlyy-job/src/main/resources/application-prod.yml
  28. 6 0
      patient-co/patient-co-wlyy-job/src/main/resources/system.properties
  29. 15 10
      patient-co/patient-co-wlyy/pom.xml
  30. 55 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/aop/SQLTimeAdivce.java
  31. 0 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/jpa/WlyyJpa.java
  32. 10 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java
  33. 38 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/template/DoctorGuidanceTempLabelDao.java
  34. 9 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/template/DoctorTeamGuidanceTemplateDao.java
  35. 16 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java
  36. 33 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java
  37. 18 17
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/scheduling/DoctorWorkTimeService.java
  38. 8 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/area/AreaService.java
  39. 126 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java
  40. 80 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorGuidanceTempLableService.java
  41. 36 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorTeamGuidanceService.java
  42. 43 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jkEduArticle/ThirdJkEduArticleService.java
  43. 168 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/YLZUserService.java
  44. 64 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/model/YLZAccessToken.java
  45. 126 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/model/YLZRequestParams.java
  46. 360 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/model/YLZUser.java
  47. 137 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/model/YLZUserCard.java
  48. 38 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/applets/AppletsService.java
  49. 6 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/MessageType.java
  50. 41 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/http/HttpResponse.java
  51. 449 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/http/HttpUtils.java
  52. 54 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/http/IPInfoUtils.java
  53. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/BaseController.java
  54. 9 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEduPC/DoctorJMJkEduArticlePCController.java
  55. 22 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/message/DoctorMessageController.java
  56. 125 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/template/DoctorGuidanceTempLabelController.java
  57. 46 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/template/DoctorTeamGuidanceController.java
  58. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/FamilyContractController.java
  59. 5 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkEduArticle/ThirdJkEduArticleController.java
  60. 51 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/ylzpay/ThirdCheckUserController.java
  61. 36 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/AppletsController.java
  62. 9 0
      patient-co/patient-co-wlyy/src/main/resources/application-dev.yml
  63. 11 0
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml
  64. 11 1
      patient-co/patient-co-wlyy/src/main/resources/application-local.yml
  65. 11 1
      patient-co/patient-co-wlyy/src/main/resources/application-localtest.yml
  66. 11 1
      patient-co/patient-co-wlyy/src/main/resources/application-prod.yml
  67. 11 1
      patient-co/patient-co-wlyy/src/main/resources/application-test.yml
  68. 10 0
      patient-co/patient-co-wlyy/src/main/resources/application.yml

ファイルの差分が大きいため隠しています
+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java


+ 10 - 10
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/SocialSecurityInfo.java

@ -11,17 +11,17 @@ import javax.persistence.*;
@Table(name = "sb_info")
public class SocialSecurityInfo {
    private String id;
    private String xming0;
    private String xbie00;
    private String csrqi0;
    private String id; //主键   必填
    private String xming0;//名字 必填
    private String xbie00;//性别  1男 2女 必填
    private String csrqi0;//出生日志 yyyyMMdd 必填
    private String zjlxbh;
    private String sfzh18;
    private String grsfen;
    private String id0000;
    private String gzztai;
    private String cardno;
    private String card16;
    private String sfzh18;//身份证号
    private String grsfen; // 必填
    private String id0000;//保险号
    private String gzztai; //必填
    private String cardno;//社保卡号
    private String card16;//必填
    private String zhgxsj;
    private String bjlxbh;

+ 87 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/template/DoctorGuidanceTempLabel.java

@ -0,0 +1,87 @@
package com.yihu.wlyy.entity.template;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by 刘文彬 on 2018/5/17.
 */
@Entity
@Table(name = "wlyy_doctor_guidance_temp_label")
public class DoctorGuidanceTempLabel extends IdEntity {
    private String code;//业务编码
    private String name;//标签名称
    private Date createTime;// 创建时间
    private String doctorCode;//创建人code
    private Integer del;//作废标识1、正常 ,0、作废
    private Integer teamId;//医生团队Id
    @Column(name = "code", length = 50)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "name", length = 100)
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "doctor_code", length = 50)
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    @Column(name = "del", length = 2)
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    @Column(name = "team_id", length = 11)
    public Integer getTeamId() {
        return teamId;
    }
    public void setTeamId(Integer teamId) {
        this.teamId = teamId;
    }
    public DoctorGuidanceTempLabel(String code, String name) {
        this.code = code;
        this.name = name;
    }
    public DoctorGuidanceTempLabel() {
    }
}

+ 19 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/template/DoctorTeamGuidanceTemplate.java

@ -33,6 +33,9 @@ public class DoctorTeamGuidanceTemplate extends IdEntity {
    private Date czrq;
    //        团队内的团队模板状态  0删除  1正常
    private int del;
    private String labelCode;//指导标签code
    private String labelName;//指导标签name
    public String getTeamName() {
        return teamName;
@ -109,4 +112,20 @@ public class DoctorTeamGuidanceTemplate extends IdEntity {
    public void setDel(int del) {
        this.del = del;
    }
    public String getLabelCode() {
        return labelCode;
    }
    public void setLabelCode(String labelCode) {
        this.labelCode = labelCode;
    }
    public String getLabelName() {
        return labelName;
    }
    public void setLabelName(String labelName) {
        this.labelName = labelName;
    }
}

+ 2 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/SpringSecurityConfig.java

@ -29,6 +29,7 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
                "/common/**",
                "/login/**",
                "/yueren/**",
                "/svr-iot/**",
                "/customer/**",
                "/third/**",
                "/admin/hos/doctor/importFromExcel",
@ -62,6 +63,7 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
                .accessDecisionManager(accessDecisionManager())
                .expressionHandler(webSecurityExpressionHandler())
                .antMatchers("/yueren/**").permitAll()
                .antMatchers("/svr-iot/device/**").permitAll()//物联网平台没有做登录(这里添加免登录验证)
//                .antMatchers("/admin/main").permitAll()
//                .antMatchers("/login/**").permitAll()
//                .antMatchers("/admin/**").authenticated()

+ 115 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/IotDeviceController.java

@ -0,0 +1,115 @@
package com.yihu.wlyy.controller.manager.device;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.device.entity.DeviceHealthIndexVO;
import com.yihu.wlyy.device.entity.WlyyDevice;
import com.yihu.wlyy.device.entity.WlyyPatientDeviceVO;
import com.yihu.wlyy.service.doctor.DoctorService;
import com.yihu.wlyy.service.manager.device.DeviceHealthIndexService;
import com.yihu.wlyy.service.manager.device.WlyyDeviceService;
import com.yihu.wlyy.service.manager.device.WlyyPatientDeviceService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * 提供物联网查询
 * @author yeshijie on 2018/5/24.
 */
@RestController
@RequestMapping(value = "/svr-iot/device/",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class IotDeviceController extends BaseController {
    @Autowired
    private WlyyDeviceService deviceService;
    @Autowired
    private DeviceHealthIndexService healthIndexService;
    @Autowired
    private WlyyPatientDeviceService patientDeviceService;
    @Autowired
    private DoctorService doctorService;
    //列表查询
    @RequestMapping(value="deviceList",method = RequestMethod.GET)
    @ApiOperation("设备管理")
    public String searchList(
            @RequestParam(value = "deviceName",required = false)String deviceName,
            @RequestParam(value = "deviceCode",required = false) String deviceCode,
            @RequestParam(value = "orgName",required = false)String orgName,
            @RequestParam(value = "linkman",required = false) String linkman,
            @RequestParam(value = "page",required = false)Integer page,
            @RequestParam(value = "pageSize",required = false)Integer pageSize){
        try {
            Page<WlyyDevice> wlyyDevices = deviceService.searchDeviceList(deviceName,deviceCode,orgName,linkman, page, pageSize);
            return write(200,"操作成功",page,pageSize,wlyyDevices);
        }catch (Exception ex){
            error(ex);
            return error(-1, "操作失败!");
        }
    }
    @RequestMapping(value = "findDeviceById",method = RequestMethod.GET)
    @ApiOperation("根据设备id查找设备管理")
    public String getDevice(@RequestParam(value = "id") Integer id){
        try {
            WlyyDevice device = deviceService.findById(id);
            return  write(200,"操作成功","data",device);
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    @RequestMapping(value ="healthlist",method = RequestMethod.GET)
    @ApiOperation("体征数据查询")
    public String searchList(
            @RequestParam(value = "deviceSn",required = false) String deviceSn,
            @RequestParam(value = "date",required = false) String date,
            @RequestParam(value = "idcard",required = false) String idcard,
            @RequestParam(value = "userName",required = false) String userName,
            @RequestParam(value = "indexType",required = false) String indexType,
            @RequestParam(value = "indexTypeMin1",required = false) Double indexTypeMin1,
            @RequestParam(value = "indexTypeMax1",required = false) Double indexTypeMax1,
            @RequestParam(value = "indexTypeMin2",required = false) Double indexTypeMin2,
            @RequestParam(value = "indexTypeMax2",required = false) Double indexTypeMax2,
            @RequestParam(value = "doctorName",required = false) String doctorName,
            @RequestParam(value = "page",required = false) Integer page,
            @RequestParam(value = "pageSize",required = false) Integer pageSize){
        try{
            Page<DeviceHealthIndexVO> deviceHealthIndexes = healthIndexService.searchList2(deviceSn,date, idcard, userName, indexType,page, pageSize,indexTypeMin1, indexTypeMax1, indexTypeMin2,indexTypeMax2,doctorName);
            return write(200,"操作成功",page,pageSize,deviceHealthIndexes);
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    @RequestMapping(value = "patientDeviceList",method = RequestMethod.GET)
    @ApiOperation("居民设备查询")
    public String searchList(
            @RequestParam(value = "deviceName",required = false) String deviceName,
            @RequestParam(value = "categoryCode",required = false) String categoryCode,
            @RequestParam(value = "deviceSn",required = false) String deviceSn,
            @RequestParam(value = "userName",required = false) String userName,
            @RequestParam(value = "doctorName",required = false) String doctorName,
            @RequestParam(value = "hospitalName",required = false) String hospitalName,
            @RequestParam(value = "page") Integer page,
            @RequestParam(value = "pageSize") Integer pageSize){
        try {
            String hospitalCode = "";
            List<WlyyPatientDeviceVO> patientDevices = patientDeviceService.searchListNew(deviceName,categoryCode, deviceSn, userName, doctorName,hospitalName,hospitalCode,page, pageSize);
            Long totalcount = patientDeviceService.getCountSearchListNew(deviceName,categoryCode, deviceSn, userName, doctorName,hospitalName,hospitalCode);
            return write(200,"操作成功",page,pageSize,totalcount,patientDevices);
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
}

+ 1 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/filter/SessionOutTimeFilter.java

@ -24,6 +24,7 @@ public class SessionOutTimeFilter extends OncePerRequestFilter {
                || path.indexOf("/yueren") != -1
                || path.indexOf("/out") != -1
                || path.indexOf("/error") != -1
                || path.indexOf("/svr-iot") != -1
                || path.indexOf(httpServletRequest.getContextPath() + "/static") != -1
                || path.indexOf("swagger") != -1
                || path.indexOf(httpServletRequest.getContextPath() + "/v2/api-docs") != -1) {

+ 143 - 3
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/DeviceHealthIndexService.java

@ -17,9 +17,11 @@ import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.query.BaseDeviceJpaService;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.*;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -27,7 +29,6 @@ import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.*;
/**
@ -184,6 +185,145 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
        return new PageImpl<DeviceHealthIndexVO>(listTemp,pageRequest,count);
    }
    /**
     * 无需登录
     * @param deviceSn
     * @param date
     * @param idcard
     * @param userName
     * @param indexType
     * @param page
     * @param pageSize
     * @param indexTypeMin1
     * @param indexTypeMax1
     * @param indexTypeMin2
     * @param indexTypeMax2
     * @param doctorName
     * @return
     * @throws Exception
     */
    public Page<DeviceHealthIndexVO> searchList2(String deviceSn,String date,String idcard,String userName,String indexType,Integer page,Integer pageSize,
                                                Double indexTypeMin1,Double indexTypeMax1,Double indexTypeMin2,Double indexTypeMax2,String doctorName)throws Exception{
        if (page == null){
            page = 1;
        }
        if(pageSize == null){
            pageSize = 15;
        }
        Pageable pageRequest = new PageRequest(page-1,pageSize);
        StringBuilder filter = new StringBuilder();
        String sql =" SELECT i.* ,s.name userName FROM device.wlyy_patient_health_index i , wlyy.wlyy_sign_family s WHERE s. STATUS > 0  and i.user=s.patient ";
        String countSql =" SELECT count(1) as num FROM device.wlyy_patient_health_index i, wlyy.wlyy_sign_family s WHERE s. STATUS > 0  and i.user=s.patient ";
        //根据患者名称过滤
        if(!StringUtils.isEmpty(userName)){
            filter.append(" AND s.NAME LIKE '%"+userName+"%' ");
        }
        //根据健管师或医生名称过滤
        if(!StringUtils.isEmpty(doctorName)){
            filter.append(" and (s.doctor_name like '%"+doctorName+"%' or s.doctor_health_name like '%"+doctorName+"%') ");
        }
        if(!StringUtils.isEmpty(deviceSn)){
            filter.append(" and i.device_sn='"+deviceSn+"' ");
        }
        if(!StringUtils.isEmpty(idcard)){
            filter.append(" and i.idcard='"+idcard+"' ");
        }
        //体征数据创建时间
        if(!StringUtils.isEmpty(date)){
            Date startTimeTemp  =  DateTimeUtil.simpleDateParse(date);
            Calendar calendar = new GregorianCalendar();
            calendar.setTime(startTimeTemp);
            calendar.set(Calendar.HOUR,23);
            calendar.set(Calendar.MINUTE,59);
            calendar.set(Calendar.SECOND,59);
            calendar.set(Calendar.MILLISECOND,999);
            Date endTimeTemp = calendar.getTime();
            filter.append(" and i.czrq>='" + DateTimeUtil.simpleDateTimeFormat(startTimeTemp)+"'");
            filter.append(" and i.czrq<='" + DateTimeUtil.simpleDateTimeFormat(endTimeTemp)+"'");
        }
        //指标类型
        if(!StringUtils.isEmpty(indexType)){
            filter.append(" and i.type="+indexType);
        }
        //体征数据
//        if("1".equals(indexType)||"2".equals(indexType)||"4".equals(indexType)){
        if(indexTypeMin1!=null){
            filter.append(" and value1>="+indexTypeMin1);
        }
        if(indexTypeMax1!=null){
            filter.append(" and value1<="+indexTypeMax1);
        }
        if(indexTypeMin2!=null){
            filter.append(" and value2>="+indexTypeMin2);
        }
        if(indexTypeMax2!=null){
            filter.append(" and value2<="+indexTypeMax2);
        }
//        }else{
//            if(indexTypeMin1!=null){
//                filter.append(" and value3>="+indexTypeMin1);
//            }
//            if(indexTypeMax1!=null){
//                filter.append(" and value3<="+indexTypeMax1);
//            }
//            if(indexTypeMin2!=null){
//                filter.append(" and value4>="+indexTypeMin2);
//            }
//            if(indexTypeMax2!=null){
//                filter.append(" and value4<="+indexTypeMax2);
//            }
//        }
        String f = filter.toString();
//        System.out.println("sql:"+sql+f+" order by i.czrq desc "+" limit "+(page-1)+","+pageSize);
        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql+f+" order by i.czrq desc "+" limit "+(page-1)+","+pageSize);
        if(resultList.size()<=0){
            return new PageImpl<DeviceHealthIndexVO>(new ArrayList<>(), pageRequest, 0);
        }
        long count = 0;
        String regex = "(\\w{3})(\\w+)(\\w{3})";
        List<DeviceHealthIndexVO> listTemp = new ArrayList<>();
        if(resultList !=null && resultList.size()>0){
//            count = getCount(filter.toString());
            count = jdbcTemplate.queryForObject(countSql+filter.toString(),Long.class);
            for (Map<String, Object> info : resultList){
                DeviceHealthIndexVO bean = new DeviceHealthIndexVO();
                bean.setId(Long.getLong(info.get("id")+""));
                bean.setCzrq(info.get("czrq")!=null?(Date)info.get("czrq"):null);
                bean.setDel(info.get("del")!=null?info.get("del")+"":null);
                bean.setDeviceSn(info.get("device_sn")!=null?info.get("device_sn")+"":null);
                bean.setIdcard(info.get("idcard")!=null?info.get("idcard")+"":null);
                bean.setIntervene(info.get("intervene")!=null?info.get("intervene")+"":null);
                bean.setRecordDate(info.get("record_date")!=null?(Date)info.get("record_date"):null);
                bean.setSortDate(info.get("sort_date")!=null?(Date)info.get("sort_date"):null);
                bean.setStatus(info.get("status")!=null?(Integer)info.get("status"):null);
                bean.setType(info.get("type")!=null?(Integer)info.get("type"):0);
                bean.setUser(info.get("user")!=null?info.get("user")+"":null);
                bean.setUserName(info.get("userName")!=null?info.get("userName")+"":null);
                bean.setValue1(info.get("value1")!=null?info.get("value1")+"":null);
                bean.setValue2(info.get("value2")!=null?info.get("value2")+"":null);
                bean.setValue3(info.get("value3")!=null?info.get("value3")+"":null);
                bean.setValue4(info.get("value4")!=null?info.get("value4")+"":null);
                bean.setValue5(info.get("value5")!=null?info.get("value5")+"":null);
                bean.setValue6(info.get("value6")!=null?info.get("value6")+"":null);
                bean.setValue7(info.get("value7")!=null?info.get("value7")+"":null);
//                BeanUtils.copyProperties(info, bean);
//                Patient patient = findPatient(bean.getUser());
//                bean.setUserName(patient== null?"":patient.getName());
                if(StringUtils.isNotBlank(bean.getIdcard())){
                    bean.setIdcard(bean.getIdcard().replaceAll(regex, "$1****$3"));
                }
                bean.setHealthStandard(gethealthStandard(bean.getType(),bean.getUser()).toString());
                listTemp.add(bean);
            }
        }
        return new PageImpl<DeviceHealthIndexVO>(listTemp,pageRequest,count);
    }
    public List<DeviceHealthIndexVO> getExcelByFilter(String deviceSn,String date,String idcard,
                                                String userName,String indexType,Double indexTypeMin1,Double indexTypeMax1,Double indexTypeMin2,Double indexTypeMax2,String doctorName)throws Exception{

+ 17 - 2
patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/task/PushMsgTask.java

@ -52,6 +52,10 @@ public class PushMsgTask {
    private String template_service_remind;
    @Value("${wechat.message.template_callserver_remind}")
    private String template_callserver_remind;
    @Value("${wechat.message.template_article_check_result}")
    private String template_article_check_result;
    @Value("${wechat.message.template_article_authen}")
    private String template_article_authen;
    @Value("${pushMes.method}")
    private String putMesMethod;
    @Value("${pushMes.redis_prescription_title}")
@ -209,7 +213,7 @@ public class PushMsgTask {
    /**
     * 直接发送微信模板消息
     *
     * @param type 1:处方待处理提醒  2:服务状态提醒  3:居民体征异常提醒  4:咨询请求通知  5:签约申请通知  6:随访提醒  7:处理结果通知 8 咨询回复提醒 9 代办事项提醒
     * @param type 1:处方待处理提醒  2:服务状态提醒  3:居民体征异常提醒  4:咨询请求通知  5:签约申请通知  6:随访提醒  7:处理结果通知 8 咨询回复提醒 9 代办事项提醒 12 文章审核结果提醒
     * @return
     */
    public boolean sendWeixinMessage(String access_token, int type, String openid, String url, JSONObject data) {
@ -253,7 +257,12 @@ public class PushMsgTask {
     */
    public String typeMsg(int type, String openid, String url, JSONObject data) {
        try {
            url = server_url + "wx_doctor/html/" + url;
            if(StringUtils.isNotEmpty(url)){
                url = server_url + "wx_doctor/html/" + url;
            }else{
                url="";
            }
            String temp_id = getTemplateId(type);
            JSONObject temp = new JSONObject();
            temp.put("touser", openid);
@ -340,6 +349,12 @@ public class PushMsgTask {
            case 11:
                templateId = template_callserver_remind;
                break;
            case 12:
                templateId = template_article_check_result;
                break;
            case 13:
                templateId = template_article_authen;
                break;
        }
        return templateId;
    }

+ 4 - 1
patient-co/patient-co-doctor-assistant/src/main/resources/application-dev.yml

@ -54,7 +54,10 @@ wechat:
   template_service_remind:  v2iqCHvqNLiU0PBBMIEPkB40xi8eUtdpsjwyxw-euo4
   #协同服务提醒
   template_callserver_remind: Fsnt5YUDBCNOREMKifZbr51XhNRyop6VAEV8mIuFYuc
   #健康文章审核提醒
   template_article_check_result: qiYuHVB20unKW2Yd9qIB7rVZyWfeSGR2WmkSXzCtFuQ
   #健康文章认证处理提醒
   template_article_authen: X3m6jEg9hNGJqn4dnfPpnetxQh63ktu0SRvTRFxcqhI
yihu:
  yihu_OpenPlatform_url: http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/
  yihu_OpenPlatform_appId: 9000276

+ 4 - 0
patient-co/patient-co-doctor-assistant/src/main/resources/application-devtest.yml

@ -54,6 +54,10 @@ wechat:
   template_service_remind:  v2iqCHvqNLiU0PBBMIEPkB40xi8eUtdpsjwyxw-euo4
   #协同服务提醒
   template_callserver_remind: Fsnt5YUDBCNOREMKifZbr51XhNRyop6VAEV8mIuFYuc
   #健康文章审核提醒
   template_article_check_result: qiYuHVB20unKW2Yd9qIB7rVZyWfeSGR2WmkSXzCtFuQ
   #健康文章认证处理提醒
   template_article_authen: X3m6jEg9hNGJqn4dnfPpnetxQh63ktu0SRvTRFxcqhI
yihu:
  yihu_OpenPlatform_url: http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/

+ 4 - 0
patient-co/patient-co-doctor-assistant/src/main/resources/application-local.yml

@ -54,6 +54,10 @@ wechat:
   template_service_remind:  v2iqCHvqNLiU0PBBMIEPkB40xi8eUtdpsjwyxw-euo4
   #协同服务提醒
   template_callserver_remind: Fsnt5YUDBCNOREMKifZbr51XhNRyop6VAEV8mIuFYuc
   #健康文章审核提醒
   template_article_check_result: qiYuHVB20unKW2Yd9qIB7rVZyWfeSGR2WmkSXzCtFuQ
   #健康文章认证处理提醒
   template_article_authen: X3m6jEg9hNGJqn4dnfPpnetxQh63ktu0SRvTRFxcqhI
yihu:
  yihu_OpenPlatform_url: http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/

+ 4 - 0
patient-co/patient-co-doctor-assistant/src/main/resources/application-localtest.yml

@ -54,6 +54,10 @@ wechat:
   template_service_remind:  v2iqCHvqNLiU0PBBMIEPkB40xi8eUtdpsjwyxw-euo4
   #协同服务提醒
   template_callserver_remind: Fsnt5YUDBCNOREMKifZbr51XhNRyop6VAEV8mIuFYuc
   #健康文章审核提醒
   template_article_check_result: qiYuHVB20unKW2Yd9qIB7rVZyWfeSGR2WmkSXzCtFuQ
   #健康文章认证处理提醒
   template_article_authen: X3m6jEg9hNGJqn4dnfPpnetxQh63ktu0SRvTRFxcqhI
yihu:

+ 4 - 0
patient-co/patient-co-doctor-assistant/src/main/resources/application-prod.yml

@ -53,6 +53,10 @@ wechat:
   template_service_remind:  v2iqCHvqNLiU0PBBMIEPkB40xi8eUtdpsjwyxw-euo4
   #协同服务提醒
   template_callserver_remind: Fsnt5YUDBCNOREMKifZbr51XhNRyop6VAEV8mIuFYuc
   #健康文章审核提醒
   template_article_check_result: qiYuHVB20unKW2Yd9qIB7rVZyWfeSGR2WmkSXzCtFuQ
   #健康文章认证处理提醒
   template_article_authen: X3m6jEg9hNGJqn4dnfPpnetxQh63ktu0SRvTRFxcqhI
yihu:
  yihu_OpenPlatform_url: http://api.yihu.com.cn/OpenPlatform/cgiBin/1.0/

+ 4 - 0
patient-co/patient-co-doctor-assistant/src/main/resources/application-test.yml

@ -53,6 +53,10 @@ wechat:
   template_service_remind:  v2iqCHvqNLiU0PBBMIEPkB40xi8eUtdpsjwyxw-euo4
   #协同服务提醒
   template_callserver_remind: Fsnt5YUDBCNOREMKifZbr51XhNRyop6VAEV8mIuFYuc
   #健康文章审核提醒
   template_article_check_result: qiYuHVB20unKW2Yd9qIB7rVZyWfeSGR2WmkSXzCtFuQ
   #健康文章认证处理提醒
   template_article_authen: X3m6jEg9hNGJqn4dnfPpnetxQh63ktu0SRvTRFxcqhI
yihu:
  yihu_OpenPlatform_url: http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/

+ 19 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.event;
import com.yihu.wlyy.job.*;
import com.yihu.wlyy.job.consult.EvaluateScoreJob;
import com.yihu.wlyy.job.consult.FinishConsultJob;
import com.yihu.wlyy.job.consult.ParticipantsCleanJob;
import com.yihu.wlyy.redis.RedisThread;
import com.yihu.wlyy.util.SystemConf;
import org.slf4j.Logger;
@ -187,6 +188,15 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
            } else {
                logger.info("patient_followup_syb_job  job exist");
            }
            //同步imgroup成员,每天凌晨3点30分执行一次
            if (!quartzHelper.isExistJob("participants_clean_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("participants_clean_job");
                quartzHelper.addJob(ParticipantsCleanJob.class, trigger, "participants_clean_job", new HashMap<String, Object>());
                logger.info("participants_clean_job  job success");
            } else {
                logger.info("participants_clean_job  job exist");
            }
    
            //居民随访信息上传基卫,每天凌晨4点执行一次
            if (!quartzHelper.isExistJob("patient_followup_upload_job")) {
@ -245,6 +255,15 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
            new Thread(redisThread).start();
            logger.info("redis message end");
            //慢病患者医疗保险号同步,每天6点执行一次
            if (!quartzHelper.isExistJob("patient_medicare_number_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("patient_medicare_number_job");
                quartzHelper.addJob(PatientMedicareNumberJob.class, trigger, "patient_medicare_number_job", new HashMap<String, Object>());
                logger.info("patient_medicare_number_job  job success");
            } else {
                logger.info("patient_medicare_number_job  job exist");
            }
        } catch (Exception e) {
            logger.info("sign end job start failed");
        }

+ 34 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/PatientMedicareNumberJob.java

@ -0,0 +1,34 @@
package com.yihu.wlyy.job;
import com.yihu.wlyy.service.third.jw.JwPatientMedicareNumberService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
 * 慢病患者医疗保险号同步JOB
 * @author humingfen
 * @date 2018/5/22
 */
public class PatientMedicareNumberJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(PatientMedicareNumberJob.class);
    @Autowired
    private JwPatientMedicareNumberService jwPatientMedicareNumberService;
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException
    {
        logger.info("START=====开始更新慢病患者医疗保险号的JOB");
        try {
            jwPatientMedicareNumberService.getEffectiveSignFamily();
        }catch (Exception e) {
            e.printStackTrace();
            logger.info("END===ERROR===开始更新慢病混着医疗保险号JOB,message:" +
                    e.getMessage());
        }
    }
}

+ 74 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/consult/ParticipantsCleanJob.java

@ -0,0 +1,74 @@
package com.yihu.wlyy.job.consult;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamMemberDao;
import com.yihu.wlyy.util.ImUtill;
import org.json.JSONObject;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import java.util.List;
import java.util.Map;
/**
 * 每天同步一次im group团队成员
 * @author yeshijie on 2018/5/18.
 */
public class ParticipantsCleanJob implements Job {
    private static Logger logger = LoggerFactory.getLogger(ParticipantsCleanJob.class);
    @Value("${im.data_base_name}")
    private String imDb;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ImUtill imUtill;
    @Autowired
    private DoctorAdminTeamMemberDao doctorAdminTeamMemberDao;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        try{
            logger.info("ParticipantsCleanJob start.....");
            SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
            //查询会话列表找出type=3的group会话
            StringBuffer sql1 = new StringBuffer();
            sql1.append("SELECT s.id,name FROM ").append(imDb).append(".sessions s ").append("WHERE s.type= 3 ");
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql1.toString());
            list.stream().forEach(one->{
                String sessionId = one.get("id").toString();
                String sessionName = one.get("name").toString();
                //删除不在团队的成员
                StringBuffer sql2 = new StringBuffer();
                sql2.append("delete from ").append(imDb).append(".participants WHERE session_id = '")
                        .append(sessionId).append("' and participant_id not in (")
                        .append("SELECT doctor_code from wlyy_admin_team_member WHERE team_id = ")
                        .append(sessionId).append(" and available =1)");
                jdbcTemplate.execute(sql2.toString());
                //新增团队成员直接调用im接口
                List<Doctor> doctors = doctorAdminTeamMemberDao.findAllMembers(Long.parseLong(sessionId));
                if(doctors!=null&&doctors.size()>0){
                    JSONObject participants = new JSONObject();
                    doctors.forEach(doctor -> {
                        participants.put(doctor.getCode(),0);
                    });
                    imUtill.createSession(participants,"3",sessionName,sessionId);
                }
            });
            logger.info("ParticipantsCleanJob end.....");
        }catch (Exception e){
            e.printStackTrace();
            logger.error("ParticipantsCleanJob error....."+e.getMessage());
        }
    }
}

+ 3 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/organization/HospitalDao.java

@ -43,4 +43,7 @@ public interface HospitalDao extends PagingAndSortingRepository<Hospital, Long>,
	@Query("select p from Hospital p where p.city = ?1 and p.del='1' and p.level =2 and p.centerSite='00'")
	List<Hospital> findByCity(String city);
	@Query("select distinct p.code from Hospital p")
	List<String> findCode();
}

+ 1 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/patient/PatientDao.java

@ -79,4 +79,5 @@ public interface PatientDao extends PagingAndSortingRepository<Patient, Long> {
    @Query(value = "SELECT DISTINCT openid FROM `wlyy_patient` WHERE `openid` IS NOT NULL AND `openid` <> ' ' AND `openid` <> 'undefined' " +
            " AND `sicard_status` IS NULL AND `sicard_time` >= ?1 ORDER BY `sicard_time`",nativeQuery = true)
    List<String> listNotupdatedByDate(String beginTime);
}

+ 7 - 6
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java

@ -5,20 +5,17 @@
 *******************************************************************************/
package com.yihu.wlyy.repository.patient;
import java.util.Date;
import java.util.List;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamilyRenew;
import com.yihu.wlyy.entity.patient.SignFamily;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.wlyy.entity.patient.SignFamily;
import java.util.Date;
import java.util.List;
public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Long>, JpaSpecificationExecutor<SignFamily> {
@ -431,4 +428,8 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
    @Query(value = "SELECT f.* FROM wlyy_sign_family f WHERE f.idcard = ?1 and f.`status` = -4 ORDER BY sign_year desc LIMIT 0,1 ",nativeQuery = true)
    SignFamily findLatelyRenew(String idcard);
    //查询wlyy_sign_family有效签约且居民的医疗保险号为空的数据
    @Query(value = "select a.idcard from wlyy_sign_family a left join wlyy_patient b on a.idcard = b.idcard where a.hospital = ?1 and (a.type = 2 or a.type = 1) " +
            "and a.status = 1 and a.expenses_status = 1 and (b.medicare_number is null or b.medicare_number = '')", nativeQuery = true)
    List<String> findIdcardByStatus(String hospital);
}

+ 28 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java

@ -1138,4 +1138,32 @@ public class PatientService extends TokenService {
        }
        return "1";
    }
    /**
     * 根据患者身份证号更新患者医疗保险号情况
     * @param idcard_medicare_number_map
     */
    @Transactional
    public void updatePatientMedicareNumberByIdcard(HashMap<String, String> idcard_medicare_number_map){
        DefaultTransactionDefinition def = new DefaultTransactionDefinition();
        def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // 事物隔离级别,开启新事务
        TransactionStatus status = transactionManager.getTransaction(def); // 获得事务状态
        try {
            for (String idcard : idcard_medicare_number_map.keySet()) {
                patientDao.updatePatientMedicareNumberByIdcard(idcard,idcard_medicare_number_map.get(idcard));
            }
            //事务提交
            transactionManager.commit(status);
        } catch (Exception ex) {
            logger.info("更新患者医疗保险号出错,从基卫获取的患者数据为:START");
            for (String idcard : idcard_medicare_number_map.keySet()) {
                logger.info("idcard:" + idcard);
                logger.info("idcard:" + idcard_medicare_number_map.get(idcard));
            }
            logger.info("更新患者医疗保险号出错,从基卫获取的患者数据为:END");
            //报错事务回滚
            transactionManager.rollback(status);
        }
    }
}

+ 52 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/third/jw/JwPatientMedicareNumberService.java

@ -0,0 +1,52 @@
package com.yihu.wlyy.service.third.jw;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.util.HttpClientUtil;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
 * 基位签约信息接口
 * Created by humingfen on 2018/5/22.
 */
@Service
public class JwPatientMedicareNumberService {
    private static final Logger logger = LoggerFactory.getLogger(JwPatientMedicareNumberService.class);
    //基卫服务地址
    @Value("${sign.zysoft}")
    private String jwUrl;
    @Autowired
    private HospitalDao hospitalDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private HttpClientUtil httpClientUtil;
    /**
     * 根据社区查找有效签约居民的签约信息,并同步到本地数据库
     */
    public void getEffectiveSignFamily () throws Exception {
        List<String> hospitals = hospitalDao.findCode();
        for(String hospital : hospitals) {
            List<String> idcards = signFamilyDao.findIdcardByStatus(hospital);
            String url = jwUrl + "/third/zysoftservice/getSickCurrnetFamilySignInfo";
            //医疗保险号的居民集合
            HashMap<String, String> idcard_medicare_number_map = new HashMap<>();
            for (String idcard : idcards) {
                List<NameValuePair> params = new ArrayList<>();
                params.add(new BasicNameValuePair("idcard", idcard));
                httpClientUtil.post(url, params, "UTF-8");
            }
        }
    }
}

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

@ -1,16 +1,12 @@
package com.yihu.wlyy.web.quota;
import com.yihu.wlyy.job.*;
import com.yihu.wlyy.job.consult.ConsultCleanerJob;
import com.yihu.wlyy.job.consult.EvaluateScoreJob;
import com.yihu.wlyy.job.consult.FamousConsultTimesJob;
import com.yihu.wlyy.job.consult.FinishConsultJob;
import com.yihu.wlyy.job.consult.*;
import com.yihu.wlyy.service.app.disease.PatientDiseaseService;
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
import com.yihu.wlyy.service.app.statistics.StatisticsService;
import com.yihu.wlyy.service.quota.JobService;
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -430,6 +426,25 @@ public class JobController extends BaseController {
        }
    }
    /**
     * 每天同步一次im group团队成员
     * @author ysj
     * @date 2018/5/18 14:16
     */
    @RequestMapping(value = "/executeParticipantsCleanJob", method = RequestMethod.POST)
    @ApiOperation("每天同步一次im group团队成员")
    public String executeParticipantsCleanJob() {
        try {
            quartzHelper.startNow(ParticipantsCleanJob.class, UUID.randomUUID().toString(), null);
            return write(200, "启动成功");
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
    /**
     * 产检提醒
     * @author ysj
@ -762,4 +777,20 @@ public class JobController extends BaseController {
        }
    }
    /**
     *立即执行慢病患者医疗保险号同步
     *@author humingfen
     *@date 2018/5/23
     */
    @RequestMapping(value = "/executePatientMedicareNumberJob", method = RequestMethod.POST)
    @ApiOperation("立即执行前一天的慢病患者医疗保险号同步")
    public String executePatientMedicareNumberJob() {
        try {
            quartzHelper.startNow(PatientMedicareNumberJob.class, UUID.randomUUID().toString(), null);
            return write(200, "启动成功");
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
}

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

@ -90,7 +90,7 @@ images:
sign:
  check_upload: http://172.19.103.88:8011/wlyy_service
  zysoft: http://59.61.92.90:8072/wlyy_sign
quartz:
  name: schedulerFactoryBean_dev

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

@ -86,7 +86,7 @@ images:
sign:
  check_upload: http://172.19.103.88:8011/wlyy_service
  zysoft: http://59.61.92.90:8072/wlyy_sign
quartz:
  name: schedulerFactoryBean_test_dev

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

@ -88,7 +88,7 @@ images:
sign:
  check_upload: http://59.61.92.90:8087/wlyy_service
  zysoft: http://59.61.92.90:8072/wlyy_sign
quartz:

+ 6 - 0
patient-co/patient-co-wlyy-job/src/main/resources/system.properties

@ -104,6 +104,9 @@ doctor_feldsher_template_job=0 */30 * * * ?
# 病患者定标情况同步JOB (每天2点一次)
patient_disease_contion_syn_job=0 0 2 * * ?
# 同步im group成员JOB (每天3点30一次)
participants_clean_job=0 30 3 * * ?
#查询家庭签约支付结果,补更新医保签约号,3分钟跑一次
sign_family_pay_result_migisterno_job=0 0/3 * * * ?
@ -131,6 +134,9 @@ doctor_prenatal_inspector_job=0 0 10 ? * MON-FRI
#续方订单自动确认job
patient_confirm_receipt_job=00 0 8,12,18,21 * * ?
# 病患者医疗保险号同步JOB (每天6点执行一次)
patient_medicare_number_job=0 0 6 * * ?
#统一支付平台支付成功后页面跳转地址
return_url={server}/wx/html/qygl/html/pay_result.html
#统一支付平台支付接口地址

+ 15 - 10
patient-co/patient-co-wlyy/pom.xml

@ -426,16 +426,16 @@
            <version>2.4.1.0</version>
        </dependency>
        <!--elasticsearch start-->
  <!--      <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>2.4.4</version>
        </dependency>
        <dependency>
            <groupId>io.searchbox</groupId>
            <artifactId>jest</artifactId>
            <version>2.4.0</version>
        </dependency>-->
        <!--      <dependency>
                  <groupId>org.elasticsearch</groupId>
                  <artifactId>elasticsearch</artifactId>
                  <version>2.4.4</version>
              </dependency>
              <dependency>
                  <groupId>io.searchbox</groupId>
                  <artifactId>jest</artifactId>
                  <version>2.4.0</version>
              </dependency>-->
        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
@ -488,6 +488,11 @@
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.ylz</groupId>
            <artifactId>ehc-empi-java-sdk</artifactId>
            <version>20180522</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>wlyy</finalName>

+ 55 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/aop/SQLTimeAdivce.java

@ -0,0 +1,55 @@
//package com.yihu.wlyy.aop;
//
//import org.aspectj.lang.ProceedingJoinPoint;
//import org.aspectj.lang.annotation.Around;
//import org.aspectj.lang.annotation.Aspect;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.stereotype.Component;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//
//import javax.servlet.http.HttpServletRequest;
//
///**
// * Created by chenweida on 2018/5/21 0021.
// * 数据库sql的拦截
// */
//@Aspect
//@Component
//public class SQLTimeAdivce {
//    public SQLTimeAdivce() {
//    }
//
//    private Logger logger = LoggerFactory.getLogger(SQLTimeAdivce.class);
//
//    @Around("execution(* org.springframework.jdbc.core.JdbcTemplate.batchUpdate*(..)) " +
//            "|| execution(* org.springframework.jdbc.core.JdbcTemplate.query*(..)) " +
//            "|| execution(* org.springframework.jdbc.core.JdbcTemplate.execute*(..)) " +
//            "|| this(org.springframework.data.repository.Repository) " +
//            "|| this(org.springframework.data.jpa.repository.JpaSpecificationExecutor)")
//    public Object process(ProceedingJoinPoint point) throws Throwable {
//        HttpServletRequest request = null;
//        if (RequestContextHolder.getRequestAttributes() != null) {
//            request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
//            logger.info("uri:" + request.getRequestURI());
//        }
//        //访问目标方法的参数:
//        Object[] args = point.getArgs();
//        String sql = null;
//        //第一个参数是sql
//        if (args != null && args.length > 0 && args[0].getClass() == String.class) {
//            sql = args[0].toString();
//            //第一个参数是sql数组
//        }
//        //用改变后的参数执行目标方法
//        Long startTime = System.currentTimeMillis();
//        Object returnValue = point.proceed(args);
//        Long endTime = System.currentTimeMillis();
//
//        logger.info("sql:" + sql);
//        logger.info("sql-time:" + (endTime - startTime));
//        return returnValue;
//
//    }
//}

+ 0 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/jpa/WlyyJpa.java

@ -51,13 +51,10 @@ public class WlyyJpa {
        JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
        emfb.setJpaVendorAdapter(vendorAdapter);
        emfb.setJpaProperties(hibernateProperties.hibProperties());
        return emfb;
    }
    @Bean(name = "wlyyTransactionManager")
    @Primary
    JpaTransactionManager transactionManagerSecondary(

+ 10 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java

@ -36,6 +36,10 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("update Message a set a.read = 0,a.over='0' where a.id = ?1")
    int read(long msgid);
    @Modifying
    @Query("update Message a set a.read = 0,a.over='0' where a.code = ?1")
    int read(String msgCode);
    @Query("SELECT a FROM Message a WHERE a.sender=?1 AND a.receiver = ?2 and a.signStatus = ?3 and a.read=1 ORDER BY czrq DESC")
    List<Message> findUnreadSign(String sender, String receiver, String signStatus);
@ -106,4 +110,10 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("from Message a where a.type = 12 and a.del='1' and a.over='1' and relationCode = ?1  ")
    List<Message> findByCallServiceRelationCode(String relationCode);
    @Query(" select a from Message a where a.type=14 and a.del='1' and a.read=1 and a.receiver=?1 and a.over='1'")
    List<Message> findEduArticle(String receiver);
    @Query(" select a from Message a where a.type=14 and a.del='1' and a.read=1 and a.receiver=?1 and a.over='1'")
    List<Message> findEduArticle(String receiver, Pageable pageRequest);
}

+ 38 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/template/DoctorGuidanceTempLabelDao.java

@ -0,0 +1,38 @@
package com.yihu.wlyy.repository.template;
import com.yihu.wlyy.entity.template.DoctorGuidanceTempLabel;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by 刘文彬 on 2018/5/18.
 */
public interface DoctorGuidanceTempLabelDao extends PagingAndSortingRepository<DoctorGuidanceTempLabel, Long> {
    @Query("select t from DoctorGuidanceTempLabel t where t.teamId = ?1 and t.del=1")
    Page<DoctorGuidanceTempLabel> findByTeamId(Integer teamId, Pageable pageRequest);
    @Query("select t from DoctorGuidanceTempLabel t where t.teamId = ?1 and t.del=1 order by t.createTime desc ")
    List<DoctorGuidanceTempLabel> findByTeamId(Integer teamId);
    @Query("select t from DoctorGuidanceTempLabel t where t.code = ?1 and t.del=1 ")
    DoctorGuidanceTempLabel findByCodeWithDel(String code);
    @Query("select t from DoctorGuidanceTempLabel t where t.code = ?1 ")
    DoctorGuidanceTempLabel findByCode(String code);
    @Modifying
    @Query(value = "update DoctorGuidanceTempLabel p set p.del=?1 where p.code=?2 ")
    int updateDel(int del,String code);
    @Modifying
    @Query(value = "update DoctorGuidanceTempLabel p set p.name=?1 where p.code=?2 ")
    int updateName(String name,String code);
}

+ 9 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/template/DoctorTeamGuidanceTemplateDao.java

@ -71,4 +71,13 @@ public interface DoctorTeamGuidanceTemplateDao extends PagingAndSortingRepositor
            " AND b.del = 1 AND b.teamId = ?1 AND b.title LIKE ?2 ")
    List<DoctorTeamGuidanceTemplate> getListByTile(int teamId, String title, Pageable pageRequest);
    // 根据模板文章标题模糊搜索团队指导模板(不分页)
    @Query("SELECT b FROM DoctorTeamGuidanceTemplate b WHERE   " +
            " b.del = 1 AND b.teamId = ?1 AND b.title LIKE ?2 ")
    List<DoctorTeamGuidanceTemplate> getListByTile(int teamId, String title);
    //    根据团队ID获取团队内的模板列表(带分页和创建时间倒序)
    @Query("select t from DoctorTeamGuidanceTemplate t where t.del = 1 and t.teamId = ?1 and t.labelCode= ?2")
    List<DoctorTeamGuidanceTemplate> findGuidanceByTeamIdAndLabelCode(int teamId,String labelCode, Pageable request);
}

+ 16 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -1620,4 +1620,20 @@ public class DoctorInfoService extends BaseService {
        }
        return jdbcTemplate.queryForList(sql);
    }
    /**
     * 获取同级的文章审核管理员
     * @param operatorRoleCode
     * @return
     */
    public List<Map<String,Object>> getDoctorManager(String operatorRoleCode){
        String sql = "select d.code,d.name,d.openid from wlyy_doctor d " +
                " join wlyy_user_role h on d.code=h.user " +
                " join manage_role_user ru on d.code=ru.user_code " +
                " join manage_role_feature rf on ru.role_id=rf.role_id " +
                " join manage_feature f on rf.feature_id=f.id " +
                " where f.code='Manage_Article_Authentication' " +
                " and h.role='"+operatorRoleCode+"'";
        return jdbcTemplate.queryForList(sql);
    }
}

+ 33 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java

@ -191,6 +191,22 @@ public class MessageService extends BaseService {
            callServiceMesJson.put("amount", 0);
        }
        //文章审核消息
        List<Message> articleMes = messageDao.findEduArticle(doctor);
        JSONObject articleMesJson = new JSONObject();
        if (articleMes != null && articleMes.size() > 0) {
            articleMesJson.put("amount", articleMes.size());
            JSONObject articleJson = new JSONObject();
            articleJson.put("title", "文章审核消息");
            articleJson.put("type", articleMes.get(0).getType());
            articleJson.put("msg", "你有"+articleMes.size()+"个文章审核消息");
            articleJson.put("msgTime", DateUtil.dateToStrLong(articleMes.get(0).getCreateTime()));
            articleMesJson.put("lastMessage", articleJson);
        }else{
            articleMesJson.put("amount", 0);
        }
        JSONObject json = new JSONObject();
        json.put("imMsgCount", getImMsgAmount(doctor));//IM消息数量
        json.put("sign", signJson);//签约数
@ -198,7 +214,7 @@ public class MessageService extends BaseService {
        json.put("system", systemJson);//系统消息
        json.put("prescription", prescriptionJson);//续方消息
        json.put("callService", callServiceMesJson);//协同服务消息
        json.put("articleCheck", articleMesJson);//健康文章审核消息
        return json;
    }
@ -485,6 +501,22 @@ public class MessageService extends BaseService {
        return messageDao.getPrescriptionMessage(doctor,type, pageRequest);
    }
    /**
     * 获取新增健康文章审核消息
     * @param receiver
     * @param page
     * @param pagesize
     * @return
     * @throws Exception
     */
    public List<Message> getEduArticleMessage(String receiver ,Integer page, Integer pagesize) throws Exception{
        // 排序
        Sort sort = new Sort(Sort.Direction.DESC, "createTime");
        // 分页信息
        Pageable pageRequest = new PageRequest(page - 1, pagesize, sort);
        return messageDao.findEduArticle(receiver,pageRequest);
    }
    /**
     * 设置某类消息已读
     *

+ 18 - 17
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/scheduling/DoctorWorkTimeService.java

@ -757,35 +757,36 @@ public class DoctorWorkTimeService extends BaseService {
            //健管师推荐开启,只判断健管师的时间
            if ("1".equals(re.getString("familyTopicSwitch"))){
                json = doctorWork(doctorHealth,week,calendar);
                if("0".equals(json.getString("status"))){
                    json.put("status","2");
                    json.put("msg","全科医生和健管师当前都不在工作时间");
                }
            }else {//健管师推荐关闭,则两个都要判断
                JSONObject doctorJson = doctorWork(doctor,week,calendar);
                JSONObject doctorHealthJson = doctorWork(doctorHealth,week,calendar);
                String doctorStatus = doctorJson.getString("status");
                String doctorHealthStatus = doctorHealthJson.getString("status");
                //两个都不接受咨询时,无法咨询
                if ("0".equals(doctorStatus) && "0".equals(doctorHealthStatus)){
                    json.put("status", "0");
                    json.put("msg", "医生不接受咨询");
                }
                //两个其中有一个可以咨询时都可以咨询
                if ("1".equals(doctorStatus) || "1".equals(doctorHealthStatus)){
//                if ("0".equals(doctorStatus) && "0".equals(doctorHealthStatus)){
//                    json.put("status", "0");
//                    json.put("msg", "医生不接受咨询");
//                }else
                if ("1".equals(doctorStatus) && "1".equals(doctorHealthStatus)){
                    //两个其中有一个可以咨询时都可以咨询
                    json.put("status", "1");
                    json.put("msg", "医生当前接受咨询");
                }
                //如果全科和健管师都不在时间范围
                if ("2".equals(doctorStatus) && "2".equals(doctorHealthStatus)){
                    json.put("status","2");
                    json.put("msg","全科医生和健管师当前都不在工作时间");
                }
                //健管师在工作时间,全科不在
                if ("2".equals(doctorStatus) || "0".equals(doctorStatus)){
                }else if (!"1".equals(doctorStatus) && "1".equals(doctorHealthStatus)){
                    //健管师在工作时间,全科不在 21 01
                    json.put("status","3");
                    json.put("msg","全科医生当前不在工作时间");
                }
                //全科在工作时间,健管师不在
                if ("0".equals(doctorHealthStatus) || "2".equals(doctorHealthStatus)){
                }else if ("1".equals(doctorStatus) && !"1".equals(doctorHealthStatus)){
                    //全科在工作时间,健管师不在 10 12
                    json.put("status","4");
                    json.put("msg","健管师当前不在工作时间");
                }else{
                    //如果全科和健管师都不在时间范围 22,02,20,00
                    json.put("status","2");
                    json.put("msg","全科医生和健管师当前都不在工作时间");
                }
            }
        }

+ 8 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/area/AreaService.java

@ -6,6 +6,7 @@ import com.yihu.wlyy.repository.address.TownDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
@ -21,6 +22,8 @@ public class AreaService extends BaseService {
    TownDao townDao;
    @Autowired
    HospitalDao hospitalDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 查询城市城镇
@ -28,11 +31,13 @@ public class AreaService extends BaseService {
     * @param city
     * @return
     */
    public List<Town> getCityTowns(String city){
    public List<Town> getCityTowns(String city) {
        return townDao.findByCityCode(city);
    }
    public List<Hospital> getTownHospitals(String town){
     return hospitalDao.findByTownCode10(town);
    public List<Hospital> getTownHospitals(String town) {
        String sql = " select * from dm_hospital where town = ?";
        jdbcTemplate.queryForList(sql, town);
        return hospitalDao.findByTownCode10(town);
    }
}

+ 126 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -10,25 +10,31 @@ import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.profile.DoctorRole;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.education.HealthEduArticle;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.message.MessageNoticeSetting;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorRoleDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.account.DoctorInfoService;
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
import com.yihu.wlyy.service.app.message.MessageService;
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.service.common.account.RoleService;
import com.yihu.wlyy.service.third.jkEduArticle.ThirdJkEduArticleService;
import com.yihu.wlyy.util.CommonUtil;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ElasticsearchUtil;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.web.third.gateway.service.GcLabelService;
import com.yihu.wlyy.web.third.gateway.vo.DictModel;
import com.yihu.wlyy.web.third.gateway.vo.HealthEduArticlePatientModel;
import io.searchbox.client.JestClient;
import io.searchbox.core.*;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
@ -89,6 +95,20 @@ public class JMJkEduArticleService extends BaseService {
    private DoctorRoleDao doctorRoleDao;
    @Autowired
    DoctorAdminTeamDao teamDao;
    @Autowired
    private MessageDao messageDao;
    @Autowired
    private MessageService messageService;
    @Autowired
    private DoctorWorkTimeService doctorWorkTimeService;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Value("${doctorAssistant.api}")
    private String doctorAssistant;
    @Value("${doctorAssistant.target_url}")
    private String targetUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    /**
     *
@ -1144,9 +1164,59 @@ public class JMJkEduArticleService extends BaseService {
                isAuthentication = 1;
            }
        }
        thirdJkEduArticleService.saveArticle(userCode,articleTitle,articleType,articlelevel,secondLevelCategoryId,image,
        boolean b = thirdJkEduArticleService.saveArticle(userCode,articleTitle,articleType,articlelevel,secondLevelCategoryId,image,
                secondLevelCategoryName,firstLevelCategoryId,firstLevelCategoryName,content,operatorRoleCode,opertorRoleLevel,
                userScope,isAuthentication,articleId,roleType);
        //如果文章需要审核且文章保存数据库成功,推送消息通知给审核的管理员
        if(isAuthentication==0&&b){
            Doctor doctor = doctorDao.findByCode(userCode);
            List<Map<String,Object>> list = doctorInfoService.getDoctorManager(operatorRoleCode);
            for(Map<String,Object> one:list){
                Message message = new Message();
                message.setCzrq(new Date());
                message.setCreateTime(new Date());
                message.setTitle("新增文章审核消息");
                message.setContent(doctor.getName()+"医生提交了文章审核,您可以点击前往处理");
                message.setRead(1);//设置未读
                message.setReceiver(one.get("code")+"");//设置接受医生的code()
                message.setSender(userCode);//设置发送的医生
                message.setSenderName(doctor.getName());
                message.setCode(getCode());
                message.setSenderPhoto(doctor.getPhoto());
                message.setType(14);//新增健康文章审核信息
                message.setReadonly(1);//是否只读消息
                message.setSex(doctor.getSex());
                message.setOver("1");//未处理
                messageDao.save(message);
                if(messageService.getMessageNoticeSettingByMessageType(one.get("code")+"","1", MessageNoticeSetting.MessageTypeEnum.signSwitch.getValue())){
                    // 发送消息给医生
                    org.json.JSONObject jsonObject = doctorWorkTimeService.isDoctorWorking(one.get("code")+"");
                    if (jsonObject.getString("status").equals("1")) {
                        //如果在工作时间内就推送
                        pushMsgTask.put(one.get("code")+"", MessageType.MESSAGE_TYPE_AUTHEN_HEALTH_EDU_ARTICLE.D_EDU_02.name(), MessageType.MESSAGE_TYPE_AUTHEN_HEALTH_EDU_ARTICLE.新增文章认证消息.name(), doctor.getName() + "医生提交了文章认证,您可以点击前往", doctor.getCode());
                    }
                    //新增发送医生助手模板消息
                    if (org.apache.commons.lang3.StringUtils.isNotEmpty(one.get("openid")+"")){
                        String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                        List<NameValuePair> params = new ArrayList<>();
                        params.add(new BasicNameValuePair("type", "13"));
                        params.add(new BasicNameValuePair("openId", one.get("openid")+""));
                        params.add(new BasicNameValuePair("url", ""));
                        params.add(new BasicNameValuePair("first", "您好,您有新的文章认证申请"));
                        params.add(new BasicNameValuePair("remark", "您可以登录厦门i健康PC端审核文章,感谢您的使用"));
//                        SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
//                        String date = format.format(new Date());
                        String keywords = doctor.getName() + ",健康文章";
                        params.add(new BasicNameValuePair("keywords", doctor.getName()));
                        params.add(new BasicNameValuePair("keywords", "健康文章"));
                        httpClientUtil.post(url, params, "UTF-8");
                    }
                }
            }
        }
    }
    /**
@ -1247,11 +1317,61 @@ public class JMJkEduArticleService extends BaseService {
    }
    @Transient
    public void authenticationArticle(String articleId,String isAuthentication,String firstLevelCategoryId,String firstLevelCategoryName,String secondLevelCategoryId,String secondLevelCategoryName) throws Exception{
    public void authenticationArticle(String articleId,String isAuthentication,String firstLevelCategoryId,String firstLevelCategoryName,String secondLevelCategoryId,String secondLevelCategoryName,String reasonContent,String sender) throws Exception{
        String[] str = articleId.split(",");
        Doctor doctor = doctorDao.findByCode(sender);
        for(String one: str){
            thirdJkEduArticleService.authenticationArticle(one,isAuthentication,firstLevelCategoryId,firstLevelCategoryName,secondLevelCategoryId,secondLevelCategoryName);
            boolean b = thirdJkEduArticleService.authenticationArticle(one,isAuthentication,firstLevelCategoryId,firstLevelCategoryName,secondLevelCategoryId,secondLevelCategoryName);
            if(b){
                Message message = new Message();
                message.setCzrq(new Date());
                message.setCreateTime(new Date());
                message.setTitle("新增文章审核消息");
                if("0".equals(isAuthentication)){
                    message.setContent("健康文章审核不通过,原因:"+reasonContent);
                }else{
                    message.setContent("健康文章审核通过。");
                }
                JSONObject article = thirdJkEduArticleService.getArticalById(one,"","");
                Doctor receiveDoctor = doctorDao.findByCode(article.getString("OperatorId"));
                message.setRead(1);//设置未读
                message.setReceiver(article.getString("OperatorId"));//设置接受医生的code()
                message.setSender(sender);//设置发送的医生
                message.setSenderName(doctor.getName());
                message.setCode(getCode());
                message.setSenderPhoto(doctor.getPhoto());
                message.setType(14);//新增健康文章审核信息
                message.setReadonly(1);//是否只读消息
                message.setSex(doctor.getSex());
                message.setOver("1");//未处理
                messageDao.save(message);
                if(messageService.getMessageNoticeSettingByMessageType(receiveDoctor.getCode(),"1", MessageNoticeSetting.MessageTypeEnum.signSwitch.getValue())){
                    // 发送消息给医生
                    org.json.JSONObject jsonObject = doctorWorkTimeService.isDoctorWorking(receiveDoctor.getCode());
                    if (jsonObject.getString("status").equals("1")) {
                        //如果在工作时间内就推送
                        pushMsgTask.put(receiveDoctor.getCode(), MessageType.MESSAGE_TYPE_SAVE_HEALTH_EDU_ARTICLE.D_EDU_01.name(), MessageType.MESSAGE_TYPE_SAVE_HEALTH_EDU_ARTICLE.新增文章审核消息.name(), doctor.getName() + "医生提交了文章审核,您可以点击前往", doctor.getCode());
                    }
                    //新增发送医生助手模板消息
                    if (org.apache.commons.lang3.StringUtils.isNotEmpty(receiveDoctor.getOpenid())){
                        String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                        List<NameValuePair> params = new ArrayList<>();
                        params.add(new BasicNameValuePair("type", "12"));
                        params.add(new BasicNameValuePair("openId", receiveDoctor.getOpenid()));
                        params.add(new BasicNameValuePair("url", ""));
                        params.add(new BasicNameValuePair("first", receiveDoctor.getName() + "医生您好,您提交的健康文章已审核"));
                        params.add(new BasicNameValuePair("remark", "您可以登录厦门i健康app查看结果,感谢您的使用"));
                        SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
                        String date = format.format(new Date());
                        String keywords = date + "," + doctor.getName();
                        params.add(new BasicNameValuePair("keywords", date));
                        params.add(new BasicNameValuePair("keywords", doctor.getName()));
                        httpClientUtil.post(url, params, "UTF-8");
                    }
                }
            }
        }
    }

+ 80 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorGuidanceTempLableService.java

@ -0,0 +1,80 @@
package com.yihu.wlyy.service.template;
import com.yihu.wlyy.entity.template.DoctorGuidanceTempLabel;
import com.yihu.wlyy.repository.template.DoctorGuidanceTempLabelDao;
import com.yihu.wlyy.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * Created by 刘文彬 on 2018/5/18.
 */
@Service
public class DoctorGuidanceTempLableService extends BaseService {
    @Autowired
    private DoctorGuidanceTempLabelDao doctorGuidanceTempLableDao;
    /**
     * 保存
     * @param doctorCode
     * @param name
     */
    @Transactional
    public DoctorGuidanceTempLabel save(String doctorCode, String name, Integer teamId)throws Exception{
        DoctorGuidanceTempLabel one = new DoctorGuidanceTempLabel();
        one.setCode(getCode());
        one.setCreateTime(new Date());
        one.setDoctorCode(doctorCode);
        one.setName(name);
        one.setTeamId(teamId);
        one.setDel(1);
        return doctorGuidanceTempLableDao.save(one);
    }
    public List<DoctorGuidanceTempLabel> findByDoctorCode(Integer teamId, int pageSize, int pageNo) throws Exception{
        Sort sort = new Sort(Sort.Direction.DESC, "createTime");
        pageNo=pageNo-1;
        PageRequest pageRequest = new PageRequest(pageNo, pageSize,sort);
        Page<DoctorGuidanceTempLabel> page =  doctorGuidanceTempLableDao.findByTeamId(teamId,pageRequest);
        List<DoctorGuidanceTempLabel> newList = new ArrayList<>();
        newList.add(0,new DoctorGuidanceTempLabel("","未分组"));
        newList.addAll(page.getContent());
        return newList;
    }
    public List<DoctorGuidanceTempLabel> findByDoctorCode(Integer teamId) throws Exception{
        List<DoctorGuidanceTempLabel> list =  doctorGuidanceTempLableDao.findByTeamId(teamId);
        List<DoctorGuidanceTempLabel> newList = new ArrayList<>();
        newList.add(0,new DoctorGuidanceTempLabel("","未分组"));
        newList.addAll(list);
        return newList;
    }
    @Transactional
    public boolean delete(String code) throws Exception{
        int temp = doctorGuidanceTempLableDao.updateDel(0,code);
        if(temp>0){
            return true;
        }
        return false;
    }
    @Transactional
    public boolean updateName(String code,String name) throws Exception{
        int temp = doctorGuidanceTempLableDao.updateName(name,code);
        if(temp>0){
            return true;
        }
        return false;
    }
}

+ 36 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorTeamGuidanceService.java

@ -5,6 +5,7 @@ import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientHealthGuidance;
import com.yihu.wlyy.entity.template.DoctorGuidanceTemp;
import com.yihu.wlyy.entity.template.DoctorGuidanceTempLabel;
import com.yihu.wlyy.entity.template.DoctorTeamGuidanceDetail;
import com.yihu.wlyy.entity.template.DoctorTeamGuidanceTemplate;
import com.yihu.wlyy.logs.BusinessLogs;
@ -12,13 +13,13 @@ import com.yihu.wlyy.repository.doctor.DoctorAdminTeamMemberDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.template.DoctorGuidanceTempDao;
import com.yihu.wlyy.repository.template.DoctorGuidanceTempLabelDao;
import com.yihu.wlyy.repository.template.DoctorTeamGuidanceDetailDao;
import com.yihu.wlyy.repository.template.DoctorTeamGuidanceTemplateDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.consult.ConsultService;
import com.yihu.wlyy.service.app.health.PatientHealthGuidanceService;
import com.yihu.wlyy.util.CommonUtil;
import io.swagger.models.auth.In;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -57,6 +58,8 @@ public class DoctorTeamGuidanceService extends BaseService {
    DoctorGuidanceTempDao guidanceTempDao;
    @Autowired
    private CommonUtil CommonUtil;
    @Autowired
    private DoctorGuidanceTempLabelDao doctorGuidanceTempLableDao;
    /**
     * 新增团队指导模板
@ -66,7 +69,7 @@ public class DoctorTeamGuidanceService extends BaseService {
     * @param content
     * @param images
     */
    public String saveTeamGuidance(String doctor, String title, JSONArray teams, String content, String images) throws Exception {
    public String saveTeamGuidance(String doctor, String title, JSONArray teams, String content, String images,String labelCode) throws Exception {
        String templateCode = getCode();
        Date nowDate = new Date();
        String image = "";
@ -75,7 +78,12 @@ public class DoctorTeamGuidanceService extends BaseService {
            image = CommonUtil.copyTempImage(images);
            System.out.println("images =====>" + image);
        }
        //指导标签
        DoctorGuidanceTempLabel doctorGuidanceTempLable =  doctorGuidanceTempLableDao.findByCode(labelCode);
        String labelName = "未分组";
        if(doctorGuidanceTempLable!=null){
            labelName = doctorGuidanceTempLable.getName();
        }
        for (Object team : teams) {
            JSONObject teamJson = new JSONObject(team.toString());
            int teamId = teamJson.getInt("teamId");
@ -93,7 +101,8 @@ public class DoctorTeamGuidanceService extends BaseService {
                doctorTeamGuidanceTemplate.setTitle(title);
                doctorTeamGuidanceTemplate.setTeamTemplateCode(templateCode);
                doctorTeamGuidanceTemplate.setUseTimes(0);
                doctorTeamGuidanceTemplate.setLabelCode(labelCode);
                doctorTeamGuidanceTemplate.setLabelName(labelName);
                doctorTeamGuidanceTemplateDao.save(doctorTeamGuidanceTemplate);
            } else {
                throw new Exception(teamName + ":团队标题重复!");
@ -468,4 +477,27 @@ public class DoctorTeamGuidanceService extends BaseService {
        return imagePath;
    }
    public List<DoctorTeamGuidanceTemplate> getGuidanceByTeamIdAndLabelCode( Integer teamId,String labelCode, int pageNo, int pageSize) throws Exception {
        Sort sort = new Sort(Sort.Direction.DESC, "useTimes","createTime");
        pageNo = pageNo -1;
        PageRequest request = new PageRequest(pageNo, pageSize, sort);
        List<DoctorTeamGuidanceTemplate> list = doctorTeamGuidanceTemplateDao.findGuidanceByTeamIdAndLabelCode(teamId,labelCode,request);
        return list;
    }
    public Map<String,List<DoctorTeamGuidanceTemplate>> getTeamGuidanceListByLabelWithFilter(Integer teamId ,String filter) throws Exception {
        List<DoctorTeamGuidanceTemplate>  listGuidances = doctorTeamGuidanceTemplateDao.getListByTile(teamId,"%"+filter+"%");
        Map<String,List<DoctorTeamGuidanceTemplate>> map= new HashMap<>();
        for(DoctorTeamGuidanceTemplate one:listGuidances){
            if(map.containsKey(one.getLabelName()!=null?one.getLabelName():"未分组")){
                List<DoctorTeamGuidanceTemplate> temp = map.get(one.getLabelName()!=null?one.getLabelName():"未分组");
                temp.add(one);
            }else{
                map.put(one.getLabelName()!=null?one.getLabelName():"未分组",new ArrayList<>(Arrays.asList(one)));
            }
        }
        return map;
    }
}

+ 43 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jkEduArticle/ThirdJkEduArticleService.java

@ -11,6 +11,7 @@ import com.yihu.wlyy.entity.organization.HospitalMapping;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorRoleDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.repository.patient.PatientDao;
@ -72,6 +73,8 @@ public class ThirdJkEduArticleService extends BaseService {
    private DoctorRoleDao doctorRoleDao;
    @Autowired
    private HospitalDao hospitalDao;
    @Autowired
    private MessageDao messageDao;
    //    private String baseUrl = "http://service.yihu.com:8085/WsPlatform/rest";
//    private String baseUrl = "http://172.17.110.230:83/WsPlatform/rest";
@ -394,6 +397,41 @@ public class ThirdJkEduArticleService extends BaseService {
        }
    }
    /**
     * 获取文章详情
     *
     * @param articleId 文章id
     * @return
     */
    public JSONObject getArticalById(String articleId,String userId,String userType,String messageCode) throws Exception {
        JSONObject re = new JSONObject();
        JSONObject json = null;
        try {
            JSONObject param = new JSONObject();
            param.put("articleId", articleId);
            param.put("userId", userId);
            param.put("userType", userType);
            String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getArticalById, param.toString(), "1"));
            json = JSON.parseObject(response);
            if("1".equals(userType)&&!org.apache.commons.lang.StringUtils.isEmpty(messageCode)){
                messageDao.read(messageCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
            return re;
        }
        if ("10000".equals(json.getString("Code"))) {
            JSONArray result = json.getJSONArray("Result");
            if (result.size() > 0) {
                return result.getJSONObject(0);
            }
            return re;
        } else {
            throw new Exception(json.getString("Message"));
        }
    }
    /**
     * 添加文章
     * @param userCode 医生code
@ -409,7 +447,7 @@ public class ThirdJkEduArticleService extends BaseService {
     * @return
     * @throws Exception
     */
    public void saveArticle(String userCode,String articleTitle,String articleType,Integer	articlelevel,String	secondLevelCategoryId,String newUrl,
    public boolean saveArticle(String userCode,String articleTitle,String articleType,Integer	articlelevel,String	secondLevelCategoryId,String newUrl,
                                 String	secondLevelCategoryName,String firstLevelCategoryId,String firstLevelCategoryName,String content,
                                 String operatorRoleCode,String opertorRoleLevel,Integer userScope,Integer isAuthentication,String articleId,Integer roleType) throws Exception {
@ -479,7 +517,7 @@ public class ThirdJkEduArticleService extends BaseService {
            e.printStackTrace();
        }
        if ("10000".equals(json.getString("Code"))) {
            return true;
        } else {
            throw new Exception(json.getString("Message"));
        }
@ -646,7 +684,7 @@ public class ThirdJkEduArticleService extends BaseService {
     * 认证文章
     * @return
     */
    public void authenticationArticle(String articleId,String isAuthentication,String firstLevelCategoryId,String firstLevelCategoryName,String secondLevelCategoryId,String secondLevelCategoryName) throws Exception{
    public boolean authenticationArticle(String articleId,String isAuthentication,String firstLevelCategoryId,String firstLevelCategoryName,String secondLevelCategoryId,String secondLevelCategoryName) throws Exception{
        String response = "";
        JSONObject json = null;
@ -665,6 +703,8 @@ public class ThirdJkEduArticleService extends BaseService {
        }
        if (!"10000".equals(json.getString("Code"))) {
            throw new Exception(json.getString("Message"));
        }else{
            return true;
        }
    }

+ 168 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/YLZUserService.java

@ -0,0 +1,168 @@
package com.yihu.wlyy.service.third.ylz;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.service.third.ylz.model.YLZAccessToken;
import com.yihu.wlyy.service.third.ylz.model.YLZUser;
import com.yihu.wlyy.service.third.ylz.model.YLZUserCard;
import com.yihu.wlyy.util.HttpClientUtil;
import com.ylzinfo.ehc.empi.sdk.EhcEmpiClient;
import com.ylzinfo.ehc.empi.sdk.dto.request.AuthorizationTokenRequest;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.RequestParams;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.exception.PayException;
import com.ylzinfo.onepay.sdk.utils.DateUtil;
import com.ylzinfo.onepay.sdk.utils.SecurityUtil;
import com.ylzinfo.onepay.sdk.utils.Signature;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
 * Created by chenweida on 2018/5/16 0016.
 */
@Service
public class YLZUserService {
    Logger logger = LoggerFactory.getLogger(YLZUserService.class);
    //网关地址
    @Value("${ylz.gateway.url}")
    private String gatewayURL;
    //1.统一实名身份认证授权
    @Value("${ylz.empi_uimc_authorization.method}")
    private String empiUimcAuthorization;
    //2.统一实名用户信息获取
    @Value("${ylz.empi_uimc_query.method}")
    private String empiUimcQuery;
    @Value("${ylz.appId}")
    private String appId;
    @Value("${ylz.termId}")
    private String termId;
    @Value("${ylz.appSecret}")
    private String appSecret;
    @Value("${ylz.redirectUrl}")
    private String redirectUrl;
    private String signType = "MD5";
    private String encryptType = "AES";
    private String responseType = "token";
    @Autowired
    private HttpClientUtil httpClientUtil;
    public String getAccessToken() {
        try {
            EhcEmpiClient empiClient = new EhcEmpiClient(gatewayURL, appId, appSecret, termId, "1.0", signType, encryptType);
            try {
                AuthorizationTokenRequest params = new AuthorizationTokenRequest();
                params.setRedirectUrl(redirectUrl);
                params.setUserName("48");
                String url = empiClient.createUrl("gatewayPage", empiUimcAuthorization, params);
                String responseStr = httpClientUtil.get(url, "UTF-8");
                net.sf.json.JSONObject responseJSON = net.sf.json.JSONObject.fromObject(responseStr);
            } catch (Exception e) {
                e.printStackTrace();
            }
        } catch (Exception e) {
            logger.error(e.getMessage());
            return null;
        }
        return null;
    }
    private String initParams(RequestParams requestParams) throws PayException {
        String sign = Signature.createSign(requestParams, this.appSecret);
        requestParams.setSign(sign);
        String requestMessage;
        try {
            logger.info("加密前报文:" + JSONObject.toJSONString(requestParams));
            requestMessage = SecurityUtil.encrypt(JSONObject.toJSONString(requestParams.getParam()), this.encryptType, this.appSecret, this.appId);
            logger.info("加密后报文:" + requestMessage);
            requestParams.setEncryptData(requestMessage);
        } catch (Exception var11) {
            throw new PayException("请求报文加密失败");
        }
        requestParams.setParam((Object) null);
        requestMessage = JSON.toJSONString(requestParams);
        System.out.println("请求参数报文:" + requestMessage);
        return requestMessage;
    }
    /**
     * 此方式仅应用到注册回调
     */
    public YLZUser getUserByToken(String token) {
        try {
            String result = null;
            OnepayDefaultClient onepayClient = new OnepayDefaultClient(
                    empiUimcQuery,
                    appId,
                    appSecret, signType, encryptType);
            RequestParams requestParams = new RequestParams();
            requestParams.setAppId(appId);
            requestParams.setTimestamp(DateUtil.getCurrentDateTime());
            requestParams.setSignType(signType);
            requestParams.setEncryptType(encryptType);
            //业务参数
            JSONObject params = new JSONObject();
            params.put("token", token);  //注册回调的token
            requestParams.setParam(params);
            logger.info("requestParams:" + requestParams.toString());
            ResponseParams<JSONObject> res = onepayClient.execute(requestParams);
            if (OnepayDefaultClient.isSuccessful(res)) {
                result = JSON.toJSONString(res.getParam());
                logger.info("易联众返回结果:" + result);
//             新增保存数据
                JSONObject userJson = JSON.parseObject(result).getJSONObject("biz_content");
                YLZUser user = getYLZUser(userJson);
                YLZUserCard userCard = getYLZUserCard(userJson.getJSONArray("card_info"));
                user.setYlzUserCard(userCard);
                return user;
            } else {
                logger.error("调用易联众接口失败:" + res.toString());
            }
            return null;
        } catch (Exception e) {
            logger.error(e.getMessage());
            return null;
        }
    }
    private YLZUserCard getYLZUserCard(JSONArray card_infos) {
        YLZUserCard ylzUserCard = null;
        for (int i = 0; i < card_infos.size(); i++) {
            JSONObject jo = card_infos.getJSONObject(i);
            if ("normal ".equals(jo.getString("state"))) {
                ylzUserCard = JSON.parseObject(jo.toJSONString(), YLZUserCard.class);
                break;
            }
        }
        return ylzUserCard;
    }
    private YLZUser getYLZUser(JSONObject userJson) {
        YLZUser ylzUserCard = JSON.parseObject(userJson.toJSONString(), YLZUser.class);
        return ylzUserCard;
    }
    public static void main(String[] args) {
        String str = "{\"card_no\":\"111111\"}";
        YLZUserCard ylzUserCard = JSON.parseObject(str, YLZUserCard.class);
        System.out.println(ylzUserCard);
    }
}

+ 64 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/model/YLZAccessToken.java

@ -0,0 +1,64 @@
package com.yihu.wlyy.service.third.ylz.model;
import java.util.Date;
/**
 * Created by chenweida on 2018/5/16 0016.
 */
public class YLZAccessToken {
    private String accessToken; //授权token	String(32)
    private String tokenType;
    private Integer expiresIn;// token过期时间  3600 秒
    private Date createTime;// token过期时间  3600 秒
    private String state;
    public String getAccessToken() {
        return accessToken;
    }
    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }
    public String getTokenType() {
        return tokenType;
    }
    public void setTokenType(String tokenType) {
        this.tokenType = tokenType;
    }
    public Integer getExpiresIn() {
        return expiresIn;
    }
    public void setExpiresIn(Integer expiresIn) {
        this.expiresIn = expiresIn;
    }
    public String getState() {
        return state;
    }
    public void setState(String state) {
        this.state = state;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public boolean isNotOutTime() {
        long interval = (new Date().getTime() - this.getCreateTime().getTime()) / 1000;
        if (interval > (expiresIn - 120)) {
            return false;
        } else {
            return true;
        }
    }
}

+ 126 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/model/YLZRequestParams.java

@ -0,0 +1,126 @@
//package com.yihu.wlyy.service.third.ylz.model;
//
//import com.alibaba.fastjson.annotation.JSONField;
//import net.sf.json.JSONObject;
//
///**
// * Created by chenweida on 2018/5/22 0022.
// */
//public class YLZRequestParams {
//    @JSONField(name = "timestamp")
//    private String timestamp;
//    @JSONField(name = "sign")
//    private String sign;
//    @JSONField(name = "biz_content")
//    private String bizContent;
//    @JSONField(name = "enc_type")
//    private String signType = "MD5";
//    @JSONField(name = "term_id")
//    private String termId;
//    @JSONField(name = "method")
//    private String method;
//    @JSONField(name = "app_id")
//    private String appId;
//    @JSONField(name = "version")
//    private String version = "1.0";
//    @JSONField(name = "sign_type")
//    private String encType = "AES";
//
//
//    public String getTimestamp() {
//        return timestamp;
//    }
//
//    public void setTimestamp(String timestamp) {
//        this.timestamp = timestamp;
//    }
//
//    public String getSign() {
//        return sign;
//    }
//
//    public void setSign(String sign) {
//        this.sign = sign;
//    }
//
//    public String getBizContent() {
//        return bizContent;
//    }
//
//    public void setBizContent(String bizContent) {
//        this.bizContent = bizContent;
//    }
//
//    public String getSignType() {
//        return signType;
//    }
//
//    public void setSignType(String signType) {
//        this.signType = signType;
//    }
//
//    public String getTermId() {
//        return termId;
//    }
//
//    public void setTermId(String termId) {
//        this.termId = termId;
//    }
//
//    public String getMethod() {
//        return method;
//    }
//
//    public void setMethod(String method) {
//        this.method = method;
//    }
//
//    public String getAppId() {
//        return appId;
//    }
//
//    public void setAppId(String appId) {
//        this.appId = appId;
//    }
//
//    public String getVersion() {
//        return version;
//    }
//
//    public void setVersion(String version) {
//        this.version = version;
//    }
//
//    public String getEncType() {
//        return encType;
//    }
//
//    public void setEncType(String encType) {
//        this.encType = encType;
//    }
//
//    /**
//     * 1. 筛选
//     获取所有请求参数,不包括字节类型参数,如文件、字节流,剔除sign字段。
//     (app_id.、term_id、method、version、timestamp、sign_type、enc_type、)
//     2. 排序
//     将筛选的参数按照第一个字符的键值ASCII码递增排序(字母升序排序),如果遇到相同字符则按照第二个字符的键值ASCII码递增排序,以此类推。
//
//     3. 拼接
//     将排序后的参数与其对应值,组合成“参数=参数值”的格式,并且把这些参数用&字符连接起来,最后拼接上应用密钥在“…参数=参数值key=你的密钥”,此时生成的字符串为待签名字符串,将待签名字符串MD5运算,即是签名(sign)的值。
//     * @return
//     */
//    public String initSign(){
//        JSONObject jo=new JSONObject();
//        jo.put("app_id",this.appId);
//        jo.put("enc_type",this.encType);
//        jo.put("method",this.method);
//        jo.put("sign_type",this.signType);
//        jo.put("term_id",this.termId);
//        jo.put("timestamp",this.timestamp);
//        jo.put("version",this.version);
//
//        StringBuffer sb=new StringBuffer();
//        sb.append("app_id="+this.appId);
//    }
//}

+ 360 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/model/YLZUser.java

@ -0,0 +1,360 @@
package com.yihu.wlyy.service.third.ylz.model;
import com.alibaba.fastjson.annotation.JSONField;
/**
 * Created by chenweida on 2018/5/16 0016.
 */
public class YLZUser {
    @JSONField(name = "empi_user_id")
    private String empiUserId;//用户主索引
    @JSONField(name = "name")
    private String name;//姓名
    @JSONField(name = "sex")
    private String sex;//性别  0未知性别 1男 2女 9未说明性别
    @JSONField(name = "birth_day")
    private String birthDay;//出生日期  yyyyMMddHH
    @JSONField(name = "birth_addr")
    private String birthAddr;//出生地
    @JSONField(name = "id_type")
    private String idType;//证件类型   01	居民身份证 02	居民户口簿 03	护照  04	军官证   05	驾驶证   06	港澳居民来往内地通行证   07	台湾居民来往内地通行证   99	其他法定有效证件
    @JSONField(name = "id_no")
    private String idNo;//证件号码
    @JSONField(name = "native")
    private String native_;//国籍
    @JSONField(name = "address")
    private String address;//所在地, 通讯地址
    @JSONField(name = "origin")
    private String origin;//籍贯
    @JSONField(name = "company")
    private String company;//作单位
    @JSONField(name = "company_phone")
    private String companyPhone;//单位电话
    @JSONField(name = "contacts_relationship")
    private String contactsRelationship;//与联系人关系 参考国家互联互通标准GB/T 4761-2008
    @JSONField(name = "contacts_phone")
    private String contactsPhone;//联系人电话
    @JSONField(name = "contacts_addr")
    private String contactsAddr;//联系人地址
    @JSONField(name = "is_certified")
    private String isCertified;//安全认证  0否,1 是
    @JSONField(name = "certificate_authority")
    private String certificateAuthority;//认证机构  1经信局 2公安 等
    @JSONField(name = "telephone")
    private String telephone;//联系方式
    @JSONField(name = "email")
    private String email;//邮箱地址
    @JSONField(name = "post")
    private String post;//邮编
    @JSONField(name = "work")
    private String work;//职业
    @JSONField(name = "home_phone")
    private String homePhone;//家庭电话
    @JSONField(name = "avatar_photo_id")
    private String avatarPhotoId;//照片
    @JSONField(name = "marital_status")
    private String maritalStatus;//婚姻状态  10未婚 20已婚  21初婚 22再婚 23复婚  30丧偶 40离婚 90未说明的婚姻状况
    @JSONField(name = "state")
    private String state;//状态  normal 正常 freeze 冻结  logout 注销   lossed 挂失
    @JSONField(name = "domain_id")
    private String domainId;//标识域编码
    @JSONField(name = "domain_name")
    private String domainName;//标识域名称
    @JSONField(name = "term_id")
    private String termId;//终端号
    @JSONField(name = "oper_id")
    private String operId;//操作员编号
    @JSONField(name = "oper_name")
    private String operName;//操作员姓名
    @JSONField(name = "crt_date")
    private String crtDate;//创建日期
    @JSONField(name = "crt_time")
    private String crtTime;//创建时间
    @JSONField(name = "nation")
    private String nation;//民族
    @JSONField(name = "contacts_name")
    private String contactsName;//联系人姓名
    private YLZUserCard ylzUserCard;
    public String getEmpiUserId() {
        return empiUserId;
    }
    public void setEmpiUserId(String empiUserId) {
        this.empiUserId = empiUserId;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    public String getBirthDay() {
        return birthDay;
    }
    public void setBirthDay(String birthDay) {
        this.birthDay = birthDay;
    }
    public String getBirthAddr() {
        return birthAddr;
    }
    public void setBirthAddr(String birthAddr) {
        this.birthAddr = birthAddr;
    }
    public String getIdType() {
        return idType;
    }
    public void setIdType(String idType) {
        this.idType = idType;
    }
    public String getIdNo() {
        return idNo;
    }
    public void setIdNo(String idNo) {
        this.idNo = idNo;
    }
    public String getNative_() {
        return native_;
    }
    public void setNative_(String native_) {
        this.native_ = native_;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public String getOrigin() {
        return origin;
    }
    public void setOrigin(String origin) {
        this.origin = origin;
    }
    public String getCompany() {
        return company;
    }
    public void setCompany(String company) {
        this.company = company;
    }
    public String getCompanyPhone() {
        return companyPhone;
    }
    public void setCompanyPhone(String companyPhone) {
        this.companyPhone = companyPhone;
    }
    public String getContactsRelationship() {
        return contactsRelationship;
    }
    public void setContactsRelationship(String contactsRelationship) {
        this.contactsRelationship = contactsRelationship;
    }
    public String getContactsPhone() {
        return contactsPhone;
    }
    public void setContactsPhone(String contactsPhone) {
        this.contactsPhone = contactsPhone;
    }
    public String getContactsAddr() {
        return contactsAddr;
    }
    public void setContactsAddr(String contactsAddr) {
        this.contactsAddr = contactsAddr;
    }
    public String getIsCertified() {
        return isCertified;
    }
    public void setIsCertified(String isCertified) {
        this.isCertified = isCertified;
    }
    public String getCertificateAuthority() {
        return certificateAuthority;
    }
    public void setCertificateAuthority(String certificateAuthority) {
        this.certificateAuthority = certificateAuthority;
    }
    public String getTelephone() {
        return telephone;
    }
    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getPost() {
        return post;
    }
    public void setPost(String post) {
        this.post = post;
    }
    public String getWork() {
        return work;
    }
    public void setWork(String work) {
        this.work = work;
    }
    public String getHomePhone() {
        return homePhone;
    }
    public void setHomePhone(String homePhone) {
        this.homePhone = homePhone;
    }
    public String getAvatarPhotoId() {
        return avatarPhotoId;
    }
    public void setAvatarPhotoId(String avatarPhotoId) {
        this.avatarPhotoId = avatarPhotoId;
    }
    public String getMaritalStatus() {
        return maritalStatus;
    }
    public void setMaritalStatus(String maritalStatus) {
        this.maritalStatus = maritalStatus;
    }
    public String getState() {
        return state;
    }
    public void setState(String state) {
        this.state = state;
    }
    public String getDomainId() {
        return domainId;
    }
    public void setDomainId(String domainId) {
        this.domainId = domainId;
    }
    public String getDomainName() {
        return domainName;
    }
    public void setDomainName(String domainName) {
        this.domainName = domainName;
    }
    public String getTermId() {
        return termId;
    }
    public void setTermId(String termId) {
        this.termId = termId;
    }
    public String getOperId() {
        return operId;
    }
    public void setOperId(String operId) {
        this.operId = operId;
    }
    public String getOperName() {
        return operName;
    }
    public void setOperName(String operName) {
        this.operName = operName;
    }
    public String getCrtDate() {
        return crtDate;
    }
    public void setCrtDate(String crtDate) {
        this.crtDate = crtDate;
    }
    public String getCrtTime() {
        return crtTime;
    }
    public void setCrtTime(String crtTime) {
        this.crtTime = crtTime;
    }
    public String getNation() {
        return nation;
    }
    public void setNation(String nation) {
        this.nation = nation;
    }
    public String getContactsName() {
        return contactsName;
    }
    public void setContactsName(String contactsName) {
        this.contactsName = contactsName;
    }
    public YLZUserCard getYlzUserCard() {
        return ylzUserCard;
    }
    public void setYlzUserCard(YLZUserCard ylzUserCard) {
        this.ylzUserCard = ylzUserCard;
    }
}

+ 137 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/model/YLZUserCard.java

@ -0,0 +1,137 @@
package com.yihu.wlyy.service.third.ylz.model;
import com.alibaba.fastjson.annotation.JSONField;
/**
 * Created by chenweida on 2018/5/16 0016.
 */
public class YLZUserCard {
    @JSONField(name = "card_no")
    private String cardNo;//卡号
    @JSONField(name = "card_type")
    private String cardType;//卡类型 01社保卡  02就诊卡
    @JSONField(name = "card_org")
    private String cardOrg;//办卡机构
    @JSONField(name = "card_zone")
    private String cardZone;//办卡地区
    @JSONField(name = "card_fn")
    private String cardFn;//卡内码
    @JSONField(name = "term_id")
    private String termId;//	终端号
    @JSONField(name = "oper_id")
    private String operId;//	操作员编号
    @JSONField(name = "oper_name")
    private String operName;//操作员姓名
    @JSONField(name = "crt_date")
    private String crtDate;//创建日期
    @JSONField(name = "crt_time")
    private String crtTime;//创建时间
    @JSONField(name = "state")
    private String state; //状态  normal 正常 freeze 冻结  logout 注销  lossed 挂失 
    public String getCardNo() {
        return cardNo;
    }
    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }
    public String getCardType() {
        return cardType;
    }
    public void setCardType(String cardType) {
        this.cardType = cardType;
    }
    public String getCardOrg() {
        return cardOrg;
    }
    public void setCardOrg(String cardOrg) {
        this.cardOrg = cardOrg;
    }
    public String getCardZone() {
        return cardZone;
    }
    public void setCardZone(String cardZone) {
        this.cardZone = cardZone;
    }
    public String getCardFn() {
        return cardFn;
    }
    public void setCardFn(String cardFn) {
        this.cardFn = cardFn;
    }
    public String getTermId() {
        return termId;
    }
    public void setTermId(String termId) {
        this.termId = termId;
    }
    public String getOperId() {
        return operId;
    }
    public void setOperId(String operId) {
        this.operId = operId;
    }
    public String getOperName() {
        return operName;
    }
    public void setOperName(String operName) {
        this.operName = operName;
    }
    public String getCrtDate() {
        return crtDate;
    }
    public void setCrtDate(String crtDate) {
        this.crtDate = crtDate;
    }
    public String getCrtTime() {
        return crtTime;
    }
    public void setCrtTime(String crtTime) {
        this.crtTime = crtTime;
    }
    public String getState() {
        return state;
    }
    public void setState(String state) {
        this.state = state;
    }
    @Override
    public String toString() {
        return "YLZUserCard{" +
                "cardNo='" + cardNo + '\'' +
                ", cardType='" + cardType + '\'' +
                ", cardOrg='" + cardOrg + '\'' +
                ", cardZone='" + cardZone + '\'' +
                ", cardFn='" + cardFn + '\'' +
                ", termId='" + termId + '\'' +
                ", operId='" + operId + '\'' +
                ", operName='" + operName + '\'' +
                ", crtDate='" + crtDate + '\'' +
                ", crtTime='" + crtTime + '\'' +
                ", state='" + state + '\'' +
                '}';
    }
}

+ 38 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/applets/AppletsService.java

@ -0,0 +1,38 @@
package com.yihu.wlyy.service.weixin.applets;
import com.yihu.wlyy.util.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Map;
/**
 * Created by Trick on 2018/5/23.
 */
@Service
@Transactional
public class AppletsService {
    private String appid = "wx47ecd9a6372e7c96";
    private String appSecret ="9df49ebba7d5cdf8b9a77213bbf36807";
    public Map<String,Object> checkApplets(String code) throws Exception{
        HttpUtils httpUtils = new HttpUtils();
        Map<String,Object> param = new HashedMap();
        param.put("appid",appid);
        param.put("secret",appSecret);
        param.put("js_code",code);
        param.put("grant_type","authorization_code");
        HttpResponse response = httpUtils.doGet("https://api.weixin.qq.com/sns/jscode2session",param);
        JSONObject rs = new JSONObject(response.getContent());
        Map<String,Object> res = new HashedMap();
        res.put("openid",rs.getString("openid"));
        res.put("sessionKey",rs.getString("session_key"));
        return res;
    }
}

+ 6 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/MessageType.java

@ -177,6 +177,12 @@ public class MessageType {
		D_P_WRD, 续方消息, 待取药
	}
	public static enum MESSAGE_TYPE_SAVE_HEALTH_EDU_ARTICLE{
		D_EDU_01,新增文章审核消息
	}
	public static enum MESSAGE_TYPE_AUTHEN_HEALTH_EDU_ARTICLE{
		D_EDU_02,新增文章认证消息
	}
}

+ 41 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/http/HttpResponse.java

@ -0,0 +1,41 @@
package com.yihu.wlyy.util.http;
/**
 * Utils - Http请求辅助类,简化页面页面判断逻辑
 * Created by progr1mmer on 2018/1/16.
 */
public class HttpResponse {
    private int status;
    private String content;
    public HttpResponse(int status, String content) {
        this.status = status;
        this.content = content;
    }
    public int getStatus() {
        return status;
    }
    public void setStatus(int status) {
        this.status = status;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public boolean isSuccessFlg() {
        return status == 200;
    }
    public String getErrorMsg() {
        return content;
    }
}

+ 449 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/http/HttpUtils.java

@ -0,0 +1,449 @@
package com.yihu.wlyy.util.http;
import org.apache.http.HttpEntity;
import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.*;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.util.StringUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Utils - HTTP请求辅助工具类
 * Created by progr1mmer on 2017/9/27.
 */
public class HttpUtils {
    public static HttpResponse doGet(String url, Map<String, Object> params) throws Exception {
        return doGet(url, params, null);
    }
    public static HttpResponse doGet(String url, Map<String, Object> params, Map<String, String> headers) throws Exception {
        return doGet(url, params, headers, null, null);
    }
    public static HttpResponse doGet(String url, Map<String, Object> params, Map<String, String> headers, String username, String password) throws Exception {
        String response;
        int status;
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse closeableHttpResponse = null;
        List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
        if (params != null) {
            for (String key : params.keySet()) {
                Object value = params.get(key);
                if (value != null) {
                    nameValuePairList.add(new BasicNameValuePair(key, String.valueOf(params.get(key))));
                }
            }
        }
        String paramStr = EntityUtils.toString(new UrlEncodedFormEntity(nameValuePairList, "UTF-8"));
        HttpGet httpGet = new HttpGet(url + "?" + paramStr);
        if (headers != null) {
            for (String key : headers.keySet()) {
                httpGet.addHeader(key, headers.get(key));
            }
        }
        try {
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(username, password);
                CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
                credentialsProvider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
                httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
            } else {
                httpClient = HttpClients.createDefault();
            }
            closeableHttpResponse = httpClient.execute(httpGet);
            HttpEntity resEntity = closeableHttpResponse.getEntity();
            status = closeableHttpResponse.getStatusLine().getStatusCode();
            response = getRespString(resEntity);
        } finally {
            try {
                if (closeableHttpResponse != null) {
                    closeableHttpResponse.close();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            }catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (status != HttpStatus.SC_OK) {
//            LogService.getLogger().error(" GET: " + url + " " + status);
        }
        HttpResponse httpResponse = new HttpResponse(status, response);
        return httpResponse;
    }
    public static HttpResponse doPost(String url, Map<String, Object> params) throws Exception {
        return doPost(url, params, null);
    }
    public static HttpResponse doPost(String url, Map<String, Object> params, Map<String, String> headers) throws Exception{
        return doPost(url, params, headers, null, null);
    }
    public static HttpResponse doPost(String url, Map<String, Object> params, Map<String, String> headers, String username, String password) throws Exception{
        String response;
        int status;
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse closeableHttpResponse = null;
        HttpPost httpPost = new HttpPost(url);
        List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
        if (params != null) {
            for (String key : params.keySet()) {
                Object value = params.get(key);
                if (value != null) {
                    nameValuePairList.add(new BasicNameValuePair(key, String.valueOf(params.get(key))));
                }
            }
        }
        httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairList, "UTF-8"));
        if (headers != null) {
            for (String key : headers.keySet()) {
                httpPost.addHeader(key, headers.get(key));
            }
        }
        try {
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(username, password);
                CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
                credentialsProvider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
                httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
            } else {
                httpClient = HttpClients.createDefault();
            }
            closeableHttpResponse = httpClient.execute(httpPost);
            HttpEntity resEntity = closeableHttpResponse.getEntity();
            status = closeableHttpResponse.getStatusLine().getStatusCode();
            response = getRespString(resEntity);
        } finally {
            try {
                if (closeableHttpResponse != null) {
                    closeableHttpResponse.close();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            }catch (Exception e) {
                e.printStackTrace();
            }
        }
        if(status != HttpStatus.SC_OK) {
//            LogService.getLogger().error(" POST: " + url + " " + status);
        }
        HttpResponse httpResponse = new HttpResponse(status, response);
        return httpResponse;
    }
    public static HttpResponse doJsonPost(String url, String jsonData, Map<String, String> headers, String username, String password) throws Exception{
        String response;
        int status;
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse closeableHttpResponse = null;
        HttpPost httpPost = new HttpPost(url);
        httpPost.setHeader("Content-Type", "application/json;charset=UTF-8");
        httpPost.setEntity(new StringEntity(jsonData, "UTF-8"));
        if (headers != null) {
            for (String key : headers.keySet()) {
                httpPost.addHeader(key, headers.get(key));
            }
        }
        try {
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(username, password);
                CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
                credentialsProvider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
                httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
            } else {
                httpClient = HttpClients.createDefault();
            }
            closeableHttpResponse = httpClient.execute(httpPost);
            HttpEntity resEntity = closeableHttpResponse.getEntity();
            status = closeableHttpResponse.getStatusLine().getStatusCode();
            response = getRespString(resEntity);
        } finally {
            try {
                if (closeableHttpResponse != null) {
                    closeableHttpResponse.close();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if(status != HttpStatus.SC_OK) {
//            LogService.getLogger().error(" POST: " + url + " " + status);
        }
        HttpResponse httpResponse = new HttpResponse(status, response);
        return httpResponse;
    }
    public static HttpResponse doPut(String url, Map<String, Object> params) throws Exception {
        return doPut(url, params, null);
    }
    public static HttpResponse doPut(String url, Map<String, Object> params, Map<String, String> headers) throws Exception {
        return doPut(url, params, headers, null, null);
    }
    public static HttpResponse doPut(String url, Map<String, Object> params, Map<String, String> headers, String username, String password) throws Exception {
        String response;
        int status;
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse closeableHttpResponse = null;
        HttpPut httpPut = new HttpPut(url);
        List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
        if (params != null) {
            for (String key : params.keySet()) {
                Object value = params.get(key);
                if (value != null) {
                    nameValuePairList.add(new BasicNameValuePair(key, String.valueOf(params.get(key))));
                }
            }
        }
        httpPut.setEntity(new UrlEncodedFormEntity(nameValuePairList, "UTF-8"));
        if (headers != null) {
            for (String key : headers.keySet()) {
                httpPut.addHeader(key, headers.get(key));
            }
        }
        try {
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(username, password);
                CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
                credentialsProvider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
                httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
            } else {
                httpClient = HttpClients.createDefault();
            }
            closeableHttpResponse = httpClient.execute(httpPut);
            HttpEntity resEntity = closeableHttpResponse.getEntity();
            status = closeableHttpResponse.getStatusLine().getStatusCode();
            response = getRespString(resEntity);
        } finally {
            try {
                if (closeableHttpResponse != null) {
                    closeableHttpResponse.close();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (status != HttpStatus.SC_OK) {
//            LogService.getLogger().error(" PUT: " + url + " " + status);
        }
        HttpResponse httpResponse = new HttpResponse(status, response);
        return httpResponse;
    }
    public static HttpResponse doJsonPut(String url, String jsonData, Map<String, String> headers, String username, String password) throws Exception {
        String response;
        int status;
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse closeableHttpResponse = null;
        HttpPut httpPut = new HttpPut(url);
        httpPut.setHeader("Content-Type", "application/json;charset=UTF-8");
        httpPut.setEntity(new StringEntity(jsonData, "UTF-8"));
        if (headers != null) {
            for (String key : headers.keySet()) {
                httpPut.addHeader(key, headers.get(key));
            }
        }
        try {
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(username, password);
                CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
                credentialsProvider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
                httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
            } else {
                httpClient = HttpClients.createDefault();
            }
            closeableHttpResponse = httpClient.execute(httpPut);
            HttpEntity resEntity = closeableHttpResponse.getEntity();
            status = closeableHttpResponse.getStatusLine().getStatusCode();
            response = getRespString(resEntity);
        } finally {
            try {
                if (closeableHttpResponse != null) {
                    closeableHttpResponse.close();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (status != HttpStatus.SC_OK) {
//            LogService.getLogger().error(" PUT: " + url + " " + status);
        }
        HttpResponse httpResponse = new HttpResponse(status, response);
        return httpResponse;
    }
    public static HttpResponse doDelete(String url, Map<String, Object> params) throws Exception {
        return doDelete(url, params, null);
    }
    public static HttpResponse doDelete(String url, Map<String, Object> params, Map<String, String> headers) throws Exception {
        return doDelete(url, params, headers, null, null);
    }
    public static HttpResponse doDelete(String url, Map<String, Object> params, Map<String, String> headers, String username, String password) throws Exception {
        String response;
        int status;
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse closeableHttpResponse = null;
        List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
        if (params != null) {
            for (String key : params.keySet()) {
                Object value = params.get(key);
                if (value != null) {
                    nameValuePairList.add(new BasicNameValuePair(key, String.valueOf(params.get(key))));
                }
            }
        }
        String paramStr = EntityUtils.toString(new UrlEncodedFormEntity(nameValuePairList, "UTF-8"));
        HttpDelete httpDelete = new HttpDelete(url + "?" + paramStr);
        if (headers != null) {
            for (String key : headers.keySet()) {
                httpDelete.addHeader(key, headers.get(key));
            }
        }
        try {
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(username, password);
                CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
                credentialsProvider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
                httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
            } else {
                httpClient = HttpClients.createDefault();
            }
            closeableHttpResponse = httpClient.execute(httpDelete);
            HttpEntity resEntity = closeableHttpResponse.getEntity();
            status = closeableHttpResponse.getStatusLine().getStatusCode();
            response = getRespString(resEntity);
        } finally {
            try {
                if (closeableHttpResponse != null) {
                    closeableHttpResponse.close();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            }catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (status != HttpStatus.SC_OK) {
//            LogService.getLogger().error(" DELETE: " + url + " " + status);
        }
        HttpResponse httpResponse = new HttpResponse(status, response);
        return httpResponse;
    }
    public static HttpResponse doUpload(String url, Map<String, Object> params, File file) throws Exception {
        return doUpload(url, params, null, file, null, null);
    }
    public static HttpResponse doUpload(String url, Map<String, Object> params, Map<String, String> headers, File file) throws Exception {
        return doUpload(url, params, headers, file, null, null);
    }
    public static HttpResponse doUpload(String url, Map<String, Object> params, Map<String, String> headers, File file, String username, String password) throws Exception {
        String response;
        int status;
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse closeableHttpResponse = null;
        HttpPost httpPost = new HttpPost(url);
        MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
        FileBody fileBody = new FileBody(file);
        multipartEntityBuilder.addPart("file", fileBody);
        if (params != null) {
            for (String key : params.keySet()) {
                Object value = params.get(key);
                if (value != null) {
                    multipartEntityBuilder.addTextBody(key, String.valueOf(params.get(key)), ContentType.TEXT_PLAIN);
                }
            }
        }
        if (headers != null) {
            for (String key : headers.keySet()) {
                httpPost.addHeader(key, headers.get(key));
            }
        }
        HttpEntity reqEntity = multipartEntityBuilder.build();
        httpPost.setEntity(reqEntity);
        try {
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(username, password);
                CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
                credentialsProvider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
                httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
            } else {
                httpClient = HttpClients.createDefault();
            }
            closeableHttpResponse = httpClient.execute(httpPost);
            HttpEntity resEntity = closeableHttpResponse.getEntity();
            status = closeableHttpResponse.getStatusLine().getStatusCode();
            response = getRespString(resEntity);
        } finally {
            try {
                if (closeableHttpResponse != null) {
                    closeableHttpResponse.close();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            }catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (status != HttpStatus.SC_OK) {
//            LogService.getLogger().error(" POST UPLOAD: " + url + " " + status);
        }
        HttpResponse httpResponse = new HttpResponse(status, response);
        return httpResponse;
    }
    private static String getRespString(HttpEntity entity) throws Exception {
        if (entity == null) {
            return null;
        }
        InputStream is = entity.getContent();
        BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
        StringBuilder stringBuilder = new StringBuilder();
        String line;
        while ((line = reader.readLine()) != null) {
            stringBuilder.append(line);
        }
        return stringBuilder.toString();
    }
}

+ 54 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/http/IPInfoUtils.java

@ -0,0 +1,54 @@
package com.yihu.wlyy.util.http;
import javax.servlet.http.HttpServletRequest;
/**
 * Utils - ip信息辅助工具类
 * Created by progr1mmer on 2018/1/18.
 */
public class IPInfoUtils {
    private static final long A1 = getIpNum("10.0.0.0");
    private static final long A2 = getIpNum("10.255.255.255");
    private static final long B1 = getIpNum("172.16.0.0");
    private static final long B2 = getIpNum("172.31.255.255");
    private static final long C1 = getIpNum("192.168.0.0");
    private static final long C2 = getIpNum("192.168.255.255");
    private static final long D1 = getIpNum("10.44.0.0");
    private static final long D2 = getIpNum("10.69.0.255");
    private static long getIpNum(String ipAddress) {
        String [] ip = ipAddress.split("\\.");
        long a = Integer.parseInt(ip[0]);
        long b = Integer.parseInt(ip[1]);
        long c = Integer.parseInt(ip[2]);
        long d = Integer.parseInt(ip[3]);
        return a * 256 * 256 * 256 + b * 256 * 256 + c * 256 + d;
    }
    public static boolean isInnerIP(String ip){
        long n = getIpNum(ip);
        return (n >= A1 && n <= A2) || (n >= B1 && n <= B2) || (n >= C1 && n <= C2) || (n >= D1 && n <= D2);
    }
    public static String getIPAddress(HttpServletRequest request) {
        String ip = request.getHeader("x-forwarded-for");
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("WL-Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_CLIENT_IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_X_FORWARDED_FOR");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getRemoteAddr();
        }
        return ip;
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/BaseController.java

@ -51,7 +51,7 @@ public class BaseController {
            JSONObject json = new JSONObject(userAgent);
            return json.getString("uid");
//            return "xh1D2017031502222";// wjw00000001000e6badcfa163e424589/wjw00000001000e6badcfa163e424525
//            return "test00000000005";// wjw00000001000e6badcfa163e424589/wjw00000001000e6badcfa163e424525
        } catch (Exception e) {
            return null;
        }

+ 9 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEduPC/DoctorJMJkEduArticlePCController.java

@ -3,6 +3,8 @@ package com.yihu.wlyy.web.doctor.jimeiJkEduPC;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.es.entity.HealthEduArticleES;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.service.app.account.DoctorInfoService;
import com.yihu.wlyy.service.app.health.HealthEduArticleLabelService;
import com.yihu.wlyy.service.jimeiJkEdu.JMJkEduArticleService;
import com.yihu.wlyy.util.ElasticsearchUtil;
@ -18,6 +20,7 @@ import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
@ -42,6 +45,8 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
    private ElasticsearchUtil elasticsearchUtil;
    @Autowired
    private HealthEduArticleLabelService healthEduArticleLabelService;
    @Autowired
    private DoctorInfoService doctorInfoService;
    @RequestMapping(value = "saveArticle", method = RequestMethod.POST)
    @ApiOperation("添加、编辑文章")
@ -249,9 +254,11 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
                                         @ApiParam(name = "secondLevelCategoryId", value = "文章二级分类")
                                         @RequestParam(value = "secondLevelCategoryId", required = false) String secondLevelCategoryId,
                                         @ApiParam(name = "secondLevelCategoryName", value = "文章二级分类名称")
                                         @RequestParam(value = "secondLevelCategoryName", required = false) String secondLevelCategoryName){
                                         @RequestParam(value = "secondLevelCategoryName", required = false) String secondLevelCategoryName,
                                         @ApiParam(name = "reasonContent", value = "原因内容")
                                         @RequestParam(value = "reasonContent", required = false) String reasonContent){
        try{
            jmJkEduArticleService.authenticationArticle(articleId,isAuthentication,firstLevelCategoryId,firstLevelCategoryName,secondLevelCategoryId,secondLevelCategoryName);
            jmJkEduArticleService.authenticationArticle(articleId,isAuthentication,firstLevelCategoryId,firstLevelCategoryName,secondLevelCategoryId,secondLevelCategoryName,reasonContent,getUID());
            return success("认证成功!");
        }catch (Exception e){
            e.printStackTrace();

+ 22 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/message/DoctorMessageController.java

@ -206,6 +206,28 @@ public class DoctorMessageController extends BaseController {
        }
    }
    /**
     * 文章审核
     * @param page
     * @param pagesize
     * @return
     */
    @RequestMapping(value = "getEduArticleMessage", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取文章审核消息")
    public String getEduArticleMessage(@ApiParam(value = "第几页", defaultValue = "1")
                                       @RequestParam Integer page,
                                       @ApiParam(value = "每页几行", defaultValue = "10")
                                       @RequestParam Integer pagesize){
        try{
            List<Message> list = messageService.getEduArticleMessage(getUID(),page,pagesize);
            return write(200,"获取消息成功!", "list", list);
        }catch (Exception e){
            error(e);
            return error(-1, "获取消息失败!");
        }
    }
    @RequestMapping(value = "getHealthIndexMessage", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取超标指标消息--根据患者分组")

+ 125 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/template/DoctorGuidanceTempLabelController.java

@ -0,0 +1,125 @@
package com.yihu.wlyy.web.doctor.template;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.template.DoctorGuidanceTempLabel;
import com.yihu.wlyy.service.template.DoctorGuidanceTempLableService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
 * Created by 刘文彬 on 2018/5/18.
 */
@RestController
@RequestMapping(value = "/doctor/guidance_temp/lable")
@Api(description = "医生健康指导模板标签")
public class DoctorGuidanceTempLabelController extends BaseController {
    @Autowired
    private DoctorGuidanceTempLableService doctorGuidanceTempLableService;
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ApiOperation(value = "添加指导模板标签")
    @ObserverRequired
    public String save(@ApiParam(name = "name", value = "标签名称", required = true)
                        @RequestParam(value = "name", required = true) String name,
                        @ApiParam(name = "teamId", value = "医生团队id", required = true)
                        @RequestParam(value = "teamId", required = true) Integer teamId){
        try{
            DoctorGuidanceTempLabel doctorGuidanceTempLable = doctorGuidanceTempLableService.save(getUID(),name,teamId);
            if(doctorGuidanceTempLable!=null){
                return write(200,"保存标签成功!","data",doctorGuidanceTempLable);
            }
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"保存标签失败!");
        }
        return error(-1,"保存标签失败!");
    }
    @RequestMapping(value = "/findAllList", method = RequestMethod.GET)
    @ApiOperation(value = "根据团队id获取标签")
    @ObserverRequired
    public String findAllList(@ApiParam(name = "teamId", value = "医生团队id", required = true)
                               @RequestParam(value = "teamId", required = true) Integer teamId){
        try{
            List<DoctorGuidanceTempLabel> list = doctorGuidanceTempLableService.findByDoctorCode(teamId);
            if (list == null || list.size() < 1) {
                return write(200, "查询成功!");
            } else {
                return write(200, "查询成功!", "data", list);
            }
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败!");
        }
    }
    @RequestMapping(value = "/findAllListByPage", method = RequestMethod.GET)
    @ApiOperation(value = "根据团队id获取标签(分页)")
    @ObserverRequired
    public String findAllListByPage(@ApiParam(name = "pageSize", value = "每页总数", required = true)
                              @RequestParam(value = "pageSize", required = true,defaultValue = "10") int pageSize,
                              @ApiParam(name = "pageNo", value = "当前页", required = true)
                              @RequestParam(value = "pageNo", required = true,defaultValue = "1") int pageNo,
                              @ApiParam(name = "teamId", value = "医生团队id", required = true)
                              @RequestParam(value = "teamId", required = true) Integer teamId){
        try{
            List<DoctorGuidanceTempLabel> list = doctorGuidanceTempLableService.findByDoctorCode(teamId, pageSize, pageNo);
            if (list == null || list.size() < 1) {
                return write(200, "查询成功!");
            } else {
                return write(200, "查询成功!", "data", list);
            }
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败!");
        }
    }
    @RequestMapping(value = "/deleteLabel", method = RequestMethod.POST)
    @ApiOperation(value = "删除健康指导模板标签")
    @ObserverRequired
    public String deleteLabel(@ApiParam(name = "code", value = "标签code", required = true)
                              @RequestParam(value = "code", required = true) String code){
        try {
            boolean b = doctorGuidanceTempLableService.delete(code);
            if(b){
                return success("删除成功!");
            }
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"删除成功!");
        }
        return error(-1,"删除成功!");
    }
    @RequestMapping(value = "/updateLabel", method = RequestMethod.POST)
    @ApiOperation(value = "修改健康指导模板标签")
    @ObserverRequired
    public String updateLabel(@ApiParam(name = "code", value = "标签code", required = true)
                              @RequestParam(value = "code", required = true) String code,
                              @ApiParam(name = "name", value = "标签名称", required = true)
                              @RequestParam(value = "name", required = true) String name){
        try {
            boolean b = doctorGuidanceTempLableService.updateName(code,name);
            if(b){
                return success("修改成功!");
            }
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"修改失败!");
        }
        return error(-1,"修改失败!");
    }
}

+ 46 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/template/DoctorTeamGuidanceController.java

@ -122,13 +122,15 @@ public class DoctorTeamGuidanceController extends WeixinBaseController {
            @ApiParam(value = "模板内容")
            @RequestParam String content,
            @ApiParam(value = "图片路径")
            @RequestParam(required = false) String images
            @RequestParam(required = false) String images,
            @ApiParam(value = "指导标签")
            @RequestParam(required = false) String labelCode
    ) {
        try {
//            前端参数校验
            String doctor = getUID();
            JSONArray teams = new JSONArray(teamInfo);
            String guidanceCode = doctorTeamGuidanceService.saveTeamGuidance(doctor, title, teams, content, images);
            String guidanceCode = doctorTeamGuidanceService.saveTeamGuidance(doctor, title, teams, content, images,labelCode);
            return write(200, "保存团队模板成功!","guidanceCode",guidanceCode);
        } catch (Exception e) {
            return invalidUserException(e, -1, e.getMessage());
@ -251,4 +253,46 @@ public class DoctorTeamGuidanceController extends WeixinBaseController {
        }
    }
    /**
     * 根据医生所属的单个团队获取团队模板标签列表
     *
     * @param teamId
     * @return
     */
    @RequestMapping(value = "/getTeamGuidanceLabelList", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("根据单个团队标签获取团队模板列表")
    public String getTeamGuidanceListByLabel(
            @RequestParam(required = true)
            @ApiParam(value = "团队ID") Integer teamId,
            @RequestParam(required = false)
            @ApiParam(value = "团队模板标签code") String labelCode,
            @RequestParam(value = "pageNo", required = true,defaultValue = "1") int pageNo,
            @RequestParam(value = "pageSize", required = true,defaultValue = "10") int pageSize) {
        try {
            List<DoctorTeamGuidanceTemplate> list = doctorTeamGuidanceService.getGuidanceByTeamIdAndLabelCode(teamId,labelCode, pageNo , pageSize);
            return write(200, "获取团队模板列表成功!", "data", list);
        } catch (Exception e) {
            return error(-1,"查询失败!");
        }
    }
    @RequestMapping(value = "/getTeamGuidanceListByLabelWithFilter", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("根据单个团队标签过滤条件获取团队模板列表")
    public String getTeamGuidanceListByLabelWithFilter(@RequestParam(value = "teamId",required = true)
                                                        @ApiParam(value = "团队ID") Integer teamId,
                                                       @RequestParam(value = "filter",required = true)
                                                       @ApiParam(value = "过滤条件") String filter){
        try{
            Map<String,List<DoctorTeamGuidanceTemplate>> map = doctorTeamGuidanceService.getTeamGuidanceListByLabelWithFilter(teamId ,filter);
            return write(200, "查询成功!","data",map);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败!");
        }
    }
}

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/FamilyContractController.java

@ -425,7 +425,7 @@ public class FamilyContractController extends BaseController {
    public String sign(@RequestParam(required = false)String doctor,
                       @RequestParam(required = false)String patient,
                       @RequestParam(required = false)String countryCode,
                       @RequestParam(required = false)String medicareNumber) {
                       @RequestParam(required = true)String medicareNumber) {
        try {
            if (StringUtils.isEmpty(doctor)) {
                return error(-1, "签约医生不能为空");
@ -468,7 +468,7 @@ public class FamilyContractController extends BaseController {
                            @RequestParam(required = false) String patient,
                            @RequestParam(required = false) String reason,
                            @RequestParam(required = false) String countryCode,
                            @RequestParam(required = false) String medicareNumber) {
                            @RequestParam(required = true) String medicareNumber) {
        try {
            if (StringUtils.isEmpty(doctor)) {
                return error(-1, "签约医生不能为空");

+ 5 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkEduArticle/ThirdJkEduArticleController.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.web.third.jkEduArticle;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.service.jimeiJkEdu.JMJkEduArticleService;
import com.yihu.wlyy.service.third.jkEduArticle.ThirdJkEduArticleService;
import com.yihu.wlyy.web.BaseController;
@ -119,7 +120,9 @@ public class ThirdJkEduArticleController extends BaseController {
    public String getArticalById(@ApiParam(name = "articleId", value = "文章id",defaultValue = "1")
                                 @RequestParam(value = "articleId", required = true) String articleId,
                                 @ApiParam(name = "userType", value = "用户类型:1医生,2居民",defaultValue = "1")
                                 @RequestParam(value = "userType", required = false) String userType){
                                 @RequestParam(value = "userType", required = false) String userType,
                                 @ApiParam(name = "messageCode", value = "消息code")
                                 @RequestParam(value = "messageCode", required = false) String messageCode){
        try {
            String uid = "";
            if("2".equals(userType)){
@ -127,7 +130,7 @@ public class ThirdJkEduArticleController extends BaseController {
            }else{
                uid = getUID();
            }
            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticalById(articleId,uid,userType);
            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticalById(articleId,uid,userType,messageCode);
            if("2".equals(userType)){
                jmJkEduArticleService.readPatientArticle(getRepUID(),articleId);

+ 51 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/ylzpay/ThirdCheckUserController.java

@ -0,0 +1,51 @@
package com.yihu.wlyy.web.third.ylzpay;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.service.third.ylz.YLZUserService;
import com.yihu.wlyy.web.BaseController;
import com.ylzinfo.onepay.sdk.exception.PayException;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
/**
 *
 */
@RestController
@RequestMapping(value = "/check")
@Api(description = "易联众验证相关的服务")
public class ThirdCheckUserController extends BaseController {
    private static final Logger LOGGER = LoggerFactory.getLogger(ThirdCheckUserController.class);
    @Autowired
    ObjectMapper objectMapper;
    @Autowired
    private YLZUserService checkService;
    /**
     * 验证用户的唯一性
     *
     * @throws IOException
     * @throws PayException
     */
    @RequestMapping(value = "/checkUser", method = RequestMethod.POST)
    public String checkUser(String mediaIds) {
        try {
            checkService.getAccessToken();
            return write(200, "获取成功!", "data", "");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "失败!");
        }
    }
}

+ 36 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/AppletsController.java

@ -0,0 +1,36 @@
package com.yihu.wlyy.web.wx;
import com.yihu.wlyy.service.weixin.applets.AppletsService;
import com.yihu.wlyy.web.WeixinBaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
 * Created by Trick on 2018/5/23.
 */
@RestController
@RequestMapping(value = "/wx/Applets", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "微信小程序相关接口")
public class AppletsController extends WeixinBaseController {
    @Autowired
    private AppletsService appletsService;
    @ApiOperation(value = "微信小程序登录信息")
    @RequestMapping(value = "/checkApplets", method = RequestMethod.GET)
    public String checkApplets(@ApiParam(name = "code", value = "小程序登录时获取的Code", required = true) @RequestParam(value = "code", required = true)String code){
        try {
            return write(200, "创建成功", "data", appletsService.checkApplets(code));
        }catch (Exception e){
            error(e);
            return error(-1, "失败");
        }
    }
}

+ 9 - 0
patient-co/patient-co-wlyy/src/main/resources/application-dev.yml

@ -160,3 +160,12 @@ neiwang:
Riva:
  RIVAED_KEY1: LUZ7TN3KOT8AWCD3ZA4NBMI5VNF7E50F6XYEP2WZM68JQYY5JE02L4L5FS9R4NGUGMHSCAPW9AL
  RIVAED_KEY2: C3SHUI8OWBOA4ZASS7FEYJ6RIVXA9SW6U5OA56ERUYZTRFHCRZO8AHT4TTW2MAGT80MGXN
ylz:
  appId: aaa
  appSecret:  aaa
  redirectUrl:  aaa
  termId: aaa
  gateway:
    url: http://120.42.37.94:1301/ehc-empi-web/gateway

+ 11 - 0
patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml

@ -160,3 +160,14 @@ neiwang:
Riva:
  RIVAED_KEY1: LUZ7TN3KOT8AWCD3ZA4NBMI5VNF7E50F6XYEP2WZM68JQYY5JE02L4L5FS9R4NGUGMHSCAPW9AL
  RIVAED_KEY2: C3SHUI8OWBOA4ZASS7FEYJ6RIVXA9SW6U5OA56ERUYZTRFHCRZO8AHT4TTW2MAGT80MGXN
ylz:
  appId: aaa
  appSecret:  aaa
  redirectUrl:  aaa
  termId: aaa
  gateway:
    url: http://120.42.37.94:1301/ehc-empi-web/gateway

+ 11 - 1
patient-co/patient-co-wlyy/src/main/resources/application-local.yml

@ -143,4 +143,14 @@ neiwang:
#系统中使用的双层对称加密使用到的KEY
Riva:
  RIVAED_KEY1: LUZ7TN3KOT8AWCD3ZA4NBMI5VNF7E50F6XYEP2WZM68JQYY5JE02L4L5FS9R4NGUGMHSCAPW9AL
  RIVAED_KEY2: C3SHUI8OWBOA4ZASS7FEYJ6RIVXA9SW6U5OA56ERUYZTRFHCRZO8AHT4TTW2MAGT80MGXN
  RIVAED_KEY2: C3SHUI8OWBOA4ZASS7FEYJ6RIVXA9SW6U5OA56ERUYZTRFHCRZO8AHT4TTW2MAGT80MGXN
ylz:
  appId: aaa
  appSecret:  aaa
  redirectUrl:  aaa
  termId: aaa
  gateway:
    url: http://120.42.37.94:1301/ehc-empi-web/gateway

+ 11 - 1
patient-co/patient-co-wlyy/src/main/resources/application-localtest.yml

@ -144,4 +144,14 @@ neiwang:
#系统中使用的双层对称加密使用到的KEY
Riva:
  RIVAED_KEY1: LUZ7TN3KOT8AWCD3ZA4NBMI5VNF7E50F6XYEP2WZM68JQYY5JE02L4L5FS9R4NGUGMHSCAPW9AL
  RIVAED_KEY2: C3SHUI8OWBOA4ZASS7FEYJ6RIVXA9SW6U5OA56ERUYZTRFHCRZO8AHT4TTW2MAGT80MGXN
  RIVAED_KEY2: C3SHUI8OWBOA4ZASS7FEYJ6RIVXA9SW6U5OA56ERUYZTRFHCRZO8AHT4TTW2MAGT80MGXN
ylz:
  appId: aaa
  appSecret:  aaa
  redirectUrl:  aaa
  termId: aaa
  gateway:
    url: http://120.42.37.94:1301/ehc-empi-web/gateway

+ 11 - 1
patient-co/patient-co-wlyy/src/main/resources/application-prod.yml

@ -165,4 +165,14 @@ springfox:
#系统中使用的双层对称加密使用到的KEY
Riva:
  RIVAED_KEY1: LUZ7TN3KOT8AWCD3ZA4NBMI5VNF7E50F6XYEP2WZM68JQYY5JE02L4L5FS9R4NGUGMHSCAPW9AL
  RIVAED_KEY2: C3SHUI8OWBOA4ZASS7FEYJ6RIVXA9SW6U5OA56ERUYZTRFHCRZO8AHT4TTW2MAGT80MGXN
  RIVAED_KEY2: C3SHUI8OWBOA4ZASS7FEYJ6RIVXA9SW6U5OA56ERUYZTRFHCRZO8AHT4TTW2MAGT80MGXN
ylz:
  appId: aaa
  appSecret:  aaa
  redirectUrl:  aaa
  termId: aaa
  gateway:
    url: http://120.42.37.94:1301/ehc-empi-web/gateway

+ 11 - 1
patient-co/patient-co-wlyy/src/main/resources/application-test.yml

@ -149,4 +149,14 @@ neiwang:
#系统中使用的双层对称加密使用到的KEY
Riva:
  RIVAED_KEY1: LUZ7TN3KOT8AWCD3ZA4NBMI5VNF7E50F6XYEP2WZM68JQYY5JE02L4L5FS9R4NGUGMHSCAPW9AL
  RIVAED_KEY2: C3SHUI8OWBOA4ZASS7FEYJ6RIVXA9SW6U5OA56ERUYZTRFHCRZO8AHT4TTW2MAGT80MGXN
  RIVAED_KEY2: C3SHUI8OWBOA4ZASS7FEYJ6RIVXA9SW6U5OA56ERUYZTRFHCRZO8AHT4TTW2MAGT80MGXN
ylz:
  appId: aaa
  appSecret:  aaa
  redirectUrl:  aaa
  termId: aaa
  gateway:
    url: http://120.42.37.94:1301/ehc-empi-web/gateway

+ 10 - 0
patient-co/patient-co-wlyy/src/main/resources/application.yml

@ -42,6 +42,9 @@ spring:
      min-evictable-idle-time-millis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
      time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
  aop:
    proxy-target-class: true
    # REDIS
  redis:
    database: 0 # Database index used by the connection factory.
@ -92,3 +95,10 @@ interceptor:
putMesType:
  #推送到redis消息类型
  wechat: wechat
ylz:
  empi_uimc_authorization:
    method: empi.uimc.authorization  ##认证授权获取token
  empi_uimc_query:
    method: empi.uimc.query  ##用户信息获取