| 
					
				 | 
			
			
				@ -0,0 +1,106 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				package com.yihu.jw.hospital.endpoint.consult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.consult.WlyyHospitalConsultPriceDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.consult.WlyyHospitalReservationSettingDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.service.consult.ConsultPriceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.service.consult.ReservationSettingService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalConsultPriceVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalReservationSettingVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.Envelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.PageEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.Api; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.ApiParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import net.sf.json.JSONArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import net.sf.json.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.http.MediaType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.bind.annotation.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.HashMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 * Created by Trick on 2019/5/16. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				@RestController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				@RequestMapping("internet/reservation/setting" ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				@Api(tags = "服务配置", description = "互联网医院") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				public class ReservationSettingEndpoint extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private ReservationSettingService reservationSettingService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @PostMapping(value = "/create", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "新增服务配置信息", notes = "服务配置") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Envelop createResverationSetting( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "json_data", value = "Json数据", required = true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestBody String jsonData) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int flag = -1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyHospitalReservationSettingDO wlyyHospitalReservationSettingDO = new WlyyHospitalReservationSettingDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map dataDetail  = JSONObject.fromObject(jsonData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map baseInfo = new HashMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String hospital = dataDetail.get("hospital").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        baseInfo.put("city",dataDetail.get("city").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        baseInfo.put("cityName",dataDetail.get("cityName").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        baseInfo.put("town",dataDetail.get("town").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        baseInfo.put("townName",dataDetail.get("townName").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        baseInfo.put("hospital",dataDetail.get("hospital").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        baseInfo.put("hospitalName",dataDetail.get("hospitalName").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 获取到职称及服务对象列表,拆分成json数组,再进行处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String data = dataDetail.get("data") == "" ? "": dataDetail.get("data") .toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray array = JSONArray.fromObject(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (array.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (int i = 0; i < array.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject jsonObject = array.getJSONObject(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wlyyHospitalReservationSettingDO = reservationSettingService.saveReverationSetting(jsonObject,baseInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(wlyyHospitalReservationSettingDO != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    flag = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(flag == 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return success("新增服务配置成功!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return failed("新增服务配置失败!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @GetMapping(value = "/search") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "获取分页") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public PageEnvelop<WlyyHospitalReservationSettingVO> page( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "fields", required = false) String fields, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "filters", required = false) String filters, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "sorts", value = "排序,规则参见说明文档") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "sorts", required = false) String sorts, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "page") int page, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "size") int size) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyHospitalReservationSettingDO> wlyyHospitalReservationSettingDOS = reservationSettingService.search(fields, filters, sorts, page, size); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int count = (int) reservationSettingService.getCount(filters); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return success(wlyyHospitalReservationSettingDOS, count, page, size, WlyyHospitalReservationSettingVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @PostMapping(value = "/delete", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "删除指定ID的配置服务记录", notes = "服务配置") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Envelop deleteConsultPrice( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "id", value = "唯一标识ID") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "id", required = false) String id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        reservationSettingService.deleteReservationSetting(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return success("删除成功!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 |