소스 검색

更新修改

chenweida 7 년 전
부모
커밋
90f067bbbb
16개의 변경된 파일266개의 추가작업 그리고 136개의 파일을 삭제
  1. 4 4
      common/common-entity/src/main/java/com/yihu/wlyy/entity/gateway/GtClientDetails.java
  2. 0 90
      common/common-entity/src/main/java/com/yihu/wlyy/entity/gateway/GtToken.java
  3. 1 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java
  4. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/gateway/GtClientDetailsDao.java
  5. 0 11
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/gateway/GtTokenDao.java
  6. 13 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/hospital/HospitalService.java
  7. 44 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/SMSService.java
  8. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/gateway/GtClientDetailsService.java
  9. 1 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/gateway/GtTokenService.java
  10. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java
  11. 16 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcHospitalController.java
  12. 90 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcMessageController.java
  13. 8 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcUserController.java
  14. 16 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/BaseResultModel.java
  15. 65 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/ResultBatchModel.java
  16. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/ResultOneModel.java

+ 4 - 4
common/common-entity/src/main/java/com/yihu/wlyy/entity/gateway/GtClientDetails.java

@ -17,8 +17,8 @@ import javax.persistence.Table;
 * GtClientDetails entity. @author MyEclipse Persistence Tools
 * GtClientDetails entity. @author MyEclipse Persistence Tools
 */
 */
@Entity
@Entity
@Table(name = "gt_client_details")
public class GtClientDetails extends IdEntity implements java.io.Serializable {
@Table(name = "gc_client_details")
public class GcClientDetails extends IdEntity implements java.io.Serializable {
    // Fields
    // Fields
@ -39,13 +39,13 @@ public class GtClientDetails extends IdEntity implements java.io.Serializable {
    /**
    /**
     * default constructor
     * default constructor
     */
     */
    public GtClientDetails() {
    public GcClientDetails() {
    }
    }
    /**
    /**
     * full constructor
     * full constructor
     */
     */
    public GtClientDetails(String appId, String appSecret, String appUri,
    public GcClientDetails(String appId, String appSecret, String appUri,
                           Timestamp creatieTime, String creatieUser, String createUserName,
                           Timestamp creatieTime, String creatieUser, String createUserName,
                           Timestamp updateTime, String updateUser, String updateUserName,
                           Timestamp updateTime, String updateUser, String updateUserName,
                           String remark, Integer del) {
                           String remark, Integer del) {

+ 0 - 90
common/common-entity/src/main/java/com/yihu/wlyy/entity/gateway/GtToken.java

@ -1,90 +0,0 @@
package com.yihu.wlyy.entity.gateway;
import com.yihu.wlyy.entity.IdEntity;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * GtToken entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "gt_token")
public class GtToken extends IdEntity implements java.io.Serializable {
    // Fields
    private String appid;
    private String token;
    private Date createTime;
    private Date outTime;
    private Integer del;
    // Constructors
    /**
     * default constructor
     */
    public GtToken() {
    }
    /**
     * full constructor
     */
    public GtToken(String appid, String token, Date createTime,
                   Date outTime, Integer del) {
        this.appid = appid;
        this.token = token;
        this.createTime = createTime;
        this.outTime = outTime;
        this.del = del;
    }
    @Column(name = "appid", length = 200)
    public String getAppid() {
        return this.appid;
    }
    public void setAppid(String appid) {
        this.appid = appid;
    }
    @Column(name = "token")
    public String getToken() {
        return this.token;
    }
    public void setToken(String token) {
        this.token = token;
    }
    @Column(name = "create_time", length = 0)
    public Date getCreateTime() {
        return this.createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "out_time", length = 0)
    public Date getOutTime() {
        return this.outTime;
    }
    public void setOutTime(Date outTime) {
        this.outTime = outTime;
    }
    @Column(name = "del")
    public Integer getDel() {
        return this.del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 1 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java

@ -30,8 +30,7 @@ public class SwaggerConfig {
                .forCodeGeneration(true)
                .forCodeGeneration(true)
                .pathMapping("/")
                .pathMapping("/")
                .select()
                .select()
                .paths(or(regex("/doctor/.*"),
                        regex("/PC/.*")))
                .paths(or(regex("/wlyygc/.*")))
                .build()
                .build()
                .apiInfo(gatewayApiInfo());
                .apiInfo(gatewayApiInfo());
    }
    }

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/gateway/GtClientDetailsDao.java

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

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

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

+ 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 province
     * @param city
     * @param city
     * @param town
     * @param town
     * @param key
     * @param hospitalName
     * @param page
     * @param page
     * @param pagesize
     * @param pagesize
     * @return
     * @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<>();
        List<Object> args = new ArrayList<>();
        args.add(type);
        if (type != null ) {
            sql += " and level = ? ";
            args.add(type);
        }
        if (StringUtils.isNotEmpty(province)) {
        if (StringUtils.isNotEmpty(province)) {
            sql += " and province = ? ";
            sql += " and province = ? ";
@ -108,11 +110,14 @@ public class HospitalService extends BaseService {
            sql += " and town = ? ";
            sql += " and town = ? ";
            args.add(town);
            args.add(town);
        }
        }
        if (StringUtils.isNotEmpty(key)) {
        if (StringUtils.isNotEmpty(hospitalName)) {
            sql += " and name like ? ";
            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;
        sql += " limit " + (page * pagesize) + "," + pagesize;
        List<Hospital> hosList = jdbcTemplate.query(sql, args.toArray(), new BeanPropertyRowMapper(Hospital.class));
        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";
        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";
    }
    /**
    /**
     * 发送短信
     * 发送短信
     *
     *

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/gateway/GtClientDetailsService.java

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

+ 1 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/gateway/GtTokenService.java

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

+ 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;
            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);
            return write(200, "查询成功", "data", hos);
        } catch (Exception e) {
        } catch (Exception e) {

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

@ -1,9 +1,11 @@
package com.yihu.wlyy.web.gateway.controller;
package com.yihu.wlyy.web.gateway.controller;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
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.repository.organization.HospitalDao;
import com.yihu.wlyy.service.app.hospital.HospitalService;
import com.yihu.wlyy.service.app.hospital.HospitalService;
import com.yihu.wlyy.web.gateway.vo.DoctorModel;
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.ResultOneModel;
import com.yihu.wlyy.web.gateway.vo.base.ResultPageListModel;
import com.yihu.wlyy.web.gateway.vo.base.ResultPageListModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
@ -13,6 +15,9 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
/**
 * Created by chenweida on 2017/8/17.
 * Created by chenweida on 2017/8/17.
 */
 */
@ -24,17 +29,24 @@ public class GcHospitalController {
    private HospitalService hospitalService;
    private HospitalService hospitalService;
    @RequestMapping(value = "/", method = RequestMethod.GET)
    @RequestMapping(value = "/", method = RequestMethod.GET)
    @ApiOperation("根据医生code查询医生信息")
    public ResultPageListModel<DoctorModel> doctor(
    @ApiOperation("获取医院列表")
    public ResultPageListModel<HospitalModel> doctor(
            @ApiParam(name = "provinceId", value = "省(国标编码 35000)", required = false) @RequestParam(value = "provinceId", required = false) String provinceId,
            @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 = "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 = "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 = "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 = "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
            @ApiParam(name = "pageSize", value = "每页大小", required = false) @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize
    ) {
    ) {
        return new ResultPageListModel();
        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);
    }
    }
}
}

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

@ -1,9 +1,33 @@
package com.yihu.wlyy.web.gateway.controller;
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.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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
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.
 * Created by chenweida on 2017/8/17.
 */
 */
@ -12,4 +36,70 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/wlyygc/message")
@RequestMapping("/wlyygc/message")
@Api(description = "消息相关服务,包括短信,微信模板")
@Api(description = "消息相关服务,包括短信,微信模板")
public class GcMessageController {
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);
        }
    }
}
}

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

@ -1,9 +1,11 @@
package com.yihu.wlyy.web.gateway.controller;
package com.yihu.wlyy.web.gateway.controller;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
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.DoctorService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.web.gateway.vo.DoctorModel;
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 com.yihu.wlyy.web.gateway.vo.base.ResultOneModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
@ -36,13 +38,13 @@ public class GcUserController {
    }
    }
    @RequestMapping(value = "/patient", method = RequestMethod.GET)
    @RequestMapping(value = "/patient", method = RequestMethod.GET)
    @ApiOperation("根据患者code查询医生信息")
    @ApiOperation("根据患者code查询患者信息")
    public ResultOneModel<DoctorModel> patient(
    public ResultOneModel<DoctorModel> patient(
            @ApiParam(name = "code", value = "医生code", required = true) @RequestParam(value = "code", required = true) String code
            @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);
        Patient patient = patientService.findByCode(code);
        PatientModel patientModel = new PatientModel();
        BeanUtils.copyProperties(patient, patientModel);
        return new ResultOneModel(patientModel);
    }
    }
}
}

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

