trick9191 7 år sedan
förälder
incheckning
43c904e60a

+ 8 - 0
app/public-health-server/src/main/java/com/yihu/ehr/health/constant/ServiceApi.java

@ -13,4 +13,12 @@ public class ServiceApi {
        public SystemDict() {
        }
    }
    public static class Archives{
        public static final String basePath = "/wg/archives";
        public static final String findPatientArchives =basePath+ "/findPatientArchives";
        public static final String findPatientArchivesInfos =basePath+ "/findPatientArchivesInfos";
        public static final String createPatientArchives = basePath+ "/createPatientArchives";
        public static final String updatePatientArchives = basePath+ "/updatePatientArchives";
        public Archives(){}
    }
}

+ 87 - 0
app/public-health-server/src/main/java/com/yihu/ehr/health/controller/archives/ArchivesController.java

@ -0,0 +1,87 @@
package com.yihu.ehr.health.controller.archives;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.health.service.archives.ArchivesService;
import com.yihu.jw.restmodel.archives.PatientArchivesInfoVO;
import com.yihu.jw.restmodel.archives.PatientArchivesVO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.rm.archives.PatientArchivesMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * Created by Trick on 2018/2/22.
 */
@RestController
@RequestMapping(PatientArchivesMapping.api_archives_common)
@Api(tags = "居民建档相关操作", description = "居民建档相关操作")
public class ArchivesController {
    @Autowired
    private ArchivesService archivesService;
    @GetMapping(value = PatientArchivesMapping.Archives.findPatientArchives)
    @ApiOperation(value = "查询健康信息列表")
    public Envelop<PatientArchivesVO> findPatientArchives(@ApiParam(name = "name", value = "姓名(模糊匹配)")
                                                          @RequestParam(value = "name", required = false)String name,
                                                          @ApiParam(name = "status", value = "档案状态")
                                                          @RequestParam(value = "status", required = false)String status,
                                                          @ApiParam(name = "cancelReseanType", value = "注销状态")
                                                          @RequestParam(value = "cancelReseanType", required = false)String cancelReseanType,
                                                          @ApiParam(name = "page", value = "分页") @RequestParam(value = "page", required = false)Integer page,
                                                          @ApiParam(name = "size", value = "每一页大小")@RequestParam(value = "size", required = false )Integer size){
        try {
            return archivesService.queryPatientArchivesPage(page,size,status, cancelReseanType ,name);
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = PatientArchivesMapping.Archives.findPatientArchivesInfos)
    @ApiOperation(value = "查询健康信息详情列表")
    public Envelop<PatientArchivesInfoVO> queryPatientArchivesInfoPage(@ApiParam(name = "code", value = "档案编号")
                                                                       @RequestParam(value = "code", required = false)String code){
        try {
            return archivesService.queryPatientArchivesInfoPage(code);
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = PatientArchivesMapping.Archives.createPatientArchives)
    @ApiOperation(value = "创建健康信息详情列表")
    public Envelop<Boolean> createPatientArchives(@ApiParam(name = "patientArchives", value = "建档基本信息Json")
                                                  @RequestParam(value = "patientArchives", required = true)String patientArchives,
                                                  @ApiParam(name = "list", value = "建档详情Json")
                                                  @RequestParam(value = "list", required = true)String list){
        try {
            return archivesService.createPatientArchives(patientArchives,list);
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
    @PutMapping(value = PatientArchivesMapping.Archives.updatePatientArchives)
    @ApiOperation(value = "更新健康信息详情列表")
    public Envelop<Boolean> updatePatientArchives(@ApiParam(name = "patientArchives", value = "建档基本信息Json")
                                                  @RequestParam(value = "patientArchives", required = true)String patientArchives,
                                                  @ApiParam(name = "list", value = "建档详情")
                                                  @RequestParam(value = "list", required = true)String list){
        try {
            return archivesService.updatePatientArchives(patientArchives,list);
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
}

+ 80 - 0
app/public-health-server/src/main/java/com/yihu/ehr/health/service/archives/ArchivesService.java

@ -0,0 +1,80 @@
package com.yihu.ehr.health.service.archives;
import com.yihu.ehr.health.constant.ServiceApi;
import com.yihu.ehr.health.service.common.BaseService;
import com.yihu.ehr.health.util.http.HttpHelper;
import com.yihu.ehr.health.util.http.HttpResponse;
import com.yihu.jw.restmodel.archives.PatientArchivesInfoVO;
import com.yihu.jw.restmodel.archives.PatientArchivesVO;
import com.yihu.jw.restmodel.archives.dict.SystemDictVO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.device.IotDeviceVO;
import com.yihu.jw.rm.archives.PatientArchivesMapping;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.util.*;
/**
 * Created by Trick on 2018/2/22.
 */
@Service
public class ArchivesService extends BaseService{
    /**
     * 分页查找健康档案
     * @param page
     * @param size
     * @param status
     * @param name
     * @return
     * @throws ParseException
     */
    public Envelop<PatientArchivesVO> queryPatientArchivesPage(Integer page, Integer size, String status, String cancelReseanType , String name) throws Exception {
        Map<String, Object> params = new HashMap<>();
        params.put("page", page);
        params.put("size", size);
        params.put("status", status);
        params.put("cancelReseanType", cancelReseanType);
        params.put("name", name);
        HttpResponse response = HttpHelper.get(archivesInnerUrl + ServiceApi.Archives.findPatientArchives, params);
        Envelop<PatientArchivesVO> envelop = objectMapper.readValue(response.getBody(),Envelop.class);
        return envelop;
    }
    /**
     * 获取档案详情
     * @return
     * @throws ParseException
     */
    public Envelop<PatientArchivesInfoVO> queryPatientArchivesInfoPage(String code) throws Exception {
        Map<String, Object> params = new HashMap<>();
        params.put("page", code);
        HttpResponse response = HttpHelper.get(archivesInnerUrl + ServiceApi.Archives.findPatientArchivesInfos, params);
        Envelop<PatientArchivesInfoVO> envelop = objectMapper.readValue(response.getBody(),Envelop.class);
        return envelop;
    }
    public Envelop<Boolean> createPatientArchives(String patientArchives,String list)throws Exception {
        Map<String, Object> params = new HashMap<>();
        params.put("patientArchives", patientArchives);
        params.put("list", list);
        HttpResponse response = HttpHelper.get(archivesInnerUrl + ServiceApi.Archives.createPatientArchives, params);
        Envelop<Boolean> envelop = objectMapper.readValue(response.getBody(),Envelop.class);
        return envelop;
    }
    public  Envelop<Boolean> updatePatientArchives(String patientArchives,String list)throws Exception {
        Map<String, Object> params = new HashMap<>();
        params.put("patientArchives", patientArchives);
        params.put("list", list);
        HttpResponse response = HttpHelper.get(archivesInnerUrl + ServiceApi.Archives.createPatientArchives, params);
        Envelop<Boolean> envelop = objectMapper.readValue(response.getBody(),Envelop.class);
        return envelop;
    }
}

+ 4 - 0
app/public-health-server/src/main/java/com/yihu/ehr/health/service/common/BaseService.java

@ -48,12 +48,16 @@ public class BaseService {
    protected String portalInnerUrl;
    @Value("${service-gateway.portalOuterUrl}")
    protected String portalOuterUrl;
    @Value("${service-gateway.archivesInnerUrl}")
    protected String archivesInnerUrl;
    @Value("${service-gateway.iotUrl}")
    protected String iotUrl;
    @Value("${app.oauth2InnerUrl}")
    protected String oauth2InnerUrl;
    @Value("${app.oauth2OuterUrl}")
    protected String oauth2OuterUrl;
    @Autowired
    private CurrentRequest currentRequest;

+ 3 - 1
app/public-health-server/src/main/resources/application.yml

@ -65,7 +65,7 @@ service-gateway:
  profileOuterUrl: http://27.154.233.186:10000/api/v1.0/admin
  portalInnerUrl: http://172.19.103.73:10280/api/v1.0/portal
  portalOuterUrl: http://27.154.233.186:10280/api/v1.0/portal
  archivesInnerUrl: http://localhost:8088/svr-archives
fast-dfs:
  tracker-server: 172.19.103.54:22122
@ -90,6 +90,7 @@ service-gateway:
  profileOuterUrl: http://27.154.233.186:10000/api/v1.0/admin
  portalInnerUrl: http://172.19.103.73:10280/api/v1.0/portal
  portalOuterUrl: http://27.154.233.186:10280/api/v1.0/portal
  archivesInnerUrl: http://localhost:8088/svr-archives
fast-dfs:
  tracker-server: 172.19.103.54:22122
  public-server: http://172.19.103.54:80/
@ -113,6 +114,7 @@ service-gateway:
  profileOuterUrl: http://27.154.233.186:10000/api/v1.0/admin
  portalInnerUrl: http://172.19.103.73:10280/api/v1.0/portal
  portalOuterUrl: http://27.154.233.186:10280/api/v1.0/portal
  archivesInnerUrl: http://localhost:8088/svr-archives
fast-dfs:
  tracker-server: 11.1.2.9:22122
  accessUrl: http://11.1.2.9

+ 30 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/archives/PatientArchives.java

@ -2,6 +2,7 @@ package com.yihu.jw.entity.archives;
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
@ -13,34 +14,61 @@ import java.util.Date;
@Entity
@Table(name = "wlyy_patient_archives")
public class PatientArchives extends IdEntityWithOperation implements Serializable {
    @Column(name = "saas_id")
    private String saasId; //saasid
    @Column(name = "patient_code")
    private String patientCode;//关联居民登录code
    @Column(name = "patient_name")
    private String patientName;//姓名
    @Column(name = "idcard")
    private String idcard;//身份证号
    @Column(name = "birthday")
    private Date birthday;//生日
    @Column(name = "sex")
    private String sex;//int(11) DEFAULT NULL COMMENT '性别,1男,2女
    @Column(name = "mobile")
    private String mobile;//手机号
    @Column(name = "ssc")
    private String ssc;//社保卡号
    @Column(name = "status")
    private String status;//int(11) DEFAULT NULL COMMENT '档案状态:1正常,0注销
    @Column(name = "cancel_resean_type")
    private String cancelReseanType;//注销原因:1死亡,2.重复
    @Column(name = "sick_village")
    private String sickVillage;//居委会代码(字典)
    @Column(name = "sick_village_name")
    private String sickVillageName;//居委会
    @Column(name = "resident_type")
    private String residentType;//常住类型 :1户籍,2非户籍
    @Column(name = "blood")
    private String blood;//血型:A,AB,O,B,N(不详)
    @Column(name = "RH")
    private String RH;//1,阴性;2阳性;0 不详
    @Column(name = "nation_code")
    private String nationCode;//民族code(字典)
    @Column(name = "nation")
    private String nation;//民族名称
    @Column(name = "work_place")
    private String workPlace;//工作地点
    @Column(name = "contact_people")
    private String contactPeople;//联系人
    @Column(name = "contact_mobile")
    private String contactMobile;//联系人电话
    @Column(name = "education_code")
    private String educationCode;//文化程度(字典)
    @Column(name = "education")
    private String education;//文化程度
    @Column(name = "profession_code")
    private String professionCode;//职业(字典)
    private String profession;//职业·
    @Column(name = "profession")
    private String profession;//职业
    @Column(name = "marriage_code")// ·
    private String marriageCode;//婚姻状况(字典)
    @Column(name = "marriage")
    private String marriage;//婚姻状况
    @Column(name = "payment_code")
    private String paymentCode;//支付方式(字典)
    @Column(name = "payment")
    private String payment;// 支付方式

+ 9 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/archives/PatientArchivesInfo.java

@ -2,6 +2,7 @@ package com.yihu.jw.entity.archives;
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
@ -14,13 +15,21 @@ import java.util.Date;
@Table(name = "wlyy_patient_archives_info")
public class PatientArchivesInfo extends IdEntityWithOperation implements Serializable {
    @Column(name = "saas_id")
    private String saasId; //saasid
    @Column(name = "archives_code")
    private String archivesCode; //档案code
    @Column(name = "level1")
    private String level1;//1.历史情况,2.既往史,3.家族史,4.生活环境
    @Column(name = "level2")
    private String level2; //子类别
    @Column(name = "key")
    private String key; //字典值,或判断值(有,无)
    @Column(name = "value")
    private String value; //字典名称
    @Column(name = "date")
    private Date date;//关联时间
    @Column(name = "remark")
    private String remark; //备注/其他/描述/详情

+ 2 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/CommonContants.java

@ -7,8 +7,9 @@ public class CommonContants {
    //微服务的id start
    public static final String svr_base = "svr-base";
    public static final String svr_iot = "svr-iot-ysj";
    public static final String svr_iot = "svr-iot";
    public static final String svr_wlyy = "svr-wlyy";
    public static final String svr_gateway = "svr-gateway";
    public static final String svr_archives = "svr-wlyy-archives";
}

+ 3 - 0
svr/svr-wlyy-archives/src/main/java/com/yihu/jw/config/jpa/WlyyArchivesJpa.java

@ -15,6 +15,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import java.util.Properties;
/**
 * Created by chenweida on 2017/4/6.
@ -40,6 +41,8 @@ public class WlyyArchivesJpa {
        emfb.setPersistenceUnitName("archives");
        JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
        emfb.setJpaVendorAdapter(vendorAdapter);
        Properties properties = hibernateProperties.hibProperties();
        properties.put("hibernate.ejb.naming_strategy","org.hibernate.cfg.ImprovedNamingStrategy");
        emfb.setJpaProperties(hibernateProperties.hibProperties());
        return emfb;

+ 24 - 14
svr/svr-wlyy-archives/src/main/java/com/yihu/jw/controller/PatientArchivesController.java

@ -1,6 +1,10 @@
package com.yihu.jw.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.archives.PatientArchives;
import com.yihu.jw.entity.archives.PatientArchivesInfo;
import com.yihu.jw.iot.device.IotDeviceQualityInspectionPlanDO;
@ -9,6 +13,7 @@ import com.yihu.jw.restmodel.archives.PatientArchivesVO;
import com.yihu.jw.restmodel.archives.Test;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.iot.device.IotDeviceImportVO;
import com.yihu.jw.rm.archives.PatientArchivesMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.service.PatientArchivesSevice;
@ -16,10 +21,8 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@ -33,7 +36,8 @@ import java.util.List;
public class PatientArchivesController extends EnvelopRestController {
    @Autowired
    private PatientArchivesSevice patientArchivesSevice;
    @Autowired
    private Tracer tracer;
    @GetMapping(value = "test")
    @ApiOperation(value = "测试")
    public Test test(){
@ -57,6 +61,7 @@ public class PatientArchivesController extends EnvelopRestController {
            return patientArchivesSevice.queryPatientArchivesPage(page,size,status, cancelReseanType ,name);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
@ -69,39 +74,44 @@ public class PatientArchivesController extends EnvelopRestController {
            return patientArchivesSevice.queryPatientArchivesInfoPage(code);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = PatientArchivesMapping.Archives.createPatientArchives)
    @PostMapping(value = PatientArchivesMapping.Archives.createPatientArchives)
    @ApiOperation(value = "创建健康信息详情列表")
    public Envelop<Boolean> createPatientArchives(@ApiParam(name = "patientArchives", value = "建档基本信息Json")
                                                  @RequestParam(value = "patientArchives", required = true)String patientArchives,
                                                  @ApiParam(name = "list", value = "建档详情")
                                                  @RequestParam(value = "list", required = true)List<PatientArchivesInfoVO> list){
                                                  @ApiParam(name = "list", value = "建档详情Json")
                                                  @RequestParam(value = "list", required = true)String list){
        try {
            PatientArchives ps = toEntity(patientArchives, PatientArchives.class);
            List<PatientArchivesInfo> infos = new ArrayList<>();
            convertToModels(list,infos,PatientArchivesInfo.class);
            List<PatientArchivesInfo> infos = new ObjectMapper().readValue(list, new TypeReference<List<PatientArchivesInfo>>(){});
            return patientArchivesSevice.createPatientArchives(ps,infos);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = PatientArchivesMapping.Archives.updatePatientArchives)
    @PutMapping(value = PatientArchivesMapping.Archives.updatePatientArchives)
    @ApiOperation(value = "更新健康信息详情列表")
    public Envelop<Boolean> updatePatientArchives(@ApiParam(name = "patientArchives", value = "建档基本信息Json")
                                                  @RequestParam(value = "patientArchives", required = true)String patientArchives,
                                                  @ApiParam(name = "list", value = "建档详情")
                                                  @RequestParam(value = "list", required = true)List<PatientArchivesInfoVO> list){
                                                  @RequestParam(value = "list", required = true)String list){
        try {
            PatientArchives ps = toEntity(patientArchives, PatientArchives.class);
            List<PatientArchivesInfo> infos = new ArrayList<>();
            convertToModels(list,infos,PatientArchivesInfo.class);
            List<PatientArchivesInfo> infos = new ObjectMapper().readValue(list, new TypeReference<List<PatientArchivesInfo>>(){});
            return patientArchivesSevice.updatePatientArchives(ps,infos);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }

+ 4 - 7
svr/svr-wlyy-archives/src/main/java/com/yihu/jw/service/PatientArchivesSevice.java

@ -6,21 +6,18 @@ import com.yihu.jw.dao.PatientArchivesDao;
import com.yihu.jw.dao.PatientArchivesInfoDao;
import com.yihu.jw.entity.archives.PatientArchives;
import com.yihu.jw.entity.archives.PatientArchivesInfo;
import com.yihu.jw.iot.company.IotCompanyDO;
import com.yihu.jw.restmodel.archives.PatientArchivesInfoVO;
import com.yihu.jw.restmodel.archives.PatientArchivesVO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.company.IotCompanyTypeVO;
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
import com.yihu.jw.rm.archives.PatientArchivesMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.awt.*;
import javax.persistence.EntityManager;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collection;
@ -38,6 +35,7 @@ public class PatientArchivesSevice extends BaseJpaService<PatientArchives,Patien
    @Autowired
    private PatientArchivesDao patientArchivesDao;
    /**
     * 分页查找健康档案
     * @param page
@ -58,7 +56,7 @@ public class PatientArchivesSevice extends BaseJpaService<PatientArchives,Patien
            filters += semicolon +"status="+status;
            semicolon = ";";
        }
        if(StringUtils.isBlank(cancelReseanType)){
        if(StringUtils.isNotBlank(cancelReseanType)){
            filters+= semicolon + "cancelReseanType="+cancelReseanType+"";
            semicolon = ";";
        }
@ -68,7 +66,6 @@ public class PatientArchivesSevice extends BaseJpaService<PatientArchives,Patien
        //获取总数
        long count = getCount(filters);
        //DO转VO
        List<PatientArchivesVO> patientArchivesVOs = convertToModelVOs(list,new ArrayList<>(list.size()));

+ 15 - 0
web-gateway/src/main/java/com/yihu/jw/commnon/archives/ArchivesContants.java

@ -0,0 +1,15 @@
package com.yihu.jw.commnon.archives;
/**
 * Created by Trick on 2018/2/12.
 */
public class ArchivesContants {
    public static final String api_archives_common = "svr-archives";
    /**
     * 公共模块
     */
    public static class Common{
        public static final String archives = api_archives_common + "/wg/archives";
    }
}

+ 68 - 0
web-gateway/src/main/java/com/yihu/jw/controller/archives/ArchivesController.java

@ -0,0 +1,68 @@
package com.yihu.jw.controller.archives;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.yihu.jw.commnon.archives.ArchivesContants;
import com.yihu.jw.feign.archives.ArchivesFeign;
import com.yihu.jw.restmodel.archives.PatientArchivesInfoVO;
import com.yihu.jw.restmodel.archives.PatientArchivesVO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.rm.archives.PatientArchivesMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * Created by Trick on 2018/2/12.
 */
@RestController
@RequestMapping(ArchivesContants.Common.archives)
@Api(tags = "居民建档相关操作", description = "居民建档相关操作")
public class ArchivesController {
    @Autowired
    private ArchivesFeign archivesFeign;
    @GetMapping(value = PatientArchivesMapping.Archives.findPatientArchives)
    @ApiOperation(value = "分页查找档案列表", notes = "分页查找档案列表")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop<PatientArchivesVO> findPatientArchives(@RequestParam(value = "name", required = false)String name,
                                                          @RequestParam(value = "status", required = false)String status,
                                                          @RequestParam(value = "cancelReseanType", required = false)String cancelReseanType,
                                                          @RequestParam(value = "page", required = false)Integer page,
                                                          @RequestParam(value = "size", required = false )Integer size){
        return archivesFeign.findPatientArchives(name,status,cancelReseanType,page,size);
    }
    @GetMapping(value = PatientArchivesMapping.Archives.findPatientArchivesInfos)
    @ApiOperation(value = "查询健康信息详情列表", notes = "查询健康信息详情列表")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop<PatientArchivesInfoVO> queryPatientArchivesInfoPage(@RequestParam(value = "code", required = false)String code){
        return archivesFeign.queryPatientArchivesInfoPage(code);
    }
    @PostMapping(value = PatientArchivesMapping.Archives.createPatientArchives)
    @ApiOperation(value = "创建健康信息详情列表")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop<Boolean> createPatientArchives(@RequestParam(value = "patientArchives", required = true)String patientArchives,
                                                  @RequestParam(value = "list", required = true)String list){
        return archivesFeign.createPatientArchives(patientArchives,list);
    }
    @PutMapping(value = PatientArchivesMapping.Archives.updatePatientArchives)
    @ApiOperation(value = "更新健康信息详情列表")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop<Boolean> updatePatientArchives(@RequestParam(value = "patientArchives", required = true)String patientArchives,
                                                  @RequestParam(value = "list", required = true)String list){
        return archivesFeign.updatePatientArchives(patientArchives,list);
    }
}

+ 42 - 0
web-gateway/src/main/java/com/yihu/jw/feign/archives/ArchivesFeign.java

@ -0,0 +1,42 @@
package com.yihu.jw.feign.archives;
import com.yihu.jw.feign.fallbackfactory.archives.ArchivesFallbackFactory;
import com.yihu.jw.feign.fallbackfactory.iot.company.IotCompanyFallbackFactory;
import com.yihu.jw.restmodel.CommonContants;
import com.yihu.jw.restmodel.archives.PatientArchivesInfoVO;
import com.yihu.jw.restmodel.archives.PatientArchivesVO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.rm.archives.PatientArchivesMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;
/**
 * Created by Trick on 2018/2/12.
 */
@FeignClient(
        name = CommonContants.svr_archives // name值是eurika的实例名字
        ,fallbackFactory  = ArchivesFallbackFactory.class
)
@RequestMapping(PatientArchivesMapping.api_archives_common)
public interface ArchivesFeign {
    @GetMapping(value = PatientArchivesMapping.Archives.findPatientArchives)
    public Envelop<PatientArchivesVO> findPatientArchives(@RequestParam(value = "name", required = false)String name,
                                                          @RequestParam(value = "status", required = false)String status,
                                                          @RequestParam(value = "cancelReseanType", required = false)String cancelReseanType,
                                                          @RequestParam(value = "page", required = false)Integer page,
                                                         @RequestParam(value = "size", required = false )Integer size);
    @GetMapping(value = PatientArchivesMapping.Archives.findPatientArchivesInfos)
    public Envelop<PatientArchivesInfoVO> queryPatientArchivesInfoPage(@RequestParam(value = "code", required = false)String code);
    @PostMapping(value = PatientArchivesMapping.Archives.createPatientArchives)
    public Envelop<Boolean> createPatientArchives(@RequestParam(value = "patientArchives", required = true)String patientArchives,
                                                  @RequestParam(value = "list", required = true)String list);
    @PutMapping(value = PatientArchivesMapping.Archives.updatePatientArchives)
    public Envelop<Boolean> updatePatientArchives(@RequestParam(value = "patientArchives", required = true)String patientArchives,
                                                  @RequestParam(value = "list", required = true)String list);
}

+ 69 - 0
web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/archives/ArchivesFallbackFactory.java

@ -0,0 +1,69 @@
package com.yihu.jw.feign.fallbackfactory.archives;
import com.yihu.jw.feign.archives.ArchivesFeign;
import com.yihu.jw.feign.iot.company.IotCompanyFeign;
import com.yihu.jw.restmodel.archives.PatientArchivesInfoVO;
import com.yihu.jw.restmodel.archives.PatientArchivesVO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.rm.archives.PatientArchivesMapping;
import feign.hystrix.FallbackFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * Created by Trick on 2018/2/22.
 */
@Component
public class ArchivesFallbackFactory implements FallbackFactory<ArchivesFeign> {
    @Autowired
    private Tracer tracer;
    @Override
    public ArchivesFeign create(Throwable e){
        return new ArchivesFeign() {
            @Override
            public Envelop<PatientArchivesVO> findPatientArchives(@RequestParam(value = "name", required = false)String name,
                                                                  @RequestParam(value = "status", required = false)String status,
                                                                  @RequestParam(value = "cancelReseanType", required = false)String cancelReseanType,
                                                                  @RequestParam(value = "page", required = false)Integer page,
                                                                  @RequestParam(value = "size", required = false )Integer size){
                tracer.getCurrentSpan().logEvent("查找档案列表失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("name:" + name);
                tracer.getCurrentSpan().logEvent("status:" + status);
                tracer.getCurrentSpan().logEvent("cancelReseanType:" + cancelReseanType);
                tracer.getCurrentSpan().logEvent("page:" + page);
                tracer.getCurrentSpan().logEvent("size:" + size);
                return null;
            }
            @Override
            public Envelop<PatientArchivesInfoVO> queryPatientArchivesInfoPage(@RequestParam(value = "code", required = false)String code){
                tracer.getCurrentSpan().logEvent("查找档案详情接口失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("code:" + code);
                return null;
            }
            @Override
            public Envelop<Boolean> createPatientArchives(@RequestParam(value = "patientArchives", required = true)String patientArchives,
                                                          @RequestParam(value = "list", required = true)String list){
                tracer.getCurrentSpan().logEvent("创建失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("patientArchives:" + patientArchives);
                tracer.getCurrentSpan().logEvent("list:" + list);
                return null;
            }
            @Override
            public Envelop<Boolean> updatePatientArchives(@RequestParam(value = "patientArchives", required = true)String patientArchives,
                                                          @RequestParam(value = "list", required = true)String list){
                tracer.getCurrentSpan().logEvent("更新档案失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("patientArchives:" + patientArchives);
                tracer.getCurrentSpan().logEvent("list:" + list);
                return null;
            }
        };
    }
}