chenweida 8 anni fa
parent
commit
280a8cc6eb
45 ha cambiato i file con 1031 aggiunte e 472 eliminazioni
  1. 90 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/aop/ObserverRequiredAOP.java
  2. 14 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/aop/observerRequired.java
  3. 106 106
      patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java
  4. 85 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/ObserverRequiredInterceptor.java
  5. 2 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorAdminTeamDao.java
  6. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientFamilyTempDao.java
  7. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java
  8. 5 5
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  9. 33 4
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java
  10. 26 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/util/SignTeamAndGroupRunnable.java
  11. 138 98
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ImUtill.java
  12. 63 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SpringUtil.java
  13. 91 24
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/im/imController.java
  14. 4 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/ManagerUtilController.java
  15. 17 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java
  16. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/archives/DoctorArchivesController.java
  17. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/booking/DoctorBookingController.java
  18. 8 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java
  19. 4 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultMoviController.java
  20. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultPublicController.java
  21. 6 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/device/DoctorDeviceController.java
  22. 7 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/discussion/DoctorDiscussionGroupController.java
  23. 3 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/feedback/DoctorFeedbackController.java
  24. 9 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/followup/DoctorFollowUpController.java
  25. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/followup/DoctorFollowupDrugsController.java
  26. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthController.java
  27. 4 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java
  28. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthGuidanceController.java
  29. 3 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/intervene/DoctorInterveneController.java
  30. 7 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/medical/DoctorMedicalRecordController.java
  31. 3 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/message/DoctorMessageController.java
  32. 6 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/DoctorPatientGroupController.java
  33. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientDiseaseController.java
  34. 5 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelController.java
  35. 5 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java
  36. 3 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/reply/DoctorQuickReplyController.java
  37. 4 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/scheduling/DoctorWorkTimeController.java
  38. 8 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java
  39. 4 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java
  40. 3 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/ManagerQuestionnaireController.java
  41. 7 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/team/AdminTeamController.java
  42. 4 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/template/DoctorGuidanceTempController.java
  43. 5 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/template/DoctorTeamGuidanceController.java
  44. 219 217
      patient-co-wlyy/src/main/resources/applicationContext.xml
  45. 13 12
      patient-co-wlyy/src/main/webapp/WEB-INF/spring-mvc.xml

+ 90 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/aop/ObserverRequiredAOP.java

@ -0,0 +1,90 @@
package com.yihu.wlyy.aop;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.json.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
/**
 * Created by Trick on 2017/6/24.
 */
@Aspect
@Component
public class ObserverRequiredAOP {
    //Controller层切点
    @Pointcut("execution(* com.yihu.wlyy.web..*.*(..))")
    public void controllerAspect() {
    }
    public ObserverRequiredAOP() {
        //System.out.println("Observer---------------------------------------");
    }
    @Around("controllerAspect() && @annotation(com.yihu.wlyy.aop.ObserverRequired)")
    public Object checkToken(ProceedingJoinPoint point) throws Throwable {
        Object o = null;
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
        String error = "";
        try {
            response.setCharacterEncoding("UTF-8");
            JSONObject json = getAgent(request);
            String observer = json.has("observer") ? json.getString("observer") : "";
            if(StringUtils.isNotBlank(observer)&&"1".equals(observer)){
                PrintWriter writer=response.getWriter();
                writer.write(error(403, "该操作没有权限"));
                writer.flush();
                return o;
            }
        }catch (Exception e){
            //return o;
        }
         o = point.proceed();
        return o;
    }
    public String write(int code, String msg) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            return json.toString();
        } catch (Exception e) {
            return null;
        }
    }
    public String error(int code, String msg) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            return json.toString();
        } catch (Exception e) {
            return null;
        }
    }
    public JSONObject getAgent(HttpServletRequest request) {
        try {
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            System.out.println("userAgent:" + userAgent);
            return new JSONObject(userAgent);
        } catch (Exception e) {
            return null;
        }
    }
}

+ 14 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/aop/observerRequired.java

@ -0,0 +1,14 @@
package com.yihu.wlyy.aop;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
 * Created by Trick on 2017/6/24.
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface ObserverRequired {
}

+ 106 - 106
patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java

@ -27,112 +27,112 @@ public class DoctorInterceptor extends BaseInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        boolean flag = true;
//        try {
//            request.setCharacterEncoding("UTF-8");
//            request.setAttribute("log-start", new Date().getTime());
//            response.setCharacterEncoding("UTF-8");
//            JSONObject json = getAgent(request);
//
//            if (json == null) {
//                // 未登录
//                response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
//                return false;
//            }
//
//            if (json.has("uid") && json.has("admin_token") && StringUtils.isNotEmpty(json.getString("admin_token"))) {
//                String adminToken = SystemConf.getInstance().getSystemProperties().getProperty("admin_token");
//                String adminUid = SystemConf.getInstance().getSystemProperties().getProperty("admin_uid");
//                if (json.getString("uid").equals(adminUid) && json.getString("admin_token").equals(adminToken)) {
//                    return true;
//                }
//            }
//
//            String tokenStr = json.has("token") ? json.getString("token") : "";
//            String uid = json.has("uid") ? json.getString("uid") : "";
//            String imei = json.has("imei") ? json.getString("imei") : "";
//            String observer = json.has("observer") ? json.getString("observer") : "";
//            //如果是观察者直接返回true
//            if (!org.springframework.util.StringUtils.isEmpty(observer) && observer.equals("1")) {
//                Class cls = ((HandlerMethod) handler).getBeanType();
//                RequestMapping clsRm = (RequestMapping) cls.getAnnotation(RequestMapping.class);
//                Method method = ((HandlerMethod) handler).getMethod();
//                RequestMapping mthRm = method.getAnnotation(RequestMapping.class);
//                String url = "";
//                String urlCls = "";
//                String urlMth = "";
//                if (clsRm.value() != null && clsRm.value().length > 0) {
//                    urlCls = clsRm.value()[0];
//                }
//                if (mthRm.value() != null && mthRm.value().length > 0) {
//                    urlMth = mthRm.value()[0];
//                }
//                if (StringUtils.isNotEmpty(urlCls)) {
//                    url += urlCls.startsWith("/") ? urlCls : ("/" + urlCls);
//                }
//                if (StringUtils.isNotEmpty(urlMth)) {
//                    url += urlMth.startsWith("/") ? urlMth : ("/" + urlMth);
//                }
//                url = url.replace("\\", "/").replace("//", "/");
//                CudUrl cudUrl = cudUrlDao.findByUrl(url);
//
//                if (url.equals("/doctor/consult/readed")) {
//                    response.getOutputStream().write(write(200, "操作成功").getBytes());
//                    return false;
//                }
//
//                if (cudUrl != null) {
//                    if (StringUtils.isNotEmpty(cudUrl.getMethod()) &&
//                            request.getMethod().toUpperCase().compareTo(cudUrl.getMethod()) != 0) {
//                        return true;
//                    } else {
//                        response.getOutputStream().write(error(403, "该操作没有权限").getBytes());
//                        return false;
//                    }
//                }
//
//                return true;
//            }
//            if (StringUtils.isEmpty(tokenStr) || StringUtils.isEmpty(imei) || StringUtils.isEmpty(uid)) {
//                response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
//                return false;
//            }
//
//            Token token = SystemData.doctorTokens.get(uid);
//            if (token == null) {
//                token = tokenDao.findByPatient(uid, 2);
//                if (token != null) {
//                    // 加入缓存
//                    SystemData.doctorTokens.put(uid, token);
//                }
//            }
//            if (token == null || token.getPlatform() != 2) {
//                // 未登录
//                response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
//                flag = false;
//            } else {
//                if (token.getTimeout().getTime() < new Date().getTime()) {
//                    // 登录超时
//                    response.getOutputStream().write(error(SystemConf.LOGIN_TIMEOUT, "登录超时,请重新登录").getBytes());
//                    flag = false;
//                } else if (!StringUtils.equals(tokenStr, token.getToken()) || !StringUtils.equals(uid, token.getUser()) || !StringUtils.equals(imei, token.getImei())) {
//                    // 别处登录
//                    response.getOutputStream().write(error(SystemConf.LOGIN_OTHER, "帐号在别处登录,请重新登录").getBytes());
//                    flag = false;
//                } else {
//                    // 一天只更新一次
//                    if (DateUtil.getDays(token.getCzrq(), DateUtil.getNowDateShort()) != 0) {
//                        // 今天未更新,则更新缓存
//                        token.setCzrq(new Date());
//                        // 更新内存
//                        SystemData.doctorTokens.put(uid, token);
//                        // 更新数据库
//                        tokenDao.save(token);
//                    }
//                }
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
        try {
            request.setCharacterEncoding("UTF-8");
            request.setAttribute("log-start", new Date().getTime());
            response.setCharacterEncoding("UTF-8");
            JSONObject json = getAgent(request);
            if (json == null) {
                // 未登录
                response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
                return false;
            }
            if (json.has("uid") && json.has("admin_token") && StringUtils.isNotEmpty(json.getString("admin_token"))) {
                String adminToken = SystemConf.getInstance().getSystemProperties().getProperty("admin_token");
                String adminUid = SystemConf.getInstance().getSystemProperties().getProperty("admin_uid");
                if (json.getString("uid").equals(adminUid) && json.getString("admin_token").equals(adminToken)) {
                    return true;
                }
            }
            String tokenStr = json.has("token") ? json.getString("token") : "";
            String uid = json.has("uid") ? json.getString("uid") : "";
            String imei = json.has("imei") ? json.getString("imei") : "";
            String observer = json.has("observer") ? json.getString("observer") : "";
            //如果是观察者直接返回true
            if (!org.springframework.util.StringUtils.isEmpty(observer) && observer.equals("1")) {
                Class cls = ((HandlerMethod) handler).getBeanType();
                RequestMapping clsRm = (RequestMapping) cls.getAnnotation(RequestMapping.class);
                Method method = ((HandlerMethod) handler).getMethod();
                RequestMapping mthRm = method.getAnnotation(RequestMapping.class);
                String url = "";
                String urlCls = "";
                String urlMth = "";
                if (clsRm.value() != null && clsRm.value().length > 0) {
                    urlCls = clsRm.value()[0];
                }
                if (mthRm.value() != null && mthRm.value().length > 0) {
                    urlMth = mthRm.value()[0];
                }
                if (StringUtils.isNotEmpty(urlCls)) {
                    url += urlCls.startsWith("/") ? urlCls : ("/" + urlCls);
                }
                if (StringUtils.isNotEmpty(urlMth)) {
                    url += urlMth.startsWith("/") ? urlMth : ("/" + urlMth);
                }
                url = url.replace("\\", "/").replace("//", "/");
                CudUrl cudUrl = cudUrlDao.findByUrl(url);
                if (url.equals("/doctor/consult/readed")) {
                    response.getOutputStream().write(write(200, "操作成功").getBytes());
                    return false;
                }
                if (cudUrl != null) {
                    if (StringUtils.isNotEmpty(cudUrl.getMethod()) &&
                            request.getMethod().toUpperCase().compareTo(cudUrl.getMethod()) != 0) {
                        return true;
                    } else {
                        response.getOutputStream().write(error(403, "该操作没有权限").getBytes());
                        return false;
                    }
                }
                return true;
            }
            if (StringUtils.isEmpty(tokenStr) || StringUtils.isEmpty(imei) || StringUtils.isEmpty(uid)) {
                response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
                return false;
            }
            Token token = SystemData.doctorTokens.get(uid);
            if (token == null) {
                token = tokenDao.findByPatient(uid, 2);
                if (token != null) {
                    // 加入缓存
                    SystemData.doctorTokens.put(uid, token);
                }
            }
            if (token == null || token.getPlatform() != 2) {
                // 未登录
                response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
                flag = false;
            } else {
                if (token.getTimeout().getTime() < new Date().getTime()) {
                    // 登录超时
                    response.getOutputStream().write(error(SystemConf.LOGIN_TIMEOUT, "登录超时,请重新登录").getBytes());
                    flag = false;
                } else if (!StringUtils.equals(tokenStr, token.getToken()) || !StringUtils.equals(uid, token.getUser()) || !StringUtils.equals(imei, token.getImei())) {
                    // 别处登录
                    response.getOutputStream().write(error(SystemConf.LOGIN_OTHER, "帐号在别处登录,请重新登录").getBytes());
                    flag = false;
                } else {
                    // 一天只更新一次
                    if (DateUtil.getDays(token.getCzrq(), DateUtil.getNowDateShort()) != 0) {
                        // 今天未更新,则更新缓存
                        token.setCzrq(new Date());
                        // 更新内存
                        SystemData.doctorTokens.put(uid, token);
                        // 更新数据库
                        tokenDao.save(token);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return flag;
    }

+ 85 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/ObserverRequiredInterceptor.java

@ -0,0 +1,85 @@
package com.yihu.wlyy.interceptors;
import com.yihu.wlyy.aop.ObserverRequired;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
/**
 * Created by Trick on 2017/6/24.
 */
public class ObserverRequiredInterceptor  implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation mi) throws Throwable {
        Object[] ars = mi.getArguments();
        HttpServletRequest request =null;
        HttpServletResponse response = null;
        for(Object o :ars){
            if(o instanceof HttpServletRequest){
                request = (HttpServletRequest) o;
            }
            if(o instanceof HttpServletResponse){
                response = (HttpServletResponse) o;
            }
        }
        if(request!=null&&response!=null){
            JSONObject json = getAgent(request);
            String tokenStr = json.has("token") ? json.getString("token") : "";
            String uid = json.has("uid") ? json.getString("uid") : "";
            String imei = json.has("imei") ? json.getString("imei") : "";
            String observer = json.has("observer") ? json.getString("observer") : "";
            //if(StringUtils.isNotBlank(observer)&&"1".equals(observer)){
                if(mi.getMethod().isAnnotationPresent(ObserverRequired.class)){
                    System.out.println("----------this method is added @ObserverRequired-------------------------");
                    response.getOutputStream().write(error(403, "该操作没有权限").getBytes());
                    return null;
                }
            //}
        }
        //执行被拦截的方法,切记,如果此方法不调用,则被拦截的方法不会被执行。
        return mi.proceed();
    }
    public JSONObject getAgent(HttpServletRequest request) {
        try {
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            System.out.println("userAgent:" + userAgent);
            return new JSONObject(userAgent);
        } catch (Exception e) {
            return null;
        }
    }
    public String write(int code, String msg) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            return json.toString();
        } catch (Exception e) {
            return null;
        }
    }
    public String error(int code, String msg) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            return json.toString();
        } catch (Exception e) {
            return null;
        }
    }
}

+ 2 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorAdminTeamDao.java

@ -93,7 +93,7 @@ public interface DoctorAdminTeamDao extends
    List<AdminTeam> findByOrgCode(String orgCode);
    //  查询当前医生是否为团队长
    @Query("SELECT count(1) from AdminTeam t WHERE t.available = true  AND t.leaderCode = ?1 ")
    int findLeader(String leaderCode);
    @Query("SELECT t.id from AdminTeam t WHERE t.available = true  AND t.leaderCode = ?1 ")
    Integer findLeader(String leaderCode);
}

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientFamilyTempDao.java

@ -13,5 +13,7 @@ public interface PatientFamilyTempDao extends PagingAndSortingRepository<Patient
        JpaSpecificationExecutor<PatientFamilyTemp> {
    public List<PatientFamilyTemp> findByDealerAndPatient(String dealer,String patient);
    public List<PatientFamilyTemp> findByDealerAndPatientAndState(String dealer,String patient,String state);
    public List<PatientFamilyTemp> findByPatientAndState(String patient,String state);
}

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java

@ -1115,7 +1115,7 @@ public class FamilyMemberService extends BaseService {
        }
        List<PatientFamilyTemp> temps =  patientFamilyTempDao.findByDealerAndPatient(member,patient);
        List<PatientFamilyTemp> temps =  patientFamilyTempDao.findByDealerAndPatientAndState(member,patient,"0");
        if(temps!=null&&temps.size()>0){
            return -3;

+ 5 - 5
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -1010,7 +1010,7 @@ public class FamilyContractService extends BaseService {
        SignFamily temp = signFamilyDao.save(sf);
        //设置基卫标识1.3.3.2版本更新
        setSignFamilyMapping(temp.getIdcard(),temp.getSignYear());
        setSignFamilyMapping(temp.getCode(),temp.getIdcard(),temp.getSignYear());
        if (temp != null && patient != null) {
            Doctor doc = doctorDao.findByCode(sf.getDoctor());
@ -1269,7 +1269,7 @@ public class FamilyContractService extends BaseService {
            doctorTeamDoctor.save(wlyyDoctorTeamPatient);
            //设置基卫标识1.3.3.2版本更新
            setSignFamilyMapping(sf.getIdcard(),sf.getSignYear());
            setSignFamilyMapping(sf.getCode(),sf.getIdcard(),sf.getSignYear());
        } else {
            // 医生拒绝
@ -3457,9 +3457,9 @@ public class FamilyContractService extends BaseService {
     * @param idCard
     * @param signYear
     */
    public void setSignFamilyMapping(String idCard,String signYear){
    public void setSignFamilyMapping(String signCode,String idCard,String signYear){
        SignFamilyMapping maping = new SignFamilyMapping();
        maping.setCode(getCode());
        maping.setCode(signCode);
        maping.setCreateTime(new Date());
        maping.setIdcard(idCard);
        maping.setNeedUpdate("0");
@ -3513,7 +3513,7 @@ public class FamilyContractService extends BaseService {
                " wlyy_sign_family s " +
                " WHERE " +
                " s.`status` >= 0 " +
                " AND s.server_type IS NOT NULL "+
                " AND s.server_type IS NOT NULL AMD s.server_type <>'3' "+
                " AND s.admin_team_code =" +teamCode+
                " AND s.doctor_health IS NULL";
        List<Map<String,Object>> patientList = jdbcTemplate.queryForList(patientSql);

+ 33 - 4
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java

@ -595,7 +595,12 @@ public class PatientService extends TokenService {
    public JSONArray getSignByTeamCodeGpbyServer(Long teamCode){
        // 获取总分组数量
        String totalGSql = "SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name AS serverTypeName FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0 AND f.server_type IS NOT NULL GROUP BY f.server_type ORDER BY f.server_type ASC";
        String totalGSql ="SELECT d.`code` AS serverType,d.`name` AS serverTypeName,ifNULL(c.Amount,0) AS Amount FROM " +
                " wlyy_sign_dict d LEFT JOIN" +
                " ("+
                "SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name AS serverTypeName FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0 AND f.server_type IS NOT NULL GROUP BY f.server_type ORDER BY f.server_type ASC"+
                " ) c ON d.code = c.serverType " +
                " WHERE d.`year`='"+DateUtil.getSignYear()+"' AND d.`code` NOT LIKE '%-%' ORDER BY d.sort ASC";
        List<Map<String,Object>> totalG = jdbcTemplate.queryForList(totalGSql);
        //获取关注量分组数量
@ -603,7 +608,31 @@ public class PatientService extends TokenService {
        List<Map<String,Object>> fousG = jdbcTemplate.queryForList(fousGSql);
        //获取二级节点分组总数
        String sesTotalSql ="SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name As serverTypeName ,f.special_population AS specialPopulation,f.special_population_name AS specialPopulationName  FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0  AND f.special_population Is NOT NULL AND f.server_type IS NOT NULL GROUP BY f.special_population ORDER BY f.special_population ASC ";
        String sesTotalSql ="SELECT " +
                " LEFT ( " +
                "  d.`code`, " +
                "  INSTR(d.`code`, '-') - 1 " +
                " ) AS serverType, " +
                " substring( " +
                "  d.`code`, " +
                "  INSTR(d.`code`, '-') + 1 " +
                " ) AS specialPopulation, " +
                " d.`name` AS specialPopulationName, " +
                " ifnull(c.Amount, 0) AS Amount " +
                " FROM " +
                " wlyy_sign_dict d " +
                " LEFT JOIN ( "+
                " SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name As serverTypeName ,f.special_population AS specialPopulation,f.special_population_name AS specialPopulationName ," +
                " CONCAT(" +
                " f.server_type," +
                " '-'," +
                " f.special_population" +
                " ) AS dcode "+
                " FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0  AND f.special_population Is NOT NULL AND f.server_type IS NOT NULL GROUP BY f.special_population ORDER BY f.special_population ASC "+
                " ) c ON c.dcode = d.code " +
                " WHERE " +
                " d.`year` = '"+DateUtil.getSignYear()+"'" +
                " AND d.`code` LIKE '%-%' ORDER BY d.sort ASC";
        List<Map<String,Object>> sesTotal = jdbcTemplate.queryForList(sesTotalSql);
        //获取二级节点分组数量
@ -703,7 +732,7 @@ public class PatientService extends TokenService {
                " ("+
                " SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name AS serverTypeName FROM wlyy_sign_family f WHERE (f.doctor ='"+doctor+"' OR f.doctor_health ='"+doctor+"') AND f.`status`>0 AND f.server_type IS NOT NULL "+teamCodeSql+" GROUP BY f.server_type ORDER BY f.server_type ASC"+
                " ) c ON d.code = c.serverType " +
                " WHERE d.`year`='"+DateUtil.getSignYear()+"' AND d.`code` NOT LIKE '%-%' ";
                " WHERE d.`year`='"+DateUtil.getSignYear()+"' AND d.`code` NOT LIKE '%-%' ORDER BY d.sort ASC";
//        String totalGSql = "SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name AS serverTypeName FROM wlyy_sign_family f WHERE (f.doctor ='"+doctor+"' OR f.doctor_health ='"+doctor+"') AND f.`status`>0 AND f.server_type IS NOT NULL "+teamCodeSql+" GROUP BY f.server_type ORDER BY f.server_type ASC";
        List<Map<String,Object>> totalG = jdbcTemplate.queryForList(totalGSql);
@ -736,7 +765,7 @@ public class PatientService extends TokenService {
                " c ON c.dcode = d.code " +
                " WHERE\n" +
                " d.`year` = '"+DateUtil.getSignYear()+"'" +
                " AND d.`code` LIKE '%-%'";
                " AND d.`code` LIKE '%-%' ORDER BY d.sort ASC";
        //String sesTotalSql ="SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name As serverTypeName ,f.special_population AS specialPopulation,f.special_population_name AS specialPopulationName  FROM wlyy_sign_family f WHERE (f.doctor ='"+doctor+"' OR f.doctor_health ='"+doctor+"')  "+teamCodeSql+" AND f.`status`>0  AND f.special_population Is NOT NULL AND f.server_type IS NOT NULL GROUP BY f.special_population ORDER BY f.special_population ASC ";
        List<Map<String,Object>> sesTotal = jdbcTemplate.queryForList(sesTotalSql);

+ 26 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/util/SignTeamAndGroupRunnable.java

@ -12,6 +12,8 @@ import com.yihu.wlyy.util.IdCardUtil;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.Transaction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.orm.jpa.JpaTransactionManager;
@ -22,6 +24,7 @@ import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import java.text.SimpleDateFormat;
@ -33,6 +36,7 @@ import java.util.UUID;
/**
 * Created by lyr-pc on 2016/10/11.
 */
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@Service
public class SignTeamAndGroupRunnable implements Runnable {
@ -55,6 +59,28 @@ public class SignTeamAndGroupRunnable implements Runnable {
        this.end = end;
    }
    public SignTeamAndGroupRunnable() {
    }
    public long getStart() {
        return start;
    }
    public SignTeamAndGroupRunnable setStart(long start) {
        this.start = start;
        return this;
    }
    public long getEnd() {
        return end;
    }
    public SignTeamAndGroupRunnable setEnd(long end) {
        this.end = end;
        return this;
    }
    public String getCode() {
        return UUID.randomUUID().toString().replaceAll("-", "");
    }

+ 138 - 98
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ImUtill.java

@ -15,16 +15,20 @@ public class ImUtill {
     * status reply 为空值是是该医生总咨询量
     *
     * @param user   团队就把团队的医生合并起来用,隔开(医生编码)
     * @param adminTeamCode
     * @param status
     * @param reply
     * @return
     */
    public static String getConsultData(String user, Integer status, Integer reply) {
    public static String getConsultData(String user,Integer adminTeamCode, Integer status, Integer reply) {
        String imAddr = im_host + "api/v2/sessions/topics/count/reply";
        imAddr = imAddr + "?user=" + user;
        if (status != null) {
            imAddr += ("&status=" + status);
        }
        if (adminTeamCode != null) {
            imAddr += ("&adminTeamCode=" + adminTeamCode);
        }
        if (reply != null) {
            imAddr += ("&reply=" + reply);
        }
@ -32,14 +36,43 @@ public class ImUtill {
        return response;
    }
    public static void updateTopics(String topicId,String jsonValue){
        String imAddr = im_host + "api/v2/sessions/"+topicId+"/topics";
    public static void updateTopics(String topicId, String jsonValue) {
        String imAddr = im_host + "api/v2/sessions/" + topicId + "/topics";
        JSONObject params = new JSONObject();
        params.put("topic_id",topicId);
        params.put("data",jsonValue);
        params.put("topic_id", topicId);
        params.put("data", jsonValue);
        HttpClientUtil.putBody(imAddr, params);
    }
    /**
     * 当前医生下当前团队列表接口
     * 获取团队内医生的健康咨询状况
     * status = 10 已结束的咨询,status=0,reply = 1 已回复 ,status=0,reply=0未回复
     *
     * @param user     团队就把团队的医生合并起来用,隔开(医生编码)
     * @param adminTeamCode  行政团队code
     * @param page
     * @param pagesize
     * @param status
     * @param reply
     * @return
     */
    public static String getTeamConsultByStatus(String user,Integer adminTeamCode, Integer status, Integer reply, int page, int pagesize) {
        String imAddr = im_host + "api/v2/sessions/healthTeamTopics";
        imAddr = imAddr + "?user=" + user + "&page=" + page + "&pagesize=" + pagesize;
        if (adminTeamCode != null) {
            imAddr += ("&adminTeamCode=" + adminTeamCode);
        }
        if (status != null) {
            imAddr += ("&status=" + status);
        }
        if (reply != null) {
            imAddr += ("&reply=" + reply);
        }
        String response = HttpClientUtil.get(imAddr, "UTF-8");
        return response;
    }
    /**
     * 列表接口
     * 获取团队内医生的健康咨询状况
@ -72,8 +105,8 @@ public class ImUtill {
     * @param contentType 1文字 2图片消息
     * @param content     内容
     */
    public static String sendImMsg(String from,String fromName, String sessionId, String contentType, String content,String businessType) {
        String imAddr = im_host + "api/v2/sessions/"+sessionId+"/messages";
    public static String sendImMsg(String from, String fromName, String sessionId, String contentType, String content, String businessType) {
        String imAddr = im_host + "api/v2/sessions/" + sessionId + "/messages";
        JSONObject params = new JSONObject();
        params.put("sender_id", from);
        params.put("sender_name", fromName);
@ -88,11 +121,11 @@ public class ImUtill {
    /**
     * 更新会话状态
     *
     * @param sessionId       会话ID
     * @param status 状态
     * @param sessionId 会话ID
     * @param status    状态
     */
    public static String updateSessionStatus(String sessionId,String status) {
        String imAddr = im_host + "api/v2/sessions/"+sessionId+"/status?status="+status+"&sessionId="+sessionId;
    public static String updateSessionStatus(String sessionId, String status) {
        String imAddr = im_host + "api/v2/sessions/" + sessionId + "/status?status=" + status + "&sessionId=" + sessionId;
        JSONObject params = new JSONObject();
        String response = HttpClientUtil.postBody(imAddr, params);
        return response;
@ -101,11 +134,11 @@ public class ImUtill {
    /**
     * 更新会话状态
     *
     * @param sessionId       会话ID
     * @param status 状态
     * @param sessionId 会话ID
     * @param status    状态
     */
    public static String updateTopicEvaluate(String sessionId,String status) {
        String imAddr = im_host + "api/v2/sessions/"+sessionId+"/status?status="+status+"&sessionId="+sessionId;
    public static String updateTopicEvaluate(String sessionId, String status) {
        String imAddr = im_host + "api/v2/sessions/" + sessionId + "/status?status=" + status + "&sessionId=" + sessionId;
        JSONObject params = new JSONObject();
        String response = HttpClientUtil.postBody(imAddr, params);
        return response;
@ -119,8 +152,8 @@ public class ImUtill {
     * @param contentType 1文字 2图片消息
     * @param content     内容
     */
    public static String sendTopicIM(String from,String fromName, String topicId, String contentType, String content,String agent) {
        String url = im_host + "api/v2/sessions/topic/"+topicId+"/messages";
    public static String sendTopicIM(String from, String fromName, String topicId, String contentType, String content, String agent) {
        String url = im_host + "api/v2/sessions/topic/" + topicId + "/messages";
        JSONObject params = new JSONObject();
        params.put("sender_id", from);
        params.put("sender_name", fromName);
@ -134,13 +167,14 @@ public class ImUtill {
    /**
     * 发送进入im消息
     *
     * @param from
     * @param sessionId
     * @param topicId
     * @return
     */
    public static String sendIntoTopicIM(String from,String sessionId,String topicId,String content,String intoUser,String intoUserName){
        String url = im_host + "api/v2/sessions/"+sessionId+"/topics/"+topicId+"/into";
    public static String sendIntoTopicIM(String from, String sessionId, String topicId, String content, String intoUser, String intoUserName) {
        String url = im_host + "api/v2/sessions/" + sessionId + "/topics/" + topicId + "/into";
        JSONObject params = new JSONObject();
        params.put("sender_id", from);
        params.put("topic_id", topicId);
@ -154,23 +188,23 @@ public class ImUtill {
    /**
     * 结束议题
     *
     * @param topicId  议题ID
     * @param endUser  结束人
     * @param topicId     议题ID
     * @param endUser     结束人
     * @param endUserName 结束人名字
     * @param sessionId 会话ID
     * @param sessionId   会话ID
     */
    public static JSONObject endTopics(String sessionId,String endUser, String endUserName,String topicId) {
        String imAddr = im_host + "api/v2/sessions/"+sessionId+"/topics/"+topicId+"/ended";
    public static JSONObject endTopics(String sessionId, String endUser, String endUserName, String topicId) {
        String imAddr = im_host + "api/v2/sessions/" + sessionId + "/topics/" + topicId + "/ended";
        JSONObject params = new JSONObject();
        params.put("session_id", sessionId);
        params.put("end_user", endUser);
        params.put("end_user_name",endUserName);
        params.put("end_user_name", endUserName);
        params.put("topic_id", topicId);
        String ret = HttpClientUtil.postBody(imAddr,params);
        JSONObject obj  = null;
        try{
        String ret = HttpClientUtil.postBody(imAddr, params);
        JSONObject obj = null;
        try {
            obj = new JSONObject(ret);
        }catch (Exception e){
        } catch (Exception e) {
            return null;
        }
        return obj;
@ -179,25 +213,26 @@ public class ImUtill {
    /**
     * 议题邀请人员
     * @param user 结束人名字
     *
     * @param user      结束人名字
     * @param sessionId 会话ID
     */
    public static void updateTopicUser(String sessionId,String user) {
        String imAddr = im_host + "api/v2/sessions/"+sessionId+"/participants/"+user;
    public static void updateTopicUser(String sessionId, String user) {
        String imAddr = im_host + "api/v2/sessions/" + sessionId + "/participants/" + user;
        JSONObject params = new JSONObject();
        params.put("user", user+":"+0);
        HttpClientUtil.putBody(imAddr,params);
        params.put("user", user + ":" + 0);
        HttpClientUtil.putBody(imAddr, params);
    }
    /**
     * 创建议题
     *
     * @param topicId  议题ID
     * @param topicName  议题名称
     * @param topicId      议题ID
     * @param topicName    议题名称
     * @param participants 成员
     */
    public static JSONObject createTopics(String sessionId, String topicId, String topicName, JSONObject participants, JSONObject messages, String sessionType) {
        String imAddr = im_host + "api/v2/sessions/"+topicId+"/topics";
        String imAddr = im_host + "api/v2/sessions/" + topicId + "/topics";
        JSONObject params = new JSONObject();
        params.put("topic_id", topicId);
        params.put("topic_name", topicName);
@ -205,11 +240,11 @@ public class ImUtill {
        params.put("messages", messages.toString());
        params.put("session_id", sessionId);
        params.put("session_type", sessionType);
        String ret = HttpClientUtil.postBody(imAddr,params);
        JSONObject obj  = null;
        try{
        String ret = HttpClientUtil.postBody(imAddr, params);
        JSONObject obj = null;
        try {
            obj = new JSONObject(ret);
        }catch (Exception e){
        } catch (Exception e) {
            return null;
        }
        return obj;
@ -217,20 +252,19 @@ public class ImUtill {
    /**
     * 创建会话(system)
     *
     */
    public static JSONObject createSession(JSONObject participants,String sessionType,String sessionName,String sessionId) {
    public static JSONObject createSession(JSONObject participants, String sessionType, String sessionName, String sessionId) {
        String imAddr = im_host + "api/v2/sessions";
        JSONObject params = new JSONObject();
        params.put("participants", participants.toString());
        params.put("session_name", sessionName);
        params.put("session_type", sessionType);
        params.put("session_id", sessionId);
        String ret = HttpClientUtil.postBody(imAddr,params);
        JSONObject obj  = null;
        try{
        String ret = HttpClientUtil.postBody(imAddr, params);
        JSONObject obj = null;
        try {
            obj = new JSONObject(ret);
        }catch (Exception e){
        } catch (Exception e) {
            return null;
        }
        return obj;
@ -238,6 +272,7 @@ public class ImUtill {
    /**
     * 获取会话实例的消息对象
     *
     * @param senderId
     * @param senderName
     * @param title
@ -246,68 +281,70 @@ public class ImUtill {
     * @param agent
     * @return
     */
    public static JSONObject getCreateTopicMessage(String senderId,String senderName,String title,String description,String images,String agent){
    public static JSONObject getCreateTopicMessage(String senderId, String senderName, String title, String description, String images, String agent) {
        JSONObject messages = new JSONObject();
        messages.put("description",description);
        messages.put("title",title);
        messages.put("img",images);
        messages.put("sender_id",senderId);
        messages.put("sender_name",senderName);
        messages.put("agent",agent);
        messages.put("description", description);
        messages.put("title", title);
        messages.put("img", images);
        messages.put("sender_id", senderId);
        messages.put("sender_name", senderName);
        messages.put("agent", agent);
        return messages;
    }
    public static JSONObject getTopicMessage(String topicId,String startMsgId,String endMsgId,int page,int pagesize,String uid){
        String url =  im_host
                + "api/v2/sessions/topic/"+topicId+"/messages?topic_id="+topicId+"&end="+startMsgId
                +"&start="+(endMsgId==null?"":endMsgId)+"&page="+page+"&pagesize="+pagesize+"&user="+uid;
        try{
    public static JSONObject getTopicMessage(String topicId, String startMsgId, String endMsgId, int page, int pagesize, String uid) {
        String url = im_host
                + "api/v2/sessions/topic/" + topicId + "/messages?topic_id=" + topicId + "&end=" + startMsgId
                + "&start=" + (endMsgId == null ? "" : endMsgId) + "&page=" + page + "&pagesize=" + pagesize + "&user=" + uid;
        try {
            String ret = HttpClientUtil.get(url, "UTF-8");
            JSONObject obj = new JSONObject(ret);
            if(obj.getInt("status")==-1){
            if (obj.getInt("status") == -1) {
                throw new RuntimeException(obj.getString("message"));
            }else{
                return  obj.getJSONObject("data");
            } else {
                return obj.getJSONObject("data");
            }
        }catch (Exception e){
        } catch (Exception e) {
            return null;
        }
    }
    public static JSONArray getSessionMessage(String sessionId,String startMsgId,String endMsgId,int page,int pagesize,String uid){
        String url =  im_host+ "api/v2/sessions/"+sessionId+"/messages?session_id="+sessionId+"&user="+uid+"&start_message_id="+startMsgId+"&end_message_id="+endMsgId+"&page="+page+"&pagesize="+pagesize;
        try{
    public static JSONArray getSessionMessage(String sessionId, String startMsgId, String endMsgId, int page, int pagesize, String uid) {
        String url = im_host + "api/v2/sessions/" + sessionId + "/messages?session_id=" + sessionId + "&user=" + uid + "&start_message_id=" + startMsgId + "&end_message_id=" + endMsgId + "&page=" + page + "&pagesize=" + pagesize;
        try {
            String ret = HttpClientUtil.get(url, "UTF-8");
            JSONArray obj = new JSONArray(ret);
            return obj;
        }catch (Exception e){
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 删除对应的成员信息在MUC模式中
     *
     * @param userId
     * @param oldUserId
     * @param sessionId
     * @return
     */
    public static JSONObject deleteMucUser(String userId,String oldUserId,String sessionId) throws  Exception{
        String url =  im_host+ "api/v2/sessions/"+sessionId+"/participant/update";
        try{
    public static JSONObject deleteMucUser(String userId, String oldUserId, String sessionId) throws Exception {
        String url = im_host + "api/v2/sessions/" + sessionId + "/participant/update";
        try {
            JSONObject params = new JSONObject();
            params.put("user_id", userId);
            params.put("old_user_id", oldUserId);
            params.put("session_id", sessionId);
            String ret = HttpClientUtil.postBody(url,params);
            String ret = HttpClientUtil.postBody(url, params);
            JSONObject obj = new JSONObject(ret);
            if(obj.getInt("status")==-1){
            if (obj.getInt("status") == -1) {
                throw new RuntimeException("人员更换失败!");
            }else{
            } else {
                return obj;
            }
        }catch (Exception e){
        } catch (Exception e) {
            throw new RuntimeException("人员更换失败!");
        }
    }
@ -315,62 +352,65 @@ public class ImUtill {
    /**
     * 获取议题
     *
     * @param topicId
     * @return
     */
    public static JSONObject getTopic(String topicId) throws  Exception{
        String url =  im_host + "api/v2/sessions/topics/"+topicId+"?topic_id="+topicId;
        try{
            String ret = HttpClientUtil.get(url,"utf-8");
    public static JSONObject getTopic(String topicId) throws Exception {
        String url = im_host + "api/v2/sessions/topics/" + topicId + "?topic_id=" + topicId;
        try {
            String ret = HttpClientUtil.get(url, "utf-8");
            JSONObject obj = new JSONObject(ret);
            if(obj.getInt("status")==-1){
            if (obj.getInt("status") == -1) {
                throw new RuntimeException("获取议题失败!");
            }else{
            } else {
                return obj;
            }
        }catch (Exception e){
        } catch (Exception e) {
            throw new RuntimeException("获取议题失败!");
        }
    }
    /**
     * 获取会话成员
     *
     * @param sessionId
     * @return
     * @throws Exception
     */
    public static JSONArray getParticipants(String sessionId){
        String url =  im_host + "api/v2/sessions/"+sessionId+"/participants?session_id="+sessionId;
        try{
            String ret = HttpClientUtil.get(url,"utf-8");
    public static JSONArray getParticipants(String sessionId) {
        String url = im_host + "api/v2/sessions/" + sessionId + "/participants?session_id=" + sessionId;
        try {
            String ret = HttpClientUtil.get(url, "utf-8");
            return new JSONArray(ret);
        }catch (Exception e){
        } catch (Exception e) {
            throw new RuntimeException("获取议题失败!");
        }
    }
    /**
     * 获取会话成员
     *
     * @param sessionId
     * @return
     * @throws Exception
     */
    public static JSONArray getSessions(String sessionId){
        String url =  im_host+ "api/v2/sessions/"+sessionId+"/participants?session_id="+sessionId;
        try{
            String ret = HttpClientUtil.get(url,"utf-8");
    public static JSONArray getSessions(String sessionId) {
        String url = im_host + "api/v2/sessions/" + sessionId + "/participants?session_id=" + sessionId;
        try {
            String ret = HttpClientUtil.get(url, "utf-8");
            return new JSONArray(ret);
        }catch (Exception e){
        } catch (Exception e) {
            throw new RuntimeException("获取议题失败!");
        }
    }
    public  static final String SESSION_TYPE_MUC = "1";
    public  static final String SESSION_TYPE_P2P = "2";
    public  static final String SESSION_TYPE_GROUP = "3";
    public  static final String SESSION_TYPE_SYSTEM = "0";
    public  static final String SESSION_STATUS_PROCEEDINGS= "0";
    public  static final String SESSION_STATUS_END= "1";
    public static final String SESSION_TYPE_MUC = "1";
    public static final String SESSION_TYPE_P2P = "2";
    public static final String SESSION_TYPE_GROUP = "3";
    public static final String SESSION_TYPE_SYSTEM = "0";
    public static final String SESSION_STATUS_PROCEEDINGS = "0";
    public static final String SESSION_STATUS_END = "1";
    public  static final String CONTENT_TYPE_TEXT= "1";
    public static final String CONTENT_TYPE_TEXT = "1";
}

+ 63 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SpringUtil.java

@ -0,0 +1,63 @@
package com.yihu.wlyy.util;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
@Component
public class SpringUtil implements ApplicationContextAware {
    private static ApplicationContext applicationContext = null;
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        if (SpringUtil.applicationContext == null) {
            SpringUtil.applicationContext = applicationContext;
        }
    }
    //获取applicationContext
    public static ApplicationContext
    getApplicationContext() {
        return applicationContext;
    }
    //通过name获取 Bean.
    public static Object
    getBean(String name) {
        return getApplicationContext().getBean(name);
    }
    //通过class获取Bean.
    public static<T> T getBean(Class<T> clazz) {
        return getApplicationContext().getBean(clazz);
    }
    //通过name,以及Clazz返回指定的Bean
    public static<T> T getBean(String name, Class<T> clazz) {
        return getApplicationContext().getBean(name, clazz);
    }
}

+ 91 - 24
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/im/imController.java

@ -38,16 +38,84 @@ public class imController extends BaseController {
    /**
     * 获取单个咨询
     *
     * @param consult
     * @return
     */
    @RequestMapping(value = "/getTopic")
    @ResponseBody
    public String getTopic(String consult){
        try{
    public String getTopic(String consult) {
        try {
            return success(ImUtill.getTopic(consult).get("data").toString());
        }catch (Exception e){
            return error(-1,e.getMessage());
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    /**
     * 获取当前团队的咨询列表
     * status = 10 已结束的咨询,status=0,reply = 1 已回复 ,status=0,reply=0未回复
     * 第一次列表为当前医生(很可能团队长)待回复列表 传参:doctor有后台获取 status=0,reply=0未回复
     * 后 取团队内单个医生的咨询情况 doctor、status、reply均有前端传入
     *
     * @return
     */
    @RequestMapping(value = "/consult/getTeamList", method = RequestMethod.GET)
    @ResponseBody
    public String getTeamConsultByStatus(
            @RequestParam(required = false) String doctor,
            @RequestParam int adminTeamCode,
            @RequestParam Integer status,
            @RequestParam(required = false) Integer reply,
            @RequestParam int page,
            @RequestParam int pagesize) {
        try {
            if (StringUtils.isEmpty(doctor)) {
                doctor = getUID();
            }
            String consult = ImUtill.getTeamConsultByStatus(doctor,adminTeamCode, status, reply, page, pagesize);
            JSONArray jsonArray = new JSONArray(consult);
            Iterator<Object> it = jsonArray.iterator();
            List list = new ArrayList();
            while (it.hasNext()) {
                Map map = new HashMap();
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                JSONObject ob = (JSONObject) it.next();
                String id = ob.get("id").toString();
                String avatar = ob.get("avatar").toString();
                String session_id = ob.get("session_id").toString();
                String name = ob.get("patient_name").toString();
                String createTime = ob.get("create_time").toString();
                String description = ob.get("description").toString();
                String sex = ob.get("sex").toString();
                String startId = ob.get("start_message_id").toString();
                String endId = ob.get("end_message_id").toString();
                Consult con = consultDao.findTypeByCode(id);
                System.out.println("consult========>" + con);
                System.out.println("consultId========>" + id);
                if (StringUtils.isNotEmpty(createTime)) {
                    Date date = sdf.parse(createTime);
                    map.put("create_time", sdf.format(date));
                }
                map.put("id", id);
                map.put("session_id", session_id);
                map.put("photo", avatar);
                map.put("patientName", name);
                map.put("patient", con.getPatient());
                map.put("sex", sex);
                map.put("description", description);
                map.put("start_message_id", startId);
                map.put("end_message_id", endId);
//                咨询类型:1三师咨询,2家庭医生咨询,3图文咨询,4公共咨询,5病友圈
                map.put("type", con.getType());
                list.add(map);
            }
            return write(200, "查询成功", "data", list);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "查询失败!");
        }
    }
@ -89,11 +157,11 @@ public class imController extends BaseController {
                String startId = ob.get("start_message_id").toString();
                String endId = ob.get("end_message_id").toString();
                Consult con = consultDao.findTypeByCode(id);
                System.out.println("consult========>"+con);
                System.out.println("consultId========>"+id);
                if (StringUtils.isNotEmpty(createTime)){
                System.out.println("consult========>" + con);
                System.out.println("consultId========>" + id);
                if (StringUtils.isNotEmpty(createTime)) {
                    Date date = sdf.parse(createTime);
                    map.put("create_time",sdf.format(date));
                    map.put("create_time", sdf.format(date));
                }
                map.put("id", id);
@ -125,7 +193,7 @@ public class imController extends BaseController {
     */
    @RequestMapping(value = "/consult/getTeamData", method = RequestMethod.GET)
    @ResponseBody
    public String getTeamData() {
    public String getTeamData(@RequestParam int adminTeamCode) {
        try {
            String uid = getUID();
            List<Map<String, Object>> doctors = getMemberByDoctor(uid);
@ -139,22 +207,22 @@ public class imController extends BaseController {
            for (Map<String, Object> doc : doctors) {
                Map map = new HashMap();
                String doctor = doc.get("code").toString();
                map.put("photo", doc.get("photo")==null?"":doc.get("photo").toString());
                map.put("photo", doc.get("photo") == null ? "" : doc.get("photo").toString());
                map.put("name", doc.get("name").toString());
                map.put("sex", doc.get("sex").toString());
                map.put("doctor", doctor);
                map.put("type",doc.get("level")==null?"":doc.get("level").toString());
                map.put("type", doc.get("level") == null ? "" : doc.get("level").toString());
//                未回复
                String totalUnReply = ImUtill.getConsultData(doctor, 0, 0);
                String totalUnReply = ImUtill.getConsultData(doctor,adminTeamCode, 0, 0);
                int unReply = Integer.parseInt(totalUnReply);
                map.put("totalUnReply", unReply);
//                已回复
                String totalReply = ImUtill.getConsultData(doctor, 0, 1);
                String totalReply1 = ImUtill.getConsultData(doctor, 10, null);
                int reply = Integer.parseInt(totalReply)+Integer.parseInt(totalReply1);
                String totalReply = ImUtill.getConsultData(doctor,adminTeamCode, 0, 1);
                String totalReply1 = ImUtill.getConsultData(doctor,adminTeamCode, 10, null);
                int reply = Integer.parseInt(totalReply) + Integer.parseInt(totalReply1);
                map.put("totalReply", reply);
//                总咨询量
                String totalConsult = ImUtill.getConsultData(doctor, null, null);
                String totalConsult = ImUtill.getConsultData(doctor, adminTeamCode,null, null);
                int consult = Integer.parseInt(totalConsult);
                map.put("totalConsult", consult);
@ -197,29 +265,28 @@ public class imController extends BaseController {
    }
    /**
     * 提醒医生相关信息
     *
     * @param doctor 提醒的医生
     * @param doctor  提醒的医生
     * @param content 提醒的内容
     * @return
     */
    @RequestMapping(value = "/message/remain", method = RequestMethod.POST)
    @ResponseBody
    public String reaminDoctor(String doctor,String content) {
    public String reaminDoctor(String doctor, String content) {
        try {
            JSONObject participants = new JSONObject();
            participants.put(doctor, 0);
            participants.put(getUID(),0);
            participants.put(getUID(), 0);
            Doctor d = doctorDao.findByCode(getUID());
            //创建医生会话讨论组
            JSONObject sessionObj = ImUtill.createSession(participants, ImUtill.SESSION_TYPE_P2P,  d.getName()+"发来消息提醒", "");
            if(sessionObj.getInt("status")==-1){
                throw  new RuntimeException(sessionObj.getString("message"));
            JSONObject sessionObj = ImUtill.createSession(participants, ImUtill.SESSION_TYPE_P2P, d.getName() + "发来消息提醒", "");
            if (sessionObj.getInt("status") == -1) {
                throw new RuntimeException(sessionObj.getString("message"));
            }
            JSONObject session = sessionObj.getJSONObject("data");
            ImUtill.sendImMsg(getUID(),d.getName(),session.getString("id"),"1", content,"REMAIN");
            ImUtill.sendImMsg(getUID(), d.getName(), session.getString("id"), "1", content, "REMAIN");
            return success("提醒成功!");
        } catch (Exception e) {
            error(e);

+ 4 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/ManagerUtilController.java

@ -9,8 +9,10 @@ import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
import com.yihu.wlyy.service.app.statistics.StatisticsService;
import com.yihu.wlyy.service.common.util.ManageUtilService;
import com.yihu.wlyy.service.common.util.SignTeamAndGroupRunnable;
import com.yihu.wlyy.util.SpringUtil;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.MediaType;
@ -219,7 +221,8 @@ public class ManagerUtilController extends BaseController {
    @RequestMapping(value = "/sign_team_group_thread")
    public String getErrorPage(long start, long end) {
        try {
            new Thread(new SignTeamAndGroupRunnable(start, end)).start();
            new Thread(SpringUtil.getBean(SignTeamAndGroupRunnable.class)
                    .setEnd(end).setStart(start)).start();
            return write(200, "启动成功");
        } catch (Exception e) {
            return error(-1, "启动失败");

+ 17 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabel;
import com.yihu.wlyy.entity.organization.Hospital;
@ -506,6 +507,7 @@ public class DoctorController extends BaseController {
     */
    @RequestMapping(value = "updatepwd")
    @ResponseBody
    @ObserverRequired
    public String updatepwd(String oldpwd, String newpwd) {
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
@ -559,7 +561,7 @@ public class DoctorController extends BaseController {
                code = getUID();
            }
            Doctor temp = doctorInfoService.findDoctorByCode(code);
            int leader = doctorAdminTeamDao.findLeader(code);
            Integer leader = doctorAdminTeamDao.findLeader(code);
            if (temp != null) {
                JSONObject json = new JSONObject();
                // 设置医生手机号码
@ -613,7 +615,9 @@ public class DoctorController extends BaseController {
                json.put("userRole", roleMap);
                json.put("evaluateScore", temp.getEvaluateScore());
//                是否团队长
                json.put("isLeader", leader == 0 ? "0" : "1");
                json.put("isLeader", leader == null ? "0" : "1");
//                团队长所管辖的团队code 一个团队长只管辖一个团队
                json.put("adminTeamCode", leader);
                return write(200, "医生信息查询成功!", "data", json);
            } else {
                return error(-1, "医生信息查询失败!");
@ -667,6 +671,7 @@ public class DoctorController extends BaseController {
     */
    @RequestMapping(value = "save")
    @ResponseBody
    @ObserverRequired
    public String save(
            @RequestParam(required = false) String photo,
            @RequestParam(required = false) Integer sex,
@ -1222,6 +1227,7 @@ public class DoctorController extends BaseController {
     */
    @RequestMapping(value = "/doctor_1_Toteam")
    @ResponseBody
    @ObserverRequired
    public String doctor_1_Toteam(
            @RequestParam(required = false) String teamCode, //没用
            @RequestParam(required = true) String parientCode,
@ -1463,6 +1469,7 @@ public class DoctorController extends BaseController {
     */
    @RequestMapping(value = "/idcard_update")
    @ResponseBody
    @ObserverRequired
    public String updateIdcard(String idcard) {
        try {
            if (StringUtils.isEmpty(idcard)) {
@ -1488,6 +1495,7 @@ public class DoctorController extends BaseController {
     */
    @RequestMapping(value = "/sex_update")
    @ResponseBody
    @ObserverRequired
    public String updateSex(int sex) {
        try {
            if (doctorInfoService.updateSex(sex, getUID())) {
@ -1508,6 +1516,7 @@ public class DoctorController extends BaseController {
     */
    @RequestMapping(value = "/introduce_update")
    @ResponseBody
    @ObserverRequired
    public String updateIntroduce(String introduce) {
        try {
            if (StringUtils.isEmpty(introduce)) {
@ -1532,6 +1541,7 @@ public class DoctorController extends BaseController {
     */
    @RequestMapping(value = "/expertise_update")
    @ResponseBody
    @ObserverRequired
    public String updateExpertise(String expertise) {
        try {
            if (StringUtils.isEmpty(expertise)) {
@ -1556,6 +1566,7 @@ public class DoctorController extends BaseController {
     */
    @RequestMapping(value = "/setFamous")
    @ResponseBody
    @ObserverRequired
    public String setFamous(String doctorCode, Integer status) {
        try {
            doctorInfoService.setFamous(doctorCode, status);
@ -1576,6 +1587,7 @@ public class DoctorController extends BaseController {
     */
    @RequestMapping(value = "/updateTeamHealthDoctors")
    @ResponseBody
    @ObserverRequired
    public String updateTeamHealthDoctors(String newDoctorCode,
                                          @RequestParam(required = false) String oldDoctorCode,
                                          @RequestParam(required = false) String patients,
@ -1630,6 +1642,7 @@ public class DoctorController extends BaseController {
     */
    @RequestMapping(value = "/updateTeamDoctors")
    @ResponseBody
    @ObserverRequired
    public String updateTeamDoctors(String newDoctorCode,
                                    String oldDoctorCode,
                                    String patients) {
@ -1666,6 +1679,7 @@ public class DoctorController extends BaseController {
     */
    @RequestMapping(value = "/mobile_update", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String changeDoctorMobile(String mobile, String captcha, int type) {
        try {
            if (StringUtils.isEmpty(mobile)) {
@ -1731,6 +1745,7 @@ public class DoctorController extends BaseController {
     */
    @RequestMapping(value = "/updatePassword", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String updatePassword(String newPassword1,
                                 String newPassword2,
                                 String oldPassword,

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/archives/DoctorArchivesController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.archives;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.service.app.archives.PatientEventService;
import com.yihu.wlyy.service.app.archives.PatientRecordService;
import com.yihu.wlyy.web.BaseController;
@ -201,6 +202,7 @@ public class DoctorArchivesController extends BaseController {
    @RequestMapping(value = "/event/save", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("保存就诊事件详情")
    @ObserverRequired
    public String saveEventDetail(@ApiParam(name="data",value="就诊事件json数据",defaultValue = "")
                                 @RequestParam(value="data",required = true) String data)
    {

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/booking/DoctorBookingController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.booking;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.patient.PatientReservation;
import com.yihu.wlyy.repository.patient.PatientReservationDao;
import com.yihu.wlyy.service.app.reservation.PatientReservationService;
@ -63,6 +64,7 @@ public class DoctorBookingController extends BaseController{
    @RequestMapping(value = "CancelOrder", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("取消挂号单")
    @ObserverRequired
    public String CancelOrder(@ApiParam(name = "orderId", value = "订单id", defaultValue = "48")
                              @RequestParam(value = "orderId", required = true) Long orderId) {
        try {

+ 8 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.consult;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.consult.ConsultTeamLog;
import com.yihu.wlyy.entity.discussion.WlyyTalkGroup;
@ -368,6 +369,7 @@ public class DoctorConsultController extends WeixinBaseController {
     */
    @RequestMapping(value = "finish")
    @ResponseBody
    @ObserverRequired
    public String finish(String consult) {
        try {
            int flag = consultTeamService.finish(consult, getUID(), 2);
@ -390,6 +392,7 @@ public class DoctorConsultController extends WeixinBaseController {
     */
    @RequestMapping(value = "/readed")
    @ResponseBody
    @ObserverRequired
    public String readMessage(String consult) {
        try {
            int result = consultTeamService.readMessage(consult);
@ -633,6 +636,7 @@ public class DoctorConsultController extends WeixinBaseController {
     */
    @RequestMapping(value = "famousAdd")
    @ResponseBody
    @ObserverRequired
    public String famousAdd(
            @RequestParam(required = false) String when,
            String symptoms,
@ -747,6 +751,7 @@ public class DoctorConsultController extends WeixinBaseController {
     */
    @RequestMapping(value = "transfer")
    @ResponseBody
    @ObserverRequired
    public String transfer(
            String consult,
            String doctor,
@ -810,6 +815,7 @@ public class DoctorConsultController extends WeixinBaseController {
     */
    @RequestMapping(value = "forHelpAdd")
    @ResponseBody
    @ObserverRequired
    public String forHelpAdd(
            @RequestParam(required = false) String when,
            String symptoms,
@ -946,6 +952,7 @@ public class DoctorConsultController extends WeixinBaseController {
    @RequestMapping(value = "seekHelp")
    @ResponseBody
    @ObserverRequired
    public String seekHelp(
            @RequestParam(required = true) String symptoms,
            @RequestParam(required = false) String oldConsultCode,
@ -990,6 +997,7 @@ public class DoctorConsultController extends WeixinBaseController {
     */
    @RequestMapping(value = "finish_consult")
    @ResponseBody
    @ObserverRequired
    public String finishConsult(@RequestParam(required = false) String consult) {
        try {
            int flag = consultTeamService.finishConsult(consult, getUID(), 2);

+ 4 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultMoviController.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.web.doctor.consult;
import java.sql.Time;
import java.util.Date;
import com.yihu.wlyy.aop.ObserverRequired;
import io.swagger.annotations.Api;
import org.json.JSONArray;
import org.json.JSONObject;
@ -149,6 +150,7 @@ public class DoctorConsultMoviController extends BaseController {
	 */
	@RequestMapping(value = "movi_finish")
	@ResponseBody
	@ObserverRequired
	public String finish(String code) {
		try {
			int row = consultMoviService.finish(code);
@ -210,6 +212,7 @@ public class DoctorConsultMoviController extends BaseController {
	 */
	@ResponseBody
	@RequestMapping(value = "referral")
	@ObserverRequired
	public String referral(String doctor, String consult, String scheduling, String appo_date, int appo_week, String hour_begin, String hour_end, String content) {
		try {
			// 查询医生信息
@ -264,6 +267,7 @@ public class DoctorConsultMoviController extends BaseController {
	 */
	@ResponseBody
	@RequestMapping(value = "inspect")
	@ObserverRequired
	public String addInspect(String patient, String items) {
		try {
			return success("保存成功!");

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultPublicController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.consult;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.consult.ConsultPublic;
import com.yihu.wlyy.entity.consult.ConsultPublicReply;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
@ -200,6 +201,7 @@ public class DoctorConsultPublicController extends BaseController {
	 */
	@RequestMapping(value = "reply")
	@ResponseBody
	@ObserverRequired
	public String reply(String consult, String content, @RequestParam(required = false) String images) {
		try {
			ConsultPublic cp = consultPublicService.findByConsult(consult);

+ 6 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/device/DoctorDeviceController.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.web.doctor.device;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.device.PatientDevice;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeamMember;
@ -45,6 +46,7 @@ public class DoctorDeviceController extends BaseController {
	@ApiOperation("设备保存接口--医生端")
	@RequestMapping(value = "SavePatientDevice",method = RequestMethod.POST)
	@ResponseBody
	@ObserverRequired
	public String saveDevice(@ApiParam(name="data",value="设备数据json",defaultValue = "{\"user\":\"915cca0a-5b1d-11e6-8344-fa163e8aee56\",\"deviceId\": \"3\",\"deviceName\": \"血压计-优瑞恩\",\"deviceSn\": \"16C000337\",\"categoryCode\": \"1\",\"userType\": \"-1\"}")
							  @RequestParam(value="data",required = true) String data) {
		try {
@ -86,6 +88,7 @@ public class DoctorDeviceController extends BaseController {
	@ApiOperation("设备删除--医生端")
	@RequestMapping(value = "DeletePatientDevice")
	@ResponseBody
	@ObserverRequired
	public String delete(@ApiParam(name="id",value="删除设备关联ID")
						 @RequestParam(value="id",required = true) String id) {
		try {
@ -127,6 +130,7 @@ public class DoctorDeviceController extends BaseController {
	@ApiOperation("设备删除--管理端")
	@RequestMapping(value = "unbindDevice")
	@ResponseBody
	@ObserverRequired
	public String deleteByAdmin(@ApiParam(name="deviceSn",value="设备SN")
						 @RequestParam(value="deviceSn",required = true) String deviceSn,
						@ApiParam(name="type",value="设备类型")
@ -161,6 +165,7 @@ public class DoctorDeviceController extends BaseController {
	@ApiOperation("批量注册接口")
	@RequestMapping(value = "registerSnInit",method = RequestMethod.GET)
	@ResponseBody
	@ObserverRequired
	public String registerSnInit(){
		try{
			String re = patientDeviceService.registerSnInit();
@ -177,6 +182,7 @@ public class DoctorDeviceController extends BaseController {
	@ApiOperation("单个注册接口")
	@RequestMapping(value = "registerSn",method = RequestMethod.GET)
	@ResponseBody
	@ObserverRequired
	public String registerSn(@ApiParam(name="deviceSn",value="设备SN码",defaultValue = "15L000002")
							@RequestParam(value="deviceSn",required = true) String deviceSn){
		try{

+ 7 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/discussion/DoctorDiscussionGroupController.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.web.doctor.discussion;
import java.util.*;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.consult.Consult;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.discussion.WlyyTalkGroup;
@ -60,6 +61,7 @@ public class DoctorDiscussionGroupController extends BaseController {
     */
    @RequestMapping(value = "/create", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    @ObserverRequired
    public String createTalkGroup(
            @RequestParam(required = true) String name,
            @RequestParam(required = true) int type,
@ -219,6 +221,7 @@ public class DoctorDiscussionGroupController extends BaseController {
     */
    @RequestMapping(value = "/create/members", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    @ObserverRequired
    public String createTalkGroupMany(@RequestParam(required = true) String name,
                                      @RequestParam(required = true) int type,
                                      @RequestParam(required = true) String members,
@ -433,6 +436,7 @@ public class DoctorDiscussionGroupController extends BaseController {
     */
    @RequestMapping(value = "addmember", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    @ObserverRequired
    public String addTalkMember(
            @RequestParam(required = true) String groupCode,
            @RequestParam(required = false) String groupName,
@ -497,6 +501,7 @@ public class DoctorDiscussionGroupController extends BaseController {
     */
    @RequestMapping(value = "/addmembers", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    @ObserverRequired
    public String addMembers(@RequestParam(required = true) String groupCode,
                             @RequestParam(required = false) String groupName,
                             @RequestParam(required = true) String members) {
@ -573,6 +578,7 @@ public class DoctorDiscussionGroupController extends BaseController {
     */
    @RequestMapping(value = "removemember", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    @ObserverRequired
    public String removeTalkMember(
            @RequestParam(required = true) String groupCode,
            @RequestParam(required = true) String memberCode) {
@ -593,6 +599,7 @@ public class DoctorDiscussionGroupController extends BaseController {
     */
    @RequestMapping(value = "/removemembers", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    @ObserverRequired
    public String removeMembers(String groupCode, String members) {
        try {
            String[] memberArray = members.split(",");

+ 3 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/feedback/DoctorFeedbackController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.feedback;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.service.app.feedback.AppealService;
import com.yihu.wlyy.service.app.feedback.FeedbackService;
import com.yihu.wlyy.util.CommonUtil;
@ -38,6 +39,7 @@ public class DoctorFeedbackController extends BaseController {
    @RequestMapping(value = "/saveFeedback", method = RequestMethod.POST)
    @ApiOperation(value = "医生端保存反馈")
    @ResponseBody
    @ObserverRequired
    public String saveFeedback(
            @RequestParam String description,
            @RequestParam int type,
@ -69,6 +71,7 @@ public class DoctorFeedbackController extends BaseController {
    @RequestMapping(value = "/saveAppeal", method = RequestMethod.POST)
    @ApiOperation(value = "医生端保存申诉")
    @ResponseBody
    @ObserverRequired
    public String saveAppeal(
            @RequestParam String description,
            @RequestParam int type,

+ 9 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/followup/DoctorFollowUpController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.followup;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.followup.Followup;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.service.app.followup.FollowUpService;
@ -87,6 +88,7 @@ public class DoctorFollowUpController extends BaseController {
    @ApiOperation("获取随访列表(创建者)")
    @RequestMapping(value = "/createrList", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    @ObserverRequired
    public String getCreaterList(@ApiParam(name = "startTime", value = "开始时间", defaultValue = "2016-12-07 00:00:00")
                                 @RequestParam(value = "startTime", required = true) String startTime,
                                 @ApiParam(name = "endTime", value = "结束时间", defaultValue = "2016-12-14 00:00:00")
@ -107,6 +109,7 @@ public class DoctorFollowUpController extends BaseController {
    @ApiOperation("新增随访计划(批量)")
    @RequestMapping(value = "/addFollowupPlan", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String addFollowupPlan(@ApiParam(name = "patient", value = "患者代码", defaultValue = "443a196ef8744536a531260eb26c05d7")
                                  @RequestParam(value = "patient", required = true) String patient,
                                  @ApiParam(name = "data", value = "随访计划列表json", defaultValue = "[{\"date\":\"2016-12-16 20:00:00\",\"type\":\"10\",\"doctor\":\"64de9952-5b15-11e6-8344-fa163e8aee56\"},{\"date\":\"2016-12-17 15:00:00\",\"type\":\"3\",\"doctor\":\"64de9952-5b15-11e6-8344-fa163e8aee56\"}]")
@ -129,6 +132,7 @@ public class DoctorFollowUpController extends BaseController {
    @ApiOperation("编辑随访计划")
    @RequestMapping(value = "/editFollowupPlan", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String editFollowupPlan(@ApiParam(name = "id", value = "随访记录ID", defaultValue = "")
                                   @RequestParam(value = "id", required = true) String id,
                                   @ApiParam(name = "planDate", value = "随访计划时间", defaultValue = "2016-12-14 20:00:00")
@ -147,6 +151,7 @@ public class DoctorFollowUpController extends BaseController {
    @ApiOperation("开始随访记录")
    @RequestMapping(value = "/startFollowup", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String startFollowup(@ApiParam(name = "id", value = "随访记录ID", defaultValue = "")
                                @RequestParam(value = "id", required = true) String id,
                                @ApiParam(name = "date", value = "随访时间", defaultValue = "2016-12-14 20:00:00")
@ -169,6 +174,7 @@ public class DoctorFollowUpController extends BaseController {
    @ApiOperation("新增临时随访记录(返回ID)")
    @RequestMapping(value = "/addFollowup", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String addFollowup(@ApiParam(name = "patient", value = "患者代码", defaultValue = "443a196ef8744536a531260eb26c05d7")
                              @RequestParam(value = "patient", required = true) String patient,
                              @ApiParam(name = "date", value = "下次随访时间", defaultValue = "2016-12-15 20:00:00")
@ -191,6 +197,7 @@ public class DoctorFollowUpController extends BaseController {
    @ApiOperation("取消随访计划")
    @RequestMapping(value = "/cancelFollowupPlan", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String cancelFollowupPlan(@ApiParam(name = "id", value = "随访记录ID", defaultValue = "")
                                     @RequestParam(value = "id", required = true) String id) {
        try {
@ -205,6 +212,7 @@ public class DoctorFollowUpController extends BaseController {
    @ApiOperation("完成随访记录")
    @RequestMapping(value = "/finishFollowup", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String finishFollowup(@ApiParam(name = "id", value = "随访记录ID", defaultValue = "")
                                 @RequestParam(value = "id", required = true) String id) {
        try {
@ -264,6 +272,7 @@ public class DoctorFollowUpController extends BaseController {
    @ApiOperation("保存随访项目数据")
    @RequestMapping(value = "/saveFollowupProjectData", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String saveFollowupProjectData(@ApiParam(name = "id", value = "随访记录ID", defaultValue = "4")
                                          @RequestParam(value = "id", required = true) String id,
                                          @ApiParam(name = "followupProject", value = "随访项目", defaultValue = "2")

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/followup/DoctorFollowupDrugsController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.followup;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.dict.DmDrugsGroupItem;
import com.yihu.wlyy.entity.followup.Followup;
import com.yihu.wlyy.entity.followup.FollowupDrugs;
@ -55,6 +56,7 @@ public class DoctorFollowupDrugsController extends BaseController {
	@ApiOperation("保存面访用药数据")
	@RequestMapping(value = "/saveFollowupDrugs", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
	@ResponseBody
	@ObserverRequired
	public String saveFollowupDrugs(@ApiParam(name="id",value="随访记录ID",defaultValue = "")
										  @RequestParam(value="id",required = true) String id,
									      @ApiParam(name="drugsData",value="面访用药数据",defaultValue = "[]")

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.health;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.patient.PatientHealthStandard;
import com.yihu.wlyy.health.entity.DevicePatientHealthIndex;
import com.yihu.wlyy.service.app.health.PatientHealthIndexService;
@ -196,6 +197,7 @@ public class DoctorHealthController extends BaseController {
	@RequestMapping(value = "standard_save",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("保存患者健康指标预警值")
	@ObserverRequired
	public String standardSave(@ApiParam("患者代码") @RequestParam String patient,
							    @ApiParam("预警值Json") @RequestParam String json) {
		try {

+ 4 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.health;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.education.*;
import com.yihu.wlyy.entity.patient.Patient;
@ -315,6 +316,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
     */
    @RequestMapping(value = "send")
    @ResponseBody
    @ObserverRequired
    public String send(@RequestParam(value = "code") String code,
                       @RequestParam(value = "patient", required = false) String patient,
                       @RequestParam(value = "group", required = false, defaultValue = "") String group,
@ -520,6 +522,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
     */
    @RequestMapping(value = "collectionArticle")
    @ResponseBody
    @ObserverRequired
    public String collectionArticle(@RequestParam(value = "article", required = true) String article) {
        HealthEduArticleDoctor healthEduArticleDoctor = healthEduArticleDoctorService.findByArticle(article, getUID());
        if (healthEduArticleDoctor != null) {
@ -549,6 +552,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
     */
    @RequestMapping(value = "uncollectionArticle")
    @ResponseBody
    @ObserverRequired
    public String uncollectionArticle(@RequestParam(value = "article", required = true) String article) {
        try {
            healthEduArticleDoctorService.delete(article, getUID());

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthGuidanceController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.health;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientHealthGuidance;
@ -124,6 +125,7 @@ public class DoctorHealthGuidanceController extends WeixinBaseController {
	 */
	@RequestMapping(value = "add")
	@ResponseBody
	@ObserverRequired
	public String add(@RequestParam String patient,
					  @RequestParam String content,
					  @RequestParam(required = false) String modelCode,

+ 3 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/intervene/DoctorInterveneController.java

@ -5,6 +5,7 @@ import java.util.Date;
import java.util.Iterator;
import java.util.List;
import com.yihu.wlyy.aop.ObserverRequired;
import io.swagger.annotations.Api;
import org.json.JSONArray;
import org.json.JSONObject;
@ -87,6 +88,7 @@ public class DoctorInterveneController extends BaseController {
	 */
	@RequestMapping(value = "self_exam")
	@ResponseBody
	@ObserverRequired
	public String selfExam(@RequestParam(required = false) Integer type, @RequestParam(required = false) String consult, String patient, String devices) {
		try {
			Doctor doctor = doctorService.findDoctorByCode(getUID());
@ -161,6 +163,7 @@ public class DoctorInterveneController extends BaseController {
	 */
	@RequestMapping(value = "inspection")
	@ResponseBody
	@ObserverRequired
	public String inspection(int type, String consult, String patient, String suggest) {
		try {
			// 查询医生信息

+ 7 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/medical/DoctorMedicalRecordController.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.web.doctor.medical;
import java.util.Date;
import java.util.List;
import com.yihu.wlyy.aop.ObserverRequired;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
@ -224,6 +225,7 @@ public class DoctorMedicalRecordController extends BaseController {
	 */
	@RequestMapping(value = "add_part")
	@ResponseBody
	@ObserverRequired
	public String addPart(String name) {
		try {
			DoctorMedicalRecordsPart part = medicalRecordsService.addPart(getUID(), name);
@ -246,6 +248,7 @@ public class DoctorMedicalRecordController extends BaseController {
	 */
	@RequestMapping(value = "add_part_item")
	@ResponseBody
	@ObserverRequired
	public String addPartItem(String part, String content) {
		try {
			DoctorMedicalRecordsPartItem item = medicalRecordsService.addPartItem(getUID(), part, content);
@ -269,6 +272,7 @@ public class DoctorMedicalRecordController extends BaseController {
	 */
	@RequestMapping(value = "add_part_record")
	@ResponseBody
	@ObserverRequired
	public String addPartRecord(String patient, String part, String content) {
		try {
			medicalRecordsService.addPartRecord(getUID(), patient, part, content);
@ -288,6 +292,7 @@ public class DoctorMedicalRecordController extends BaseController {
	 */
	@RequestMapping(value = "modify_part_record")
	@ResponseBody
	@ObserverRequired
	public String modifyPartRecord(String record, String content) {
		try {
			// 查询片段记录内容
@ -314,6 +319,7 @@ public class DoctorMedicalRecordController extends BaseController {
	 */
	@RequestMapping(value = "del_part_record")
	@ResponseBody
	@ObserverRequired
	public String delPartRecord(String record) {
		try {
			PatientMedicalRecords temp = medicalRecordsService.findRecordByCode(record);
@ -344,6 +350,7 @@ public class DoctorMedicalRecordController extends BaseController {
	 */
	@RequestMapping(value = "add_record")
	@ResponseBody
	@ObserverRequired
	public String addRecord(String patient, String consult, String title, String parts) {
		try {
			PatientMedicalRecords temp = medicalRecordsService.addRecord(getUID(), patient, consult, title, parts);

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

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.message;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.message.Message;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -119,6 +120,7 @@ public class DoctorMessageController extends BaseController {
    @RequestMapping(value = "read_health")
    @ResponseBody
    @ApiOperation("消息设置成已读")
    @ObserverRequired
    public String readHealth(long msgid) {
        try {
            messageService.readHealth(msgid);
@ -330,6 +332,7 @@ public class DoctorMessageController extends BaseController {
    @RequestMapping(value = "setMessageReaded")
    @ResponseBody
    @ApiOperation("设置某类消息已读")
    @ObserverRequired
    public String setMessageReaded(@RequestParam @ApiParam(value = "消息类型") Integer type) {
        try {
            messageService.setMessageReaded(getUID(), type);

+ 6 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/DoctorPatientGroupController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.patient;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroup;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroupInfo;
@ -734,6 +735,7 @@ public class DoctorPatientGroupController extends BaseController {
     */
    @RequestMapping(value = "add_group")
    @ResponseBody
    @ObserverRequired
    public String addGroup(String name) {
        try {
            if (doctorPatientGroupService.addGroup(getUID(), name) != null) {
@ -755,6 +757,7 @@ public class DoctorPatientGroupController extends BaseController {
     */
    @RequestMapping(value = "del_group")
    @ResponseBody
    @ObserverRequired
    public String deleteGroup(String group) {
        try {
            if (StringUtils.equals(group, "1") || StringUtils.equals(group, "2") || StringUtils.equals(group, "3")) {
@ -787,6 +790,7 @@ public class DoctorPatientGroupController extends BaseController {
     */
    @RequestMapping(value = "modify_group")
    @ResponseBody
    @ObserverRequired
    public String modifyGroup(String group, String name) {
        try {
            if (StringUtils.equals(group, "1") || StringUtils.equals(group, "2") || StringUtils.equals(group, "3")) {
@ -937,6 +941,7 @@ public class DoctorPatientGroupController extends BaseController {
     */
    @RequestMapping(value = "add_patients")
    @ResponseBody
    @ObserverRequired
    public String addGroupPatients(String group, String patients) {
        try {
            if (StringUtils.equals(group, "1") || StringUtils.equals(group, "2") || StringUtils.equals(group, "3")) {
@ -1142,6 +1147,7 @@ public class DoctorPatientGroupController extends BaseController {
     */
    @RequestMapping(value = "sign_doctors")
    @ResponseBody
    @ObserverRequired
    public String signDoctors(String patient) {
        try {
            JSONObject data = new JSONObject();

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientDiseaseController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.patient;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.patient.PatientDisease;
import com.yihu.wlyy.service.app.disease.PatientDiseaseService;
import com.yihu.wlyy.web.BaseController;
@ -85,6 +86,7 @@ public class PatientDiseaseController extends BaseController {
     * @return
     */
    @RequestMapping(value = "/disease_update")
    @ObserverRequired
    public String updatePatientDisease(String patient, String disease) {
        try {
            List<PatientDisease> diseases = patientDiseaseService.getPatientDiseaseSs(patient);

+ 5 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.patient;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.team.sign.SignLabel;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabel;
import com.yihu.wlyy.repository.doctor.SignLabelDao;
@ -57,6 +58,7 @@ public class SignPatientLabelController extends BaseController {
     * @return
     */
    @RequestMapping(value = "/add")
    @ObserverRequired
    public String addPatientLabel(String labelName, Long teamCode) {
        try {
            if (StringUtils.isEmpty(labelName)) {
@ -96,6 +98,7 @@ public class SignPatientLabelController extends BaseController {
     * @return
     */
    @RequestMapping(value = "/add/teams")
    @ObserverRequired
    public String addTeamsLabel(@RequestParam String labelName, @RequestParam String teamCode) {
        try {
            if (StringUtils.isEmpty(labelName)) {
@ -130,6 +133,7 @@ public class SignPatientLabelController extends BaseController {
     * @return
     */
    @RequestMapping(value = "/modify")
    @ObserverRequired
    public String modifyPatientLabel(String labelCode, String newName) {
        try {
            if (StringUtils.isEmpty(labelCode)) {
@ -160,6 +164,7 @@ public class SignPatientLabelController extends BaseController {
     * @return
     */
    @RequestMapping(value = "/delete")
    @ObserverRequired
    public String deletePatientLabel(String labelCode) {
        try {
            if (StringUtils.isEmpty(labelCode)) {

+ 5 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.patient;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
import com.yihu.wlyy.service.app.sign.SignWebService;
import com.yihu.wlyy.service.common.account.PatientService;
@ -348,6 +349,7 @@ public class SignPatientLabelInfoController extends BaseController {
     * @return
     */
    @RequestMapping(value = "/patient_label_update")
    @ObserverRequired
    public String setPatientLabels(@RequestParam(required = false) String patient,
                                   @RequestParam(required = false) String health,
                                   @RequestParam(required = false) String disease,
@ -546,6 +548,7 @@ public class SignPatientLabelInfoController extends BaseController {
     * @return
     */
    @RequestMapping(value = "/patient_label_add")
    @ObserverRequired
    public String addPatientLabel(String patient, String labelCode, String labelType) {
        try {
            if (StringUtils.isEmpty(String.valueOf(patient))) {
@ -585,6 +588,7 @@ public class SignPatientLabelInfoController extends BaseController {
     * @return
     */
    @RequestMapping(value = "/label_and_patients_add")
    @ObserverRequired
    public String addLabelAndPatient(String labelName, Long teamCode, @RequestParam(required = false) String patients) {
        try {
            if (StringUtils.isEmpty(labelName)) {
@ -620,6 +624,7 @@ public class SignPatientLabelInfoController extends BaseController {
     * @return
     */
    @RequestMapping(value = "/patient_label_delete")
    @ObserverRequired
    public String deletePatientLabel(String patient, String labelCode, String labelType) {
        try {
            if (StringUtils.isEmpty(String.valueOf(patient))) {

+ 3 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/reply/DoctorQuickReplyController.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.web.doctor.reply;
import com.fasterxml.jackson.databind.deser.Deserializers;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.reply.DoctorQuickReply;
import com.yihu.wlyy.service.app.reply.DoctorQuickReplyService;
import com.yihu.wlyy.web.BaseController;
@ -48,6 +49,7 @@ public class DoctorQuickReplyController extends BaseController {
    @RequestMapping(value = "/modify", method = RequestMethod.POST)
    @ApiOperation(value = "修改快捷回复")
    @ObserverRequired
    public String modifyReply(@RequestParam @ApiParam(value = "快捷回复ID") Long id,
                              @RequestParam @ApiParam(value = "快捷回复内容") String content) {
        try {
@ -73,6 +75,7 @@ public class DoctorQuickReplyController extends BaseController {
    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    @ApiOperation(value = "删除快捷回复")
    @ObserverRequired
    public String delReply(@RequestParam @ApiParam(value = "快捷回复ID") Long id) {
        try {
            if (id == null || id < 1) {

+ 4 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/scheduling/DoctorWorkTimeController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.scheduling;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.service.app.account.DoctorInfoService;
@ -75,6 +76,7 @@ public class DoctorWorkTimeController extends BaseController {
     */
    @RequestMapping(value = "/save")
    @ResponseBody
    @ObserverRequired
    public String saveDoctorWorkTime(String workScheduling) {
        try {
            if (StringUtils.isEmpty(workScheduling)) {
@ -127,6 +129,7 @@ public class DoctorWorkTimeController extends BaseController {
     */
    @RequestMapping(value = "/receive_consult_setting")
    @ResponseBody
    @ObserverRequired
    public String setDoctorReceiveConsult(String receiveConsult) {
        try {
            if (StringUtils.isEmpty(receiveConsult)) {
@ -151,6 +154,7 @@ public class DoctorWorkTimeController extends BaseController {
     */
    @RequestMapping(value = "/consult_times_setting")
    @ResponseBody
    @ObserverRequired
    public String setFamousDoctorConsultTime(int consultTimes) {
        try {
            Doctor doc = doctorInfoService.findDoctorByCode(getUID());

+ 8 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java

@ -5,6 +5,7 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabel;
import com.yihu.wlyy.entity.message.Message;
@ -397,6 +398,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
     */
    @RequestMapping(value = "agent")
    @ResponseBody
    @ObserverRequired
    public String agent(
            @RequestParam(required = false) String name,
            @RequestParam(required = false) String idcard,
@ -508,6 +510,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
     */
    @RequestMapping(value = "sign")
    @ResponseBody
    @ObserverRequired
    public String sign(
            @RequestParam(required = true, defaultValue = "1") String signType,
            @RequestParam(required = false, defaultValue = "") String healthDoctor,
@ -617,6 +620,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
     */
    @RequestMapping(value = "surrender")
    @ResponseBody
    @ObserverRequired
    public String surrender(
            long msgid,
            String patient,
@ -804,6 +808,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
     */
    @RequestMapping(value = "/expenses_type_update")
    @ResponseBody
    @ObserverRequired
    public String updateExpensesType(String expensesType, String patient) {
        try {
            if (StringUtils.isEmpty(expensesType)) {
@ -1108,6 +1113,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
     */
    @RequestMapping(value = "/sign_info_update")
    @ResponseBody
    @ObserverRequired
    public String updateSignInfo(String patient, @RequestParam(required = false) String healthDoctor,
                                 @RequestParam(required = false) String doctor,
                                 @RequestParam(required = false) String expensesType) {
@ -1334,6 +1340,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
     */
    @RequestMapping(value = "/expenses_remind")
    @ResponseBody
    @ObserverRequired
    public String remindPatientExpenses(@RequestParam(required = false) String patient
            , @RequestParam(required = false) String isAll) {
        try {
@ -1560,6 +1567,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
    @RequestMapping(value = "/wechat_focus_remind", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    @ApiOperation(value = "微信关注提醒")
    @ObserverRequired
    public String wechatFocusRemind(@RequestParam(defaultValue = "") @ApiParam(value = "居民") String patient,
                                    @RequestParam(defaultValue = "") @ApiParam(value = "是否全部(1:全部  0:非全部)") String isAll) {
        try {

+ 4 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.sign;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.service.app.account.DoctorInfoService;
import com.yihu.wlyy.service.app.account.PatientInfoService;
@ -422,6 +423,7 @@ public class DoctorSignController extends WeixinBaseController {
     */
    @RequestMapping("/sendRenewToPatients")
    @ApiOperation(value = "提醒用户签约接口")
    @ObserverRequired
    public String sendRenewToPatients(){
        try{
            int rs ;
@ -450,6 +452,7 @@ public class DoctorSignController extends WeixinBaseController {
     */
    @RequestMapping("/agreeRenew")
    @ApiOperation(value = "医生处理签约")
    @ObserverRequired
    public String agreeRenew(@RequestParam(required = true)String state,
                             @RequestParam(required = true)String patient,
                             @RequestParam(required = false) Long mesId,
@ -557,6 +560,7 @@ public class DoctorSignController extends WeixinBaseController {
    @RequestMapping("/remindPatientRenew")
    @ApiOperation(value = "提醒居民续签")
    @ObserverRequired
    public String remindPatientRenew(@RequestParam(required = true)String patient){
        try{
            int rs =signWebService.remainPatientRenew(getAccessToken(),patient,getUID());

File diff suppressed because it is too large
+ 3 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/ManagerQuestionnaireController.java


+ 7 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/team/AdminTeamController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.team;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
@ -76,6 +77,7 @@ public class AdminTeamController extends BaseController {
    @RequestMapping(method = RequestMethod.POST)
    @ApiOperation(value = "创建团队")
    @ObserverRequired
    public String createTeam(@RequestParam("team_name") String teamName,
                             @RequestParam("leader_id") String leaderCode,
                             @RequestParam("org_code") String orgCode) {
@ -93,6 +95,7 @@ public class AdminTeamController extends BaseController {
    @RequestMapping(value = "/remove", method = RequestMethod.POST)
    @ApiOperation(value = "删除团队信息")
    @ObserverRequired
    public String deleteTeam(@RequestParam("teamId") long teamId) {
        try {
            teamService.deleteTeam(teamId);
@ -106,6 +109,7 @@ public class AdminTeamController extends BaseController {
    @RequestMapping(value = "/{team_id}/name", method = RequestMethod.POST)
    @ApiOperation(value = "更新团队名称")
    @ObserverRequired
    public String updateTeamName(@PathVariable("team_id") long teamId,
                                 @RequestParam("team_name") String teamName) {
        try {
@ -120,6 +124,7 @@ public class AdminTeamController extends BaseController {
    @RequestMapping(value = "/{team_id}/leader", method = RequestMethod.POST)
    @ApiOperation(value = "更新团队领导")
    @ObserverRequired
    public String updateTeamLeader(@PathVariable("team_id") long teamId,
                                   @RequestParam("doctor_code") String doctorCode) {
        try {
@ -147,6 +152,7 @@ public class AdminTeamController extends BaseController {
    @RequestMapping(value = "/{team_id}/members", method = RequestMethod.POST)
    @ApiOperation(value = "添加团队成员,批量添加使用逗号分隔列表")
    @ObserverRequired
    public String addMember(@PathVariable("team_id") long teamId,
                            @RequestParam("doctor_code") String doctorCodeList) {
        try {
@ -211,6 +217,7 @@ public class AdminTeamController extends BaseController {
    @RequestMapping(value = "/{team_id}/members/{doctor_code}/remove", method = RequestMethod.POST)
    @ApiOperation(value = "移除成员")
    @ObserverRequired
    public String removeMember(@PathVariable("team_id") long teamId,
                               @PathVariable("doctor_code") String doctorCode) {

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

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.template;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.template.DoctorGuidanceTemp;
import com.yihu.wlyy.service.template.DoctorGuidanceTempService;
import com.yihu.wlyy.web.BaseController;
@ -77,6 +78,7 @@ public class DoctorGuidanceTempController extends BaseController {
//  =====================
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ApiOperation(value = "添加指导模板")
    @ObserverRequired
    public String add(@RequestParam @ApiParam(value = "指导内容") String content,
                      @RequestParam @ApiParam(value = "模板名称") String modelName,
                      @RequestParam(required = false) @ApiParam(value = "图片内容") String imagesUrl) {
@ -111,6 +113,7 @@ public class DoctorGuidanceTempController extends BaseController {
     */
    @RequestMapping(value = "/modify", method = RequestMethod.POST)
    @ApiOperation(value = "修改指导模板")
    @ObserverRequired
    public String modify(@RequestParam @ApiParam(value = "指导编码") String code,
                         @RequestParam @ApiParam(value = "模板标题") String modelName,
                         @RequestParam @ApiParam(value = "指导内容") String content,
@ -150,6 +153,7 @@ public class DoctorGuidanceTempController extends BaseController {
     */
    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    @ApiOperation(value = "删除指导模板")
    @ObserverRequired
    public String delete(@RequestParam @ApiParam(value = "指导编码") String code) {
        try {
            if (StringUtils.isEmpty(code)) {

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

@ -1,6 +1,7 @@
package com.yihu.wlyy.web.doctor.template;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.patient.PatientHealthStandard;
import com.yihu.wlyy.entity.template.DoctorTeamGuidanceDetail;
@ -124,6 +125,7 @@ public class DoctorTeamGuidanceController extends WeixinBaseController {
    @RequestMapping(value = "/saveTeamGuidance", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("新增团队模板")
    @ObserverRequired
    public String saveTeamGuidance(
            @ApiParam(value = "团队模板标题")
            @RequestParam String title,
@ -157,6 +159,7 @@ public class DoctorTeamGuidanceController extends WeixinBaseController {
     */
    @RequestMapping(value = "/modifyTeamGuidance", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("修改团队模板")
    public String modifyTeamGuidance(
            @ApiParam(value = "团队模板团队模板是否保存为个人模板", defaultValue = "0")
@ -193,6 +196,7 @@ public class DoctorTeamGuidanceController extends WeixinBaseController {
    @RequestMapping(value = "/deleteTeamGuidance", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("删除团队所属的团队模板")
    @ObserverRequired
    public String deleteTeamGuidance(
            @ApiParam(value = "是否删除存在该模板的所有团队")
            @RequestParam int deleteAll,
@ -221,6 +225,7 @@ public class DoctorTeamGuidanceController extends WeixinBaseController {
    @RequestMapping(value = "/sendTeamGuidance", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("发送团队模板给居民")
    @ObserverRequired
    public String sendTeamGuidance(
            @ApiParam(value = "要发送的居民code")
            @RequestParam String patient,

+ 219 - 217
patient-co-wlyy/src/main/resources/applicationContext.xml

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	   xmlns:task="http://www.springframework.org/schema/task"
	   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	   xmlns:context="http://www.springframework.org/schema/context"
	   xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee"
	   xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jpa="http://www.springframework.org/schema/data/jpa"
	   xmlns:aop="http://www.springframework.org/schema/aop" xmlns:util="http://www.springframework.org/schema/util"
	   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
       xmlns:task="http://www.springframework.org/schema/task"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee"
       xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jpa="http://www.springframework.org/schema/data/jpa"
       xmlns:aop="http://www.springframework.org/schema/aop" xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
		http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd
		http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
@ -15,222 +15,224 @@
		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
		http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
	   default-lazy-init="true">
	<description>Spring公共配置 </description>
	<!-- 使用annotation 自动注册bean, 并保证@Required、@Autowired的属性被注入 -->
	<context:component-scan base-package="com.yihu.wlyy">
		<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
		<context:exclude-filter type="annotation" expression="org.springframework.web.bind.annotation.ControllerAdvice"/>
	</context:component-scan>
	
	<task:annotation-driven />
	<!-- aop:aspectj-autoproxy proxy-target-class="true" / -->
	
	<!-- 此处对于定时时间的配置会被注解中的时间配置覆盖,因此,以注解配置为准 -->  
       default-lazy-init="true">
    <description>Spring公共配置</description>
    <!-- 使用annotation 自动注册bean, 并保证@Required、@Autowired的属性被注入 -->
    <context:component-scan base-package="com.yihu.wlyy">
        <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
    </context:component-scan>
    <task:annotation-driven/>
    <!-- 此处对于定时时间的配置会被注解中的时间配置覆盖,因此,以注解配置为准 -->
    <!-- task:scheduled-tasks scheduler="followUpScheduler">
        <task:scheduled ref="followUpTask" method="push" cron="0 0 6 * * *"/>  
    </task:scheduled-tasks>
    <task:scheduler id="followUpScheduler" pool-size="10"/ -->
	<!-- Jpa Entity Manager 配置 -->
	<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" autowire-candidate="default">
		<property name="dataSource" ref="dataSource"/>
		<property name="jpaVendorAdapter" ref="hibernateJpaVendorAdapter"/>
		<property name="packagesToScan" value="com.yihu.wlyy.entity"/>
		<property name="jpaProperties">
			<props>
				<!-- 命名规则 My_NAME->MyName -->
				<prop key="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy</prop>
				<prop key="hibernate.show_sql">true</prop>
			</props>
		</property>
	</bean>
	<bean id="entityManagerFactoryHealth" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
		<property name="dataSource" ref="dataSourceHealth"/>
		<property name="jpaVendorAdapter" ref="hibernateJpaVendorAdapterHealth"/>
		<property name="packagesToScan" value="com.yihu.wlyy.health.entity"/>
		<property name="jpaProperties">
			<props>
				<!-- 命名规则 My_NAME->MyName -->
				<prop key="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy</prop>
				<prop key="hibernate.show_sql">true</prop>
			</props>
		</property>
	</bean>
	
	<bean id="hibernateJpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
		<property name="databasePlatform">
			<bean factory-method="getDialect" class="org.springside.modules.persistence.Hibernates">
				<constructor-arg ref="dataSource"/>
			</bean>
		</property>
	</bean>
	<bean id="hibernateJpaVendorAdapterHealth" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
		<property name="databasePlatform">
			<bean factory-method="getDialect" class="org.springside.modules.persistence.Hibernates">
				<constructor-arg ref="dataSourceHealth"/>
			</bean>
		</property>
	</bean>
	<!-- Spring Data Jpa配置 -->
 	<jpa:repositories base-package="com.yihu.wlyy.repository"  transaction-manager-ref="transactionManager" entity-manager-factory-ref="entityManagerFactory"/>
	<jpa:repositories base-package="com.yihu.wlyy.health.repository"  transaction-manager-ref="transactionManagerHealth" entity-manager-factory-ref="entityManagerFactoryHealth"/>
	<!-- Jpa 事务配置 -->
	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
		<property name="entityManagerFactory" ref="entityManagerFactory"/>
	</bean>
	<!-- Jpa 事务配置 -->
	<bean id="transactionManagerHealth" class="org.springframework.orm.jpa.JpaTransactionManager">
		<property name="entityManagerFactory" ref="entityManagerFactoryHealth"/>
	</bean>
	<!-- 使用annotation定义事务 -->
	<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" />
	<tx:annotation-driven transaction-manager="transactionManagerHealth" proxy-target-class="true" />
	<!-- JSR303 Validator定义 -->
 	<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" />
 	
 	<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
		<property name="dataSource" ref="dataSource" />
	</bean>
	<bean id="objectMapper" class="com.fasterxml.jackson.databind.ObjectMapper" />
    <!-- Jpa Entity Manager 配置 -->
    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
          autowire-candidate="default">
        <property name="dataSource" ref="dataSource"/>
        <property name="jpaVendorAdapter" ref="hibernateJpaVendorAdapter"/>
        <property name="packagesToScan" value="com.yihu.wlyy.entity"/>
        <property name="jpaProperties">
            <props>
                <!-- 命名规则 My_NAME->MyName -->
                <prop key="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy</prop>
                <prop key="hibernate.show_sql">true</prop>
            </props>
        </property>
    </bean>
    <bean id="entityManagerFactoryHealth" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="dataSourceHealth"/>
        <property name="jpaVendorAdapter" ref="hibernateJpaVendorAdapterHealth"/>
        <property name="packagesToScan" value="com.yihu.wlyy.health.entity"/>
        <property name="jpaProperties">
            <props>
                <!-- 命名规则 My_NAME->MyName -->
                <prop key="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy</prop>
                <prop key="hibernate.show_sql">true</prop>
            </props>
        </property>
    </bean>
    <bean id="hibernateJpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
        <property name="databasePlatform">
            <bean factory-method="getDialect" class="org.springside.modules.persistence.Hibernates">
                <constructor-arg ref="dataSource"/>
            </bean>
        </property>
    </bean>
    <bean id="hibernateJpaVendorAdapterHealth" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
        <property name="databasePlatform">
            <bean factory-method="getDialect" class="org.springside.modules.persistence.Hibernates">
                <constructor-arg ref="dataSourceHealth"/>
            </bean>
        </property>
    </bean>
    <!-- Spring Data Jpa配置 -->
    <jpa:repositories base-package="com.yihu.wlyy.repository" transaction-manager-ref="transactionManager"
                      entity-manager-factory-ref="entityManagerFactory"/>
    <jpa:repositories base-package="com.yihu.wlyy.health.repository" transaction-manager-ref="transactionManagerHealth"
                      entity-manager-factory-ref="entityManagerFactoryHealth"/>
    <!-- Jpa 事务配置 -->
    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory"/>
    </bean>
    <!-- Jpa 事务配置 -->
    <bean id="transactionManagerHealth" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactoryHealth"/>
    </bean>
    <!-- 使用annotation定义事务 -->
    <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
    <tx:annotation-driven transaction-manager="transactionManagerHealth" proxy-target-class="true"/>
    <!-- JSR303 Validator定义 -->
    <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>
    <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
        <property name="dataSource" ref="dataSource"/>
    </bean>
    <bean id="objectMapper" class="com.fasterxml.jackson.databind.ObjectMapper"/>
    <!--quartz任务调度器名称,调度器只能加载与名称相同的任务-->
	<!--<bean id="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" scope="singleton">-->
		<!--<property name="dataSource" ref="dataSource"/>-->
		<!--<property name="configLocation" value="classpath:/quartz.properties" />-->
		<!--<property name="autoStartup" value="true"/>-->
	<!--</bean>-->
	<bean id="poolConfig" class="redis.clients.jedis.JedisPoolConfig">
		<property name="maxIdle" value="${redis.maxIdle}"/>
		<property name="maxTotal" value="${redis.maxActive}"/>
		<property name="maxWaitMillis" value="${redis.maxWait}"/>
		<property name="testOnBorrow" value="${redis.testOnBorrow}"/>
	</bean>
	<bean id="connectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
		<property name="hostName" value="${redis.host}"></property>
		<property name="port" value="${redis.port}"></property>
		<property name="password" value="${redis.password}"></property>
		<property name="database" value="0"></property>
		<property name="poolConfig" ref="poolConfig"></property>
	</bean>
	<bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
		<property name="connectionFactory" ref="connectionFactory"/>
	</bean>
	<util:properties id="sys" location="classpath*:/system.properties"/>
	<beans>
		<context:property-placeholder ignore-unresolvable="true"
									  location="classpath*:/application.properties" />
		<!-- 数据源配置, 使用Tomcat JDBC连接池 -->
		<bean id="dataSourceHealth" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close">
			<!-- Connection Info -->
			<property name="driverClassName" value="${jdbc.driver}" />
			<property name="url" value="${health.jdbc.url}" />
			<property name="username" value="${health.jdbc.username}" />
			<property name="password" value="${health.jdbc.password}" />
			<!-- Connection Pooling Info -->
			<property name="maxActive" value="${jdbc.pool.maxActive}" />
			<property name="maxIdle" value="${jdbc.pool.maxIdle}" />
			<property name="minIdle" value="0" />
			<property name="defaultAutoCommit" value="false" />
		</bean>
	</beans>
	<!-- production环境 -->
 	<beans profile="production">
 		<context:property-placeholder ignore-unresolvable="true"
			location="classpath*:/application.properties" />
		
		<!-- 数据源配置, 使用Tomcat JDBC连接池 -->
		<bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close">
			<!-- Connection Info -->
			<property name="driverClassName" value="${jdbc.driver}" />
			<property name="url" value="${jdbc.url}" />
			<property name="username" value="${jdbc.username}" />
			<property name="password" value="${jdbc.password}" />
		
			<!-- Connection Pooling Info -->
			<property name="maxActive" value="${jdbc.pool.maxActive}" />
			<property name="maxIdle" value="${jdbc.pool.maxIdle}" />
			<property name="minIdle" value="0" />
			<property name="defaultAutoCommit" value="false" />
		</bean>
		<!-- 数据源配置,使用应用服务器的数据库连接池 -->
		<!--<jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/ExampleDB" />-->
	</beans>
	
	<!-- local development环境 -->
	<beans profile="development">
		<context:property-placeholder ignore-resource-not-found="true"
			location="classpath*:/application.properties,
          			  classpath*:/application.development.properties" />
		<!-- Tomcat JDBC连接池 -->
		<bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close">
			<property name="driverClassName" value="${jdbc.driver}" />
			<property name="url" value="${jdbc.url}" />
			<property name="username" value="${jdbc.username}" />
			<property name="password" value="${jdbc.password}" />
			<property name="defaultAutoCommit" value="false" />
		</bean>
	</beans>
	<!-- functional test 环境 -->
	<beans profile="functional">
		<context:property-placeholder ignore-resource-not-found="true"
			location="classpath*:/application.properties,
    <!--<bean id="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" scope="singleton">-->
    <!--<property name="dataSource" ref="dataSource"/>-->
    <!--<property name="configLocation" value="classpath:/quartz.properties" />-->
    <!--<property name="autoStartup" value="true"/>-->
    <!--</bean>-->
    <bean id="poolConfig" class="redis.clients.jedis.JedisPoolConfig">
        <property name="maxIdle" value="${redis.maxIdle}"/>
        <property name="maxTotal" value="${redis.maxActive}"/>
        <property name="maxWaitMillis" value="${redis.maxWait}"/>
        <property name="testOnBorrow" value="${redis.testOnBorrow}"/>
    </bean>
    <bean id="connectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
        <property name="hostName" value="${redis.host}"></property>
        <property name="port" value="${redis.port}"></property>
        <property name="password" value="${redis.password}"></property>
        <property name="database" value="0"></property>
        <property name="poolConfig" ref="poolConfig"></property>
    </bean>
    <bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
        <property name="connectionFactory" ref="connectionFactory"/>
    </bean>
    <util:properties id="sys" location="classpath*:/system.properties"/>
    <beans>
        <context:property-placeholder ignore-unresolvable="true"
                                      location="classpath*:/application.properties"/>
        <!-- 数据源配置, 使用Tomcat JDBC连接池 -->
        <bean id="dataSourceHealth" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close">
            <!-- Connection Info -->
            <property name="driverClassName" value="${jdbc.driver}"/>
            <property name="url" value="${health.jdbc.url}"/>
            <property name="username" value="${health.jdbc.username}"/>
            <property name="password" value="${health.jdbc.password}"/>
            <!-- Connection Pooling Info -->
            <property name="maxActive" value="${jdbc.pool.maxActive}"/>
            <property name="maxIdle" value="${jdbc.pool.maxIdle}"/>
            <property name="minIdle" value="0"/>
            <property name="defaultAutoCommit" value="false"/>
        </bean>
    </beans>
    <!-- production环境 -->
    <beans profile="production">
        <context:property-placeholder ignore-unresolvable="true"
                                      location="classpath*:/application.properties"/>
        <!-- 数据源配置, 使用Tomcat JDBC连接池 -->
        <bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close">
            <!-- Connection Info -->
            <property name="driverClassName" value="${jdbc.driver}"/>
            <property name="url" value="${jdbc.url}"/>
            <property name="username" value="${jdbc.username}"/>
            <property name="password" value="${jdbc.password}"/>
            <!-- Connection Pooling Info -->
            <property name="maxActive" value="${jdbc.pool.maxActive}"/>
            <property name="maxIdle" value="${jdbc.pool.maxIdle}"/>
            <property name="minIdle" value="0"/>
            <property name="defaultAutoCommit" value="false"/>
        </bean>
        <!-- 数据源配置,使用应用服务器的数据库连接池 -->
        <!--<jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/ExampleDB" />-->
    </beans>
    <!-- local development环境 -->
    <beans profile="development">
        <context:property-placeholder ignore-resource-not-found="true"
                                      location="classpath*:/application.properties,
          			  classpath*:/application.development.properties"/>
        <!-- Tomcat JDBC连接池 -->
        <bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close">
            <property name="driverClassName" value="${jdbc.driver}"/>
            <property name="url" value="${jdbc.url}"/>
            <property name="username" value="${jdbc.username}"/>
            <property name="password" value="${jdbc.password}"/>
            <property name="defaultAutoCommit" value="false"/>
        </bean>
    </beans>
    <!-- functional test 环境 -->
    <beans profile="functional">
        <context:property-placeholder ignore-resource-not-found="true"
                                      location="classpath*:/application.properties,
          			  classpath*:/application.functional.properties,
          			  classpath*:/application.functional-local.properties" />
		<!-- Tomcat JDBC连接池 -->
		<bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close">
			<property name="driverClassName" value="${jdbc.driver}" />
			<property name="url" value="${jdbc.url}" />
			<property name="username" value="${jdbc.username}" />
			<property name="password" value="${jdbc.password}" />
			<property name="defaultAutoCommit" value="false" />
		</bean>
		<!-- 初始化数据表结构 -->
		<jdbc:initialize-database data-source="dataSource" ignore-failures="ALL">
			<jdbc:script location="classpath:sql/${db.type}/schema.sql" />
		</jdbc:initialize-database>
	</beans>
	<!-- unit test环境 -->
	<beans profile="test">
	 	<context:property-placeholder ignore-resource-not-found="true"
			location="classpath*:/application.properties,
          			  classpath*:/application.test.properties" />
		<!-- Spring Simple连接池 -->
		<bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
			<property name="driverClass" value="${jdbc.driver}" />
			<property name="url" value="${jdbc.url}" />
			<property name="username" value="${jdbc.username}" />
			<property name="password" value="${jdbc.password}" />
		</bean>
		<!-- 初始化数据表结构 与默认数据-->
		<jdbc:initialize-database data-source="dataSource" ignore-failures="ALL">
			<jdbc:script location="classpath:sql/mysql/schema.sql" />
			<!-- jdbc:script location="classpath:data/h2/import-data.sql" encoding="UTF-8"/ -->
		</jdbc:initialize-database>
	</beans>
          			  classpath*:/application.functional-local.properties"/>
        <!-- Tomcat JDBC连接池 -->
        <bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close">
            <property name="driverClassName" value="${jdbc.driver}"/>
            <property name="url" value="${jdbc.url}"/>
            <property name="username" value="${jdbc.username}"/>
            <property name="password" value="${jdbc.password}"/>
            <property name="defaultAutoCommit" value="false"/>
        </bean>
        <!-- 初始化数据表结构 -->
        <jdbc:initialize-database data-source="dataSource" ignore-failures="ALL">
            <jdbc:script location="classpath:sql/${db.type}/schema.sql"/>
        </jdbc:initialize-database>
    </beans>
    <!-- unit test环境 -->
    <beans profile="test">
        <context:property-placeholder ignore-resource-not-found="true"
                                      location="classpath*:/application.properties,
          			  classpath*:/application.test.properties"/>
        <!-- Spring Simple连接池 -->
        <bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
            <property name="driverClass" value="${jdbc.driver}"/>
            <property name="url" value="${jdbc.url}"/>
            <property name="username" value="${jdbc.username}"/>
            <property name="password" value="${jdbc.password}"/>
        </bean>
        <!-- 初始化数据表结构 与默认数据-->
        <jdbc:initialize-database data-source="dataSource" ignore-failures="ALL">
            <jdbc:script location="classpath:sql/mysql/schema.sql"/>
            <!-- jdbc:script location="classpath:data/h2/import-data.sql" encoding="UTF-8"/ -->
        </jdbc:initialize-database>
    </beans>
</beans>

+ 13 - 12
patient-co-wlyy/src/main/webapp/WEB-INF/spring-mvc.xml

@ -1,20 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:task="http://www.springframework.org/schema/task"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
        http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd">
	   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	   xmlns:task="http://www.springframework.org/schema/task"
	   xmlns:context="http://www.springframework.org/schema/context"
	   xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop"
	   xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
		 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
		 http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
        http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
	<!-- 自动扫描且只扫描@Controller -->
	<context:component-scan base-package="com.yihu.wlyy" use-default-filters="false">
	<context:component-scan base-package="com.yihu.wlyy" >
		<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
		<context:include-filter type="annotation" expression="org.springframework.web.bind.annotation.ControllerAdvice"/>
	</context:component-scan>
	<aop:aspectj-autoproxy proxy-target-class="true" expose-proxy="true"> </aop:aspectj-autoproxy>
	<task:annotation-driven />
    <mvc:resources mapping="swagger-ui.html" location="classpath:/META-INF/resources/"/>
@ -75,7 +76,7 @@
			<value>4096</value>
		</property>
	</bean>
	
	<mvc:interceptors>
		<mvc:interceptor>
	        <mvc:mapping path="/patient/**"/>
@ -90,5 +91,5 @@
	        <bean class="com.yihu.wlyy.interceptors.UserInterceptor"/>
	    </mvc:interceptor>
	</mvc:interceptors>
    
</beans>