|  | @ -2,6 +2,7 @@ package com.yihu.wlyy.web.doctor.team;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.doctor.profile.Doctor;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.patient.Patient;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.app.account.DoctorInfoService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.app.team.AdminTeamService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.web.BaseController;
 | 
	
	
		
			
				|  | @ -45,17 +46,6 @@ public class AdminTeamController extends BaseController {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /*@ResponseBody
 | 
	
		
			
				|  |  |     @RequestMapping(method = RequestMethod.GET)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "团队列表")
 | 
	
		
			
				|  |  |     public String getTeamList(
 | 
	
		
			
				|  |  |             @RequestParam("filter") String filter,
 | 
	
		
			
				|  |  |             @RequestParam("order") String order,
 | 
	
		
			
				|  |  |             @RequestParam("page") int page,
 | 
	
		
			
				|  |  |             @RequestParam("size") int pageSize) {
 | 
	
		
			
				|  |  |         return null;
 | 
	
		
			
				|  |  |     }*/
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @RequestMapping(method = RequestMethod.POST)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "创建团队")
 | 
	
		
			
				|  |  |     public String createTeam(@RequestParam("team_name") String teamName,
 | 
	
	
		
			
				|  | @ -73,7 +63,7 @@ public class AdminTeamController extends BaseController {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/{team_id}/name", method = RequestMethod.PUT)
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/{team_id}/name", method = RequestMethod.POST)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "更新团队名称")
 | 
	
		
			
				|  |  |     public String updateTeamName(@PathVariable("team_id") long teamId,
 | 
	
		
			
				|  |  |                                  @RequestParam("team_name") String teamName) {
 | 
	
	
		
			
				|  | @ -87,7 +77,7 @@ public class AdminTeamController extends BaseController {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/{team_id}/leader", method = RequestMethod.PUT)
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/{team_id}/leader", method = RequestMethod.POST)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "更新团队领导")
 | 
	
		
			
				|  |  |     public String updateTeamLeader(@PathVariable("team_id") long teamId,
 | 
	
		
			
				|  |  |                                    @RequestParam("doctor_code") String doctorCode) {
 | 
	
	
		
			
				|  | @ -115,11 +105,14 @@ public class AdminTeamController extends BaseController {
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/{team_id}/members", method = RequestMethod.POST)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "添加团队成员")
 | 
	
		
			
				|  |  |     @ApiOperation(value = "添加团队成员,批量添加使用逗号分隔列表")
 | 
	
		
			
				|  |  |     public String addMember(@PathVariable("team_id") long teamId,
 | 
	
		
			
				|  |  |                             @RequestParam("doctor_code") String doctorCode) {
 | 
	
		
			
				|  |  |                             @RequestParam("doctor_code") String doctorCodeList) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             teamService.addMember(teamId, doctorCode);
 | 
	
		
			
				|  |  |             String doctorCodes[] = doctorCodeList.split(",");
 | 
	
		
			
				|  |  |             for (String doctorCode : doctorCodes) {
 | 
	
		
			
				|  |  |                 teamService.addMember(teamId, doctorCode);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             return write(200, "OK", "data", "");
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
	
		
			
				|  | @ -141,8 +134,24 @@ public class AdminTeamController extends BaseController {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/{team_id}/members/{doctor_code}", method = RequestMethod.DELETE)
 | 
	
		
			
				|  |  |     @ResponseStatus(HttpStatus.NO_CONTENT)
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/{team_id}/members/excluded", method = RequestMethod.GET)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "获取机构内不在特定团队的医生")
 | 
	
		
			
				|  |  |     public String getExcludedTeamMembers(@RequestParam("org_code") String orgCode,
 | 
	
		
			
				|  |  |                                          @PathVariable("team_id") long teamId,
 | 
	
		
			
				|  |  |                                          @RequestParam(value = "page", required = false, defaultValue = "1") int page,
 | 
	
		
			
				|  |  |                                          @RequestParam(value = "size", required = false, defaultValue = "10") int size) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             page = page <= 0 ? 0 : page - 1;
 | 
	
		
			
				|  |  |             List<Doctor> members = memberService.getExcludedMembers(orgCode, teamId, page, size);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             return write(200, "OK", "data", new JSONArray(members));
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             error(e);
 | 
	
		
			
				|  |  |             return error(-1, e.getMessage());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/{team_id}/members/{doctor_code}/remove", method = RequestMethod.POST)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "移除成员")
 | 
	
		
			
				|  |  |     public String removeMember(@PathVariable("team_id") long teamId,
 | 
	
		
			
				|  |  |                                @PathVariable("doctor_code") String doctorCode) {
 | 
	
	
		
			
				|  | @ -172,13 +181,30 @@ public class AdminTeamController extends BaseController {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/teams/{team_id}/signing/count", method = RequestMethod.GET)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "获取团队医生的队内签约数量")
 | 
	
		
			
				|  |  |     public String getDoctorSignPatientCount(@PathVariable("team_id") long teamId){
 | 
	
		
			
				|  |  |         try{
 | 
	
		
			
				|  |  |     public String getDoctorSignPatientCount(@PathVariable("team_id") long teamId) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             List<Doctor> members = memberService.getMembers(teamId);
 | 
	
		
			
				|  |  |             Map<String, Integer> counts = memberService.getMemberSigningCount(members);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             return write(200, "OK", "data", new JSONObject(counts));
 | 
	
		
			
				|  |  |         } catch (Exception e){
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             error(e);
 | 
	
		
			
				|  |  |             return error(-1, e.getMessage());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/teams/{team_id}/members/{doctor_code}/signing", method = RequestMethod.GET)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "获取团队医生的队内签约患者列表")
 | 
	
		
			
				|  |  |     public String getDoctorSignPatients(@PathVariable("team_id") long teamId,
 | 
	
		
			
				|  |  |                                         @PathVariable("doctor_code") String doctorCode,
 | 
	
		
			
				|  |  |                                         @RequestParam(value = "page", defaultValue = "1", required = false) int page,
 | 
	
		
			
				|  |  |                                         @RequestParam(value = "size", defaultValue = "10", required = false) int size) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             page = page <= 0 ? 0 : page - 1;
 | 
	
		
			
				|  |  |             List<Patient> patients = memberService.getMemberSigningPatients(teamId, doctorCode, page, size);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             return write(200, "OK", "data", new JSONArray(patients));
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             error(e);
 | 
	
		
			
				|  |  |             return error(-1, e.getMessage());
 | 
	
		
			
				|  |  |         }
 |