| 
					
				 | 
			
			
				@ -3,7 +3,10 @@ package com.yihu.wlyy.web.third.gateway.controller.doctor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.service.app.label.SignPatientLabelService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.service.common.account.PatientService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.web.BaseController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.web.third.gateway.service.GcLabelService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.web.third.gateway.vo.DictModel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.web.third.gateway.vo.HospitalModel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.web.third.gateway.vo.PatientLabelModel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.web.third.gateway.vo.PatientModel; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -39,22 +42,19 @@ public class GcLableController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private SignPatientLabelService signPatientLabelService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private SignPatientLabelInfoService signPatientLabelInfoService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private GcLabelService labelService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PatientService patientService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @RequestMapping(value = "/labels", method = RequestMethod.GET) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation("根据分组类型查找标签") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public ResultListModel<List<PatientLabelModel>> labels( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "type", value = "1:服务类型(卫计委三大分组) 2:健康情况 3:疾病类型 4:团队标签(自定义标签)", required = true) @RequestParam(value = "type", required = true) String type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "team", value = "type是4的时候需要传team", required = false) @RequestParam(value = "team", required = false) Long team 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "labelType", value = "1:服务类型(卫计委分组) 2:健康情况 3:疾病类型 4:团队标签(自定义标签)", required = true) @RequestParam(value = "labelType", required = true) String labelType 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SignPatientLabel> signPatientLabels = signPatientLabelService.getLabelsByTypeAndTeam(type, String.valueOf(team)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<PatientLabelModel> patientLabelModels = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (SignPatientLabel signPatientLabel : signPatientLabels) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                PatientLabelModel patientLabelModel = new PatientLabelModel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                BeanUtils.copyProperties(signPatientLabel, patientLabelModel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientLabelModels.add(patientLabelModel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return new ResultListModel(patientLabelModels); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<DictModel> dictModels = labelService.getLabelsByTypeAndTeam(labelType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return new ResultListModel(dictModels); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return new ResultListModel(BaseResultModel.statusEm.find_error.getCode(), BaseResultModel.statusEm.find_error.getMessage() + "," + e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -63,14 +63,21 @@ public class GcLableController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @RequestMapping(value = "/labelsWithNum", method = RequestMethod.GET) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation("根据分组类型查找标签已经标签下的患者数目") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public ResultListModel<List<PatientLabelModel>> labelsWithNum( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "type", value = "1:服务类型(卫计委三大分组) 2:健康情况 3:疾病类型 4:团队标签(自定义标签)", required = true) @RequestParam(value = "type", required = true) String type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "team", value = "医生所属的团队ID", required = true) @RequestParam(value = "team", required = true) Long team 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "labelType", value = "1:服务类型(卫计委分组) 2:健康情况 3:疾病类型 4:团队标签(自定义标签)", required = true) @RequestParam(value = "labelType", required = true) String labelType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "teamCode", value = "医生所属的团队ID", required = true) @RequestParam(value = "teamCode", required = true) Long teamCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray signPatientLabels = signPatientLabelInfoService.getPatientAmountByTeamGroupLable(team, type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray result = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("1".equals(labelType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //卫纪委服务类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                result = patientService.getSignByTeamCodeGpbyServer(teamCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //其他标签 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                result = labelService.getPatientAmountByTeamGroupLable(teamCode, labelType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<PatientLabelModel> patientLabelModels = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i = 0; i < signPatientLabels.length(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject jo = signPatientLabels.getJSONObject(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i = 0; i < result.length(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject jo = result.getJSONObject(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                PatientLabelModel patientLabelModel = new PatientLabelModel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientLabelModel.setLabelCode(jo.getString("labelCode")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientLabelModel.setLabelName(jo.getString("labelName")); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -94,21 +101,21 @@ public class GcLableController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "pageSize", value = "每页大小", required = true) @RequestParam(value = "pageSize", required = true, defaultValue = "10") Integer pageSize 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray result = signPatientLabelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page, pageSize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray result = signPatientLabelInfoService.getPatientByLabel("totoD2017031502222", labelCode, labelType, teamCode, page-1, pageSize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<PatientModel> patientLabelModels = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i = 0; i < result.length(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject jo = result.getJSONObject(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                PatientModel patientModel = new PatientModel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientModel.setCode(jo.getString("code")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientModel.setName(jo.getString("name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientModel.setWechatFocusRemind(jo.getString("wechatFocusRemind")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientModel.setWechatFocusRemind(jo.getInt("wechatFocusRemind")+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientModel.setPhoto(jo.getString("photo")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientModel.setSex(jo.getInt("sex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientModel.setAge(jo.getInt("age")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientLabelModels.add(patientModel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return new ResultPageListModel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return new ResultPageListModel(page,pageSize,0,patientLabelModels); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return new ResultPageListModel(BaseResultModel.statusEm.find_error.getCode(), BaseResultModel.statusEm.find_error.getMessage() + "," + e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 |