| 
					
				 | 
			
			
				@ -1,6 +1,9 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				package com.yihu.jw.patient.endpoint.myFamily; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.patient.BasePatientDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.myFamily.PatientApplyLog; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.patient.service.myFamily.MyFamilyService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.patient.service.personal_Info.PatientService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.Envelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.rm.patient.PatientRequestMapping; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -8,11 +11,9 @@ 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.web.bind.annotation.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import javax.servlet.http.HttpServletRequest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -26,6 +27,8 @@ public class MyFamilyEndpoint extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private MyFamilyService myFamilyService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PatientService patientService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @GetMapping(value = PatientRequestMapping.MyFamily.getMyFamilyBindingRole) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "获取我的家人") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -55,5 +58,109 @@ public class MyFamilyEndpoint extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @PostMapping(value = PatientRequestMapping.MyFamily.bindingMyFamily) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "一键绑定家人") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Envelop bindingMyFamily( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "patient", value = "居民code", required = false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "patient",required = false) String patient, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "wechatId", value = "wechatId", required = true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "wechatId",required = true) String wechatId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "saasId", value = "saasId", required = true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "saasId",required = true) String saasId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "familyMobile", value = "家人的手机号码", required = true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "familyMobile",required = true) String familyMobile, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "familyBindRole", value = "家庭关系关系 1配偶 2父亲 3母亲 4公公 5婆婆 6岳父 7岳母 8子女", required = true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "familyBindRole",required = true) Integer familyBindRole,HttpServletRequest request) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            PatientApplyLog patientApplyLog = myFamilyService.bindingMyFamily(request,wechatId, saasId, getUID(patient), familyMobile, 1,familyBindRole); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return success(patientApplyLog); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return failed(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @PostMapping(value = PatientRequestMapping.MyFamily.createFamilyQrCode) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "生成绑定家人的二维码") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Envelop createFamilyQrCode( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "patient", value = "居民code", required = false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "patient",required = false) String patient, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "familyMobile", value = "家人的手机号码", required = true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "familyMobile",required = true) String familyMobile, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "wechatId", value = "wechatId", required = true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "wechatId",required = true) String wechatId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "familyBindRole", value = "家庭关系关系 1配偶 2父亲 3母亲 4公公 5婆婆 6岳父 7岳母 8子女", required = true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "familyBindRole",required = true) Integer familyBindRole,HttpServletRequest request) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BasePatientDO familyPatient = patientService.findByMobileAndDel(familyMobile); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            PatientApplyLog patientApplyLog = myFamilyService.createFamilyQrCode(request,familyPatient,wechatId, getUID(patient),familyBindRole); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return success(patientApplyLog.getQrCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return failed(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @PostMapping(value = PatientRequestMapping.MyFamily.remindMyFamily) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "签约界面已绑定家人信息") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Envelop remindMyFamily( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "patientApplyLogId", value = "patientApplyLogId", required = true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "patientApplyLogId",required = true) Integer patientApplyLogId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "remindType", value = "提醒方式(1、打电话,2、发短信,3、微信)", required = true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "remindType",required = true) Integer remindType) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            myFamilyService.remindMyFamily(patientApplyLogId,remindType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return success(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return failed(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @GetMapping(value = PatientRequestMapping.MyFamily.applyMessageList) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "有效的申请绑定消息") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Envelop applyMessageList( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "patient", value = "居民code", required = false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "patient",required = false) String patient) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String,Object>> messageList = myFamilyService.applyMessageList(getUID(patient)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return success(messageList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return failed(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @PostMapping(value = PatientRequestMapping.MyFamily.confirmApply) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "家人确认绑定") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Envelop confirmApply( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "patientApplyLogId", value = "patientApplyLogId", required = true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "patientApplyLogId",required = true) Integer patientApplyLogId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "status", value = "3、通过,4、拒绝", required = true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "status",required = true) Integer status, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "isAuthorize", value = "0:未授权,1:已授权", required = true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "isAuthorize",required = true) Integer isAuthorize) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            myFamilyService.confirmApply(patientApplyLogId,status,isAuthorize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return success(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return failed(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @PostMapping(value = PatientRequestMapping.MyFamily.cancelApply) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "取消申请绑定家人") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Envelop cancelApply( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "patientApplyLogId", value = "patientApplyLogId", required = true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "patientApplyLogId",required = true) Integer patientApplyLogId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            myFamilyService.cancelApply(patientApplyLogId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return success(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return failed(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |