Quellcode durchsuchen

Merge branch 'dev' of chenyongxing/jw2.0 into dev

chenweida vor 8 Jahren
Ursprung
Commit
92f5228b33
57 geänderte Dateien mit 2671 neuen und 429 gelöschten Zeilen
  1. 9 9
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wlyy/WlyyContants.java
  2. 35 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wlyy/patient/WlyyPatientContants.java
  3. 3 3
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wx/MWxWechat.java
  4. 5 4
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wx/WxContants.java
  5. 7 5
      common/common-swagger/src/main/java/com/yihu/jw/config/SwaggerConfig.java
  6. 5 0
      svr-lib-parent-pom/pom.xml
  7. 4 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/SaasService.java
  8. 0 10
      svr/svr-base/src/main/java/com/yihu/jw/user/service/PatientService.java
  9. 6 0
      svr/svr-base/src/main/java/com/yihu/jw/wx/service/WechatService.java
  10. 4 0
      svr/svr-wlyy/pom.xml
  11. 221 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/util/AddressUtils.java
  12. 47 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/util/CusAccessObjectUtil.java
  13. 0 55
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/service/WlyyAgreementKpiLogService.java
  14. 0 116
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/service/WlyyAgreementKpiService.java
  15. 0 95
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/service/WlyyAgreementService.java
  16. 17 17
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/controller/WlyyAgreementController.java
  17. 17 17
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/controller/WlyyAgreementKpiController.java
  18. 13 13
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/controller/WlyyAgreementKpiLogController.java
  19. 15 15
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/controller/WlyySignFamilyController.java
  20. 159 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/controller/patient/AdvertisementControlelr.java
  21. 17 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/BaseSaasDao.java
  22. 2 2
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/dao/WlyyAgreementDao.java
  23. 2 2
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/dao/WlyyAgreementKpiDao.java
  24. 2 2
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/dao/WlyyAgreementKpiLogDao.java
  25. 7 2
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/dao/WlyySignFamilyDao.java
  26. 15 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/doctor/DoctorDao.java
  27. 15 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/doctor/HospitalDao.java
  28. 28 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/patient/AdvertisementDao.java
  29. 19 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/patient/BasePatientDao.java
  30. 124 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/BaseSaas.java
  31. 1 1
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/common/entity/base/IdEntity.java
  32. 6 6
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/entity/WlyyAgreement.java
  33. 13 2
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/entity/WlyyAgreementKpi.java
  34. 12 2
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/entity/WlyyAgreementKpiLog.java
  35. 15 5
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/entity/WlyySignFamily.java
  36. 98 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/doctor/BaseOrgHospital.java
  37. 248 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/doctor/Doctors.java
  38. 306 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/patient/BasePatient.java
  39. 173 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/patient/WlyyAdvertisement.java
  40. 24 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/BaseSaasService.java
  41. 66 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyyAgreementKpiLogService.java
  42. 135 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyyAgreementKpiService.java
  43. 114 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyyAgreementService.java
  44. 39 17
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/service/WlyySignFamilyService.java
  45. 23 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/doctor/DoctorService.java
  46. 22 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/doctor/HospitalService.java
  47. 226 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/patient/AdvertisementService.java
  48. 22 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/patient/PatientService.java
  49. 19 0
      web-gateway/src/main/java/com/yihu/jw/commnon/wlyy/PatientContants.java
  50. 119 0
      web-gateway/src/main/java/com/yihu/jw/controller/wlyy/patient/AdvertisementControlelr.java
  51. 63 0
      web-gateway/src/main/java/com/yihu/jw/fegin/fallbackfactory/wlyy/patient/AdvertisementFeginFallbackFactory.java
  52. 8 8
      web-gateway/src/main/java/com/yihu/jw/fegin/wlyy/agreement/WlyyAgreementFegin.java
  53. 8 8
      web-gateway/src/main/java/com/yihu/jw/fegin/wlyy/agreement/WlyyAgreementKpiFegin.java
  54. 6 6
      web-gateway/src/main/java/com/yihu/jw/fegin/wlyy/agreement/WlyyAgreementKpiLogFegin.java
  55. 7 7
      web-gateway/src/main/java/com/yihu/jw/fegin/wlyy/agreement/WlyySignFamilyFegin.java
  56. 53 0
      web-gateway/src/main/java/com/yihu/jw/fegin/wlyy/patient/AdvertisementFegin.java
  57. 47 0
      web-gateway/src/main/java/com/yihu/jw/util/CusAccessObjectUtil.java

+ 9 - 9
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wlyy/WlyyContants.java

@ -1,9 +1,9 @@
package com.yihu.jw.restmodel.wlyy;
package com.yihu.jw.restmodel.wlyy.agreement;
/**
 * Created by Administrator on 2017/5/20 0020.
 */
public class WlyyContants {
public class WlyyAgreementContants {
    //协议模块常量
    public static class Agreement{
        public static final String api_common="agreement";
@ -14,6 +14,12 @@ public class WlyyContants {
        public static final String api_queryPage="queryPage";
        public static final String api_getList="getList";
        public static final String message_success_update="agreement update success";
        public static final String message_success_delete="agreement delete success";
        public static final String message_success_find="agreement find success";
        public static final String message_success_create="agreement create success";
        public static final String message_success_find_functions="agreement find success";
        public static final String message_fail_code_is_null="code is null";
        public static final String message_fail_name_is_null="name is null";
        public static final String message_fail_price_is_null="price is null";
@ -22,13 +28,7 @@ public class WlyyContants {
        public static final String message_fail_status_is_null="status is null";
        public static final String message_fail_id_is_null="id is null";
        public static final String message_fail_code_exist="code exist";
        public static final String message_success_update="agreement update success";
        public static final String message_success_delete="agreement delete success";
        public static final String message_success_find="agreement find success";
        public static final String message_success_create="agreement create success";
        public static final String message_success_find_functions="agreement find success";
        public static final String message_fail_saasId_is_null="saasId is null";
    }
    //协议模块常量

+ 35 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wlyy/patient/WlyyPatientContants.java

@ -0,0 +1,35 @@
package com.yihu.jw.restmodel.wlyy.patient;
/**
 * Created by Administrator on 2017/6/6 0006.
 */
public class WlyyPatientContants {
    public static class Advertisement{
        public static final String api_common="advertisement";
        public static final String api_create="create";
        public static final String api_delete="delete";
        public static final String api_getByCode="getByCode";
        public static final String api_update="update";
        public static final String api_queryPage="queryPage";
        public static final String api_getList="getList";
        public static final String api_getListByPatientCode="getListByPatientCode";
        public static final String api_getListByHttp="getListByHttp";
        public static final String api_getListByIp="getListByIp";
        public static final String message_success_update="advertisement update success";
        public static final String message_success_delete="advertisement delete success";
        public static final String message_success_find="advertisement find success";
        public static final String message_success_create="advertisement create success";
        public static final String message_success_find_functions="advertisement find success";
        public static final String message_fail_code_is_null="code is null";
        public static final String message_fail_name_is_null="name is null";
        public static final String message_fail_code_no_exist="code no exist";
        public static final String message_fail_status_is_null="status is null";
        public static final String message_fail_id_is_null="id is null";
        public static final String message_fail_code_exist="code exist";
        public static final String message_fail_saasid_is_null="saasid is null";
        public static final String message_fail_picture_is_null="picture is null";
        public static final String message_fail_wlyyAdvertisement_is_not_exist="WlyyAdvertisement is not exist";
    }
}

+ 3 - 3
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wx/MWxWechat.java

@ -14,7 +14,7 @@ public class MWxWechat {
    private String token;//token
    private String encodingAesKey;//加密密钥
    private Integer encType;//加密方式  0:明文模式   1:兼容模式   2:安全模式
    private String status;//'类型 -1 已删除 0待审核 1审核通过 2 审核不通过'
    private Integer status;//'类型 -1 已删除 0待审核 1审核通过 2 审核不通过'
    private String type;//'1:服务号 2 订阅号
    private String appId;//'微信app_id'
    private String appSecret;//'微信app_secret'
@ -83,11 +83,11 @@ public class MWxWechat {
        this.encType = encType;
    }
    public String getStatus() {
    public Integer getStatus() {
        return status;
    }
    public void setStatus(String status) {
    public void setStatus(Integer status) {
        this.status = status;
    }

+ 5 - 4
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wx/WxContants.java

@ -94,15 +94,16 @@ public class WxContants {
        public static final String message_success_delete="wechat delete success";
        public static final String message_fail_code_is_null="code is null";
        public static final String message_fail_code_no_exist="code no exist";
        public static final String message_fail_code_no_exist="code not exist";
        public static final String message_fail_appSecret_is_null="appSecret is null";
        public static final String message_fail_appId_exist="wechat appId exist";
        public static final String message_fail_status_is_null="status is null";
        public static final String message_fail_type_is_null="type is null";
        public static final String message_fail_appId_is_null="appId is null";
        public static final String message_fail_name_is_null="name is null";
        public static final String message_fail_wxWechat_is_no_exist="wxWechat is no exist";//微信配置不存在
        public static final String message_fail_wxWechat_is_no_exist="wxWechat is not exist";//微信配置不存在
        public static final String message_fail_id_is_null="id is null";
        public static final String message_fail_saasId_is_null="saasId is null";
    }
    //微信图文消息
    public static class WxGraphicMessage {
@ -122,10 +123,10 @@ public class WxContants {
        public static final String message_success_find_functions="wxGraphicMessage find success";
        public static final String message_success_delete="wxGraphicMessage delete success";
        public static final String message_fail_code_is_null="code is null";
        public static final String message_fail_code_no_exist="code no exist";
        public static final String message_fail_code_no_exist="code not exist";
        public static final String message_fail_code_exist="code exist";
        public static final String message_fail_status_is_null="status is null";
        public static final String message_fail_title_is_null="title is null";
        public static final String message_fail_wxGraphicMessage_is_no_exist="wxGraphicMessage is no exist";
        public static final String message_fail_wxGraphicMessage_is_no_exist="wxGraphicMessage is not exist";
    }
}

+ 7 - 5
common/common-swagger/src/main/java/com/yihu/jw/config/SwaggerConfig.java

@ -1,7 +1,8 @@
package com.yihu.jw.config;
import com.yihu.jw.restmodel.base.BaseContants;
import com.yihu.jw.restmodel.wlyy.WlyyContants;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
import com.yihu.jw.restmodel.wlyy.patient.WlyyPatientContants;
import com.yihu.jw.restmodel.wx.WxContants;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@ -66,10 +67,11 @@ public class SwaggerConfig {
                .pathMapping("/")
                .select()
                .paths(or(
                        regex("/" + WlyyContants.Agreement.api_common + "/.*")
                        ,regex("/"+WlyyContants.AgreementKpi.api_common+"/.*")
                        ,regex("/"+WlyyContants.AgreementKpiLog.api_common+"/.*")
                        ,regex("/"+WlyyContants.SignFamily.api_common+"/.*")
                        regex("/" + WlyyAgreementContants.Agreement.api_common + "/.*")
                        , regex("/" + WlyyAgreementContants.AgreementKpi.api_common + "/.*")
                        , regex("/" + WlyyAgreementContants.AgreementKpiLog.api_common + "/.*")
                        , regex("/" + WlyyAgreementContants.SignFamily.api_common + "/.*")
                        , regex("/" + WlyyPatientContants.Advertisement.api_common + "/.*")
                ))
                .build()
                .apiInfo(wlyyApiInfo());

+ 5 - 0
svr-lib-parent-pom/pom.xml

@ -95,6 +95,11 @@
                <artifactId>common-rest-model</artifactId>
                <version>${version.myCommon}</version>
            </dependency>
            <dependency>
                <groupId>com.yihu.jw</groupId>
                <artifactId>svr-base</artifactId>
                <version>${version.myCommon}</version>
            </dependency>
            <dependency>
                <groupId>com.yihu.jw</groupId>
                <artifactId>common-util</artifactId>

+ 4 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/SaasService.java

@ -68,4 +68,8 @@ public class SaasService extends BaseJpaService<Saas, SaasDao> {
        }
        saas.setStatus(-1);
    }
    public Saas findByName(String cityName) {
        return saasDao.findByName(cityName);
    }
}

+ 0 - 10
svr/svr-base/src/main/java/com/yihu/jw/user/service/PatientService.java

@ -1,10 +0,0 @@
package com.yihu.jw.user.service;
import org.springframework.stereotype.Service;
/**
 * Created by chenweida on 2017/5/11.
 */
@Service
public class PatientService {
}

+ 6 - 0
svr/svr-base/src/main/java/com/yihu/jw/wx/service/WechatService.java

@ -27,6 +27,9 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
        if (StringUtils.isEmpty(wechat.getCode())) {
            throw new ApiException(WxContants.Wechat.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wechat.getSaasId())) {
            throw new ApiException(WxContants.Wechat.message_fail_saasId_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wechat.getStatus())) {
            throw new ApiException(WxContants.Wechat.message_fail_status_is_null, CommonContants.common_error_params_code);
        }
@ -59,6 +62,9 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
        if (StringUtils.isEmpty(wechat.getCode())) {
            throw new ApiException(WxContants.Wechat.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wechat.getSaasId())) {
            throw new ApiException(WxContants.Wechat.message_fail_saasId_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wechat.getStatus())) {
            throw new ApiException(WxContants.Wechat.message_fail_status_is_null, CommonContants.common_error_params_code);
        }

+ 4 - 0
svr/svr-wlyy/pom.xml

@ -15,6 +15,10 @@
    <version>1.0.0</version>
    <dependencies>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>svr-base</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-swagger</artifactId>

+ 221 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/util/AddressUtils.java

@ -0,0 +1,221 @@
package com.yihu.jw.util;
import org.apache.commons.lang.StringUtils;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
/**
 * Created by Administrator on 2017/6/6 0006.
 */
public class AddressUtils {
    public String getAddresses(String ip)
            throws UnsupportedEncodingException {
        return getAddresses(ip,"utf-8");
    }
    /**
     * 返回"0" 为无效ip,局域网测试
     * "中国-西南-四川省-成都市- -电信"  (没有值,中间用空格隔开  country-area-region-city-county-isp)
     * @param content
     * @param encodingString
     * @return
     * @throws UnsupportedEncodingException
     */
    public String getAddresses(String content, String encodingString)
            throws UnsupportedEncodingException {
        // 这里调用pconline的接口
        String urlStr = "http://ip.taobao.com/service/getIpInfo.php";
        // 从http://whois.pconline.com.cn取得IP所在的省市区信息
        content = "ip="+content;
        String returnStr = this.getResult(urlStr, content, encodingString);
        if (returnStr != null) {
            // 处理返回的省市区信息
            System.out.println(returnStr);
            String[] temp = returnStr.split(",");
            if (temp.length < 3) {
                return "0";//无效IP,局域网测试
            }
            String region = (temp[5].split(":"))[1].replaceAll("\"", "");
            region = decodeUnicode(region);// 省份
            String country = "";
            String area = "";
            // String region = "";
            String city = "";
            String county = "";
            String isp = "";
            for (int i = 0; i < temp.length; i++) {
                switch (i) {
                    case 1:
                        country = (temp[i].split(":"))[2].replaceAll("\"", "");
                        country = decodeUnicode(country);// 国家
                        break;
                    case 3:
                        area = (temp[i].split(":"))[1].replaceAll("\"", "");
                        area = decodeUnicode(area);// 地区
                        break;
                    case 5:
                        region = (temp[i].split(":"))[1].replaceAll("\"", "");
                        region = decodeUnicode(region);// 省份
                        break;
                    case 7:
                        city = (temp[i].split(":"))[1].replaceAll("\"", "");
                        city = decodeUnicode(city);// 市区
                        break;
                    case 9:
                        county = (temp[i].split(":"))[1].replaceAll("\"", "");
                        county = decodeUnicode(county);// 地区
                        break;
                    case 11:
                        isp = (temp[i].split(":"))[1].replaceAll("\"", "");
                        isp = decodeUnicode(isp); // ISP公司
                        break;
                }
            }
            String district = country + "-" + area + "-" + region + "-" + city + "-" + county + "-" + isp;
            return district;
        }
        return null;
    }
    /**
     * @param urlStr   请求的地址
     * @param content  请求的参数 格式为:name=xxx&pwd=xxx
     * @param encoding 服务器端请求编码。如GBK,UTF-8等
     * @return
     */
    private String getResult(String urlStr, String content, String encoding) {
        URL url = null;
        HttpURLConnection connection = null;
        try {
            url = new URL(urlStr);
            connection = (HttpURLConnection) url.openConnection();// 新建连接实例
            connection.setConnectTimeout(2000);// 设置连接超时时间,单位毫秒
            connection.setReadTimeout(2000);// 设置读取数据超时时间,单位毫秒
            connection.setDoOutput(true);// 是否打开输出流 true|false
            connection.setDoInput(true);// 是否打开输入流true|false
            connection.setRequestMethod("POST");// 提交方法POST|GET
            connection.setUseCaches(false);// 是否缓存true|false
            connection.connect();// 打开连接端口
            DataOutputStream out = new DataOutputStream(connection
                    .getOutputStream());// 打开输出流往对端服务器写数据
            out.writeBytes(content);// 写数据,也就是提交你的表单 name=xxx&pwd=xxx
            out.flush();// 刷新
            out.close();// 关闭输出流
            BufferedReader reader = new BufferedReader(new InputStreamReader(
                    connection.getInputStream(), encoding));// 往对端写完数据对端服务器返回数据
            // ,以BufferedReader流来读取
            StringBuffer buffer = new StringBuffer();
            String line = "";
            while ((line = reader.readLine()) != null) {
                buffer.append(line);
            }
            reader.close();
            return buffer.toString();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (connection != null) {
                connection.disconnect();// 关闭连接
            }
        }
        return null;
    }
    /**
     * unicode 转换成 中文
     *
     * @param theString
     * @return
     * @author fanhui 2007-3-15
     */
    public static String decodeUnicode(String theString) {
        char aChar;
        int len = theString.length();
        StringBuffer outBuffer = new StringBuffer(len);
        for (int x = 0; x < len; ) {
            aChar = theString.charAt(x++);
            if (aChar == '\\') {
                aChar = theString.charAt(x++);
                if (aChar == 'u') {
                    int value = 0;
                    for (int i = 0; i < 4; i++) {
                        aChar = theString.charAt(x++);
                        switch (aChar) {
                            case '0':
                            case '1':
                            case '2':
                            case '3':
                            case '4':
                            case '5':
                            case '6':
                            case '7':
                            case '8':
                            case '9':
                                value = (value << 4) + aChar - '0';
                                break;
                            case 'a':
                            case 'b':
                            case 'c':
                            case 'd':
                            case 'e':
                            case 'f':
                                value = (value << 4) + 10 + aChar - 'a';
                                break;
                            case 'A':
                            case 'B':
                            case 'C':
                            case 'D':
                            case 'E':
                            case 'F':
                                value = (value << 4) + 10 + aChar - 'A';
                                break;
                            default:
                                throw new IllegalArgumentException(
                                        "Malformed      encoding.");
                        }
                    }
                    outBuffer.append((char) value);
                } else {
                    if (aChar == 't') {
                        aChar = '\t';
                    } else if (aChar == 'r') {
                        aChar = '\r';
                    } else if (aChar == 'n') {
                        aChar = '\n';
                    } else if (aChar == 'f') {
                        aChar = '\f';
                    }
                    outBuffer.append(aChar);
                }
            } else {
                outBuffer.append(aChar);
            }
        }
        String string = outBuffer.toString();
        if(StringUtils.isBlank(string)){
            string=" ";
        }
        return string;
    }
    // 测试
    public static void main(String[] args) {
        AddressUtils addressUtils = new AddressUtils();
        // 测试ip 219.136.134.157 中国-华南-广东省-广州市-越秀区-电信
        String ip = "219.136.134.157";
        String address = "";
        try {
            address = addressUtils.getAddresses(ip);
        } catch (UnsupportedEncodingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        System.out.println(address);
        // 输出结果为:广东省,广州市,越秀区
    }
}

+ 47 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/util/CusAccessObjectUtil.java

@ -0,0 +1,47 @@
package com.yihu.jw.util;
import javax.servlet.http.HttpServletRequest;
/**
 * 自定义访问对象工具类
 *
 * 获取对象的IP地址等信息
 * @author X-rapido
 *
 */
public class CusAccessObjectUtil {
    /**
     * 获取用户真实IP地址,不使用request.getRemoteAddr();的原因是有可能用户使用了代理软件方式避免真实IP地址,
     *
     * 可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串IP值,究竟哪个才是真正的用户端的真实IP呢?
     * 答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。
     *
     * 如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130,
     * 192.168.1.100
     *
     * 用户真实IP为: 192.168.1.110
     *
     * @param request
     * @return
     */
    public static String getIpAddress(HttpServletRequest request) {
        String ip = request.getHeader("x-forwarded-for");
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("WL-Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_CLIENT_IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_X_FORWARDED_FOR");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getRemoteAddr();
        }
        return ip;
    }
}

+ 0 - 55
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/service/WlyyAgreementKpiLogService.java

@ -1,55 +0,0 @@
package com.yihu.jw.wlyy.agreement.service;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wlyy.WlyyContants;
import com.yihu.jw.wlyy.agreement.dao.WlyyAgreementKpiLogDao;
import com.yihu.jw.wlyy.agreement.entity.WlyyAgreementKpiLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.persistence.Transient;
import java.util.Date;
/**
 * Created by Administrator on 2017/6/1 0001.
 */
@Service
public class WlyyAgreementKpiLogService extends BaseJpaService<WlyyAgreementKpiLog, WlyyAgreementKpiLogDao> {
    @Autowired
    private WlyyAgreementKpiLogDao wlyyAgreementKpiLogDao;
    @Transient
    public WlyyAgreementKpiLog create(WlyyAgreementKpiLog wlyyAgreementKpiLog) {
        if (StringUtils.isEmpty(wlyyAgreementKpiLog.getPatientCode())) {
            throw new ApiException(WlyyContants.AgreementKpi.message_fail_patientCode_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpiLog.getSignCode())) {
            throw new ApiException(WlyyContants.AgreementKpi.message_fail_signCode_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpiLog.getKpiCode())) {
            throw new ApiException(WlyyContants.AgreementKpi.message_fail_kpiCode_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpiLog.getAgreementCode())) {
            throw new ApiException(WlyyContants.AgreementKpi.message_fail_agreementCode_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpiLog.getKpiName())) {
            throw new ApiException(WlyyContants.AgreementKpi.message_fail_kpiName_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpiLog.getCode())) {
            throw new ApiException(WlyyContants.AgreementKpi.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        //设置创建时间
        Date date = new Date();
        wlyyAgreementKpiLog.setCreateTime(date);
        return wlyyAgreementKpiLogDao.save(wlyyAgreementKpiLog);
    }
    public WlyyAgreementKpiLog findByCode(String code) {
        return wlyyAgreementKpiLogDao.findByCode(code);
    }
}

+ 0 - 116
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/service/WlyyAgreementKpiService.java

@ -1,116 +0,0 @@
package com.yihu.jw.wlyy.agreement.service;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wlyy.WlyyContants;
import com.yihu.jw.wlyy.agreement.dao.WlyyAgreementKpiDao;
import com.yihu.jw.wlyy.agreement.entity.WlyyAgreement;
import com.yihu.jw.wlyy.agreement.entity.WlyyAgreementKpi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.persistence.Transient;
import java.util.Date;
/**
 * Created by Administrator on 2017/6/1 0001.
 */
@Service
public class WlyyAgreementKpiService extends BaseJpaService<WlyyAgreementKpi, WlyyAgreementKpiDao> {
    @Autowired
    private WlyyAgreementKpiDao wlyyAgreementKpiDao;
    @Autowired
    private WlyyAgreementService wlyyAgreementService;
    @Transient
    public WlyyAgreementKpi create(WlyyAgreementKpi wlyyAgreementKpi) {
        if (StringUtils.isEmpty(wlyyAgreementKpi.getCode())) {
            throw new ApiException(WlyyContants.AgreementKpi.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        //判断agreement是否存在
        String agreementCode = wlyyAgreementKpi.getAgreementCode();
        if (StringUtils.isEmpty(agreementCode)) {
            throw new ApiException(WlyyContants.AgreementKpi.message_fail_agreementCode_is_null, CommonContants.common_error_params_code);
        }
        WlyyAgreement agreement = wlyyAgreementService.findByCode(agreementCode);
        if(agreement == null){
            throw new ApiException(WlyyContants.AgreementKpi.message_fail_agreement_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpi.getKpiName())) {
            throw new ApiException(WlyyContants.AgreementKpi.message_fail_kpiName_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpi.getType())){
            throw new ApiException(WlyyContants.AgreementKpi.message_fail_type_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpi.getStatus())) {
            throw new ApiException(WlyyContants.AgreementKpi.message_fail_status_is_null, CommonContants.common_error_params_code);
        }
        //设置创建时间和修改时间
        Date date = new Date();
        wlyyAgreementKpi.setCreateTime(date);
        wlyyAgreementKpi.setUpdaateTime(date);
        return wlyyAgreementKpiDao.save(wlyyAgreementKpi);
    }
    @Transient
    public WlyyAgreementKpi update(WlyyAgreementKpi wlyyAgreementKpi) {
        String code = wlyyAgreementKpi.getCode();
        if (StringUtils.isEmpty(code)) {
            throw new ApiException(WlyyContants.AgreementKpi.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        //判断agreement是否存在
        String agreementCode = wlyyAgreementKpi.getAgreementCode();
        if (StringUtils.isEmpty(agreementCode)) {
            throw new ApiException(WlyyContants.AgreementKpi.message_fail_agreementCode_is_null, CommonContants.common_error_params_code);
        }
        WlyyAgreement agreement = wlyyAgreementService.findByCode(agreementCode);
        if(agreement == null){
            throw new ApiException(WlyyContants.AgreementKpi.message_fail_agreement_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpi.getKpiName())) {
            throw new ApiException(WlyyContants.AgreementKpi.message_fail_kpiName_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpi.getType())){
            throw new ApiException(WlyyContants.AgreementKpi.message_fail_type_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpi.getStatus())) {
            throw new ApiException(WlyyContants.AgreementKpi.message_fail_status_is_null, CommonContants.common_error_params_code);
        }
        Long id = wlyyAgreementKpi.getId();
        if (StringUtils.isEmpty(id)) {
            throw new ApiException(WlyyContants.Agreement.message_fail_id_is_null, CommonContants.common_error_params_code);
        }
        WlyyAgreementKpi wlyyAgreementKpi1 = wlyyAgreementKpiDao.findById(id);
        if(wlyyAgreementKpi1==null){
            throw new ApiException(WlyyContants.Agreement.message_fail_wlyyAgreement_is_no_exist, CommonContants.common_error_params_code);
        }
        //设置创建时间和修改时间
        Date date = new Date();
        wlyyAgreementKpi.setCreateTime(wlyyAgreementKpi1.getCreateTime());
        wlyyAgreementKpi.setUpdaateTime(date);
        wlyyAgreementKpi1 = wlyyAgreementKpiDao.findCodeExcludeId(code,id);
        if(wlyyAgreementKpi1 !=null){
            throw new ApiException(WlyyContants.Agreement.message_fail_code_exist, CommonContants.common_error_params_code);
        }
        return wlyyAgreementKpiDao.save(wlyyAgreementKpi);
    }
    public WlyyAgreementKpi findByCode(String code) {
        return wlyyAgreementKpiDao.findByCode(code);
    }
    @Transient
    public void delete(String code) {
        WlyyAgreementKpi wlyyAgreementKpi = findByCode(code);
        if(wlyyAgreementKpi==null){
            throw new ApiException(WlyyContants.AgreementKpi.message_fail_wlyyAgreementKpi_is_no_exist, CommonContants.common_error_params_code);
        }
        wlyyAgreementKpi.setStatus(-1);
        wlyyAgreementKpiDao.save(wlyyAgreementKpi);
    }
}

+ 0 - 95
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/service/WlyyAgreementService.java

@ -1,95 +0,0 @@
package com.yihu.jw.wlyy.agreement.service;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wlyy.WlyyContants;
import com.yihu.jw.wlyy.agreement.dao.WlyyAgreementDao;
import com.yihu.jw.wlyy.agreement.entity.WlyyAgreement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.persistence.Transient;
import java.util.Date;
/**
 * Created by Administrator on 2017/6/1 0001.
 */
@Service
public class WlyyAgreementService extends BaseJpaService<WlyyAgreement, WlyyAgreementDao> {
    @Autowired
    private WlyyAgreementDao wlyyAgreementDao;
    @Transient
    public WlyyAgreement create(WlyyAgreement wlyyAgreement) {
        if (StringUtils.isEmpty(wlyyAgreement.getCode())) {
            throw new ApiException(WlyyContants.Agreement.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreement.getName())) {
            throw new ApiException(WlyyContants.Agreement.message_fail_name_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreement.getPrice())) {
            throw new ApiException(WlyyContants.Agreement.message_fail_price_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreement.getStatus())) {
            throw new ApiException(WlyyContants.Agreement.message_fail_status_is_null, CommonContants.common_error_params_code);
        }
        //设置创建时间和修改时间
        Date date = new Date();
        wlyyAgreement.setCreateTime(date);
        wlyyAgreement.setUpdateTime(date);
        return wlyyAgreementDao.save(wlyyAgreement);
    }
    @Transient
    public WlyyAgreement update(WlyyAgreement wlyyAgreement) {
        String code = wlyyAgreement.getCode();
        if (StringUtils.isEmpty(code)) {
            throw new ApiException(WlyyContants.Agreement.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreement.getName())) {
            throw new ApiException(WlyyContants.Agreement.message_fail_name_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreement.getPrice())) {
            throw new ApiException(WlyyContants.Agreement.message_fail_price_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreement.getStatus())) {
            throw new ApiException(WlyyContants.Agreement.message_fail_status_is_null, CommonContants.common_error_params_code);
        }
        Long id = wlyyAgreement.getId();
        if (StringUtils.isEmpty(id)) {
            throw new ApiException(WlyyContants.Agreement.message_fail_id_is_null, CommonContants.common_error_params_code);
        }
        WlyyAgreement wlyyAgreement1 = wlyyAgreementDao.findById(id);
        if(wlyyAgreement1==null){
            throw new ApiException(WlyyContants.Agreement.message_fail_wlyyAgreement_is_no_exist, CommonContants.common_error_params_code);
        }
        //设置创建时间和修改时间
        Date date = new Date();
        wlyyAgreement.setCreateTime(wlyyAgreement1.getCreateTime());
        wlyyAgreement.setUpdateTime(date);
        wlyyAgreement1 = wlyyAgreementDao.findCodeExcludeId(code,id);
        if(wlyyAgreement1 !=null){
            throw new ApiException(WlyyContants.Agreement.message_fail_code_exist, CommonContants.common_error_params_code);
        }
        return wlyyAgreementDao.save(wlyyAgreement);
    }
    public WlyyAgreement findByCode(String code) {
        WlyyAgreement wlyyAgreement = wlyyAgreementDao.findByCode(code);
        return wlyyAgreement;
    }
    @Transient
    public void delete(String code) {
        WlyyAgreement wlyyAgreement = findByCode(code);
        if(wlyyAgreement==null){
            throw new ApiException(WlyyContants.Agreement.message_fail_wlyyAgreement_is_no_exist, CommonContants.common_error_params_code);
        }
        wlyyAgreement.setStatus("-1");
        wlyyAgreementDao.save(wlyyAgreement);
    }
}

+ 17 - 17
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/controller/WlyyAgreementController.java

@ -1,11 +1,11 @@
package com.yihu.jw.wlyy.agreement.controller;
package com.yihu.jw.wlyy.controller.agreement;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wlyy.WlyyContants;
import com.yihu.jw.wlyy.agreement.entity.WlyyAgreement;
import com.yihu.jw.wlyy.agreement.service.WlyyAgreementService;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
import com.yihu.jw.wlyy.entity.agreement.WlyyAgreement;
import com.yihu.jw.wlyy.service.agreement.WlyyAgreementService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -19,67 +19,67 @@ import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping(WlyyContants.Agreement.api_common)
@RequestMapping(WlyyAgreementContants.Agreement.api_common)
@Api(value = "协议相关操作", description = "协议相关操作")
public class WlyyAgreementController extends EnvelopRestController {
    @Autowired
    private WlyyAgreementService wlyyAgreementService;
    @PostMapping(value = WlyyContants.Agreement.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = WlyyAgreementContants.Agreement.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建协议", notes = "创建协议")
    public Envelop create(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        try {
            WlyyAgreement wlyyAgreement = toEntity(jsonData, WlyyAgreement.class);
            return Envelop.getSuccess(WlyyContants.Agreement.message_success_create, wlyyAgreementService.create(wlyyAgreement));
            return Envelop.getSuccess(WlyyAgreementContants.Agreement.message_success_create, wlyyAgreementService.create(wlyyAgreement));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @PutMapping(value = WlyyContants.Agreement.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PutMapping(value = WlyyAgreementContants.Agreement.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "修改协议", notes = "修改协议")
    public Envelop update(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        try {
            WlyyAgreement wlyyAgreement = toEntity(jsonData, WlyyAgreement.class);
            return Envelop.getSuccess(WlyyContants.Agreement.message_success_update, wlyyAgreementService.update(wlyyAgreement));
            return Envelop.getSuccess(WlyyAgreementContants.Agreement.message_success_update, wlyyAgreementService.update(wlyyAgreement));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @DeleteMapping(value =WlyyContants.Agreement.api_delete)
    @DeleteMapping(value = WlyyAgreementContants.Agreement.api_delete)
    @ApiOperation(value = "删除协议", notes = "删除协议")
    public Envelop delete(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code) {
        try {
            wlyyAgreementService.delete(code);
            return Envelop.getSuccess(WlyyContants.Agreement.message_success_delete );
            return Envelop.getSuccess(WlyyAgreementContants.Agreement.message_success_delete );
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @GetMapping(value =WlyyContants.Agreement.api_getByCode)
    @GetMapping(value = WlyyAgreementContants.Agreement.api_getByCode)
    @ApiOperation(value = "根据code查找协议", notes = "根据code查找协议")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
    ) {
        try {
            return Envelop.getSuccess(WlyyContants.Agreement.message_success_find, wlyyAgreementService.findByCode(code));
            return Envelop.getSuccess(WlyyAgreementContants.Agreement.message_success_find, wlyyAgreementService.findByCode(code));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @RequestMapping(value =WlyyContants.Agreement.api_queryPage, method = RequestMethod.GET)
    @RequestMapping(value = WlyyAgreementContants.Agreement.api_queryPage, method = RequestMethod.GET)
    @ApiOperation(value = "分页获取协议")
    public Envelop queryPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,parentCode,saasId,name,price,posterPic,remark,type,status")
@ -103,11 +103,11 @@ public class WlyyAgreementController extends EnvelopRestController {
        //封装返回格式
        List<WlyyAgreement> wlyyAgreement = convertToModels(list, new ArrayList<>(list.size()), WlyyAgreement.class, fields);
        return Envelop.getSuccessListWithPage(WlyyContants.Agreement.message_success_find_functions,wlyyAgreement, page, size,count);
        return Envelop.getSuccessListWithPage(WlyyAgreementContants.Agreement.message_success_find_functions,wlyyAgreement, page, size,count);
    }
    @GetMapping(value =WlyyContants.Agreement.api_getList)
    @GetMapping(value = WlyyAgreementContants.Agreement.api_getList)
    @ApiOperation(value = "获取协议列表(不分页)")
    public Envelop getList(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,parentCode,saasId,name,price,posterPic,remark,type,status")
@ -120,7 +120,7 @@ public class WlyyAgreementController extends EnvelopRestController {
        List<WlyyAgreement> list = wlyyAgreementService.search(fields,filters,sorts);
        //封装返回格式
        List<WlyyAgreement> wlyyAgreement = convertToModels(list, new ArrayList<>(list.size()), WlyyAgreement.class, fields);
        return Envelop.getSuccessList(WlyyContants.Agreement.message_success_find_functions,wlyyAgreement);
        return Envelop.getSuccessList(WlyyAgreementContants.Agreement.message_success_find_functions,wlyyAgreement);
    }
}

+ 17 - 17
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/controller/WlyyAgreementKpiController.java

@ -1,11 +1,11 @@
package com.yihu.jw.wlyy.agreement.controller;
package com.yihu.jw.wlyy.controller.agreement;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wlyy.WlyyContants;
import com.yihu.jw.wlyy.agreement.entity.WlyyAgreementKpi;
import com.yihu.jw.wlyy.agreement.service.WlyyAgreementKpiService;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
import com.yihu.jw.wlyy.entity.agreement.WlyyAgreementKpi;
import com.yihu.jw.wlyy.service.agreement.WlyyAgreementKpiService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -19,67 +19,67 @@ import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping(WlyyContants.AgreementKpi.api_common)
@RequestMapping(WlyyAgreementContants.AgreementKpi.api_common)
@Api(value = "套餐指标相关操作", description = "套餐指标相关操作")
public class WlyyAgreementKpiController extends EnvelopRestController {
    @Autowired
    private WlyyAgreementKpiService wlyyAgreementKpiService;
    @PostMapping(value = WlyyContants.AgreementKpi.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = WlyyAgreementContants.AgreementKpi.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建套餐指标", notes = "创建套餐指标")
    public Envelop create(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        try {
            WlyyAgreementKpi wlyyAgreementKpi = toEntity(jsonData, WlyyAgreementKpi.class);
            return Envelop.getSuccess(WlyyContants.AgreementKpi.message_success_create, wlyyAgreementKpiService.create(wlyyAgreementKpi));
            return Envelop.getSuccess(WlyyAgreementContants.AgreementKpi.message_success_create, wlyyAgreementKpiService.create(wlyyAgreementKpi));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @PutMapping(value = WlyyContants.AgreementKpi.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PutMapping(value = WlyyAgreementContants.AgreementKpi.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "修改套餐指标", notes = "修改套餐指标")
    public Envelop update(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        try {
            WlyyAgreementKpi wlyyAgreementKpi = toEntity(jsonData, WlyyAgreementKpi.class);
            return Envelop.getSuccess(WlyyContants.AgreementKpi.message_success_update, wlyyAgreementKpiService.update(wlyyAgreementKpi));
            return Envelop.getSuccess(WlyyAgreementContants.AgreementKpi.message_success_update, wlyyAgreementKpiService.update(wlyyAgreementKpi));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @DeleteMapping(value =WlyyContants.AgreementKpi.api_delete)
    @DeleteMapping(value = WlyyAgreementContants.AgreementKpi.api_delete)
    @ApiOperation(value = "删除套餐指标", notes = "删除套餐指标")
    public Envelop delete(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code) {
        try {
            wlyyAgreementKpiService.delete(code);
            return Envelop.getSuccess(WlyyContants.AgreementKpi.message_success_delete );
            return Envelop.getSuccess(WlyyAgreementContants.AgreementKpi.message_success_delete );
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @GetMapping(value =WlyyContants.AgreementKpi.api_getByCode)
    @GetMapping(value = WlyyAgreementContants.AgreementKpi.api_getByCode)
    @ApiOperation(value = "根据code查找套餐指标", notes = "根据code查找套餐指标")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
    ) {
        try {
            return Envelop.getSuccess(WlyyContants.AgreementKpi.message_success_find, wlyyAgreementKpiService.findByCode(code));
            return Envelop.getSuccess(WlyyAgreementContants.AgreementKpi.message_success_find, wlyyAgreementKpiService.findByCode(code));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @RequestMapping(value =WlyyContants.AgreementKpi.api_queryPage, method = RequestMethod.GET)
    @RequestMapping(value = WlyyAgreementContants.AgreementKpi.api_queryPage, method = RequestMethod.GET)
    @ApiOperation(value = "分页获取套餐指标")
    public Envelop queryPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,agreementCode,kpiName,type,kpiTimes,status,del,kpiContent,keyword")
@ -103,11 +103,11 @@ public class WlyyAgreementKpiController extends EnvelopRestController {
        //封装返回格式
        List<WlyyAgreementKpi> wlyyAgreementKpi = convertToModels(list, new ArrayList<>(list.size()), WlyyAgreementKpi.class, fields);
        return Envelop.getSuccessListWithPage(WlyyContants.AgreementKpi.message_success_find_functions,wlyyAgreementKpi, page, size,count);
        return Envelop.getSuccessListWithPage(WlyyAgreementContants.AgreementKpi.message_success_find_functions,wlyyAgreementKpi, page, size,count);
    }
    @GetMapping(value =WlyyContants.AgreementKpi.api_getList)
    @GetMapping(value = WlyyAgreementContants.AgreementKpi.api_getList)
    @ApiOperation(value = "获取套餐指标列表(不分页)")
    public Envelop getList(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,agreementCode,kpiName,type,kpiTimes,status,del,kpiContent,keyword")
@ -120,7 +120,7 @@ public class WlyyAgreementKpiController extends EnvelopRestController {
        List<WlyyAgreementKpi> list = wlyyAgreementKpiService.search(fields,filters,sorts);
        //封装返回格式
        List<WlyyAgreementKpi> wlyyAgreementKpi = convertToModels(list, new ArrayList<>(list.size()), WlyyAgreementKpi.class, fields);
        return Envelop.getSuccessList(WlyyContants.AgreementKpi.message_success_find_functions,wlyyAgreementKpi);
        return Envelop.getSuccessList(WlyyAgreementContants.AgreementKpi.message_success_find_functions,wlyyAgreementKpi);
    }
}

+ 13 - 13
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/controller/WlyyAgreementKpiLogController.java

@ -1,11 +1,11 @@
package com.yihu.jw.wlyy.agreement.controller;
package com.yihu.jw.wlyy.controller.agreement;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wlyy.WlyyContants;
import com.yihu.jw.wlyy.agreement.entity.WlyyAgreementKpiLog;
import com.yihu.jw.wlyy.agreement.service.WlyyAgreementKpiLogService;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
import com.yihu.jw.wlyy.entity.agreement.WlyyAgreementKpiLog;
import com.yihu.jw.wlyy.service.agreement.WlyyAgreementKpiLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -19,40 +19,40 @@ import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping(WlyyContants.AgreementKpiLog.api_common)
@RequestMapping(WlyyAgreementContants.AgreementKpiLog.api_common)
@Api(value = "套餐指标执行日志相关操作", description = "套餐指标执行日志相关操作")
public class WlyyAgreementKpiLogController extends EnvelopRestController {
    @Autowired
    private WlyyAgreementKpiLogService wlyyAgreementKpiLogService;
    @PostMapping(value = WlyyContants.AgreementKpiLog.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = WlyyAgreementContants.AgreementKpiLog.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建套餐指标日志", notes = "创建套餐指标日志")
    public Envelop create(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        try {
            WlyyAgreementKpiLog wlyyAgreementKpiLog = toEntity(jsonData, WlyyAgreementKpiLog.class);
            return Envelop.getSuccess(WlyyContants.AgreementKpiLog.message_success_create, wlyyAgreementKpiLogService.create(wlyyAgreementKpiLog));
            return Envelop.getSuccess(WlyyAgreementContants.AgreementKpiLog.message_success_create, wlyyAgreementKpiLogService.create(wlyyAgreementKpiLog));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @GetMapping(value =WlyyContants.AgreementKpiLog.api_getByCode)
    @GetMapping(value = WlyyAgreementContants.AgreementKpiLog.api_getByCode)
    @ApiOperation(value = "根据code查找套餐指标日志", notes = "根据code查找套餐指标日志")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
    ) {
        try {
            return Envelop.getSuccess(WlyyContants.AgreementKpiLog.message_success_find, wlyyAgreementKpiLogService.findByCode(code));
            return Envelop.getSuccess(WlyyAgreementContants.AgreementKpiLog.message_success_find, wlyyAgreementKpiLogService.findByCode(code));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @RequestMapping(value =WlyyContants.AgreementKpiLog.api_queryPage, method = RequestMethod.GET)
    @RequestMapping(value = WlyyAgreementContants.AgreementKpiLog.api_queryPage, method = RequestMethod.GET)
    @ApiOperation(value = "分页获取套餐指标日志")
    public Envelop queryPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,patientCode,signCode,kpiCode,agreementCode,kpiName")
@ -76,11 +76,11 @@ public class WlyyAgreementKpiLogController extends EnvelopRestController {
        //封装返回格式
        List<WlyyAgreementKpiLog> wlyyAgreementKpiLog = convertToModels(list, new ArrayList<>(list.size()), WlyyAgreementKpiLog.class, fields);
        return Envelop.getSuccessListWithPage(WlyyContants.AgreementKpiLog.message_success_find_functions,wlyyAgreementKpiLog, page, size,count);
        return Envelop.getSuccessListWithPage(WlyyAgreementContants.AgreementKpiLog.message_success_find_functions,wlyyAgreementKpiLog, page, size,count);
    }
    @GetMapping(value =WlyyContants.AgreementKpiLog.api_getList)
    @GetMapping(value = WlyyAgreementContants.AgreementKpiLog.api_getList)
    @ApiOperation(value = "获取套餐指标日志列表(不分页)")
    public Envelop getList(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,patientCode,signCode,kpiCode,agreementCode,kpiName")
@ -93,7 +93,7 @@ public class WlyyAgreementKpiLogController extends EnvelopRestController {
        List<WlyyAgreementKpiLog> list = wlyyAgreementKpiLogService.search(fields,filters,sorts);
        //封装返回格式
        List<WlyyAgreementKpiLog> wlyyAgreementKpiLog = convertToModels(list, new ArrayList<>(list.size()), WlyyAgreementKpiLog.class, fields);
        return Envelop.getSuccessList(WlyyContants.AgreementKpiLog.message_success_find_functions,wlyyAgreementKpiLog);
        return Envelop.getSuccessList(WlyyAgreementContants.AgreementKpiLog.message_success_find_functions,wlyyAgreementKpiLog);
    }
}

+ 15 - 15
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/controller/WlyySignFamilyController.java

@ -1,11 +1,11 @@
package com.yihu.jw.wlyy.agreement.controller;
package com.yihu.jw.wlyy.controller.agreement;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wlyy.WlyyContants;
import com.yihu.jw.wlyy.agreement.entity.WlyySignFamily;
import com.yihu.jw.wlyy.agreement.service.WlyySignFamilyService;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
import com.yihu.jw.wlyy.entity.agreement.WlyySignFamily;
import com.yihu.jw.wlyy.service.agreement.WlyySignFamilyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -20,53 +20,53 @@ import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping(WlyyContants.SignFamily.api_common)
@RequestMapping(WlyyAgreementContants.SignFamily.api_common)
@Api(value = "签约相关操作", description = "签约相关操作")
public class WlyySignFamilyController extends EnvelopRestController {
    @Autowired
    private WlyySignFamilyService wlyySignFamilyService;
    @PostMapping(value = WlyyContants.SignFamily.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = WlyyAgreementContants.SignFamily.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建签约", notes = "创建签约")
    public Envelop create(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) throws ParseException {
        try {
            WlyySignFamily wlyySignFamily = toEntity(jsonData, WlyySignFamily.class);
            return Envelop.getSuccess(WlyyContants.SignFamily.message_success_create, wlyySignFamilyService.create(wlyySignFamily));
            return Envelop.getSuccess(WlyyAgreementContants.SignFamily.message_success_create, wlyySignFamilyService.create(wlyySignFamily));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @PutMapping(value = WlyyContants.SignFamily.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PutMapping(value = WlyyAgreementContants.SignFamily.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "修改签约", notes = "修改签约")
    public Envelop update(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) throws ParseException {
        try {
            WlyySignFamily wlyySignFamily = toEntity(jsonData, WlyySignFamily.class);
            return Envelop.getSuccess(WlyyContants.SignFamily.message_success_update, wlyySignFamilyService.update(wlyySignFamily));
            return Envelop.getSuccess(WlyyAgreementContants.SignFamily.message_success_update, wlyySignFamilyService.update(wlyySignFamily));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @GetMapping(value =WlyyContants.SignFamily.api_getByCode)
    @GetMapping(value = WlyyAgreementContants.SignFamily.api_getByCode)
    @ApiOperation(value = "根据code查找协议", notes = "根据code查找协议")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
    ) {
        try {
            return Envelop.getSuccess(WlyyContants.SignFamily.message_success_find, wlyySignFamilyService.findByCode(code));
            return Envelop.getSuccess(WlyyAgreementContants.SignFamily.message_success_find, wlyySignFamilyService.findByCode(code));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @RequestMapping(value =WlyyContants.SignFamily.api_queryPage, method = RequestMethod.GET)
    @RequestMapping(value = WlyyAgreementContants.SignFamily.api_queryPage, method = RequestMethod.GET)
    @ApiOperation(value = "分页获取协议")
    public Envelop queryPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
@ -90,11 +90,11 @@ public class WlyySignFamilyController extends EnvelopRestController {
        //封装返回格式
        List<WlyySignFamily> wlyySignFamily = convertToModels(list, new ArrayList<>(list.size()), WlyySignFamily.class, fields);
        return Envelop.getSuccessListWithPage(WlyyContants.SignFamily.message_success_find_functions,wlyySignFamily, page, size,count);
        return Envelop.getSuccessListWithPage(WlyyAgreementContants.SignFamily.message_success_find_functions,wlyySignFamily, page, size,count);
    }
    @GetMapping(value =WlyyContants.SignFamily.api_getList)
    @GetMapping(value = WlyyAgreementContants.SignFamily.api_getList)
    @ApiOperation(value = "获取协议列表(不分页)")
    public Envelop getList(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
@ -107,7 +107,7 @@ public class WlyySignFamilyController extends EnvelopRestController {
        List<WlyySignFamily> list = wlyySignFamilyService.search(fields,filters,sorts);
        //封装返回格式
        List<WlyySignFamily> wlyySignFamily = convertToModels(list, new ArrayList<>(list.size()), WlyySignFamily.class, fields);
        return Envelop.getSuccessList(WlyyContants.SignFamily.message_success_find_functions,wlyySignFamily);
        return Envelop.getSuccessList(WlyyAgreementContants.SignFamily.message_success_find_functions,wlyySignFamily);
    }
}

+ 159 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/controller/patient/AdvertisementControlelr.java

@ -0,0 +1,159 @@
package com.yihu.jw.wlyy.controller.patient;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wlyy.patient.WlyyPatientContants;
import com.yihu.jw.wlyy.entity.patient.WlyyAdvertisement;
import com.yihu.jw.wlyy.service.patient.AdvertisementService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by Administrator on 2017/6/6 0006.
 */
@RestController
@RequestMapping(WlyyPatientContants.Advertisement.api_common)
@Api(value = "广告相关操作", description = "广告相关操作")
public class AdvertisementControlelr extends EnvelopRestController {
    @Autowired
    private AdvertisementService advertisementService;
    @PostMapping(value = WlyyPatientContants.Advertisement.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建广告", notes = "创建广告")
    public Envelop create(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        try {
            WlyyAdvertisement advertisement = toEntity(jsonData, WlyyAdvertisement.class);
            return Envelop.getSuccess(WlyyPatientContants.Advertisement.message_success_create, advertisementService.create(advertisement));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @PutMapping(value = WlyyPatientContants.Advertisement.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "修改广告", notes = "修改广告")
    public Envelop update(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        try {
            WlyyAdvertisement advertisement = toEntity(jsonData, WlyyAdvertisement.class);
            return Envelop.getSuccess(WlyyPatientContants.Advertisement.message_success_update, advertisementService.update(advertisement));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @DeleteMapping(value = WlyyPatientContants.Advertisement.api_delete)
    @ApiOperation(value = "删除广告", notes = "删除广告")
    public Envelop delete(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code) {
        try {
            advertisementService.delete(code);
            return Envelop.getSuccess(WlyyPatientContants.Advertisement.message_success_delete );
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @GetMapping(value = WlyyPatientContants.Advertisement.api_getByCode)
    @ApiOperation(value = "根据code查找广告", notes = "根据code查找广告")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
    ) {
        try {
            return Envelop.getSuccess(WlyyPatientContants.Advertisement.message_success_find, advertisementService.findByCode(code));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @RequestMapping(value = WlyyPatientContants.Advertisement.api_queryPage, method = RequestMethod.GET)
    @ApiOperation(value = "分页获取广告")
    public Envelop queryPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,parentCode,saasId,name,price,posterPic,remark,type,status")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
            @RequestParam(value = "size", required = false) int size,
            @ApiParam(name = "page", value = "页码", defaultValue = "1")
            @RequestParam(value = "page", required = false) int page,
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        //得到list数据
        List<WlyyAdvertisement> list = advertisementService.search(fields, filters, sorts, page, size);
        //获取总数
        long count=advertisementService.getCount(filters);
        //封装头信息
        pagedResponse(request, response, count, page, size);
        //封装返回格式
        List<WlyyAdvertisement> advertisement = convertToModels(list, new ArrayList<>(list.size()), WlyyAdvertisement.class, fields);
        return Envelop.getSuccessListWithPage(WlyyPatientContants.Advertisement.message_success_find_functions, advertisement, page, size, count);
    }
    @GetMapping(value = WlyyPatientContants.Advertisement.api_getList)
    @ApiOperation(value = "获取广告列表(不分页)")
    public Envelop getList(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,parentCode,saasId,name,price,posterPic,remark,type,status")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        //得到list数据
        List<WlyyAdvertisement> list = advertisementService.search(fields,filters,sorts);
        //封装返回格式
        List<WlyyAdvertisement> advertisement = convertToModels(list, new ArrayList<>(list.size()), WlyyAdvertisement.class, fields);
        return Envelop.getSuccessList(WlyyPatientContants.Advertisement.message_success_find_functions,advertisement);
    }
    @GetMapping(value = WlyyPatientContants.Advertisement.api_getListByPatientCode)
    @ApiOperation(value = "根据患者code获取广告")
    public Envelop getListByPatientCode(
            @ApiParam(name="patientCode")
            @RequestParam(value="patientCode") String patientCode,
            HttpServletRequest request
            ){
        List<WlyyAdvertisement> advertisements = advertisementService.getListByPatientCode(patientCode,request);
        return Envelop.getSuccessList(WlyyPatientContants.Advertisement.message_success_find_functions,advertisements);
    }
    @GetMapping(value= WlyyPatientContants.Advertisement.api_getListByHttp)
    @ApiOperation(value = "根据患者code地区(通过http判断)获取广告")
    public Envelop getListByHttp(HttpServletRequest request){
        List<WlyyAdvertisement> advertisements = advertisementService.getByHttp(request);
        return Envelop.getSuccess(WlyyPatientContants.Advertisement.message_success_find_functions,advertisements);
    }
    /**
     * 供网关调用
     * @param ipAddress
     * @return
     */
    @GetMapping(value= WlyyPatientContants.Advertisement.api_getListByIp)
    @ApiOperation(value = "根据患者ip地址(供网关调用)")
    public Envelop getListByIp(@RequestParam(value="ipAddress") String ipAddress){
        List<WlyyAdvertisement> advertisements = advertisementService.getListByIp(ipAddress);
        return Envelop.getSuccess(WlyyPatientContants.Advertisement.message_success_find_functions,advertisements);
    }
}

+ 17 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/BaseSaasDao.java

@ -0,0 +1,17 @@
package com.yihu.jw.wlyy.dao;
import com.yihu.jw.wlyy.entity.BaseSaas;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by chenweida on 2017/5/19.
 */
public interface BaseSaasDao extends PagingAndSortingRepository<BaseSaas, Long>, JpaSpecificationExecutor<BaseSaas> {
    @Query("from BaseSaas f where f.name=?1 and f.status=1")
    BaseSaas findByName(String name);
    @Query("from BaseSaas f where f.code=?1 and f.status=1")
    BaseSaas findByCode(String code);
}

+ 2 - 2
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/dao/WlyyAgreementDao.java

@ -1,6 +1,6 @@
package com.yihu.jw.wlyy.agreement.dao;
package com.yihu.jw.wlyy.dao.agreement;
import com.yihu.jw.wlyy.agreement.entity.WlyyAgreement;
import com.yihu.jw.wlyy.entity.agreement.WlyyAgreement;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

+ 2 - 2
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/dao/WlyyAgreementKpiDao.java

@ -1,6 +1,6 @@
package com.yihu.jw.wlyy.agreement.dao;
package com.yihu.jw.wlyy.dao.agreement;
import com.yihu.jw.wlyy.agreement.entity.WlyyAgreementKpi;
import com.yihu.jw.wlyy.entity.agreement.WlyyAgreementKpi;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

+ 2 - 2
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/dao/WlyyAgreementKpiLogDao.java

@ -1,6 +1,6 @@
package com.yihu.jw.wlyy.agreement.dao;
package com.yihu.jw.wlyy.dao.agreement;
import com.yihu.jw.wlyy.agreement.entity.WlyyAgreementKpiLog;
import com.yihu.jw.wlyy.entity.agreement.WlyyAgreementKpiLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

+ 7 - 2
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/dao/WlyySignFamilyDao.java

@ -1,10 +1,12 @@
package com.yihu.jw.wlyy.agreement.dao;
package com.yihu.jw.wlyy.dao.agreement;
import com.yihu.jw.wlyy.agreement.entity.WlyySignFamily;
import com.yihu.jw.wlyy.entity.agreement.WlyySignFamily;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Administrator on 2017/6/2 0002.
 */
@ -12,4 +14,7 @@ public interface WlyySignFamilyDao  extends PagingAndSortingRepository<WlyySignF
    @Query("from WlyySignFamily w where w.code = ?1")
    WlyySignFamily findByCode(String code);
    @Query("from WlyySignFamily w where w.patient = ?1 and w.status = ?2")
    List<WlyySignFamily> findByPatientCode(String patientCode, Integer status);
}

+ 15 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/doctor/DoctorDao.java

@ -0,0 +1,15 @@
package com.yihu.jw.wlyy.dao.doctor;
import com.yihu.jw.wlyy.entity.doctor.Doctors;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Administrator on 2017/6/7 0007.
 */
public interface DoctorDao extends PagingAndSortingRepository<Doctors, Long>, JpaSpecificationExecutor<Doctors> {
    @Query("from Doctors d where d.code = ?1 and d.status !=-1")
    Doctors findByCode(String code);
}

+ 15 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/doctor/HospitalDao.java

@ -0,0 +1,15 @@
package com.yihu.jw.wlyy.dao.doctor;
import com.yihu.jw.wlyy.entity.doctor.BaseOrgHospital;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Administrator on 2017/6/7 0007.
 */
public interface HospitalDao extends PagingAndSortingRepository<BaseOrgHospital, Long>, JpaSpecificationExecutor<BaseOrgHospital> {
    @Query("from BaseOrgHospital w where w.code = ?1")
    BaseOrgHospital findByCode(String code);
}

+ 28 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/patient/AdvertisementDao.java

@ -0,0 +1,28 @@
package com.yihu.jw.wlyy.dao.patient;
import com.yihu.jw.wlyy.entity.patient.WlyyAdvertisement;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Administrator on 2017/6/6 0006.
 */
public interface AdvertisementDao extends PagingAndSortingRepository<WlyyAdvertisement, Long>, JpaSpecificationExecutor<WlyyAdvertisement> {
    @Query("from WlyyAdvertisement w where w.code =?1 and w.status!=-1")
    WlyyAdvertisement findByCode(String code);
    @Query("from WlyyAdvertisement w where w.id=?1 and w.status !=-1")
    WlyyAdvertisement findById(Long id);
    //根据saasCode查询广告
    @Query("from WlyyAdvertisement w where w.saasId=?1 and w.status !=-1 order by w.sort")
    List<WlyyAdvertisement> getListBySaasCode(String saasCode);
    //查询默认广告
    @Query("from WlyyAdvertisement w where w.saasId ='0' and w.status !=-1 order by w.sort")
    List<WlyyAdvertisement> getDefaultList();
}

+ 19 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/patient/BasePatientDao.java

@ -0,0 +1,19 @@
package com.yihu.jw.wlyy.dao.patient;
import com.yihu.jw.wlyy.entity.patient.BasePatient;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Administrator on 2017/6/6 0006.
 */
public interface BasePatientDao extends PagingAndSortingRepository<BasePatient, Long>, JpaSpecificationExecutor<BasePatient> {
    @Query("from BasePatient w where w.code =?1")
    BasePatient findByCode(String code);
    @Query("from BasePatient w where w.id=?1 ")
    BasePatient findById(Long id);
}

+ 124 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/BaseSaas.java

@ -0,0 +1,124 @@
package com.yihu.jw.wlyy.entity;// default package
import javax.persistence.*;
import java.util.Date;
/**
 * WlyySaas entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "base_saas")
public class BaseSaas extends IdEntity implements java.io.Serializable {
	// Fields
	private String code;//业务code、
	private String name;//名称
	private Integer status;//状态 -1 已删除 0待审核 1审核通过 2 审核不通过
	private String createUser; //创建人code
	private String createUserName;//创建人名称
	private Date createTime;//创建时间
	private String modifyUser;//修改人
	private String modifyUserName;//修改人名称
	private Date modifyTime;//修改时间
	private String remark;//备注
	// Constructors
	/** default constructor */
	public BaseSaas() {
	}
	@Column(name = "name", length = 200)
	public String getName() {
		return this.name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Column(name = "status", precision = 2, scale = 0)
	public Integer getStatus() {
		return this.status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	@Column(name = "create_user", length = 200)
	public String getCreateUser() {
		return this.createUser;
	}
	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}
	@Column(name = "create_user_name", length = 200)
	public String getCreateUserName() {
		return this.createUserName;
	}
	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time", nullable = false, length = 0)
	public Date getCreateTime() {
		return this.createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	@Column(name = "modify_user", length = 200)
	public String getModifyUser() {
		return this.modifyUser;
	}
	public void setModifyUser(String modifyUser) {
		this.modifyUser = modifyUser;
	}
	@Column(name = "modify_user_name", length = 200)
	public String getModifyUserName() {
		return this.modifyUserName;
	}
	public void setModifyUserName(String modifyUserName) {
		this.modifyUserName = modifyUserName;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "modify_time", nullable = false, length = 0)
	public Date getModifyTime() {
		return this.modifyTime;
	}
	public void setModifyTime(Date modifyTime) {
		this.modifyTime = modifyTime;
	}
	@Column(name = "remark", length = 1000)
	public String getRemark() {
		return this.remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	@Column(name = "code", length = 100)
	public String getCode() {
		return this.code;
	}
	public void setCode(String code) {
		this.code = code;
	}
}

+ 1 - 1
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/common/entity/base/IdEntity.java

@ -3,7 +3,7 @@
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.jw.wlyy.common.entity.base;
package com.yihu.jw.wlyy.entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

+ 6 - 6
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/entity/WlyyAgreement.java

@ -1,8 +1,8 @@
package com.yihu.jw.wlyy.agreement.entity;
package com.yihu.jw.wlyy.entity.agreement;
import com.yihu.jw.wlyy.common.entity.base.IdEntity;
import com.yihu.jw.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -30,10 +30,10 @@ public class WlyyAgreement extends IdEntity implements Serializable{
    private String type;//类型
    private Date createTime;
    private Date updateTime;
    private String status;//状态 -1删除 0 冻结 1可用
    private Integer status;//状态 -1删除 0 冻结 1可用
    private String createUser;
    public WlyyAgreement(String code, String parentCode, String saasId, String name, BigDecimal price, String posterPic, String remark, String type, Date createTime, Date updateTime, String status, String createUser) {
    public WlyyAgreement(String code, String parentCode, String saasId, String name, BigDecimal price, String posterPic, String remark, String type, Date createTime, Date updateTime, Integer status, String createUser) {
        this.code = code;
        this.parentCode = parentCode;
        this.saasId = saasId;
@ -143,11 +143,11 @@ public class WlyyAgreement extends IdEntity implements Serializable{
    }
    @Column(name = "status")
    public String getStatus() {
    public Integer getStatus() {
        return status;
    }
    public void setStatus(String status) {
    public void setStatus(Integer status) {
        this.status = status;
    }

+ 13 - 2
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/entity/WlyyAgreementKpi.java

@ -1,8 +1,8 @@
package com.yihu.jw.wlyy.agreement.entity;
package com.yihu.jw.wlyy.entity.agreement;
import com.yihu.jw.wlyy.common.entity.base.IdEntity;
import com.yihu.jw.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -16,6 +16,7 @@ import java.util.Date;
@Table(name = "wlyy_agreement_kpi")
public class WlyyAgreementKpi extends IdEntity {
    private String code;//业务code
    private String saasId;//saasId
    private String agreementCode;//套餐代码
    private String kpiName;//服务项名称
    private String type;//服务项类型
@ -27,6 +28,16 @@ public class WlyyAgreementKpi extends IdEntity {
    private String createUser;
    private Date updaateTime;
    @Column(name="saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name="agreement_code")
    public String getAgreementCode() {
        return agreementCode;
    }

+ 12 - 2
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/entity/WlyyAgreementKpiLog.java

@ -1,7 +1,7 @@
package com.yihu.jw.wlyy.agreement.entity;
package com.yihu.jw.wlyy.entity.agreement;
import com.yihu.jw.wlyy.common.entity.base.IdEntity;
import com.yihu.jw.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -18,6 +18,7 @@ public class WlyyAgreementKpiLog extends IdEntity {
    private static final long serialVersionUID = -3196907595969778396L;
    private String code;//业务code
    private String saasId;
    private String patientCode;//患者code
    private String signCode;
    private String kpiCode;
@ -36,6 +37,15 @@ public class WlyyAgreementKpiLog extends IdEntity {
        this.code = code;
    }
    @Column(name="saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "patient_code")
    public String getPatientCode() {
        return patientCode;

+ 15 - 5
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/entity/WlyySignFamily.java

@ -1,6 +1,6 @@
package com.yihu.jw.wlyy.agreement.entity;
package com.yihu.jw.wlyy.entity.agreement;
import com.yihu.jw.wlyy.common.entity.base.IdEntity;
import com.yihu.jw.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -17,6 +17,7 @@ public class WlyySignFamily extends IdEntity{
    private static final long serialVersionUID = -6759565631854462880L;
    private String code;//业务code
    private String saasId;
    private int type;//签约类型:1三师签约,2家庭签约
    private String patient;//患者标识
    private String openid;//患者微信公众号openid
@ -33,7 +34,7 @@ public class WlyySignFamily extends IdEntity{
    private Date end;//签约结束日期
    private String images;//签约图片附件URL,多图以逗号分隔
    private String groupCode;//分组标识
    private int status;//签约状态(-1患者已取消,-2已拒绝,-3已解约,-4已到期,0待签约,1已签约,2患者申请取消签约,3医生申请取消签约
    private Integer status;//签约状态(-1患者已取消,-2已拒绝,-3已解约,-4已到期,0待签约,1已签约,2患者申请取消签约,3医生申请取消签约
    private String reason;//解决原因
    private Date czrq;//操作时间
    private String teamCode;//所属团队code 关联wlyy_doctor_team
@ -73,6 +74,15 @@ public class WlyySignFamily extends IdEntity{
        this.code = code;
    }
    @Column(name="saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "type")
    public int getType() {
        return type;
@ -218,11 +228,11 @@ public class WlyySignFamily extends IdEntity{
    }
    @Column(name = "status")
    public int getStatus() {
    public Integer getStatus() {
        return status;
    }
    public void setStatus(int status) {
    public void setStatus(Integer status) {
        this.status = status;
    }

+ 98 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/doctor/BaseOrgHospital.java

@ -0,0 +1,98 @@
package com.yihu.jw.wlyy.entity.doctor;
import com.yihu.jw.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Administrator on 2017/6/7 0007.
 */
@Entity
@Table(name = "base_org_hospital")
public class BaseOrgHospital extends IdEntity {
    private static final long serialVersionUID = 5463913446686402252L;
    private String code;//业务code
    private String orgCode;//
    private String roadCode;
    private String centerSite;
    private String ascriptionType;
    private String levelId;
    private String levelName;
    
    
    @Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    
    @Column(name = "org_code")
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    
    @Column(name = "road_code")
    public String getRoadCode() {
        return roadCode;
    }
    public void setRoadCode(String roadCode) {
        this.roadCode = roadCode;
    }
    
    @Column(name = "center_site")
    public String getCenterSite() {
        return centerSite;
    }
    public void setCenterSite(String centerSite) {
        this.centerSite = centerSite;
    }
    
    @Column(name = "ascription_type")
    public String getAscriptionType() {
        return ascriptionType;
    }
    public void setAscriptionType(String ascriptionType) {
        this.ascriptionType = ascriptionType;
    }
    
    @Column(name = "level_id")
    public String getLevelId() {
        return levelId;
    }
    public void setLevelId(String levelId) {
        this.levelId = levelId;
    }
    
    @Column(name = "level_name")
    public String getLevelName() {
        return levelName;
    }
    public void setLevelName(String levelName) {
        this.levelName = levelName;
    }
}

+ 248 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/doctor/Doctors.java

@ -0,0 +1,248 @@
package com.yihu.jw.wlyy.entity.doctor;
import com.yihu.jw.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import java.util.Date;
/**
 * Created by Administrator on 2017/6/7 0007.
 */
@Entity
public class Doctors extends IdEntity {
    private static final long serialVersionUID = 3138130150854187709L;
    private String userId;//云平台用户ID
    private String code;//业务code
    private String name;//姓名
    private String pyCode;//姓名首字母
    private String sex;//性别(1男,2女)
    private String photo;//医生头像
    private String skill;//医生专长
    private String workPortal;//医生门户首页
    private String email;//邮箱
    private String phone;//联系电话
    private String secondPhone;//备用电话
    private String familyTel;//家庭电话(固)
    private String officeTel;//办公电话(固)
    private String introduction;//简介
    private String jxzc;//教学职称
    private String lczc;//临床职称
    private String xlzc;//学历职称
    private String xzzc;//行政职称
    private Integer status;//状态:-1 删除 0 禁用 1可用
    private Date createTime;//
    private Date updateTime;
    @Column(name = "user_id")
    public String getUserId() {
        return userId;
    }
    public void setUserId(String userId) {
        this.userId = userId;
    }
    @Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    
    @Column(name = "py_code")
    public String getPyCode() {
        return pyCode;
    }
    public void setPyCode(String pyCode) {
        this.pyCode = pyCode;
    }
    
    @Column(name = "sex")
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    
    @Column(name = "photo")
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    
    @Column(name = "skill")
    public String getSkill() {
        return skill;
    }
    public void setSkill(String skill) {
        this.skill = skill;
    }
    
    @Column(name = "work_portal")
    public String getWorkPortal() {
        return workPortal;
    }
    public void setWorkPortal(String workPortal) {
        this.workPortal = workPortal;
    }
    
    @Column(name = "email")
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    
    @Column(name = "phone")
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    
    @Column(name = "second_phone")
    public String getSecondPhone() {
        return secondPhone;
    }
    public void setSecondPhone(String secondPhone) {
        this.secondPhone = secondPhone;
    }
    
    @Column(name = "family_tel")
    public String getFamilyTel() {
        return familyTel;
    }
    public void setFamilyTel(String familyTel) {
        this.familyTel = familyTel;
    }
    
    @Column(name = "office_tel")
    public String getOfficeTel() {
        return officeTel;
    }
    public void setOfficeTel(String officeTel) {
        this.officeTel = officeTel;
    }
    
    @Column(name = "introduction")
    public String getIntroduction() {
        return introduction;
    }
    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }
    
    @Column(name = "jxzc")
    public String getJxzc() {
        return jxzc;
    }
    public void setJxzc(String jxzc) {
        this.jxzc = jxzc;
    }
    
    @Column(name = "lczc")
    public String getLczc() {
        return lczc;
    }
    public void setLczc(String lczc) {
        this.lczc = lczc;
    }
    
    @Column(name = "xlzc")
    public String getXlzc() {
        return xlzc;
    }
    public void setXlzc(String xlzc) {
        this.xlzc = xlzc;
    }
    
    @Column(name = "xzzc")
    public String getXzzc() {
        return xzzc;
    }
    public void setXzzc(String xzzc) {
        this.xzzc = xzzc;
    }
    
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    
    @Column(name = "update_time")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}

+ 306 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/patient/BasePatient.java

@ -0,0 +1,306 @@
package com.yihu.jw.wlyy.entity.patient;
import com.yihu.jw.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.sql.Date;
/**
 * Created by Administrator on 2017/6/6 0006.
 */
@Entity
@Table(name = "base_patient")
public class BasePatient extends IdEntity implements Serializable {
    private static final long serialVersionUID = -5371957917251091855L;
    private String code;//业务code
    private String accountCode;//关联wlyy_login_account账号code
    private String idcard;//身份证
    private String name;//姓名
    private Date birthday;//生日
    private String sex;//性别
    private String mobile;//手机
    private String phone;//联系电话
    private String ssc;//社保卡
    private String photo;//头像http地址
    private String province;//省编码
    private String provinceName;//省名称
    private String city;//市编码
    private String cityName;//市名称
    private String town;//区县编码
    private String townName;//区县名称
    private String street;//街道
    private String streetName;//街道名称
    private String address;//详细地址
    private Integer status;//用户状态:1正常,0禁用,-1恶意注册,2审核中
    private Date updateTime;//更新时间
    private Date createTime;//创建时间
    private String saasId;//saas配置id
    private String email;//邮箱
    private String nation;//籍贯
    private String spell;//名称拼音首字母
    
    @Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    
    @Column(name = "account_code")
    public String getAccountCode() {
        return accountCode;
    }
    public void setAccountCode(String accountCode) {
        this.accountCode = accountCode;
    }
    
    @Column(name = "idcard")
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    
    @Column(name = "birthday")
    public Date getBirthday() {
        return birthday;
    }
    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
    
    @Column(name = "sex")
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    
    @Column(name = "mobile")
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    
    @Column(name = "phone")
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    
    @Column(name = "ssc")
    public String getSsc() {
        return ssc;
    }
    public void setSsc(String ssc) {
        this.ssc = ssc;
    }
    
    @Column(name = "photo")
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    
    @Column(name = "province")
    public String getProvince() {
        return province;
    }
    public void setProvince(String province) {
        this.province = province;
    }
    
    @Column(name = "province_name")
    public String getProvinceName() {
        return provinceName;
    }
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
    
    @Column(name = "city")
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
    
    @Column(name = "city_name")
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    
    @Column(name = "town")
    public String getTown() {
        return town;
    }
    public void setTown(String town) {
        this.town = town;
    }
    
    @Column(name = "town_name")
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
    
    @Column(name = "street")
    public String getStreet() {
        return street;
    }
    public void setStreet(String street) {
        this.street = street;
    }
    
    @Column(name = "street_name")
    public String getStreetName() {
        return streetName;
    }
    public void setStreetName(String streetName) {
        this.streetName = streetName;
    }
    
    @Column(name = "address")
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    
    @Column(name = "update_time")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    
    @Column(name = "email")
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    
    @Column(name = "nation")
    public String getNation() {
        return nation;
    }
    public void setNation(String nation) {
        this.nation = nation;
    }
    
    @Column(name = "spell")
    public String getSpell() {
        return spell;
    }
    public void setSpell(String spell) {
        this.spell = spell;
    }
}

+ 173 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/patient/WlyyAdvertisement.java

@ -0,0 +1,173 @@
package com.yihu.jw.wlyy.entity.patient;
import com.yihu.jw.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * Created by Administrator on 2017/6/6 0006.
 */
@Entity
@Table(name = "wlyy_advertisement")
public class WlyyAdvertisement extends IdEntity implements Serializable {
    private static final long serialVersionUID = 1497635003375865515L;
    private String code;//业务code
    private String saasId;//0,为默认广告
    private String name;//名称
    private String picture;//展示的图片
    private String url;//链接
    private Integer sort;//排序( 数字越小排越前面)
    private Integer status;//状态 -1 删除 0 禁用 1可用
    private String createUser;//创建人
    private String createUserName;////创建人名
    private Date createTime;//创建时间
    private String updateUser;//修改人
    private String updateUserName;//修改人名
    private Date updateTime;//修改时间
    private String remark;//备注
    
    @Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    
    @Column(name = "picture")
    public String getPicture() {
        return picture;
    }
    public void setPicture(String picture) {
        this.picture = picture;
    }
    
    @Column(name = "url")
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    
    @Column(name = "sort")
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    
    @Column(name = "create_user")
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    
    @Column(name = "create_user_name")
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    
    @Column(name = "update_user")
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    
    @Column(name = "update_user_name")
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    
    @Column(name = "update_time")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    
    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 24 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/BaseSaasService.java

@ -0,0 +1,24 @@
package com.yihu.jw.wlyy.service;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.wlyy.dao.BaseSaasDao;
import com.yihu.jw.wlyy.entity.BaseSaas;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * Created by chenweida on 2017/5/19.
 */
@Service
public class BaseSaasService extends BaseJpaService<BaseSaas, BaseSaasDao> {
    @Autowired
    private BaseSaasDao saasDao;
    public BaseSaas findByCode(String code) {
        return saasDao.findByCode(code);
    }
    public BaseSaas findByName(String cityName) {
        return saasDao.findByName(cityName);
    }
}

+ 66 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyyAgreementKpiLogService.java

@ -0,0 +1,66 @@
package com.yihu.jw.wlyy.service.agreement;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
import com.yihu.jw.wlyy.dao.agreement.WlyyAgreementKpiLogDao;
import com.yihu.jw.wlyy.entity.agreement.WlyyAgreementKpiLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.persistence.Transient;
import java.util.Date;
/**
 * Created by Administrator on 2017/6/1 0001.
 */
@Service
public class WlyyAgreementKpiLogService extends BaseJpaService<WlyyAgreementKpiLog, WlyyAgreementKpiLogDao> {
    @Autowired
    private WlyyAgreementKpiLogDao wlyyAgreementKpiLogDao;
    //@Autowired
    //private SaasService saasService;
    @Transient
    public WlyyAgreementKpiLog create(WlyyAgreementKpiLog wlyyAgreementKpiLog) {
        String saasId = wlyyAgreementKpiLog.getSaasId();
        if (StringUtils.isEmpty(saasId)) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_saasId_is_null, CommonContants.common_error_params_code);
        }
        //Saas saas = saasService.findByCode(saasId);
        //if(saas==null){
        //    throw new ApiException(BaseContants.Saas.message_fail_code_no_exist, CommonContants.common_error_params_code);
        //}
        if (StringUtils.isEmpty(wlyyAgreementKpiLog.getPatientCode())) {
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_patientCode_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpiLog.getSignCode())) {
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_signCode_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpiLog.getKpiCode())) {
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_kpiCode_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpiLog.getAgreementCode())) {
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_agreementCode_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpiLog.getKpiName())) {
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_kpiName_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpiLog.getCode())) {
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        //设置创建时间
        Date date = new Date();
        wlyyAgreementKpiLog.setCreateTime(date);
        return wlyyAgreementKpiLogDao.save(wlyyAgreementKpiLog);
    }
    public WlyyAgreementKpiLog findByCode(String code) {
        return wlyyAgreementKpiLogDao.findByCode(code);
    }
}

+ 135 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyyAgreementKpiService.java

@ -0,0 +1,135 @@
package com.yihu.jw.wlyy.service.agreement;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
import com.yihu.jw.wlyy.dao.agreement.WlyyAgreementKpiDao;
import com.yihu.jw.wlyy.entity.agreement.WlyyAgreement;
import com.yihu.jw.wlyy.entity.agreement.WlyyAgreementKpi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.persistence.Transient;
import java.util.Date;
/**
 * Created by Administrator on 2017/6/1 0001.
 */
@Service
public class WlyyAgreementKpiService extends BaseJpaService<WlyyAgreementKpi, WlyyAgreementKpiDao> {
    @Autowired
    private WlyyAgreementKpiDao wlyyAgreementKpiDao;
    @Autowired
    private WlyyAgreementService wlyyAgreementService;
    //@Autowired
    //private SaasService saasService;
    @Transient
    public WlyyAgreementKpi create(WlyyAgreementKpi wlyyAgreementKpi) {
        if (StringUtils.isEmpty(wlyyAgreementKpi.getCode())) {
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        String saasId = wlyyAgreementKpi.getSaasId();
        if (StringUtils.isEmpty(saasId)) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_saasId_is_null, CommonContants.common_error_params_code);
        }
        //Saas saas = saasService.findByCode(saasId);
        //if(saas==null){
        //    throw new ApiException(BaseContants.Saas.message_fail_code_no_exist, CommonContants.common_error_params_code);
        //}
        //判断agreement是否存在
        String agreementCode = wlyyAgreementKpi.getAgreementCode();
        if (StringUtils.isEmpty(agreementCode)) {
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_agreementCode_is_null, CommonContants.common_error_params_code);
        }
        WlyyAgreement agreement = wlyyAgreementService.findByCode(agreementCode);
        if(agreement == null){
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_agreement_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpi.getKpiName())) {
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_kpiName_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpi.getType())){
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_type_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpi.getStatus())) {
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_status_is_null, CommonContants.common_error_params_code);
        }
        //设置创建时间和修改时间
        Date date = new Date();
        wlyyAgreementKpi.setCreateTime(date);
        wlyyAgreementKpi.setUpdaateTime(date);
        return wlyyAgreementKpiDao.save(wlyyAgreementKpi);
    }
    @Transient
    public WlyyAgreementKpi update(WlyyAgreementKpi wlyyAgreementKpi) {
        String code = wlyyAgreementKpi.getCode();
        if (StringUtils.isEmpty(code)) {
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        String saasId = wlyyAgreementKpi.getSaasId();
        if (StringUtils.isEmpty(saasId)) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_saasId_is_null, CommonContants.common_error_params_code);
        }
        //Saas saas = saasService.findByCode(saasId);
        //if(saas==null){
        //    throw new ApiException(BaseContants.Saas.message_fail_code_no_exist, CommonContants.common_error_params_code);
        //}
        //判断agreement是否存在
        String agreementCode = wlyyAgreementKpi.getAgreementCode();
        if (StringUtils.isEmpty(agreementCode)) {
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_agreementCode_is_null, CommonContants.common_error_params_code);
        }
        WlyyAgreement agreement = wlyyAgreementService.findByCode(agreementCode);
        if(agreement == null){
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_agreement_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpi.getKpiName())) {
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_kpiName_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpi.getType())){
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_type_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpi.getStatus())) {
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_status_is_null, CommonContants.common_error_params_code);
        }
        Long id = wlyyAgreementKpi.getId();
        if (StringUtils.isEmpty(id)) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_id_is_null, CommonContants.common_error_params_code);
        }
        WlyyAgreementKpi wlyyAgreementKpi1 = wlyyAgreementKpiDao.findById(id);
        if(wlyyAgreementKpi1==null){
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_wlyyAgreement_is_no_exist, CommonContants.common_error_params_code);
        }
        //设置创建时间和修改时间
        Date date = new Date();
        wlyyAgreementKpi.setCreateTime(wlyyAgreementKpi1.getCreateTime());
        wlyyAgreementKpi.setUpdaateTime(date);
        wlyyAgreementKpi1 = wlyyAgreementKpiDao.findCodeExcludeId(code,id);
        if(wlyyAgreementKpi1 !=null){
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_code_exist, CommonContants.common_error_params_code);
        }
        return wlyyAgreementKpiDao.save(wlyyAgreementKpi);
    }
    public WlyyAgreementKpi findByCode(String code) {
        return wlyyAgreementKpiDao.findByCode(code);
    }
    @Transient
    public void delete(String code) {
        WlyyAgreementKpi wlyyAgreementKpi = findByCode(code);
        if(wlyyAgreementKpi==null){
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_wlyyAgreementKpi_is_no_exist, CommonContants.common_error_params_code);
        }
        wlyyAgreementKpi.setStatus(-1);
        wlyyAgreementKpiDao.save(wlyyAgreementKpi);
    }
}

+ 114 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyyAgreementService.java

@ -0,0 +1,114 @@
package com.yihu.jw.wlyy.service.agreement;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
import com.yihu.jw.wlyy.dao.agreement.WlyyAgreementDao;
import com.yihu.jw.wlyy.entity.agreement.WlyyAgreement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.persistence.Transient;
import java.util.Date;
/**
 * Created by Administrator on 2017/6/1 0001.
 */
@Service
public class WlyyAgreementService extends BaseJpaService<WlyyAgreement, WlyyAgreementDao> {
    @Autowired
    private WlyyAgreementDao wlyyAgreementDao;
    //@Autowired
    //private SaasService saasService;
    @Transient
    public WlyyAgreement create(WlyyAgreement wlyyAgreement) {
        if (StringUtils.isEmpty(wlyyAgreement.getCode())) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        String saasId = wlyyAgreement.getSaasId();
        if (StringUtils.isEmpty(saasId)) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_saasId_is_null, CommonContants.common_error_params_code);
        }
        //Saas saas = saasService.findByCode(saasId);
        //if(saas==null){
        //    throw new ApiException(BaseContants.Saas.message_fail_code_no_exist, CommonContants.common_error_params_code);
        //}
        if (StringUtils.isEmpty(wlyyAgreement.getName())) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_name_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreement.getPrice())) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_price_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreement.getStatus())) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_status_is_null, CommonContants.common_error_params_code);
        }
        //设置创建时间和修改时间
        Date date = new Date();
        wlyyAgreement.setCreateTime(date);
        wlyyAgreement.setUpdateTime(date);
        return wlyyAgreementDao.save(wlyyAgreement);
    }
    @Transient
    public WlyyAgreement update(WlyyAgreement wlyyAgreement) {
        String code = wlyyAgreement.getCode();
        if (StringUtils.isEmpty(code)) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        String saasId = wlyyAgreement.getSaasId();
        if (StringUtils.isEmpty(saasId)) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_saasId_is_null, CommonContants.common_error_params_code);
        }
        //Saas saas = saasService.findByCode(saasId);
        //if(saas==null){
        //    throw new ApiException(BaseContants.Saas.message_fail_code_no_exist, CommonContants.common_error_params_code);
        //}
        if (StringUtils.isEmpty(wlyyAgreement.getName())) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_name_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreement.getPrice())) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_price_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreement.getStatus())) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_status_is_null, CommonContants.common_error_params_code);
        }
        Long id = wlyyAgreement.getId();
        if (StringUtils.isEmpty(id)) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_id_is_null, CommonContants.common_error_params_code);
        }
        WlyyAgreement wlyyAgreement1 = wlyyAgreementDao.findById(id);
        if(wlyyAgreement1==null){
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_wlyyAgreement_is_no_exist, CommonContants.common_error_params_code);
        }
        //设置创建时间和修改时间
        Date date = new Date();
        wlyyAgreement.setCreateTime(wlyyAgreement1.getCreateTime());
        wlyyAgreement.setUpdateTime(date);
        wlyyAgreement1 = wlyyAgreementDao.findCodeExcludeId(code,id);
        if(wlyyAgreement1 !=null){
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_code_exist, CommonContants.common_error_params_code);
        }
        return wlyyAgreementDao.save(wlyyAgreement);
    }
    public WlyyAgreement findByCode(String code) {
        WlyyAgreement wlyyAgreement = wlyyAgreementDao.findByCode(code);
        return wlyyAgreement;
    }
    @Transient
    public void delete(String code) {
        WlyyAgreement wlyyAgreement = findByCode(code);
        if(wlyyAgreement==null){
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_wlyyAgreement_is_no_exist, CommonContants.common_error_params_code);
        }
        wlyyAgreement.setStatus(-1);
        wlyyAgreementDao.save(wlyyAgreement);
    }
}

+ 39 - 17
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/Agreement/service/WlyySignFamilyService.java

@ -1,19 +1,20 @@
package com.yihu.jw.wlyy.agreement.service;
package com.yihu.jw.wlyy.service.agreement;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wlyy.WlyyContants;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
import com.yihu.jw.util.IDCard;
import com.yihu.jw.wlyy.agreement.dao.WlyySignFamilyDao;
import com.yihu.jw.wlyy.agreement.entity.WlyyAgreement;
import com.yihu.jw.wlyy.agreement.entity.WlyySignFamily;
import com.yihu.jw.wlyy.dao.agreement.WlyySignFamilyDao;
import com.yihu.jw.wlyy.entity.agreement.WlyyAgreement;
import com.yihu.jw.wlyy.entity.agreement.WlyySignFamily;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.persistence.Transient;
import java.text.ParseException;
import java.util.List;
/**
 * Created by Administrator on 2017/6/2 0002.
@ -27,6 +28,9 @@ public class WlyySignFamilyService extends BaseJpaService<WlyySignFamily, WlyySi
    @Autowired
    private WlyyAgreementService wlyyAgreementService;
    //@Autowired
    //private SaasService saasService;
    @Transient
    public WlyySignFamily create(WlyySignFamily wlyySignFamily) throws ParseException {
        boolean b = canSaveOrUpdate(wlyySignFamily);
@ -51,49 +55,67 @@ public class WlyySignFamilyService extends BaseJpaService<WlyySignFamily, WlyySi
    private boolean canSaveOrUpdate(WlyySignFamily wlyySignFamily) throws ParseException {
        if (StringUtils.isEmpty(wlyySignFamily.getCode())) {
            throw new ApiException(WlyyContants.SignFamily.message_fail_code_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WlyyAgreementContants.SignFamily.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        String saasId = wlyySignFamily.getSaasId();
        if (StringUtils.isEmpty(saasId)) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_saasId_is_null, CommonContants.common_error_params_code);
        }
        //Saas saas = saasService.findByCode(saasId);
        //if(saas==null){
        //    throw new ApiException(BaseContants.Saas.message_fail_code_no_exist, CommonContants.common_error_params_code);
        //}
        if (StringUtils.isEmpty(wlyySignFamily.getType())) {
            throw new ApiException(WlyyContants.SignFamily.message_fail_type_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WlyyAgreementContants.SignFamily.message_fail_type_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyySignFamily.getName())) {
            throw new ApiException(WlyyContants.SignFamily.message_fail_name_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WlyyAgreementContants.SignFamily.message_fail_name_is_null, CommonContants.common_error_params_code);
        }
        String idcard = wlyySignFamily.getIdcard();
        if (StringUtils.isEmpty(idcard)) {
            throw new ApiException(WlyyContants.SignFamily.message_fail_idCard_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WlyyAgreementContants.SignFamily.message_fail_idCard_is_null, CommonContants.common_error_params_code);
        }
        String s = new IDCard().IDCardValidate(idcard);//不为空字符串,说明身份证有问题啦
        if(!StringUtils.isEmpty(s)){
            throw new ApiException(s, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyySignFamily.getSsc())) {
            throw new ApiException(WlyyContants.SignFamily.message_fail_ssc_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WlyyAgreementContants.SignFamily.message_fail_ssc_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyySignFamily.getHospital())) {
            throw new ApiException(WlyyContants.SignFamily.message_fail_hospital_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WlyyAgreementContants.SignFamily.message_fail_hospital_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyySignFamily.getHospitalName())) {
            throw new ApiException(WlyyContants.SignFamily.message_fail_hospitalName_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WlyyAgreementContants.SignFamily.message_fail_hospitalName_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyySignFamily.getStatus())) {
            throw new ApiException(WlyyContants.SignFamily.message_fail_status_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WlyyAgreementContants.SignFamily.message_fail_status_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyySignFamily.getExpenses())) {
            throw new ApiException(WlyyContants.SignFamily.message_fail_expense_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WlyyAgreementContants.SignFamily.message_fail_expense_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyySignFamily.getExpensesStatus())) {
            throw new ApiException(WlyyContants.SignFamily.message_fail_expenseStatus_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WlyyAgreementContants.SignFamily.message_fail_expenseStatus_is_null, CommonContants.common_error_params_code);
        }
        String agreementCode = wlyySignFamily.getAgreementCode();
        if (StringUtils.isEmpty(agreementCode)) {
            throw new ApiException(WlyyContants.SignFamily.message_fail_agreementCode_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WlyyAgreementContants.SignFamily.message_fail_agreementCode_is_null, CommonContants.common_error_params_code);
        }
        //根据agreementCode查找协议是否存在
        WlyyAgreement agreement = wlyyAgreementService.findByCode(agreementCode);
        if(agreement==null){
            throw new ApiException(WlyyContants.Agreement.message_fail_wlyyAgreement_is_no_exist, CommonContants.common_error_params_code);
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_wlyyAgreement_is_no_exist, CommonContants.common_error_params_code);
        }
        return true;
    }
    /**
     * 根据患者code和签约状态查找签约
     * @param patientCode
     * @param status
     * @return
     */
    public List<WlyySignFamily> findByPatientCode(String patientCode,Integer status) {
        return wlyySignFamilyDao.findByPatientCode(patientCode,status);
    }
}

+ 23 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/doctor/DoctorService.java

@ -0,0 +1,23 @@
package com.yihu.jw.wlyy.service.doctor;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.wlyy.dao.doctor.DoctorDao;
import com.yihu.jw.wlyy.entity.doctor.Doctors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * Created by Administrator on 2017/6/7 0007.
 */
@Service
public class DoctorService extends BaseJpaService<Doctors, DoctorDao> {
    @Autowired
    private DoctorDao doctorDao;
    public Doctors findByCode(String code){
        return doctorDao.findByCode(code);
    }
}

+ 22 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/doctor/HospitalService.java

@ -0,0 +1,22 @@
package com.yihu.jw.wlyy.service.doctor;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.wlyy.dao.doctor.HospitalDao;
import com.yihu.jw.wlyy.entity.doctor.BaseOrgHospital;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * Created by Administrator on 2017/6/7 0007.
 */
@Service
public class HospitalService extends BaseJpaService<BaseOrgHospital, HospitalDao> {
    @Autowired
    private HospitalDao hospitalDao;
    public BaseOrgHospital findByCode(String code){
        return hospitalDao.findByCode(code);
    }
}

+ 226 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/patient/AdvertisementService.java

@ -0,0 +1,226 @@
package com.yihu.jw.wlyy.service.patient;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wlyy.patient.WlyyPatientContants;
import com.yihu.jw.util.AddressUtils;
import com.yihu.jw.util.CusAccessObjectUtil;
import com.yihu.jw.wlyy.dao.patient.AdvertisementDao;
import com.yihu.jw.wlyy.entity.BaseSaas;
import com.yihu.jw.wlyy.entity.agreement.WlyySignFamily;
import com.yihu.jw.wlyy.entity.patient.WlyyAdvertisement;
import com.yihu.jw.wlyy.service.BaseSaasService;
import com.yihu.jw.wlyy.service.agreement.WlyySignFamilyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.persistence.Transient;
import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.List;
/**
 * Created by Administrator on 2017/6/6 0006.
 */
@Service
public class AdvertisementService extends BaseJpaService<WlyyAdvertisement, AdvertisementDao> {
    @Autowired
    private AdvertisementDao advertisementDao;
    @Autowired
    private PatientService patientService;
    @Autowired
    private WlyySignFamilyService signFamilyService;
    @Autowired
    private BaseSaasService saasService;
    @Transient
     public WlyyAdvertisement create(WlyyAdvertisement advertisement) {
        if (StringUtils.isEmpty(advertisement.getCode())) {
            throw new ApiException(WlyyPatientContants.Advertisement.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(advertisement.getSaasId())) {
            throw new ApiException(WlyyPatientContants.Advertisement.message_fail_saasid_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(advertisement.getName())) {
            throw new ApiException(WlyyPatientContants.Advertisement.message_fail_name_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(advertisement.getPicture())) {
            throw new ApiException(WlyyPatientContants.Advertisement.message_fail_picture_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(advertisement.getStatus())) {
            throw new ApiException(WlyyPatientContants.Advertisement.message_fail_status_is_null, CommonContants.common_error_params_code);
        }
        //设置创建时间和修改时间
        Date date = new Date();
        advertisement.setCreateTime(date);
        advertisement.setUpdateTime(date);
        return advertisementDao.save(advertisement);
    }
    @Transient
    public WlyyAdvertisement update(WlyyAdvertisement advertisement) {
        String code = advertisement.getCode();
        if (StringUtils.isEmpty(code)) {
            throw new ApiException(WlyyPatientContants.Advertisement.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(advertisement.getSaasId())) {
            throw new ApiException(WlyyPatientContants.Advertisement.message_fail_saasid_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(advertisement.getName())) {
            throw new ApiException(WlyyPatientContants.Advertisement.message_fail_name_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(advertisement.getPicture())) {
            throw new ApiException(WlyyPatientContants.Advertisement.message_fail_picture_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(advertisement.getStatus())) {
            throw new ApiException(WlyyPatientContants.Advertisement.message_fail_status_is_null, CommonContants.common_error_params_code);
        }
        Long id = advertisement.getId();
        if (StringUtils.isEmpty(id)) {
            throw new ApiException(WlyyPatientContants.Advertisement.message_fail_picture_is_null, CommonContants.common_error_params_code);
        }
        //根据id获取修改前的记录
        WlyyAdvertisement advertisement1 = findById(id);
        if(null == advertisement1){
            throw new ApiException(WlyyPatientContants.Advertisement.message_fail_wlyyAdvertisement_is_not_exist, CommonContants.common_error_params_code);
        }
        //设置创建时间和修改时间
        Date date = new Date();
        advertisement.setCreateTime(advertisement1.getCreateTime());
        advertisement.setUpdateTime(date);
        return advertisementDao.save(advertisement);
    }
    public WlyyAdvertisement findById(Long id) {
        return advertisementDao.findById(id);
    }
    public WlyyAdvertisement findByCode(String code) {
        return advertisementDao.findByCode(code);
    }
    @Transient
    public void delete(String code) {
        WlyyAdvertisement advertisement = findByCode(code);
        if(advertisement==null){
            throw new ApiException(WlyyPatientContants.Advertisement.message_fail_wlyyAdvertisement_is_not_exist, CommonContants.common_error_params_code);
        }
        advertisement.setStatus(-1);
        advertisementDao.save(advertisement);
    }
    /**
     * 根据患者code查找广告
     * @param patientCode
     * @param request
     * @return
     */
    public List<WlyyAdvertisement> getListByPatientCode(String patientCode, HttpServletRequest request) {
        List<WlyyAdvertisement> advertisements = null;
        //查找已签约的,根据签约的saasId查找地区,获得广告
        List<WlyySignFamily> signs =  signFamilyService.findByPatientCode(patientCode,1);
        if(signs!=null){
            for(WlyySignFamily sign:signs){
                String saasCode = sign.getSaasId();
                if(!StringUtils.isEmpty(sign.getSaasId())){
                    advertisements = getListBySaasCode(saasCode);
                    if(advertisements!=null){
                        return advertisements;
                    }
                }
            }
        }
        //如果未签约或者通过签约未获取到广告,则根据http获取广告
        advertisements = getByHttp(request);
        return advertisements;
    }
    /**
     * 通过saasCode查找广告
     * @param saasCode
     * @return
     */
    public List<WlyyAdvertisement> getListBySaasCode(String saasCode){
        return advertisementDao.getListBySaasCode(saasCode);
    }
    /**
     * 查找默认广告
     * @return
     */
    private List<WlyyAdvertisement> getDefaultList(){
        return advertisementDao.getDefaultList();
    }
    /**
     * 通过用户的HttpServletRequest,判断显示的广告
     * @param request
     * @return
     */
    public  List<WlyyAdvertisement> getByHttp(HttpServletRequest request){
        String ipAddress = CusAccessObjectUtil.getIpAddress(request);
        AddressUtils addressUtils = new AddressUtils();
        try {
            String address = addressUtils.getAddresses(ipAddress);//"中国-西南-四川省-成都市- -电信"  (没有值,中间用空格隔开  country-area-region-city-county-isp)或者返回0
            String[] addresses = address.split("-");
            if(addresses.length<6){
                return  getDefaultList();
            }else{
                String cityName = addresses[3];
                BaseSaas saas = saasService.findByName(cityName);//成都市
                if(saas ==null){
                    cityName = cityName.substring(0,cityName.length()-1);//成都
                    saas = saasService.findByName(cityName);
                }
                if(saas==null){//如果还是为空,则展示默认广告
                    return  getDefaultList();
                }
                String saasCode = saas.getCode();
                return getListBySaasCode(saasCode);
            }
        } catch (UnsupportedEncodingException e) {//解析ip失败,展示默认广告
            return  getDefaultList();
        }
    }
    /**
     * 通过ip定位地址,展示广告的广告(供网关调用)
     * @param ipaddress
     * @return
     */
    public  List<WlyyAdvertisement> getListByIp(String ipaddress){
        try {
            AddressUtils addressUtils = new AddressUtils();
            String address = addressUtils.getAddresses(ipaddress);
            String[] addresses = address.split("-");
            if(addresses.length<6){
                return  getDefaultList();
            }else{
                String cityName = addresses[3];
                BaseSaas saas = saasService.findByName(cityName);//成都市
                if(saas ==null){
                    cityName = cityName.substring(0,cityName.length()-1);//成都
                    saas = saasService.findByName(cityName);
                }
                if(saas==null){//如果还是为空,则展示默认广告
                    return  getDefaultList();
                }
                String saasCode = saas.getCode();
                return getListBySaasCode(saasCode);
            }
        } catch (UnsupportedEncodingException e) {//解析ip失败,展示默认广告
            return  getDefaultList();
        }
    }
}

+ 22 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/patient/PatientService.java

@ -0,0 +1,22 @@
package com.yihu.jw.wlyy.service.patient;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.wlyy.dao.patient.BasePatientDao;
import com.yihu.jw.wlyy.entity.patient.BasePatient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * Created by Administrator on 2017/6/6 0006.
 */
@Service
public class PatientService extends BaseJpaService<BasePatient, BasePatientDao> {
    @Autowired
    private BasePatientDao basePatientDao;
    public BasePatient findByCode(String code){
        return basePatientDao.findByCode(code);
    }
}

+ 19 - 0
web-gateway/src/main/java/com/yihu/jw/commnon/wlyy/PatientContants.java

@ -0,0 +1,19 @@
package com.yihu.jw.commnon.wlyy;
/**
 * Created by Administrator on 2017/6/6 0006.
 */
public class PatientContants {
    public static class Advertisement{
        public static final String api_common="wlyyAdvertisement";
        public static final String api_create="create";
        public static final String api_delete="delete";
        public static final String api_getByCode="getByCode";
        public static final String api_update="update";
        public static final String api_queryPage="queryPage";
        public static final String api_getList="getList";
        public static final String api_getListByPatientCode="getListByPatientCode";
        public static final String api_getListByHttp="getListByHttp";
        public static final String api_getListByIp="getListByIp";
    }
}

+ 119 - 0
web-gateway/src/main/java/com/yihu/jw/controller/wlyy/patient/AdvertisementControlelr.java

@ -0,0 +1,119 @@
package com.yihu.jw.controller.wlyy.patient;
import com.yihu.jw.commnon.wlyy.PatientContants;
import com.yihu.jw.fegin.wlyy.patient.AdvertisementFegin;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.util.CusAccessObjectUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * Created by Administrator on 2017/6/6 0006.
 */
@RestController
@RequestMapping(PatientContants.Advertisement.api_common)
@Api(value = "签约相关操作", description = "签约相关操作")
public class AdvertisementControlelr extends EnvelopRestController {
    private Logger logger = LoggerFactory.getLogger(AdvertisementControlelr.class);
    @Autowired
    private AdvertisementFegin advertisementFegin;
    @Autowired
    private Tracer tracer;
    @PostMapping(value = PatientContants.Advertisement.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建广告", notes = "创建广告")
    public Envelop create(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        return advertisementFegin.create(jsonData);
    }
    @PutMapping(value = PatientContants.Advertisement.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "修改广告", notes = "修改广告")
    public Envelop update(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        return advertisementFegin.update(jsonData);
    }
    @DeleteMapping(value =PatientContants.Advertisement.api_delete)
    @ApiOperation(value = "删除广告", notes = "删除广告")
    public Envelop delete(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code) {
        return advertisementFegin.delete(code);
    }
    @GetMapping(value =PatientContants.Advertisement.api_getByCode)
    @ApiOperation(value = "根据code查找协议", notes = "根据code查找协议")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
    ) {
        return advertisementFegin.findByCode(code);
    }
    @RequestMapping(value =PatientContants.Advertisement.api_queryPage, method = RequestMethod.GET)
    @ApiOperation(value = "分页获取协议")
    public Envelop queryPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,parentCode,saasId,name,price,posterPic,remark,type,status")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
            @RequestParam(value = "size", required = false) int size,
            @ApiParam(name = "page", value = "页码", defaultValue = "1")
            @RequestParam(value = "page", required = false) int page,
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        return advertisementFegin.queryPage(fields,filters,sorts,size,page);
    }
    @GetMapping(value =PatientContants.Advertisement.api_getList)
    @ApiOperation(value = "获取协议列表(不分页)")
    public Envelop getList(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,parentCode,saasId,name,price,posterPic,remark,type,status")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        return advertisementFegin.getList(fields, filters, sorts);
    }
    @GetMapping(value =PatientContants.Advertisement.api_getListByPatientCode)
    @ApiOperation(value = "根据患者code获取广告")
    public Envelop getListByPatientCode(
            @ApiParam(name="patientCode")
            @RequestParam(value="patientCode") String patientCode,
            HttpServletRequest request
    ){
        return advertisementFegin.getListByPatientCode(patientCode);
    }
    @GetMapping(value =PatientContants.Advertisement.api_getListByHttp)
    @ApiOperation(value = "根据患者http获取广告")
    public Envelop getListByHttp(
            HttpServletRequest request
    ){
        String ipAddress = CusAccessObjectUtil.getIpAddress(request);
        return advertisementFegin.getListByIp(ipAddress);
    }
}

+ 63 - 0
web-gateway/src/main/java/com/yihu/jw/fegin/fallbackfactory/wlyy/patient/AdvertisementFeginFallbackFactory.java

@ -0,0 +1,63 @@
package com.yihu.jw.fegin.fallbackfactory.wlyy.patient;
import com.yihu.jw.fegin.wlyy.patient.AdvertisementFegin;
import com.yihu.jw.restmodel.common.Envelop;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * Created by Administrator on 2017/6/6 0006.
 */
@Component
public class AdvertisementFeginFallbackFactory implements FallbackFactory<AdvertisementFegin> {
    @Override
    public AdvertisementFegin create(Throwable throwable) {
        return new AdvertisementFegin() {
            @Override
            public Envelop create(@RequestBody String jsonData) {
                return null;
            }
            @Override
            public Envelop update(@RequestBody String jsonData) {
                return null;
            }
            @Override
            public Envelop delete(@RequestParam(value = "code") String code) {
                return null;
            }
            @Override
            public Envelop findByCode(@RequestParam(value = "code") String code) {
                return null;
            }
            @Override
            public Envelop queryPage(@RequestParam(value = "fields", required = false) String fields, @RequestParam(value = "filters", required = false) String filters, @RequestParam(value = "sorts", required = false) String sorts, @RequestParam(value = "size", required = false) int size, @RequestParam(value = "page", required = false) int page) {
                return null;
            }
            @Override
            public Envelop getList(@RequestParam(value = "fields", required = false) String fields, @RequestParam(value = "filters", required = false) String filters, @RequestParam(value = "sorts", required = false) String sorts) {
                return null;
            }
            @Override
            public Envelop getListByPatientCode(@RequestParam(value = "patientCode") String patientCode) {
                return null;
            }
            @Override
            public Envelop getListByIp(@RequestParam(value = "ipAddress") String ipAddress) {
                return null;
            }
        };
    }
}

+ 8 - 8
web-gateway/src/main/java/com/yihu/jw/fegin/wlyy/agreement/WlyyAgreementFegin.java

@ -3,7 +3,7 @@ package com.yihu.jw.fegin.wlyy.agreement;
import com.yihu.jw.fegin.fallbackfactory.wlyy.agreement.WlyyAgreementFeginFallbackFactory;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.wlyy.WlyyContants;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@ -13,22 +13,22 @@ import org.springframework.web.bind.annotation.*;
        name = CommonContants.svr_wlyy // name值是eurika的实例名字
        ,fallbackFactory  = WlyyAgreementFeginFallbackFactory.class
)
@RequestMapping(WlyyContants.Agreement.api_common)
@RequestMapping(WlyyAgreementContants.Agreement.api_common)
public interface WlyyAgreementFegin {
    @PostMapping(value = WlyyContants.Agreement.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = WlyyAgreementContants.Agreement.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop create(@RequestBody String jsonData);
    @PutMapping(value = WlyyContants.Agreement.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PutMapping(value = WlyyAgreementContants.Agreement.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop update(@RequestBody String jsonData);
    @DeleteMapping(value =WlyyContants.Agreement.api_delete)
    @DeleteMapping(value = WlyyAgreementContants.Agreement.api_delete)
    Envelop delete( @RequestParam(value = "code") String code);
    @RequestMapping(value=WlyyContants.Agreement.api_getByCode,method = RequestMethod.GET)
    @RequestMapping(value= WlyyAgreementContants.Agreement.api_getByCode,method = RequestMethod.GET)
    Envelop findByCode( @RequestParam(value = "code" ) String code);
    @RequestMapping(value =WlyyContants.Agreement.api_queryPage, method = RequestMethod.GET)
    @RequestMapping(value = WlyyAgreementContants.Agreement.api_queryPage, method = RequestMethod.GET)
    Envelop queryPage(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
@ -36,7 +36,7 @@ public interface WlyyAgreementFegin {
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "page", required = false) int page);
    @GetMapping(value =WlyyContants.Agreement.api_getList)
    @GetMapping(value = WlyyAgreementContants.Agreement.api_getList)
    Envelop getList(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,

+ 8 - 8
web-gateway/src/main/java/com/yihu/jw/fegin/wlyy/agreement/WlyyAgreementKpiFegin.java

@ -3,7 +3,7 @@ package com.yihu.jw.fegin.wlyy.agreement;
import com.yihu.jw.fegin.fallbackfactory.wlyy.agreement.WlyyAgreementKpiFeginFallbackFactory;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.wlyy.WlyyContants;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@ -13,22 +13,22 @@ import org.springframework.web.bind.annotation.*;
        name = CommonContants.svr_wlyy // name值是eurika的实例名字
        ,fallbackFactory  = WlyyAgreementKpiFeginFallbackFactory.class
)
@RequestMapping(WlyyContants.AgreementKpi.api_common)
@RequestMapping(WlyyAgreementContants.AgreementKpi.api_common)
public interface WlyyAgreementKpiFegin {
    @PostMapping(value = WlyyContants.AgreementKpi.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = WlyyAgreementContants.AgreementKpi.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop create(@RequestBody String jsonData);
    @PutMapping(value = WlyyContants.AgreementKpi.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PutMapping(value = WlyyAgreementContants.AgreementKpi.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop update(@RequestBody String jsonData);
    @DeleteMapping(value =WlyyContants.AgreementKpi.api_delete)
    @DeleteMapping(value = WlyyAgreementContants.AgreementKpi.api_delete)
    Envelop delete(@RequestParam(value = "code" ) String code);
    @GetMapping(value =WlyyContants.AgreementKpi.api_getByCode)
    @GetMapping(value = WlyyAgreementContants.AgreementKpi.api_getByCode)
    Envelop findByCode(@RequestParam(value = "code" ) String code);
    @RequestMapping(value =WlyyContants.AgreementKpi.api_queryPage, method = RequestMethod.GET)
    @RequestMapping(value = WlyyAgreementContants.AgreementKpi.api_queryPage, method = RequestMethod.GET)
    Envelop queryPage(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
@ -36,7 +36,7 @@ public interface WlyyAgreementKpiFegin {
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "page", required = false) int page);
    @GetMapping(value =WlyyContants.AgreementKpi.api_getList)
    @GetMapping(value = WlyyAgreementContants.AgreementKpi.api_getList)
    Envelop getList(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,

+ 6 - 6
web-gateway/src/main/java/com/yihu/jw/fegin/wlyy/agreement/WlyyAgreementKpiLogFegin.java

@ -3,7 +3,7 @@ package com.yihu.jw.fegin.wlyy.agreement;
import com.yihu.jw.fegin.fallbackfactory.wlyy.agreement.WlyyAgreementKpiLogFeginFallbackFactory;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.wlyy.WlyyContants;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;
@ -12,16 +12,16 @@ import org.springframework.web.bind.annotation.*;
        name = CommonContants.svr_wlyy // name值是eurika的实例名字
        ,fallbackFactory  = WlyyAgreementKpiLogFeginFallbackFactory.class
)
@RequestMapping(WlyyContants.AgreementKpiLog.api_common)
@RequestMapping(WlyyAgreementContants.AgreementKpiLog.api_common)
public interface WlyyAgreementKpiLogFegin {
    @PostMapping(value = WlyyContants.AgreementKpiLog.api_create)
    @PostMapping(value = WlyyAgreementContants.AgreementKpiLog.api_create)
    Envelop create(@RequestBody String jsonData);
    @GetMapping(value =WlyyContants.AgreementKpiLog.api_getByCode)
    @GetMapping(value = WlyyAgreementContants.AgreementKpiLog.api_getByCode)
    Envelop findByCode(@RequestParam(value = "code")String code);
    @RequestMapping(value =WlyyContants.AgreementKpiLog.api_queryPage, method = RequestMethod.GET)
    @RequestMapping(value = WlyyAgreementContants.AgreementKpiLog.api_queryPage, method = RequestMethod.GET)
    Envelop queryPage(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
@ -29,7 +29,7 @@ public interface WlyyAgreementKpiLogFegin {
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "page", required = false) int page);
    @GetMapping(value =WlyyContants.AgreementKpiLog.api_getList)
    @GetMapping(value = WlyyAgreementContants.AgreementKpiLog.api_getList)
    Envelop getList(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,

+ 7 - 7
web-gateway/src/main/java/com/yihu/jw/fegin/wlyy/agreement/WlyySignFamilyFegin.java

@ -3,7 +3,7 @@ package com.yihu.jw.fegin.wlyy.agreement;
import com.yihu.jw.fegin.fallbackfactory.wlyy.agreement.WlyySignFamilyFeginFallbackFactory;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.wlyy.WlyyContants;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@ -13,19 +13,19 @@ import org.springframework.web.bind.annotation.*;
        name = CommonContants.svr_wlyy // name值是eurika的实例名字
        ,fallbackFactory  = WlyySignFamilyFeginFallbackFactory.class
)
@RequestMapping(WlyyContants.SignFamily.api_common)
@RequestMapping(WlyyAgreementContants.SignFamily.api_common)
public interface WlyySignFamilyFegin {
    @PostMapping(value = WlyyContants.SignFamily.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = WlyyAgreementContants.SignFamily.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop create(@RequestBody String jsonData);
    @PutMapping(value = WlyyContants.SignFamily.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PutMapping(value = WlyyAgreementContants.SignFamily.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop update(@RequestBody String jsonData);
    @RequestMapping(value=WlyyContants.SignFamily.api_getByCode,method = RequestMethod.GET)
    @RequestMapping(value= WlyyAgreementContants.SignFamily.api_getByCode,method = RequestMethod.GET)
    Envelop findByCode(@RequestParam(value = "code") String code);
    @RequestMapping(value =WlyyContants.SignFamily.api_queryPage, method = RequestMethod.GET)
    @RequestMapping(value = WlyyAgreementContants.SignFamily.api_queryPage, method = RequestMethod.GET)
    Envelop queryPage(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
@ -33,7 +33,7 @@ public interface WlyySignFamilyFegin {
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "page", required = false) int page);
    @GetMapping(value =WlyyContants.SignFamily.api_getList)
    @GetMapping(value = WlyyAgreementContants.SignFamily.api_getList)
    Envelop getList(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,

+ 53 - 0
web-gateway/src/main/java/com/yihu/jw/fegin/wlyy/patient/AdvertisementFegin.java

@ -0,0 +1,53 @@
package com.yihu.jw.fegin.wlyy.patient;
import com.yihu.jw.fegin.fallbackfactory.wlyy.patient.AdvertisementFeginFallbackFactory;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.wlyy.patient.WlyyPatientContants;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
/**
 * Created by Administrator on 2017/6/6 0006.
 */
@FeignClient(
        name = CommonContants.svr_wlyy // name值是eurika的实例名字
        ,fallbackFactory  = AdvertisementFeginFallbackFactory.class
)
@RequestMapping(WlyyPatientContants.Advertisement.api_common)
public interface AdvertisementFegin {
    @PostMapping(value = WlyyPatientContants.Advertisement.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop create(@RequestBody String jsonData);
    @PutMapping(value = WlyyPatientContants.Advertisement.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop update(@RequestBody String jsonData);
    @DeleteMapping(value = WlyyPatientContants.Advertisement.api_delete)
    Envelop delete( @RequestParam(value = "code") String code);
    @RequestMapping(value= WlyyPatientContants.Advertisement.api_getByCode,method = RequestMethod.GET)
    Envelop findByCode( @RequestParam(value = "code" ) String code);
    @RequestMapping(value = WlyyPatientContants.Advertisement.api_queryPage, method = RequestMethod.GET)
    Envelop queryPage(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "sorts", required = false) String sorts,
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "page", required = false) int page);
    @GetMapping(value = WlyyPatientContants.Advertisement.api_getList)
    Envelop getList(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "sorts", required = false) String sorts);
    @GetMapping(value= WlyyPatientContants.Advertisement.api_getListByPatientCode)
    Envelop getListByPatientCode(@RequestParam(value="patientCode")String patientCode);
    @GetMapping(value= WlyyPatientContants.Advertisement.api_getListByIp)
    Envelop getListByIp(@RequestParam(value="ipAddress") String ipAddress);
}

+ 47 - 0
web-gateway/src/main/java/com/yihu/jw/util/CusAccessObjectUtil.java

@ -0,0 +1,47 @@
package com.yihu.jw.util;
import javax.servlet.http.HttpServletRequest;
/**
 * 自定义访问对象工具类
 *
 * 获取对象的IP地址等信息
 * @author X-rapido
 *
 */
public class CusAccessObjectUtil {
    /**
     * 获取用户真实IP地址,不使用request.getRemoteAddr();的原因是有可能用户使用了代理软件方式避免真实IP地址,
     *
     * 可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串IP值,究竟哪个才是真正的用户端的真实IP呢?
     * 答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。
     *
     * 如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130,
     * 192.168.1.100
     *
     * 用户真实IP为: 192.168.1.110
     *
     * @param request
     * @return
     */
    public static String getIpAddress(HttpServletRequest request) {
        String ip = request.getHeader("x-forwarded-for");
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("WL-Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_CLIENT_IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_X_FORWARDED_FOR");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getRemoteAddr();
        }
        return ip;
    }
}