Преглед изворни кода

Merge branch 'dev' of chenweida/patient-co-management into dev

chenweida пре 7 година
родитељ
комит
219ac189f0
26 измењених фајлова са 1609 додато и 9 уклоњено
  1. 165 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/gateway/GcClientDetails.java
  2. 109 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/gateway/GcHttpLog.java
  3. 101 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/gateway/GcTokenLog.java
  4. 4 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/MvcConfig.java
  5. 27 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java
  6. 43 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/GateWayInterceptor.java
  7. 11 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/gateway/GcClientDetailsDao.java
  8. 12 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/gateway/GcHttpLogdAO.java
  9. 11 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/gateway/GcTokenLogDao.java
  10. 13 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/hospital/HospitalService.java
  11. 44 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/SMSService.java
  12. 14 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/gateway/GcClientDetailsService.java
  13. 14 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/gateway/GcTokenService.java
  14. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java
  15. 52 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcHospitalController.java
  16. 105 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcMessageController.java
  17. 29 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcTokenController.java
  18. 50 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcUserController.java
  19. 317 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/DoctorModel.java
  20. 172 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/HospitalModel.java
  21. 80 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/PatientModel.java
  22. 66 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/BaseResultModel.java
  23. 65 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/ResultBatchModel.java
  24. 23 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/ResultListModel.java
  25. 29 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/ResultOneModel.java
  26. 52 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/ResultPageListModel.java

+ 165 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/gateway/GcClientDetails.java