@ -1,11 +1,12 @@
package com.yihu.wlyy.web.gateway.vo.base;
package com.yihu.wlyy.web.gateway.vo.base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
/**
/**
 * Created by chenweida on 2017/8/17.
 * Created by chenweida on 2017/8/17.
 */
 */
@ApiModel("返回实体")
public class BaseResultModel {
public class BaseResultModel {
    @ApiModelProperty(value = "状态", required = false, access = "response")
    @ApiModelProperty(value = "状态", required = false, access = "response")
    protected Integer code = codeEm.success.getCode();
    protected Integer code = codeEm.success.getCode();
@ -30,6 +31,8 @@ public class BaseResultModel {
    public enum codeEm {
    public enum codeEm {
        success(10000),//请求成功
        success(10000),//请求成功
        error_params(-10000),//请求失败 参数错误
        error_no_ip(-10010),//请求失败,获取IP失败
        token_outEffect(997),//token无效  包括过期
        token_outEffect(997),//token无效  包括过期
        token_no_power(999)// 没权限 包括未授权 或者uri错误
        token_no_power(999)// 没权限 包括未授权 或者uri错误
        ;
        ;
@ -48,4 +51,16 @@ public class BaseResultModel {
            this.code = 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;
    }
}

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

@ -24,4 +24,6 @@ public class ResultOneModel<T> extends BaseResultModel {
    public ResultOneModel(T result) {
    public ResultOneModel(T result) {
        this.result = result;
        this.result = result;
    }
    }
}
}