package com.jasamedika.medifirst2000.controller;

import java.io.PrintWriter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.entities.JadwalDokter;
import com.jasamedika.medifirst2000.entities.Ruangan;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.service.JadwalDokterService;
import com.jasamedika.medifirst2000.service.PegawaiService;
import com.jasamedika.medifirst2000.service.RuanganService;
import com.jasamedika.medifirst2000.vo.JadwalDokter_VO;

@RestController
@RequestMapping("/jadwalDokter")
public class JadwalDokterController extends LocaleController<JadwalDokter_VO>
		implements IBaseRestController<JadwalDokter_VO> {

	@Autowired
	private JadwalDokterService jadwalDokterService;

	@Autowired
	private RuanganService ruanganService;
	@Autowired
	private PegawaiService pegawaiService;
	private static final Logger LOGGER = LoggerFactory.getLogger(JadwalDokterController.class);

	@Override
	public ResponseEntity<Collection<JadwalDokter_VO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
			Integer limit, String sort, String dir) {
		return null;
	}

	@Override
	public ResponseEntity<JadwalDokter_VO> getVO(Integer id) {
		return null;
	}

	@Override
	public ResponseEntity<String> addVO(JadwalDokter_VO vo) {
		return null;
	}

	@Override
	public ResponseEntity<String> editVO(JadwalDokter_VO vo) {
		return null;
	}

	@Override
	public ResponseEntity<String> deleteVO(Integer id) {
		return null;
	}

	@Override
	public ResponseEntity<List<JadwalDokter_VO>> getAllVO() {
		return null;
	}

	@RequestMapping(value = "/save-jadwal-dokter/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody JadwalDokter_VO vo,
			HttpServletRequest request) {

		try {
			Map<String, Object> result = jadwalDokterService.saveJadwalDokter(vo);
			if (null != result)
				mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
						getMessage(MessageResource.LABEL_SUCCESS, request));
			return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
		} catch (ServiceVOException e) {
			LOGGER.error("Got exception {} when add Catatan Perkembangan", e.getMessage());
			addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
			return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
		} catch (JpaSystemException jse) {
			LOGGER.error("Got exception {} when add  Catatan Perkembangan", jse.getMessage());
			addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
			return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
		}
	}

	@RequestMapping(value = "/delete-jadwal-dokter/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<Map<String,Object>> deleteVO(@Valid @RequestBody JadwalDokter_VO vo, HttpServletRequest request) {
		
		try {
			Map<String,Object> result=jadwalDokterService.deleteJadwalDokter(vo);
			if (null != result)
			mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
			return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
		} catch (ServiceVOException e) {
			LOGGER.error("Got exception {} when add Catatan Perkembangan", e.getMessage());
			addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
					e.getMessage());
			return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
					mapHeaderMessage);
		} catch (JpaSystemException jse) {
			LOGGER.error("Got exception {} when add  Catatan Perkembangan", jse.getMessage());
			addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
					jse.getMessage());
			return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
					mapHeaderMessage);
		}
	}
	
	@RequestMapping(value = "/save-all-jadwal-dokter/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<Map<String, Object>> addAllVO(@Valid @RequestBody List<JadwalDokter_VO> vos,
			HttpServletRequest request) {

		try {
			Map<String, Object> result = jadwalDokterService.saveListJadwalDokter(vos);
			if (null != result)
				mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
						getMessage(MessageResource.LABEL_SUCCESS, request));
			return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
		} catch (ServiceVOException e) {
			LOGGER.error("Got exception {} when add Catatan Perkembangan", e.getMessage());
			addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
			return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
		} catch (JpaSystemException jse) {
			LOGGER.error("Got exception {} when add  Catatan Perkembangan", jse.getMessage());
			addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
			return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
		}
	}

	@RequestMapping(value = "/update-all-jadwal-dokter/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<Map<String, Object>> updateAllVo(@Valid @RequestBody List<JadwalDokter_VO> vos,
			HttpServletRequest request) {

		try {
			Map<String, Object> result = jadwalDokterService.updateListJadwalDokter(vos);
			if (null != result)
				mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
						getMessage(MessageResource.LABEL_SUCCESS, request));
			return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
		} catch (ServiceVOException e) {
			LOGGER.error("Got exception {} when add Catatan Perkembangan", e.getMessage());
			addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
			return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
		} catch (JpaSystemException jse) {
			LOGGER.error("Got exception {} when add  Catatan Perkembangan", jse.getMessage());
			addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
			return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
		}
	}

	@RequestMapping(value = "/update-jadwal-dokter/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<Map<String, Object>> editVO(@Valid @RequestBody JadwalDokter_VO vo,
			HttpServletRequest request) {

		try {
			Map<String, Object> result = jadwalDokterService.updateJadwalDokter(vo);
			if (null != result)
				mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
						getMessage(MessageResource.LABEL_SUCCESS, request));
			return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
		} catch (ServiceVOException e) {
			LOGGER.error("Got exception {} when update Catatan Perkembangan", e.getMessage());
			addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
			return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
		} catch (JpaSystemException jse) {
			LOGGER.error("Got exception {} when update  Catatan Perkembangan", jse.getMessage());
			addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
			return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
		}
	}

	@RequestMapping(value = "/save-list-jadwal-dokter/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<Map<String, Object>> addListVO(@Valid @RequestBody List<JadwalDokter_VO> vos,
			HttpServletRequest request) {

		try {
			Map<String, Object> result = jadwalDokterService.saveListJadwalDokter(vos);
			if (null != result)
				mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
						getMessage(MessageResource.LABEL_SUCCESS, request));
			return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
		} catch (ServiceVOException e) {
			LOGGER.error("Got exception {} when add jadwal-dokter", e.getMessage());
			addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
			return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
		} catch (JpaSystemException jse) {
			LOGGER.error("Got exception {} when add jadwal-dokter", jse.getMessage());
			addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
			return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
		}
	}

	@RequestMapping(value = "/save-jadwal-supir/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<Map<String, Object>> addJadwalSupirVO(@Valid @RequestBody JadwalDokter_VO vo,
			HttpServletRequest request) {

		try {
			Map<String, Object> result = jadwalDokterService.saveJadwalSupirAmbulance(vo);
			if (null != result)
				mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
						getMessage(MessageResource.LABEL_SUCCESS, request));
			return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
		} catch (ServiceVOException e) {
			LOGGER.error("Got exception {} when add jadwal-dokter", e.getMessage());
			addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
			return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
		} catch (JpaSystemException jse) {
			LOGGER.error("Got exception {} when add jadwal-dokter", jse.getMessage());
			addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
			return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
		}
	}

	@RequestMapping(value = "/find-by-tanggal/{tglJadwal}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<Map<String, Object>> findByTanggal(@PathVariable("tglJadwal") String tanggalJadwal,
			HttpServletRequest request) {
		Map<String, Object> result = jadwalDokterService.findByTanggal(DateUtil.toDate(tanggalJadwal));
		Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
		if (dataFound) {
			mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
					getMessage(MessageResource.LABEL_SUCCESS, request));
		} else {
			mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
					getMessage(MessageResource.LABEL_ERROR, request));
		}

		return RestUtil.getJsonResponse(result, HttpStatus.OK);
	}

	@RequestMapping(value = "/find-by-ruangan/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<Map<String, Object>> findByNoCm(@PathVariable("id") Integer id, HttpServletRequest request) {
		Map<String, Object> result = jadwalDokterService.findByRuangan(id);
		Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
		if (dataFound) {
			mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
					getMessage(MessageResource.LABEL_SUCCESS, request));
		} else {
			mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
					getMessage(MessageResource.LABEL_ERROR, request));
		}

		return RestUtil.getJsonResponse(result, HttpStatus.OK);
	}

	@RequestMapping(value = "/find-by-ruangan-tanggal/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<Map<String, Object>> findByNoCmtglJadwal(
			@RequestParam(value = "id", required = false) Integer id,
			@RequestParam(value = "tglJadwal", required = false) String tanggalJadwal, HttpServletRequest request) {

		Map<String, Object> result = jadwalDokterService.findJadwalByTanggalRuangan(DateUtil.toDate(tanggalJadwal), id);
		Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
		if (dataFound) {
			mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
					getMessage(MessageResource.LABEL_SUCCESS, request));
		} else {
			mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
					getMessage(MessageResource.LABEL_ERROR, request));
		}

		return RestUtil.getJsonResponse(result, HttpStatus.OK);
	}
	
	@RequestMapping(value = "/find-by-antrian-tanggal/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<Map<String, Object>> findByNoCmtglJadwal(
			@RequestParam(value = "noRec", required = false) String noRec,
			@RequestParam(value = "tglJadwal", required = false) String tanggalJadwal, HttpServletRequest request) {

		Map<String, Object> result = jadwalDokterService.findJadwalByTanggalRuangan(DateUtil.toDate(tanggalJadwal), noRec);
		Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
		if (dataFound) {
			mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
					getMessage(MessageResource.LABEL_SUCCESS, request));
		} else {
			mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
					getMessage(MessageResource.LABEL_ERROR, request));
		}

		return RestUtil.getJsonResponse(result, HttpStatus.OK);
	}
	
	/*
	 * create by iwan date : 21.04.2017
	 */
	@RequestMapping(
			value = "/find-by-periode-ruangan-dokter", 
				method = RequestMethod.GET, 
					produces = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<Map<String, Object>> findJadwalDokterByPeriodRuangan(
			@RequestParam(value = "iddok", required = false) final int iddok,
			@RequestParam(value = "id", required = false) final int id, 
			@RequestParam(value = "from", required = false) final String from,
			@RequestParam(value = "to", required = false) final String to,
			final HttpServletRequest request) {
		
		Map<String, Object> result = this.jadwalDokterService.findJadwalDokterByKisaranTglRuangan(iddok, id, DateUtil.toDate(from), DateUtil.toDate(to));
		
		Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
		
		if (dataFound) {
			mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, 
					getMessage(MessageResource.LABEL_SUCCESS, request));
		}
		else {
			mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, 
					getMessage(MessageResource.LABEL_ERROR, request));
		}
		return RestUtil.getJsonResponse(result, HttpStatus.OK);
	}
	
	/*
	 * create by iwan date : 21.04.2017
	 */
	@RequestMapping(
			value = "/find-by-periode-ruangan-all-dokter", 
				method = RequestMethod.GET, 
					produces = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<Map<String, Object>> findJadwalDokterByPeriodRuangan(
			@RequestParam(value = "iddok", required = false) final int iddok,
			@RequestParam(value = "from", required = false) final String from,
			@RequestParam(value = "to", required = false) final String to,
			final HttpServletRequest request) {
		
		Map<String, Object> result = this.jadwalDokterService.findJadwalDokterByKisaranTglRuanganAll(iddok, DateUtil.toDate(from), DateUtil.toDate(to));
		
		Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
		
		if (dataFound) {
			mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, 
					getMessage(MessageResource.LABEL_SUCCESS, request));
		}
		else {
			mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, 
					getMessage(MessageResource.LABEL_ERROR, request));
		}
		return RestUtil.getJsonResponse(result, HttpStatus.OK);
	}
	
	@RequestMapping(value = "/get-jadwal-dokter-by-id", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<Map<String, Object>> getJadwalDokterByIdDokter(
			@RequestParam(value = "id", required = false) Integer id, HttpServletRequest request) {
		Map<String, Object> result = jadwalDokterService.getJadwalDokterByIdDokter(id);
		Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
		if (dataFound) {
			mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
					getMessage(MessageResource.LABEL_SUCCESS, request));
		} else {
			mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
					getMessage(MessageResource.LABEL_ERROR, request));
		}

		return RestUtil.getJsonResponse(result, HttpStatus.OK);
	}

	@RequestMapping(value = "/get-jadwal-dokter-mingguan-by-id/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<Map<String, Object>> getJadwalDokterMingguanByIdDokter(
			@RequestParam(value = "id", required = false) Integer id, HttpServletRequest request) {
		Map<String, Object> result = jadwalDokterService.getJadwalDokterMingguanByIdDokter(id);
		Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
		if (dataFound) {
			mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
					getMessage(MessageResource.LABEL_SUCCESS, request));
		} else {
			mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
					getMessage(MessageResource.LABEL_ERROR, request));
		}

		return RestUtil.getJsonResponse(result, HttpStatus.OK);
	}

	@RequestMapping(value = "/get-jadwal-supir-ambulance/{bulan}/{tahun}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public List<Map<String, Object>> getAllInformasi(@PathVariable("bulan") Integer bulan,
			@PathVariable("tahun") Integer tahun, HttpServletRequest request) {
		List<Map<String, Object>> result = null;
		result = jadwalDokterService.getJadwalSupirAmbulanceByPeriode(bulan, tahun);
		return result;
	}

	@RequestMapping(value = "/get-jadwal-supir-ambulance/{id}/{bulan}/{tahun}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public List<Map<String, Object>> getJadwalByIdAndPeriode(@PathVariable("id") Integer id,
			@PathVariable("bulan") Integer bulan, @PathVariable("tahun") Integer tahun, HttpServletRequest request) {
		List<Map<String, Object>> result = null;
		result = jadwalDokterService.getJadwalSupirAmbulanByIdAndPeriode(id, bulan, tahun);
		return result;
	}

	@RequestMapping(value = "/get-jadwal-by-date/{tanggal}/{bulan}/{tahun}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<Map<String, Object>> getJadwalByDate(@PathVariable("tanggal") Integer tanggal,
			@PathVariable("bulan") Integer bulan, @PathVariable("tahun") Integer tahun, HttpServletRequest request) {
		Map<String, Object> result = null;
		try {
			result = jadwalDokterService.getJadwalSupirByDate(tanggal, bulan, tahun);
			Boolean dataFound = new Boolean((boolean) result.get("dataFound"));

			if (dataFound) {
				mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
						getMessage(MessageResource.LABEL_SUCCESS, request));
			} else {
				mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
						getMessage(MessageResource.LABEL_ERROR, request));
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return RestUtil.getJsonResponse(result, HttpStatus.OK);
	}
	/* Author : Lukman Hakim
	 * */
	@RequestMapping(value = "/get-pegawai-by-ruangan/{ruangan}/{tahun}/{bulan}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<Map<String, Object>> getPegawaiByRuangan(@PathVariable("ruangan") Integer ruangan,
			@PathVariable("tahun") Integer tahun, @PathVariable("bulan") Integer bulan, HttpServletRequest request) {
		Map<String, Object> result = null;
		try {
			result = pegawaiService.findPegawaiByRuanganRev(ruangan, tahun, bulan);

			mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
					getMessage(MessageResource.LABEL_SUCCESS, request));

		} catch (Exception e) {
			e.printStackTrace();
		}
		return RestUtil.getJsonResponse(result, HttpStatus.OK);
	}
}
