| 
					
				 | 
			
			
				@ -1,9 +1,12 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				package com.yihu.jw.care.endpoint.visit; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.aop.ObserverRequired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.service.common.PermissionService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.service.visit.BaseVisitService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.team.BaseTeamDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.care.visit.BaseVisitDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.ResponseContant; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.Envelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.ListEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.ObjEnvelop; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -13,7 +16,6 @@ import io.swagger.annotations.Api; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.ApiParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.json.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.bind.annotation.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -32,6 +34,9 @@ public class VisitEndpoint extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BaseVisitService baseVisitService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PermissionService permissionService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation("获取日常走访列表") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @RequestMapping(value = "/getListByDoctor", method = RequestMethod.GET) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public ListEnvelop getListByDoctor(@ApiParam(name = "startTime", value = "开始时间", defaultValue = "2021-11-11 00:00:00") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -137,7 +142,7 @@ public class VisitEndpoint extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation("直接新增走访--管理员端") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation("直接新增走访--管理员端--管理员端取消日常走访") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @RequestMapping(value = "/adminAddVisit",method = RequestMethod.POST) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Envelop adminAddVisit(@ApiParam(name = "doctor", value = "医生id") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 @RequestParam(value = "doctor", required = true) String doctor, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -154,10 +159,43 @@ public class VisitEndpoint extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 @ApiParam(name = "lifeConsult", value = "生活咨询") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 @RequestParam(value = "lifeConsult", required = false) String lifeConsult) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            baseVisitService.adminAddVisit(doctor,patient,visitContent,visitImg,deviceMaintenance,health,lifeConsult); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            baseVisitService.adminAddVisit(doctor,patient,visitContent,visitImg,deviceMaintenance,health,lifeConsult); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return Envelop.getSuccess("操作成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return failedException2(e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @PostMapping("signIn") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "日常走访签到") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ObserverRequired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public ObjEnvelop signIn( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(value = "走访id", name = "visitId") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "visitId", required = true) String visitId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(value = "签到方式:1.定位,2.拍照", name = "signWay") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "signWay", required = true) Integer signWay, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(value = "签到纬度", name = "signLat") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "signLat", required = false) String signLat, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(value = "签到经度", name = "signLon") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "signLon", required = false) String signLon, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(value = "签到地址", name = "address") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "address", required = false) String address, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(value = "签到照片", name = "signImg") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "signImg", required = false) String signImg) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String doctorId = permissionService.getUID(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject param = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.put("doctorId",doctorId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(permissionService.noPermission(1,param)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return ObjEnvelop.getError("该操作没有权限"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject result = baseVisitService.signIn(visitId, signWay, signLat,signLon, address,signImg,doctorId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return ObjEnvelop.getError(result.getString("resultMsg")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getSuccess("操作成功",result.getString(ResponseContant.resultMsg)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return failedObjEnvelopException2(e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |