|  | @ -1,5 +1,7 @@
 | 
	
		
			
				|  |  | package com.yihu.jw.care.endpoint.org;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.service.common.PermissionService;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.service.org.BaseOrgService;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.ListEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.ObjEnvelop;
 | 
	
	
		
			
				|  | @ -10,6 +12,9 @@ import io.swagger.annotations.ApiParam;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.util.List;
 | 
	
		
			
				|  |  | import java.util.Map;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /**
 | 
	
		
			
				|  |  |  * Created by yeshijie on 2021/3/3.
 | 
	
		
			
				|  |  |  */
 | 
	
	
		
			
				|  | @ -20,9 +25,11 @@ public class OrgEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BaseOrgService orgService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private PermissionService permissionService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/findOrgList", method = RequestMethod.GET)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "获取机构成员")
 | 
	
		
			
				|  |  |     @ApiOperation(value = "获取机构")
 | 
	
		
			
				|  |  |     public ListEnvelop findOrgList(@ApiParam(name = "type", value = "机构类型1. 等级医院2. 社区医院3.  养老机构 4.  托育机构")
 | 
	
		
			
				|  |  |                                       @RequestParam(value = "type", required = false) String type,
 | 
	
		
			
				|  |  |                                       @ApiParam(name = "name", value = "机构名称")
 | 
	
	
		
			
				|  | @ -30,6 +37,14 @@ public class OrgEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  |                                       @ApiParam(name = "orgCode", value = "orgCode")
 | 
	
		
			
				|  |  |                                       @RequestParam(value = "orgCode", required = false) String orgCode) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             JSONObject param = new JSONObject();
 | 
	
		
			
				|  |  |             String doctorId =  permissionService.getUID();
 | 
	
		
			
				|  |  |             param.put("doctorId",doctorId);
 | 
	
		
			
				|  |  |             if(permissionService.noPermission(0,param)){
 | 
	
		
			
				|  |  |                 return ListEnvelop.getError("该操作没有权限");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             return ListEnvelop.getSuccess("获取成功",orgService.findOrgList(type,name,orgCode));
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             return failedListEnvelopException2(e);
 | 
	
	
		
			
				|  | @ -43,11 +58,58 @@ public class OrgEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  |                                    @ApiParam(name = "orgCode", value = "orgCode")
 | 
	
		
			
				|  |  |                                    @RequestParam(value = "orgCode", required = false) String orgCode) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             JSONObject param = new JSONObject();
 | 
	
		
			
				|  |  |             String doctorId =  permissionService.getUID();
 | 
	
		
			
				|  |  |             param.put("doctorId",doctorId);
 | 
	
		
			
				|  |  |             if(permissionService.noPermission(0,param)){
 | 
	
		
			
				|  |  |                 return ObjEnvelop.getError("该操作没有权限");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             return ObjEnvelop.getSuccess("获取成功",orgService.findOrgByCode(orgCode));
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             return failedObjEnvelopException2(e);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @GetMapping(value = "/findCommunity")
 | 
	
		
			
				|  |  |     @ApiOperation(value = "获取机构社区-朝晖街道养老机构用")
 | 
	
		
			
				|  |  |     public ListEnvelop findCommunity(){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             JSONObject param = new JSONObject();
 | 
	
		
			
				|  |  |             String doctorId =  permissionService.getUID();
 | 
	
		
			
				|  |  |             param.put("doctorId",doctorId);
 | 
	
		
			
				|  |  |             if(permissionService.noPermission(0,param)){
 | 
	
		
			
				|  |  |                 return ListEnvelop.getError("该操作没有权限");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             List<Map<String, Object>> community = orgService.findCommunity();
 | 
	
		
			
				|  |  |             return success(community);
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             return failedListEnvelopException2(e);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @GetMapping(value = "/findCommunity")
 | 
	
		
			
				|  |  |     @ApiOperation(value = "获取社区成员-朝晖街道养老机构用")
 | 
	
		
			
				|  |  |     public ListEnvelop findCommunityZly(@ApiParam(name = "teamId", value = "teamId")
 | 
	
		
			
				|  |  |                                         @RequestParam(value = "teamId", required = true) String teamId){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             JSONObject param = new JSONObject();
 | 
	
		
			
				|  |  |             String doctorId =  permissionService.getUID();
 | 
	
		
			
				|  |  |             param.put("doctorId",doctorId);
 | 
	
		
			
				|  |  |             if(permissionService.noPermission(0,param)){
 | 
	
		
			
				|  |  |                 return ListEnvelop.getError("该操作没有权限");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             List<Map<String, Object>> communityZly = orgService.findCommunityZly(teamId);
 | 
	
		
			
				|  |  |             return success(communityZly);
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             return failedListEnvelopException2(e);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |