|  | @ -1,13 +1,15 @@
 | 
	
		
			
				|  |  | package com.yihu.jw.controller;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  | import com.fasterxml.jackson.annotation.JsonInclude;
 | 
	
		
			
				|  |  | import com.fasterxml.jackson.core.type.TypeReference;
 | 
	
		
			
				|  |  | import com.fasterxml.jackson.databind.ObjectMapper;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.specialist.SpecialistArticleDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.specialist.SpecialistConsultDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.specialist.SpecialistDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.specialist.SpecialistPatientRelationDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.common.Envelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.common.EnvelopRestController;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.specialist.AssistantVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.specialist.PatientLabelVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.specialist.PatientRelationVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.specialist.SpecialistPatientRelationVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.archives.PatientArchivesMapping;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.specialist.SpecialistMapping;
 | 
	
	
		
			
				|  | @ -34,13 +36,13 @@ public class SpecialistController extends EnvelopRestController {
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private Tracer tracer;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @PostMapping(value = SpecialistMapping.specialist.createSpecialists)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "创建专科医生")
 | 
	
		
			
				|  |  |     public Envelop<Boolean> createSpecialists(@ApiParam(name = "specialists", value = "专科医生实体")
 | 
	
		
			
				|  |  |                                                   @RequestParam(value = "code", required = false)String specialists){
 | 
	
		
			
				|  |  |     @PostMapping(value = SpecialistMapping.specialist.createSpecialistRelation)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "创建专科医生与患者匹配关系")
 | 
	
		
			
				|  |  |     public Envelop<Boolean> createSpecialistPatientRelation(@ApiParam(name = "specialistPatientRelation", value = "实体JSON")
 | 
	
		
			
				|  |  |                                                                 @RequestParam(value = "specialistPatientRelation", required = false)String specialistPatientRelation){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             List<SpecialistDO> infos = new ObjectMapper().readValue(specialists, new TypeReference<List<SpecialistDO>>(){});
 | 
	
		
			
				|  |  |             return specialistService.createSpecialists(infos);
 | 
	
		
			
				|  |  |             SpecialistPatientRelationDO ps = toEntity(specialistPatientRelation, SpecialistPatientRelationDO.class);
 | 
	
		
			
				|  |  |             return specialistService.createSpecialistsPatientRelation(ps);
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |             tracer.getCurrentSpan().logEvent(e.getMessage());
 | 
	
	
		
			
				|  | @ -48,13 +50,16 @@ public class SpecialistController extends EnvelopRestController {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @PostMapping(value = SpecialistMapping.specialist.createSpecialistRelation)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "创建专科医生与患者匹配关系")
 | 
	
		
			
				|  |  |     public Envelop<Boolean> createSpecialistPatientRelation(@ApiParam(name = "specialistPatientRelation", value = "实体JSON")
 | 
	
		
			
				|  |  |                                                                 @RequestParam(value = "specialistPatientRelation", required = false)String specialistPatientRelation){
 | 
	
		
			
				|  |  |     @GetMapping(value = SpecialistMapping.specialist.findSpecialistPatientRelation)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "获取专科医生关系列表")
 | 
	
		
			
				|  |  |     public Envelop<SpecialistPatientRelationVO> findSpecialistPatientRelation(@ApiParam(name = "doctor", value = "专科医生ID")
 | 
	
		
			
				|  |  |                                                                                   @RequestParam(value = "doctor", required = false)String doctor,
 | 
	
		
			
				|  |  |                                                                               @ApiParam(name = "page", value = "第几页,从1开始")
 | 
	
		
			
				|  |  |                                                                               @RequestParam(value = "page", required = false)Integer page,
 | 
	
		
			
				|  |  |                                                                               @ApiParam(name = "size", value = ",每页分页大小")
 | 
	
		
			
				|  |  |                                                                                   @RequestParam(value = "size", required = false)Integer size){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             SpecialistPatientRelationDO ps = toEntity(specialistPatientRelation, SpecialistPatientRelationDO.class);
 | 
	
		
			
				|  |  |             return specialistService.createSpecialistsPatientRelation(ps);
 | 
	
		
			
				|  |  |             return specialistService.findSpecialistPatientRelation(doctor,page,size);
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |             tracer.getCurrentSpan().logEvent(e.getMessage());
 | 
	
	
		
			
				|  | @ -62,13 +67,11 @@ public class SpecialistController extends EnvelopRestController {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @PostMapping(value = SpecialistMapping.specialist.createConsult)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "创建专科医生咨询")
 | 
	
		
			
				|  |  |     public Envelop<Boolean> createSpscialistConsult(@ApiParam(name = "specialistConsult", value = "专科医生咨询实体JSON")
 | 
	
		
			
				|  |  |                                                         @RequestParam(value = "specialistConsult", required = false)String specialistConsult){
 | 
	
		
			
				|  |  |     @GetMapping(value = SpecialistMapping.specialist.findSpecialistPatientRelationCout)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "获取专科医生下未分配标签居民数目")
 | 
	
		
			
				|  |  |     public Envelop<Long> findSpecialistPatientRelationCout(@ApiParam(name = "doctor", value = "医生") @RequestParam(required = true)String doctor){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             SpecialistConsultDO ps = toEntity(specialistConsult, SpecialistConsultDO.class);
 | 
	
		
			
				|  |  |             return specialistService.createSpscialistConsult(ps);
 | 
	
		
			
				|  |  |             return specialistService.findSpecialistPatientRelationCout(doctor);
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |             tracer.getCurrentSpan().logEvent(e.getMessage());
 | 
	
	
		
			
				|  | @ -76,13 +79,11 @@ public class SpecialistController extends EnvelopRestController {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @PostMapping(value = SpecialistMapping.specialist.createArticle)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "创建专科医生健康文章")
 | 
	
		
			
				|  |  |     public Envelop<Boolean> createSpecialistArticle(@ApiParam(name = "specialistArticle", value = "专科医生健康文章JSON")
 | 
	
		
			
				|  |  |                                                         @RequestParam(value = "specialistArticle", required = false)String specialistArticle){
 | 
	
		
			
				|  |  |     @GetMapping(value = SpecialistMapping.specialist.findNoLabelPatientRelation)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "获取专科医生下未分配标签居民")
 | 
	
		
			
				|  |  |     public Envelop<PatientRelationVO> findNoLabelPatientRelation(@ApiParam(name = "doctor", value = "医生") @RequestParam(required = true)String doctor){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             SpecialistArticleDO ps = toEntity(specialistArticle, SpecialistArticleDO.class);
 | 
	
		
			
				|  |  |             return specialistService.createSpecialistArticle(ps);
 | 
	
		
			
				|  |  |             return specialistService.findNoLabelPatientRelation(doctor);
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |             tracer.getCurrentSpan().logEvent(e.getMessage());
 | 
	
	
		
			
				|  | @ -90,16 +91,12 @@ public class SpecialistController extends EnvelopRestController {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @GetMapping(value = SpecialistMapping.specialist.findSpecialistPatientRelation)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "获取专科医生关系列表")
 | 
	
		
			
				|  |  |     public Envelop<SpecialistPatientRelationVO> findSpecialistPatientRelation(@ApiParam(name = "doctor", value = "专科医生ID")
 | 
	
		
			
				|  |  |                                                                                   @RequestParam(value = "doctor", required = false)String doctor,
 | 
	
		
			
				|  |  |                                                                               @ApiParam(name = "page", value = "第几页,从1开始")
 | 
	
		
			
				|  |  |                                                                               @RequestParam(value = "page", required = false)Integer page,
 | 
	
		
			
				|  |  |                                                                               @ApiParam(name = "size", value = ",每页分页大小")
 | 
	
		
			
				|  |  |                                                                                   @RequestParam(value = "size", required = false)Integer size){
 | 
	
		
			
				|  |  |     @PostMapping(value = SpecialistMapping.specialist.saveHealthAssistant)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "保存配置居民计管师居民")
 | 
	
		
			
				|  |  |     public Envelop<Boolean> saveHealthAssistant(@ApiParam(name = "json", value = "计管师居民实体") @RequestParam(required = true)String json){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             return specialistService.findSpecialistPatientRelation(doctor,page,size);
 | 
	
		
			
				|  |  |             List<SpecialistPatientRelationDO> info = (List<SpecialistPatientRelationDO>) JSONArray.parseArray(json, SpecialistPatientRelationDO.class);
 | 
	
		
			
				|  |  |             return specialistService.saveHealthAssistant(info);
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |             tracer.getCurrentSpan().logEvent(e.getMessage());
 | 
	
	
		
			
				|  | @ -107,5 +104,118 @@ public class SpecialistController extends EnvelopRestController {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @GetMapping(value = SpecialistMapping.specialist.findPatientRelatioByAssistant)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "根据计管师获取居民信息")
 | 
	
		
			
				|  |  |     public Envelop<PatientRelationVO> findPatientRelatioByAssistant(@ApiParam(name = "assistant", value = "计管师") @RequestParam(required = true)String assistant,
 | 
	
		
			
				|  |  |                                                                     @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true)Integer page,
 | 
	
		
			
				|  |  |                                                                     @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true)Integer size) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             return specialistService.findPatientRelatioByAssistant(assistant,page,size);
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |             tracer.getCurrentSpan().logEvent(e.getMessage());
 | 
	
		
			
				|  |  |             return Envelop.getError(e.getMessage());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @GetMapping(value = SpecialistMapping.specialist.getPatientByLabel)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "根据标签获取居民信息")
 | 
	
		
			
				|  |  |     public Envelop<PatientLabelVO>  getPatientByLabel(@ApiParam(name = "doctor", value = "医生") @RequestParam(required = true)String doctor,
 | 
	
		
			
				|  |  |                                                       @ApiParam(name = "labelType", value = "标签类型") @RequestParam(required = true)String labelType,
 | 
	
		
			
				|  |  |                                                       @ApiParam(name = "labelCode", value = "标签code") @RequestParam(required = true)String labelCode,
 | 
	
		
			
				|  |  |                                                       @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true)Integer page,
 | 
	
		
			
				|  |  |                                                       @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true)Integer size){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             return specialistService.getPatientByLabel(doctor,labelType,labelCode,page,size);
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |             tracer.getCurrentSpan().logEvent(e.getMessage());
 | 
	
		
			
				|  |  |             return Envelop.getError(e.getMessage());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @GetMapping(value = SpecialistMapping.specialist.getLabelpatientCount)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "根据标签获取居民数量")
 | 
	
		
			
				|  |  |     public Envelop<Long> getLabelpatientCount(@ApiParam(name = "doctor", value = "医生") @RequestParam(required = true)String doctor,
 | 
	
		
			
				|  |  |                                               @ApiParam(name = "labelType", value = "标签类型") @RequestParam(required = true)String labelType,
 | 
	
		
			
				|  |  |                                               @ApiParam(name = "labelCode", value = "标签code") @RequestParam(required = true)String labelCode) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             return specialistService.getLabelpatientCount(doctor,labelType,labelCode);
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |             tracer.getCurrentSpan().logEvent(e.getMessage());
 | 
	
		
			
				|  |  |             return Envelop.getError(e.getMessage());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @GetMapping(value = SpecialistMapping.specialist.getAssistantPatientCount)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "根据计管获取居民数量")
 | 
	
		
			
				|  |  |     public Envelop<Long> getAssistantPatientCount(@ApiParam(name = "doctor", value = "计管师医生") @RequestParam(required = true)String doctor) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             return specialistService.getAssistantPatientCount(doctor);
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |             tracer.getCurrentSpan().logEvent(e.getMessage());
 | 
	
		
			
				|  |  |             return Envelop.getError(e.getMessage());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @GetMapping(value = SpecialistMapping.specialist.getDoctorPatientByName)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "搜索专科医生居民")
 | 
	
		
			
				|  |  |     public Envelop<PatientRelationVO> getDoctorPatientByName(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor,
 | 
	
		
			
				|  |  |                                                              @ApiParam(name = "name", value = "居民姓名模糊") @RequestParam(required = false)String nameKey,
 | 
	
		
			
				|  |  |                                                              @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true)Integer page,
 | 
	
		
			
				|  |  |                                                              @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true)Integer size) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             return specialistService.getDoctorPatientByName(doctor,nameKey,page,size);
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |             tracer.getCurrentSpan().logEvent(e.getMessage());
 | 
	
		
			
				|  |  |             return Envelop.getError(e.getMessage());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //    @PostMapping(value = SpecialistMapping.specialist.createArticle)
 | 
	
		
			
				|  |  | //    @ApiOperation(value = "创建专科医生健康文章")
 | 
	
		
			
				|  |  | //    public Envelop<Boolean> createSpecialistArticle(@ApiParam(name = "specialistArticle", value = "专科医生健康文章JSON")
 | 
	
		
			
				|  |  | //                                                    @RequestParam(value = "specialistArticle", required = false)String specialistArticle){
 | 
	
		
			
				|  |  | //        try {
 | 
	
		
			
				|  |  | //            SpecialistArticleDO ps = toEntity(specialistArticle, SpecialistArticleDO.class);
 | 
	
		
			
				|  |  | //            return specialistService.createSpecialistArticle(ps);
 | 
	
		
			
				|  |  | //        }catch (Exception e){
 | 
	
		
			
				|  |  | //            e.printStackTrace();
 | 
	
		
			
				|  |  | //            tracer.getCurrentSpan().logEvent(e.getMessage());
 | 
	
		
			
				|  |  | //            return Envelop.getError(e.getMessage());
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  | //    }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //    @PostMapping(value = SpecialistMapping.specialist.createConsult)
 | 
	
		
			
				|  |  | //    @ApiOperation(value = "创建专科医生咨询")
 | 
	
		
			
				|  |  | //    public Envelop<Boolean> createSpscialistConsult(@ApiParam(name = "specialistConsult", value = "专科医生咨询实体JSON")
 | 
	
		
			
				|  |  | //                                                    @RequestParam(value = "specialistConsult", required = false)String specialistConsult){
 | 
	
		
			
				|  |  | //        try {
 | 
	
		
			
				|  |  | //            SpecialistConsultDO ps = toEntity(specialistConsult, SpecialistConsultDO.class);
 | 
	
		
			
				|  |  | //            return specialistService.createSpscialistConsult(ps);
 | 
	
		
			
				|  |  | //        }catch (Exception e){
 | 
	
		
			
				|  |  | //            e.printStackTrace();
 | 
	
		
			
				|  |  | //            tracer.getCurrentSpan().logEvent(e.getMessage());
 | 
	
		
			
				|  |  | //            return Envelop.getError(e.getMessage());
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  | //    }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //    @PostMapping(value = SpecialistMapping.specialist.createSpecialists)
 | 
	
		
			
				|  |  | //    @ApiOperation(value = "创建专科医生")
 | 
	
		
			
				|  |  | //    public Envelop<Boolean> createSpecialists(@ApiParam(name = "specialists", value = "专科医生实体")
 | 
	
		
			
				|  |  | //                                              @RequestParam(value = "code", required = false)String specialists){
 | 
	
		
			
				|  |  | //        try {
 | 
	
		
			
				|  |  | //            List<SpecialistDO> infos = new ObjectMapper().readValue(specialists, new TypeReference<List<SpecialistDO>>(){});
 | 
	
		
			
				|  |  | //            return specialistService.createSpecialists(infos);
 | 
	
		
			
				|  |  | //        }catch (Exception e){
 | 
	
		
			
				|  |  | //            e.printStackTrace();
 | 
	
		
			
				|  |  | //            tracer.getCurrentSpan().logEvent(e.getMessage());
 | 
	
		
			
				|  |  | //            return Envelop.getError(e.getMessage());
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  | //    }
 | 
	
		
			
				|  |  | }
 |