@ -0,0 +1,165 @@
package com.yihu.wlyy.entity.gateway;
import com.yihu.wlyy.entity.IdEntity;
import java.sql.Timestamp;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
/**
 * GtClientDetails entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "gc_client_details")
public class GcClientDetails extends IdEntity implements java.io.Serializable {
    // Fields
    private String appId;
    private String appSecret;
    private String appUri;
    private Date creatieTime;
    private String creatieUser;
    private String createUserName;
    private Date updateTime;
    private String updateUser;
    private String updateUserName;
    private String remark;
    private Integer del;
    // Constructors
    /**
     * default constructor
     */
    public GcClientDetails() {
    }
    /**
     * full constructor
     */
    public GcClientDetails(String appId, String appSecret, String appUri,
                           Timestamp creatieTime, String creatieUser, String createUserName,
                           Timestamp updateTime, String updateUser, String updateUserName,
                           String remark, Integer del) {
        this.appId = appId;
        this.appSecret = appSecret;
        this.appUri = appUri;
        this.creatieTime = creatieTime;
        this.creatieUser = creatieUser;
        this.createUserName = createUserName;
        this.updateTime = updateTime;
        this.updateUser = updateUser;
        this.updateUserName = updateUserName;
        this.remark = remark;
        this.del = del;
    }
    @Column(name = "app_id", length = 100)
    public String getAppId() {
        return this.appId;
    }
    public void setAppId(String appId) {
        this.appId = appId;
    }
    @Column(name = "app_secret", length = 100)
    public String getAppSecret() {
        return this.appSecret;
    }
    public void setAppSecret(String appSecret) {
        this.appSecret = appSecret;
    }
    @Column(name = "app_uri", length = 256)
    public String getAppUri() {
        return this.appUri;
    }
    public void setAppUri(String appUri) {
        this.appUri = appUri;
    }
    @Column(name = "creatie_time", length = 0)
    public Date getCreatieTime() {
        return this.creatieTime;
    }
    public void setCreatieTime(Date creatieTime) {
        this.creatieTime = creatieTime;
    }
    @Column(name = "creatie_user", length = 100)
    public String getCreatieUser() {
        return this.creatieUser;
    }
    public void setCreatieUser(String creatieUser) {
        this.creatieUser = creatieUser;
    }
    @Column(name = "create_user_name", length = 20)
    public String getCreateUserName() {
        return this.createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @Column(name = "update_time", length = 0)
    public Date getUpdateTime() {
        return this.updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    @Column(name = "update_user")
    public String getUpdateUser() {
        return this.updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    @Column(name = "update_user_name", length = 100)
    public String getUpdateUserName() {
        return this.updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    @Column(name = "remark", length = 20)
    public String getRemark() {
        return this.remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Column(name = "del")
    public Integer getDel() {
        return this.del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 109 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/gateway/GcHttpLog.java

@ -0,0 +1,109 @@
package com.yihu.wlyy.entity.gateway;
import com.yihu.wlyy.entity.IdEntity;
import java.sql.Timestamp;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
/**
 * GcHttpLog entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "gc_http_log")
public class GcHttpLog extends IdEntity implements java.io.Serializable {
    // Fields
    private String token;
    private String ip;
    private String method;
    private String input;
    private String output;
    private Date createTime;
    // Constructors
    /**
     * default constructor
     */
    public GcHttpLog() {
    }
    /**
     * full constructor
     */
    public GcHttpLog(String token, String ip, String method, String input,
                     String output, Timestamp createTime) {
        this.token = token;
        this.ip = ip;
        this.method = method;
        this.input = input;
        this.output = output;
        this.createTime = createTime;
    }
    @Column(name = "token")
    public String getToken() {
        return this.token;
    }
    public void setToken(String token) {
        this.token = token;
    }
    @Column(name = "ip", length = 100)
    public String getIp() {
        return this.ip;
    }
    public void setIp(String ip) {
        this.ip = ip;
    }
    @Column(name = "method")
    public String getMethod() {
        return this.method;
    }
    public void setMethod(String method) {
        this.method = method;
    }
    @Column(name = "input")
    public String getInput() {
        return this.input;
    }
    public void setInput(String input) {
        this.input = input;
    }
    @Column(name = "output")
    public String getOutput() {
        return this.output;
    }
    public void setOutput(String output) {
        this.output = output;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return this.createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 101 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/gateway/GcTokenLog.java

@ -0,0 +1,101 @@
package com.yihu.wlyy.entity.gateway;
import com.yihu.wlyy.entity.IdEntity;
import java.sql.Timestamp;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
/**
 * GcTokenLog entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "gc_token_log")
public class GcTokenLog extends IdEntity implements java.io.Serializable {
	// Fields
	private String ip;
	private String appIp;
	private Integer tokenId;
	private Integer flag;
	private String message;
	private Date createTime;
	// Constructors
	/** default constructor */
	public GcTokenLog() {
	}
	/** full constructor */
	public GcTokenLog(String ip, String appIp, Integer tokenId, Integer flag,
			String message, Timestamp createTime) {
		this.ip = ip;
		this.appIp = appIp;
		this.tokenId = tokenId;
		this.flag = flag;
		this.message = message;
		this.createTime = createTime;
	}
	@Column(name = "ip")
	public String getIp() {
		return this.ip;
	}
	public void setIp(String ip) {
		this.ip = ip;
	}
	@Column(name = "app_ip")
	public String getAppIp() {
		return this.appIp;
	}
	public void setAppIp(String appIp) {
		this.appIp = appIp;
	}
	@Column(name = "token_id")
	public Integer getTokenId() {
		return this.tokenId;
	}
	public void setTokenId(Integer tokenId) {
		this.tokenId = tokenId;
	}
	@Column(name = "flag")
	public Integer getFlag() {
		return this.flag;
	}
	public void setFlag(Integer flag) {
		this.flag = flag;
	}
	@Column(name = "message", length = 2000)
	public String getMessage() {
		return this.message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	@Column(name = "create_time", length = 0)
	public Date getCreateTime() {
		return this.createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
}

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/MvcConfig.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.config;
import com.yihu.wlyy.interceptors.DoctorInterceptor;
import com.yihu.wlyy.interceptors.GateWayInterceptor;
import com.yihu.wlyy.interceptors.PatientInterceptor;
import com.yihu.wlyy.interceptors.UserInterceptor;
import org.slf4j.Logger;
@ -25,6 +26,8 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
    private PatientInterceptor patientInterceptor;
    @Autowired
    private UserInterceptor userInterceptor;
    @Autowired
    private GateWayInterceptor gateWayInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
@ -34,6 +37,7 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
        registry.addInterceptor(doctorInterceptor).addPathPatterns("/doctor/**", "/statistics/province/**", "/statistics/**");
        registry.addInterceptor(patientInterceptor).addPathPatterns("/patient/**");
        registry.addInterceptor(userInterceptor).addPathPatterns("/user/**");
        registry.addInterceptor(gateWayInterceptor).addPathPatterns("/wlyygc/**");
        super.addInterceptors(registry);
        logger.info("init doctorInterceptor,patientInterceptor");

+ 27 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java

@ -19,7 +19,34 @@ public class SwaggerConfig {
    private static final String Doctor_API = "doctor";
    private static final String Patient_API = "patient";
    private static final String Other_API = "other";
    private static final String GateWay_API = "gateway";
    @Bean
    public Docket gatewayAPI() {
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName(GateWay_API)
                .genericModelSubstitutes(DeferredResult.class)
                .useDefaultResponseMessages(false)
                .forCodeGeneration(true)
                .pathMapping("/")
                .select()
                .paths(or(regex("/wlyygc/.*")))
                .build()
                .apiInfo(gatewayApiInfo());
    }
    private ApiInfo gatewayApiInfo() {
        ApiInfo apiInfo = new ApiInfo("三师平台API",
                "对外部应用提供功能与数据接口。",
                "1.0",
                "No terms of service",
                "admin@jkzl.com",
                "The Apache License, Version 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0.html"
        );
        return apiInfo;
    }
    @Bean
    public Docket publicAPI() {
        return new Docket(DocumentationType.SWAGGER_2)

+ 43 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/GateWayInterceptor.java

@ -0,0 +1,43 @@
package com.yihu.wlyy.interceptors;
/**
 * Created by chenweida on 2017/8/17.
 */
import com.yihu.wlyy.repository.gateway.GcHttpLogDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * 对外的请求拦截
 */
@Component
public class GateWayInterceptor extends BaseInterceptor {
    private Logger logger = LoggerFactory.getLogger(GateWayInterceptor.class);
    @Autowired
    private GcHttpLogDao httpLogDao;
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        return false;
    }
    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
        HandlerMethod handlerMethod = (HandlerMethod) handler;
    }
    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
    }
}

+ 11 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/gateway/GcClientDetailsDao.java

@ -0,0 +1,11 @@
package com.yihu.wlyy.repository.gateway;
import com.yihu.wlyy.entity.gateway.GcClientDetails;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by chenweida on 2017/8/17.
 */
public interface GcClientDetailsDao extends PagingAndSortingRepository<GcClientDetails, Long>, JpaSpecificationExecutor<GcClientDetails> {
}

+ 12 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/gateway/GcHttpLogdAO.java

@ -0,0 +1,12 @@
package com.yihu.wlyy.repository.gateway;
import com.yihu.wlyy.entity.gateway.GcHttpLog;
import com.yihu.wlyy.entity.httpLog.HttpLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by chenweida on 2017/8/17.
 */
public interface GcHttpLogDao extends PagingAndSortingRepository<GcHttpLog, Long>, JpaSpecificationExecutor<GcHttpLog> {
}

+ 11 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/gateway/GcTokenLogDao.java

@ -0,0 +1,11 @@
package com.yihu.wlyy.repository.gateway;
import com.yihu.wlyy.entity.gateway.GcTokenLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by chenweida on 2017/8/17.
 */
public interface GcTokenLogDao extends PagingAndSortingRepository<GcTokenLog, Long>, JpaSpecificationExecutor<GcTokenLog> {
}

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

@ -85,16 +85,18 @@ public class HospitalService extends BaseService {
     * @param province
     * @param city
     * @param town
     * @param key
     * @param hospitalName
     * @param page
     * @param pagesize
     * @return
     */
    public List<Hospital> getHospitals(int type, String province, String city, String town, String key, int page, int pagesize) {
        String sql = "select * from dm_hospital where exists (select * from wlyy_doctor where wlyy_doctor.hospital = dm_hospital.code) and level = ? ";
    public List<Hospital> getHospitals(Integer type, String province, String city, String town, String hospitalName,String hospitalId, int page, int pagesize) {
        String sql = "select * from dm_hospital where exists (select * from wlyy_doctor where wlyy_doctor.hospital = dm_hospital.code) ";
        List<Object> args = new ArrayList<>();
        args.add(type);
        if (type != null ) {
            sql += " and level = ? ";
            args.add(type);
        }
        if (StringUtils.isNotEmpty(province)) {
            sql += " and province = ? ";
@ -108,11 +110,14 @@ public class HospitalService extends BaseService {
            sql += " and town = ? ";
            args.add(town);
        }
        if (StringUtils.isNotEmpty(key)) {
        if (StringUtils.isNotEmpty(hospitalName)) {
            sql += " and name like ? ";
            args.add("%" + key + "%");
            args.add("%" + hospitalName + "%");
        }
        if (StringUtils.isNotEmpty(hospitalId)) {
            sql += " and code = ? ";
            args.add(hospitalId);
        }
        sql += " limit " + (page * pagesize) + "," + pagesize;
        List<Hospital> hosList = jdbcTemplate.query(sql, args.toArray(), new BeanPropertyRowMapper(Hospital.class));

+ 44 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/SMSService.java

@ -177,7 +177,51 @@ public class SMSService extends BaseService {
        }
        return "ok";
    }
    /**
     * 外部短信调用 发送短信验证码接口
     *
     * @param mobile 手机号
     * @param type   消息类型:11 外部接口调用
     * @return
     * @throws Exception
     */
    public String sendWithContent(String mobile, String ip, int type, String content) throws Exception {
        // 同一ip一天不允许超过10条短信
        String today = DateUtil.getStringDateShort();
        Date begin = DateUtil.strToDate(today + " 00:00:00", DateUtil.YYYY_MM_DD_HH_MM_SS);
        Date end = DateUtil.strToDate(today + " 23:59:59", DateUtil.YYYY_MM_DD_HH_MM_SS);
        // }
        // 一天的短信数不允许超过10条
        int count = smsDao.countByMobile(mobile, begin, end);
        if (count >= SystemConf.MAX_SMS_MOBILE) {
            return "当前手机号:[" + mobile + "]今天最多发送" + SystemConf.MAX_SMS_MOBILE + "条短信!";
        }
        // 保存短信发送记录
        SMS sms = new SMS();
        Date date = new Date();
        // 延后5分钟
        sms.setContent(content);
        sms.setDeadline(DateUtil.getNextMin(date, type == 10 ? 30 : 5));
        sms.setCzrq(date);
        sms.setMobile(mobile);
        sms.setIp(ip);
        sms.setType(type);
        sms.setStatus(1);
        // 调用总部发送信息的接口
        String result = HttpClientUtil.post(SystemConf.getInstance().getSmsUrl(), buildSmsParams(sms.getContent(), mobile), "GBK");
        JSONObject json = toJson(result);
        if (json == null) {
            // 发送失败
            throw new Exception("短信发送失败!");
        } else if (json.getInt("result") != 0) {
            return json.getString("description");
        } else {
            //发送成功,保存到数据库
            smsDao.save(sms);
        }
        return "ok";
    }
    /**
     * 发送短信
     *

+ 14 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/gateway/GcClientDetailsService.java

@ -0,0 +1,14 @@
package com.yihu.wlyy.service.gateway;
import com.yihu.wlyy.repository.gateway.GcClientDetailsDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * Created by chenweida on 2017/8/17.
 */
@Service
public class GcClientDetailsService {
    @Autowired
    private GcClientDetailsDao gtClientDetailsDao;
}

+ 14 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/gateway/GcTokenService.java

@ -0,0 +1,14 @@
package com.yihu.wlyy.service.gateway;
import com.yihu.wlyy.repository.gateway.GcTokenLogDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * Created by chenweida on 2017/8/17.
 */
@Service
public class GcTokenService {
    @Autowired
    private GcTokenLogDao tokenLogDao;
}

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

@ -292,7 +292,7 @@ public class DoctorController extends BaseController {
            page = page >= 1 ? page - 1 : 0;
            List<Hospital> hos = hospitalService.getHospitals(type, province, city, town, key, page, pagesize);
            List<Hospital> hos = hospitalService.getHospitals(type, province, city, town, key,null, page, pagesize);
            return write(200, "查询成功", "data", hos);
        } catch (Exception e) {

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

@ -0,0 +1,52 @@
package com.yihu.wlyy.web.gateway.controller;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.service.app.hospital.HospitalService;
import com.yihu.wlyy.web.gateway.vo.DoctorModel;
import com.yihu.wlyy.web.gateway.vo.HospitalModel;
import com.yihu.wlyy.web.gateway.vo.base.ResultOneModel;
import com.yihu.wlyy.web.gateway.vo.base.ResultPageListModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by chenweida on 2017/8/17.
 */
@RestController
@RequestMapping("/wlyygc/hospital")
@Api(description = "医院相关服务,医院,科室")
public class GcHospitalController {
    @Autowired
    private HospitalService hospitalService;
    @RequestMapping(value = "/", method = RequestMethod.GET)
    @ApiOperation("获取医院列表")
    public ResultPageListModel<HospitalModel> doctor(
            @ApiParam(name = "provinceId", value = "省(国标编码 35000)", required = false) @RequestParam(value = "provinceId", required = false) String provinceId,
            @ApiParam(name = "cityId", value = "市(国标编码 350200)", required = false) @RequestParam(value = "provinceId", required = false) String cityId,
            @ApiParam(name = "townId", value = "区(国标编码 350206)", required = false) @RequestParam(value = "townId", required = false) String townId,
            @ApiParam(name = "hospitalId", value = "机构id", required = false) @RequestParam(value = "hospitalId", required = false) String hospitalId,
            @ApiParam(name = "hospitalName", value = "机构名称(支持模糊查询)", required = false) @RequestParam(value = "hospitalName", required = false) String hospitalName,
            @ApiParam(name = "page", value = "当前页(1开始)", required = false) @RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
            @ApiParam(name = "pageSize", value = "每页大小", required = false) @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize
    ) {
        List<Hospital> hospitals = hospitalService.getHospitals(null, provinceId, cityId, townId, hospitalName, hospitalId, page, pageSize);
        List<HospitalModel> hospitalModels = new ArrayList<>();
        for (Hospital hospital : hospitals) {
            HospitalModel hospitalModel = new HospitalModel();
            BeanUtils.copyProperties(hospital, hospitalModel);
            hospitalModels.add(hospitalModel);
        }
        return new ResultPageListModel(page, pageSize, hospitalModels);
    }
}

+ 105 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcMessageController.java

@ -0,0 +1,105 @@
package com.yihu.wlyy.web.gateway.controller;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.service.common.SMSService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.util.NetworkUtil;
import com.yihu.wlyy.web.gateway.vo.DoctorModel;
import com.yihu.wlyy.web.gateway.vo.PatientModel;
import com.yihu.wlyy.web.gateway.vo.base.BaseResultModel;
import com.yihu.wlyy.web.gateway.vo.base.ResultBatchModel;
import com.yihu.wlyy.web.gateway.vo.base.ResultOneModel;
import com.yihu.wlyy.wechat.util.WeiXinTempMsgSendUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by chenweida on 2017/8/17.
 */
@RestController
@RequestMapping("/wlyygc/message")
@Api(description = "消息相关服务,包括短信,微信模板")
public class GcMessageController {
    private Logger logger= LoggerFactory.getLogger(GcMessageController.class);
    @Autowired
    private WeiXinTempMsgSendUtils weiXinTempMsgSendUtils;
    @Autowired
    private PatientService patientService;
    @Autowired
    private SMSService smsService;
    @RequestMapping(value = "/sendWXTemplate", method = RequestMethod.POST)
    @ApiOperation("给患者发送微信模板消息")
    public ResultBatchModel sendWXTemplate(
            @ApiParam(name = "codes", value = "患者code(多个逗号分割)", required = true) @RequestParam(value = "codes", required = true) String codes,
            @ApiParam(name = "templateId", value = "微信模板Id", required = true) @RequestParam(value = "templateId", required = true) String templateId,
            @ApiParam(name = "teampolateJson", value = "微信模板内容json格式", required = true) @RequestParam(value = "teampolateJson", required = true) String teampolateJson,
            @ApiParam(name = "url", value = "模板跳转的url", required = true) @RequestParam(value = "url", required = true) String url
    ) {
        Integer success = 0;
        Integer error = 0;
        List<String> errorLiust = new ArrayList<>();
        String[] codeArr = codes.split(",");
        for (String code : codeArr) {
            try {
                Patient patient = patientService.findByCode(code);
                weiXinTempMsgSendUtils.sendTemplateMessage(templateId, patient.getOpenid(), url, new JSONObject(teampolateJson));
                success++;
            } catch (Exception e) {
                logger.error("code "+code+"send Template error:"+e.getMessage());
                error++;
                errorLiust.add(code);
            }
        }
        return new ResultBatchModel(success, error, errorLiust);
    }
    @RequestMapping(value = "/sendMobileMessage", method = RequestMethod.POST)
    @ApiOperation("给手机号码发送短信消息")
    public ResultBatchModel sendMobileMessage(
            @ApiParam(name = "mobiles", value = "电话号码(批量逗号分割)", required = true) @RequestParam(value = "mobiles", required = true) String mobiles,
            @ApiParam(name = "content", value = "消息内容", required = true) @RequestParam(value = "content", required = true) String content,
            HttpServletRequest request
    ) {
        // 获取ip地址
        Integer success = 0;
        Integer error = 0;
        List<String> errorLiust = new ArrayList<>();
        try {
            String ip = NetworkUtil.getIpAddress(request);
            String[] mobileArr = mobiles.split(",");
            for (String mobile : mobileArr) {
                try {
                    smsService.sendWithContent(mobile, ip, 11, content);
                    success++;
                } catch (Exception e) {
                    logger.error("mobile "+mobile+"send message error:"+e.getMessage());
                    error++;
                    errorLiust.add(mobile);
                }
            }
            return new ResultBatchModel(success, error, errorLiust);
        } catch (Exception e) {
            return new ResultBatchModel(BaseResultModel.codeEm.error_no_ip.getCode(), "获取IP失败", success, error, errorLiust);
        }
    }
}

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

@ -0,0 +1,29 @@
package com.yihu.wlyy.web.gateway.controller;
import com.yihu.wlyy.web.gateway.vo.base.ResultOneModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by chenweida on 2017/8/17.
 * 对外的网关
 */
@RestController
@RequestMapping("/wlyygc")
@Api(description = "token相关服务")
public class GcTokenController {
    @ApiOperation("获取token")
    @RequestMapping(value = "token", method = RequestMethod.GET)
    public ResultOneModel getToken(
            @ApiParam(name = "appid", value = "appid", required = true) @RequestParam(required = true, value = "appid") String appid,
            @ApiParam(name = "appSecret", value = "appSecret", required = true) @RequestParam(required = true, value = "appSecret") String appSecret) {
        return null;
    }
}

+ 50 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcUserController.java

@ -0,0 +1,50 @@
package com.yihu.wlyy.web.gateway.controller;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.web.gateway.vo.DoctorModel;
import com.yihu.wlyy.web.gateway.vo.PatientModel;
import com.yihu.wlyy.web.gateway.vo.base.ResultOneModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * Created by chenweida on 2017/8/17.
 */
@RestController
@RequestMapping("/wlyygc/user")
@Api(description = "用户相关服务")
public class GcUserController {
    @Autowired
    private DoctorService doctorService;
    @Autowired
    private PatientService patientService;
    @RequestMapping(value = "/doctor", method = RequestMethod.GET)
    @ApiOperation("根据医生code查询医生信息")
    public ResultOneModel<DoctorModel> doctor(
            @ApiParam(name = "code", value = "医生code", required = true) @RequestParam(value = "code", required = true) String code
    ) {
        Doctor doctor = doctorService.findDoctorByCode(code);
        DoctorModel doctorModel = new DoctorModel();
        BeanUtils.copyProperties(doctor, doctorModel);
        return new ResultOneModel(doctorModel);
    }
    @RequestMapping(value = "/patient", method = RequestMethod.GET)
    @ApiOperation("根据患者code查询患者信息")
    public ResultOneModel<DoctorModel> patient(
            @ApiParam(name = "code", value = "患者code", required = true) @RequestParam(value = "code", required = true) String code
    ) {
        Patient patient = patientService.findByCode(code);
        PatientModel patientModel = new PatientModel();
        BeanUtils.copyProperties(patient, patientModel);
        return new ResultOneModel(patientModel);
    }
}

+ 317 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/DoctorModel.java

@ -0,0 +1,317 @@
package com.yihu.wlyy.web.gateway.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * Created by chenweida on 2017/8/17.
 */
@ApiModel("医生实体")
public class DoctorModel {
    @ApiModelProperty(value = "主键", required = false, access = "response")
    private String code;        // 业务主键
    @ApiModelProperty(value = "姓名", required = false, access = "response")
    private String name;        //姓名
    @ApiModelProperty(value = "性别(1男,2女)", required = false, access = "response")
    private Integer sex;        // 性别(1男,2女)
    @ApiModelProperty(value = "生日", required = false, access = "response")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date birthday;      //生日
    @ApiModelProperty(value = "头像http地址", required = false, access = "response")
    private String photo;       //头像http地址
    @ApiModelProperty(value = "手机号", required = false, access = "response")
    private String mobile;      //手机号
    @ApiModelProperty(value = "省code", required = false, access = "response")
    private String province;    //省code
    @ApiModelProperty(value = "市code", required = false, access = "response")
    private String city;         //市code
    @ApiModelProperty(value = "区县code", required = false, access = "response")
    private String town;         //区县code
    @ApiModelProperty(value = "省名称", required = false, access = "response")
    private String provinceName;//省名称
    @ApiModelProperty(value = "市名称", required = false, access = "response")
    private String cityName;    //市名称
    @ApiModelProperty(value = "区县名称", required = false, access = "response")
    private String townName;    //区县名称
    @ApiModelProperty(value = "医院代码", required = false, access = "response")
    private String hospital;        // 医院代码
    @ApiModelProperty(value = "医院名称", required = false, access = "response")
    private String hospitalName;    //医院名称
    @ApiModelProperty(value = "科室代码", required = false, access = "response")
    private String dept;            // 科室代码
    @ApiModelProperty(value = "科室名称", required = false, access = "response")
    private String deptName;        //可是名称
    @ApiModelProperty(value = "职称代码", required = false, access = "response")
    private String job;             // 职称代码
    @ApiModelProperty(value = "职称名", required = false, access = "response")
    private String jobName;         // 职称名
    @ApiModelProperty(value = "医生专长", required = false, access = "response")
    private String expertise;       // 医生专长
    @ApiModelProperty(value = "医生介绍", required = false, access = "response")
    private String introduce;       // 医生介绍
    @ApiModelProperty(value = "1专科医生,2全科医生,3健康管理师", required = false, access = "response")
    private Integer level;          // 类型:1专科医生,2全科医生,3健康管理师
    @ApiModelProperty(value = "资格是否认证通过,1是,0否", required = false, access = "response")
    private Integer iscertified;   // 资格是否认证通过,1是,0否
    @ApiModelProperty(value = "二维码", required = false, access = "response")
    private String qrcode;          // 二维码
    @ApiModelProperty(value = "身份证号", required = false, access = "response")
    private String idcard;          //身份证号
    @ApiModelProperty(value = "是否是名医", required = false, access = "response")
    private Integer isFamous;       //是否是名医 1是  0或者空不是
    @ApiModelProperty(value = "评分", required = false, access = "response")
    private Double evaluateScore;//评分
    @ApiModelProperty(value = "审方密码", required = false, access = "response")
    private String checkPassword;   //审方密码
    @ApiModelProperty(value = "审方密码的盐", required = false, access = "response")
    private String checkSalt;       //审方密码的盐
    @ApiModelProperty(value = "CA证书过期时间", required = false, access = "response")
    private Date certifiedOvertime; //CA证书过期时间
    @ApiModelProperty(value = "CA证书编号", required = false, access = "response")
    private String certificateNum;     //CA证书编号
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getSex() {
        return sex;
    }
    public void setSex(Integer sex) {
        this.sex = sex;
    }
    public Date getBirthday() {
        return birthday;
    }
    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getProvince() {
        return province;
    }
    public void setProvince(String province) {
        this.province = province;
    }
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
    public String getTown() {
        return town;
    }
    public void setTown(String town) {
        this.town = town;
    }
    public String getProvinceName() {
        return provinceName;
    }
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    public String getJob() {
        return job;
    }
    public void setJob(String job) {
        this.job = job;
    }
    public String getJobName() {
        return jobName;
    }
    public void setJobName(String jobName) {
        this.jobName = jobName;
    }
    public String getExpertise() {
        return expertise;
    }
    public void setExpertise(String expertise) {
        this.expertise = expertise;
    }
    public String getIntroduce() {
        return introduce;
    }
    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }
    public Integer getLevel() {
        return level;
    }
    public void setLevel(Integer level) {
        this.level = level;
    }
    public Integer getIscertified() {
        return iscertified;
    }
    public void setIscertified(Integer iscertified) {
        this.iscertified = iscertified;
    }
    public String getQrcode() {
        return qrcode;
    }
    public void setQrcode(String qrcode) {
        this.qrcode = qrcode;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public Integer getIsFamous() {
        return isFamous;
    }
    public void setIsFamous(Integer isFamous) {
        this.isFamous = isFamous;
    }
    public Double getEvaluateScore() {
        return evaluateScore;
    }
    public void setEvaluateScore(Double evaluateScore) {
        this.evaluateScore = evaluateScore;
    }
    public String getCheckPassword() {
        return checkPassword;
    }
    public void setCheckPassword(String checkPassword) {
        this.checkPassword = checkPassword;
    }
    public String getCheckSalt() {
        return checkSalt;
    }
    public void setCheckSalt(String checkSalt) {
        this.checkSalt = checkSalt;
    }
    public Date getCertifiedOvertime() {
        return certifiedOvertime;
    }
    public void setCertifiedOvertime(Date certifiedOvertime) {
        this.certifiedOvertime = certifiedOvertime;
    }
    public String getCertificateNum() {
        return certificateNum;
    }
    public void setCertificateNum(String certificateNum) {
        this.certificateNum = certificateNum;
    }
}

+ 172 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/HospitalModel.java

@ -0,0 +1,172 @@
package com.yihu.wlyy.web.gateway.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by chenweida on 2017/8/17.
 */
@ApiModel("医生实体")
public class HospitalModel {
    @ApiModelProperty(value = "医院編碼", required = false, access = "response")
    private String code;            // 医院編碼
    @ApiModelProperty(value = "医院名稱", required = false, access = "response")
    private String name;            // 医院名稱
    @ApiModelProperty(value = "作废标志", required = false, access = "response")
    private String del;             // 作废标志
    @ApiModelProperty(value = "省份标志", required = false, access = "response")
    private String province;        //省份标志
    @ApiModelProperty(value = "省份名称", required = false, access = "response")
    private String provinceName;    //省份名称
    @ApiModelProperty(value = "城市标志", required = false, access = "response")
    private String city;            //城市标志
    @ApiModelProperty(value = "城市名称", required = false, access = "response")
    private String cityName;        //城市名称
    @ApiModelProperty(value = "区县标志", required = false, access = "response")
    private String town;            //区县标志
    @ApiModelProperty(value = "区县名称", required = false, access = "response")
    private String townName;        //区县名称
    @ApiModelProperty(value = "级别,1医院,2社区医院", required = false, access = "response")
    private Integer level;          //级别,1医院,2社区医院
    @ApiModelProperty(value = "医院详细地址", required = false, access = "response")
    private String address;         //医院详细地址
    @ApiModelProperty(value = "医院简介", required = false, access = "response")
    private String intro;           //医院简介
    @ApiModelProperty(value = "医院图片", required = false, access = "response")
    private String photo;           //医院图片
    @ApiModelProperty(value = "街道编码", required = false, access = "response")
    private String roadCode;        //街道编码
    @ApiModelProperty(value = "中心/站点", required = false, access = "response")
    private String centerSite;      //中心/站点
    @ApiModelProperty(value = "联系电话", required = false, access = "response")
    private String phone;            //联系电话
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    public String getProvince() {
        return province;
    }
    public void setProvince(String province) {
        this.province = province;
    }
    public String getProvinceName() {
        return provinceName;
    }
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    public String getTown() {
        return town;
    }
    public void setTown(String town) {
        this.town = town;
    }
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
    public Integer getLevel() {
        return level;
    }
    public void setLevel(Integer level) {
        this.level = level;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public String getIntro() {
        return intro;
    }
    public void setIntro(String intro) {
        this.intro = intro;
    }
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    public String getRoadCode() {
        return roadCode;
    }
    public void setRoadCode(String roadCode) {
        this.roadCode = roadCode;
    }
    public String getCenterSite() {
        return centerSite;
    }
    public void setCenterSite(String centerSite) {
        this.centerSite = centerSite;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
}

+ 80 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/PatientModel.java

@ -0,0 +1,80 @@
package com.yihu.wlyy.web.gateway.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * Created by chenweida on 2017/8/17.
 */
public class PatientModel {
    // 业务主键
    @ApiModelProperty(value = "业务主键", required = false, access = "response")
    private String code;
    // 身份证号
    @ApiModelProperty(value = "身份证号", required = false, access = "response")
    private String idcard;
    // 姓名
    @ApiModelProperty(value = "姓名", required = false, access = "response")
    private String name;
    // 生日
    @ApiModelProperty(value = "生日", required = false, access = "response")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date birthday;
    // 性別,1男,2女
    @ApiModelProperty(value = "性別,1男,2女", required = false, access = "response")
    private Integer sex;
    // 手機號
    @ApiModelProperty(value = "手機號", required = false, access = "response")
    private String mobile;
    // 聯繫電話
    @ApiModelProperty(value = "聯繫電話", required = false, access = "response")
    private String phone;
    // 社保卡號
    @ApiModelProperty(value = "社保卡號", required = false, access = "response")
    private String ssc;
    // 頭像HTTP地址
    @ApiModelProperty(value = "頭像HTTP地址", required = false, access = "response")
    private String photo;
    // 省代碼
    @ApiModelProperty(value = "省代碼", required = false, access = "response")
    private String province;
    // 城市代碼
    @ApiModelProperty(value = "城市代碼", required = false, access = "response")
    private String city;
    // 區縣代碼
    @ApiModelProperty(value = "區縣代碼", required = false, access = "response")
    private String town;
    // 街道代码
    @ApiModelProperty(value = "街道代码", required = false, access = "response")
    private String street;
    // 省名
    @ApiModelProperty(value = "省名", required = false, access = "response")
    private String provinceName;
    // 市名
    @ApiModelProperty(value = "市名", required = false, access = "response")
    private String cityName;
    // 區縣名
    @ApiModelProperty(value = "區縣名", required = false, access = "response")
    private String townName;
    // 街道名称
    @ApiModelProperty(value = "街道名称", required = false, access = "response")
    private String streetName;
    // 地址
    @ApiModelProperty(value = "地址", required = false, access = "response")
    private String address;
    // 居委会字段id
    @ApiModelProperty(value = "居委会字段id", required = false, access = "response")
    private String sickVillage;
    // 居委会字段名称
    @ApiModelProperty(value = "居委会字段名称", required = false, access = "response")
    private String sickVillageName;
    //	是否绑定电子社保卡
    @ApiModelProperty(value = "是否绑定电子社保卡", required = false, access = "response")
    private Integer sicardStatus;
    //	绑定电子社保卡时间
    @ApiModelProperty(value = "绑定电子社保卡时间", required = false, access = "response")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date sicardTime;
}

+ 66 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/BaseResultModel.java

@ -0,0 +1,66 @@
package com.yihu.wlyy.web.gateway.vo.base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by chenweida on 2017/8/17.
 */
@ApiModel("返回实体")
public class BaseResultModel {
    @ApiModelProperty(value = "状态", required = false, access = "response")
    protected Integer code = codeEm.success.getCode();
    @ApiModelProperty(value = "信息", required = false, access = "response")
    protected String message = "成功";
    public Integer getCode() {
        return code;
    }
    public void setCode(Integer code) {
        this.code = code;
    }
    public String getMessage() {
        return message;
    }
    public void setMessage(String message) {
        this.message = message;
    }
    public enum codeEm {
        success(10000),//请求成功
        error_params(-10000),//请求失败 参数错误
        error_no_ip(-10010),//请求失败,获取IP失败
        token_outEffect(997),//token无效  包括过期
        token_no_power(999)// 没权限 包括未授权 或者uri错误
        ;
        codeEm(Integer code) {
            this.code = code;
        }
        private Integer code;
        public Integer getCode() {
            return code;
        }
        public void setCode(Integer code) {
            this.code = code;
        }
    }
    public BaseResultModel() {
    }
    public BaseResultModel(String message) {
        this.message = message;
    }
    public BaseResultModel(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
}

+ 65 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/ResultBatchModel.java

@ -0,0 +1,65 @@
package com.yihu.wlyy.web.gateway.vo.base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by chenweida on 2017/8/17.
 */
@ApiModel("返回实体")
public class ResultBatchModel extends BaseResultModel {
    @ApiModelProperty(value = "成功数目", required = false, access = "response")
    private Integer success = 0;
    @ApiModelProperty(value = "失败数目", required = false, access = "response")
    private Integer error = 0;
    @ApiModelProperty(value = "失败List", required = false, access = "response")
    private List<String> errorList = new ArrayList<>();
    public ResultBatchModel(Integer success, Integer error, List<String> errorList) {
        this.success = success;
        this.error = error;
        this.errorList = errorList;
    }
    public ResultBatchModel(Integer code, String message, Integer success, Integer error, List<String> errorList) {
        super(code, message);
        this.success = success;
        this.error = error;
        this.errorList = errorList;
    }
    public ResultBatchModel() {
    }
    public Integer getSuccess() {
        return success;
    }
    public void setSuccess(Integer success) {
        this.success = success;
    }
    public Integer getError() {
        return error;
    }
    public void setError(Integer error) {
        this.error = error;
    }
    public List<String> getErrorList() {
        return errorList;
    }
    public void setErrorList(List<String> errorList) {
        this.errorList = errorList;
    }
}

+ 23 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/ResultListModel.java

@ -0,0 +1,23 @@
package com.yihu.wlyy.web.gateway.vo.base;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
 * Created by chenweida on 2017/8/17.
 */
public class ResultListModel<T> extends BaseResultModel {
    @ApiModelProperty(value = "返回数据", required = false, access = "response")
    private List<T> result;
    public List<T> getResult() {
        return result;
    }
    public void setResult(List<T> result) {
        this.result = result;
    }
}

+ 29 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/ResultOneModel.java

@ -0,0 +1,29 @@
package com.yihu.wlyy.web.gateway.vo.base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by chenweida on 2017/8/17.
 * 对外放回的实体
 */
@ApiModel("返回的实体类")
public class ResultOneModel<T> extends BaseResultModel {
    @ApiModelProperty(value = "返回数据", required = false, access = "response")
    private T result;
    public T getResult() {
        return result;
    }
    public void setResult(T result) {
        this.result = result;
    }
    public ResultOneModel(T result) {
        this.result = result;
    }
}

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

@ -0,0 +1,52 @@
package com.yihu.wlyy.web.gateway.vo.base;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
 * Created by chenweida on 2017/8/17.
 */
public class ResultPageListModel<T> extends BaseResultModel {
    @ApiModelProperty(value = "当前页", required = false, access = "response")
    private Integer page;
    @ApiModelProperty(value = "每页大小", required = false, access = "response")
    private Integer pageSize;
    @ApiModelProperty(value = "返回数据", required = false, access = "response")
    private List<T> result;
    public List<T> getResult() {
        return result;
    }
    public void setResult(List<T> result) {
        this.result = result;
    }
    public Integer getPage() {
        return page;
    }
    public void setPage(Integer page) {
        this.page = page;
    }
    public Integer getPageSize() {
        return pageSize;
    }
    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
    public ResultPageListModel(Integer page, Integer pageSize, List<T> result) {
        this.page = page;
        this.pageSize = pageSize;
        this.result = result;
    }
    public ResultPageListModel() {
    }
}