Update controller

Clean code
This commit is contained in:
Salman Manoe 2025-01-03 21:07:09 +07:00
parent e2e94198a4
commit d2bc46ffbe
15 changed files with 844 additions and 2344 deletions

View File

@ -1,101 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PMAnamnesisUmumService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PMAnamnesisUmumVO;
/**
*
*
* @author Roberto
*/
@RestController
@RequestMapping("/pm-anamnesis-umum")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PMAnamnesisUmumController extends LocaleController<PMAnamnesisUmumVO> implements IBaseRestController<PMAnamnesisUmumVO> {
@Autowired
private PMAnamnesisUmumService pMAnamnesisUmumService;
private static final Logger LOGGER = LoggerFactory.getLogger(PMAnamnesisUmumController.class);
@RequestMapping(value = "/save-pm-anamnesis-umum", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> savePMAnamnesisUmum(@Valid @RequestBody PMAnamnesisUmumVO vo,HttpServletRequest request) {
try {
PMAnamnesisUmumVO result = pMAnamnesisUmumService.add(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
RestUtil.getJsonHttpStatus(HttpStatus.CREATED);
return RestUtil.getJsonResponse("Status Sukses", HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Status Keluarga", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Status Keluarga", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@Override
public ResponseEntity<Collection<PMAnamnesisUmumVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PMAnamnesisUmumVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PMAnamnesisUmumVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PMAnamnesisUmumVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PMAnamnesisUmumVO>> getAllVO() {
return null;
}
}

View File

@ -1,102 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PMDiagnosisService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PMDiagnosisVO;
/**
*
*
* @author Roberto
*/
@RestController
@RequestMapping("/pm-diagnosis")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PMDiagnosisController extends LocaleController<PMDiagnosisVO> implements IBaseRestController<PMDiagnosisVO> {
@Autowired
private PMDiagnosisService pMDiagnosisService;
private static final Logger LOGGER = LoggerFactory.getLogger(PMDiagnosisController.class);
@RequestMapping(value = "/save-pm-diagnosis", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> savePMDiagnosis(@Valid @RequestBody PMDiagnosisVO vo,HttpServletRequest request) {
try {
PMDiagnosisVO result = pMDiagnosisService.add(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
RestUtil.getJsonHttpStatus(HttpStatus.CREATED);
return RestUtil.getJsonResponse("Status Sukses", HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Status Keluarga", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Status Keluarga", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@Override
public ResponseEntity<Collection<PMDiagnosisVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PMDiagnosisVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PMDiagnosisVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PMDiagnosisVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PMDiagnosisVO>> getAllVO() {
return null;
}
}

View File

@ -1,284 +1,209 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PlanningDiklatHumasMarketPesertaService;
import com.jasamedika.medifirst2000.vo.PlanningDiklatHumasMarketPesertaVO;
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.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.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PlanningDiklatHumasMarketPesertaService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PlanningDiklatHumasMarketPesertaVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController
@RequestMapping("/planningdiklathumasmarketpeserta")
public class PlanningDiklatHumasMarketPesertaController extends LocaleController<PlanningDiklatHumasMarketPesertaVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PlanningDiklatHumasMarketBiayaController.class);
private static final Logger LOGGER = getLogger(PlanningDiklatHumasMarketPesertaController.class);
@Autowired
private PlanningDiklatHumasMarketPesertaService planningDiklatHumasMarketPesertaService;
@RequestMapping(
value = "/save-planning-dhm-peserta",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-planning-dhm-peserta", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePlanningDHMPeserta(
@Valid @RequestBody PlanningDiklatHumasMarketPesertaVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = this.planningDiklatHumasMarketPesertaService.savePlanningDHMPeserta(vo);
if (result != null)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when savePlanningDHMPeserta", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePlanningDHMPeserta", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when savePlanningDHMPeserta", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
LOGGER.error("Got JpaSystemException {} when savePlanningDHMPeserta", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-list-bynoplanning",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataByNoPlanning(
@RequestParam(value = "noPlanning", required = true) String noPlanning, HttpServletRequest request) {
@RequestMapping(value = "/get-list-bynoplanning", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataByNoPlanning(
@RequestParam(value = "noPlanning") String noPlanning, HttpServletRequest request) {
try {
Map<String, Object> result = this.planningDiklatHumasMarketPesertaService.getListPDHMPeserta(noPlanning);
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getLoadDataByNoPlanning", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getListPDHMPeserta", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadDataByNoPlanning", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getListPDHMPeserta", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-list-jenispetugaspe",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataJenisPetugasPe(HttpServletRequest request) {
@RequestMapping(value = "/get-list-jenispetugaspe", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataJenisPetugasPe(HttpServletRequest request) {
try {
Map<String, Object> result = this.planningDiklatHumasMarketPesertaService.getListJenisPetugasPe();
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getLoadDataJenisPetugasPe", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getListJenisPetugasPe", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadDataJenisPetugasPe", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getListJenisPetugasPe", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-list-asalpeserta",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataAsalPeserta(HttpServletRequest request) {
@RequestMapping(value = "/get-list-asalpeserta", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataAsalPeserta(HttpServletRequest request) {
try {
Map<String, Object> result = this.planningDiklatHumasMarketPesertaService.getListAsalPeserta();
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getLoadDataAsalPeserta", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getListAsalPeserta", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadDataAsalPeserta", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getListAsalPeserta", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-list-rekananpeserta",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataRekananPeserta(HttpServletRequest request) {
@RequestMapping(value = "/get-list-rekananpeserta", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataRekananPeserta(HttpServletRequest request) {
try {
Map<String, Object> result = this.planningDiklatHumasMarketPesertaService.getListRekananPeserta();
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getLoadDataRekananPeserta", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getListRekananPeserta", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadDataRekananPeserta", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getListRekananPeserta", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-list-all-planning-dhm",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataAllPlanningDH(HttpServletRequest request) {
@RequestMapping(value = "/get-list-all-planning-dhm", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataAllPlanningDH(HttpServletRequest request) {
try {
Map<String, Object> result = this.planningDiklatHumasMarketPesertaService.getListAllPlanningDHM();
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getLoadDataAllPlanningDH", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getListAllPlanningDHM", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadDataAllPlanningDH", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getListAllPlanningDHM", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-list-all-pegawai",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataAllPegawai(HttpServletRequest request) {
@RequestMapping(value = "/get-list-all-pegawai", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataAllPegawai(HttpServletRequest request) {
try {
Map<String, Object> result = this.planningDiklatHumasMarketPesertaService.getListPegawai();
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getLoadDataAllPegawai", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getListPegawai", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadDataAllPegawai", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getListPegawai", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-list-all-produkdkm-bynoplanning",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-list-all-produkdkm-bynoplanning", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataProdukDKMbyNoPlanning(
@RequestParam(value = "noPlanning", required = true) String noPlanning, HttpServletRequest request) {
@RequestParam(value = "noPlanning") String noPlanning, HttpServletRequest request) {
try {
Map<String, Object> result = this.planningDiklatHumasMarketPesertaService.getListProdukDHMbyNoPlanning(noPlanning);
Map<String, Object> result = this.planningDiklatHumasMarketPesertaService
.getListProdukDHMbyNoPlanning(noPlanning);
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getLoadDataProdukDKMbyNoPlanning", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getListProdukDHMbyNoPlanning", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadDataProdukDKMbyNoPlanning", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getListProdukDHMbyNoPlanning", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,223 +1,123 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PlanningHistoriPelayananCsService;
import com.jasamedika.medifirst2000.vo.PlanningHistoriPelayananCsVO;
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.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.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PlanningHistoriPelayananCsService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PlanningHistoriPelayananCsVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController
@RequestMapping("/planningHistoriPelayananCs")
public class PlanningHistoriPelayananCsController extends LocaleController<PlanningHistoriPelayananCsVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(HistoriPelayananCsController.class);
private static final Logger LOGGER = getLogger(PlanningHistoriPelayananCsController.class);
@Autowired
private PlanningHistoriPelayananCsService planningHistoriPelayananCsService;
@RequestMapping(
value = "/save-planning-histori-pelayanancs",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-planning-histori-pelayanancs", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePlanningHistoriPelayananCs(
@Valid @RequestBody PlanningHistoriPelayananCsVO phpcsvo, HttpServletRequest request) {
try {
Map<String, Object> result = this.planningHistoriPelayananCsService.savePlanningHistriPelayananCs(phpcsvo);
if (result != null)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when savePlanningHistoriPelayananCs", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePlanningHistriPelayananCs", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when savePlanningHistoriPelayananCs", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
/*
@RequestMapping(
value = "/save-planning-histori-struk",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePlanningHistoriStruk(
@Valid @RequestBody StrukPlanningVO spo, HttpServletRequest request) {
try {
Map<String, Object> result = this.planningHistoriPelayananCsService.saveStrukPlanning(spo);
if (result != null)
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 savePlanningHistoriPelayananCs", 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 savePlanningHistoriPelayananCs", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}*/
/*
@RequestMapping(value = "/get-list-planning-histori-pelayanan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getListPlanningHistoriPelayanan(
@RequestParam(value = "id", required = true) String id, HttpServletRequest request) {
try {
Map<String, Object> result = this.planningHistoriPelayananCsService.getListPlanningHistoriPelayananCs(id);
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getListPlanningHistoriPelayanan", 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 getListPlanningHistoriPelayanan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when savePlanningHistriPelayananCs", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
*/
@RequestMapping(
value = "/get-list-planning-histori-pelayanan",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getListPlanningHistoriPelayanan(HttpServletRequest request) {
@RequestMapping(value = "/get-list-planning-histori-pelayanan", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getListPlanningHistoriPelayanan(HttpServletRequest request) {
try {
Map<String, Object> result = this.planningHistoriPelayananCsService.getListPlanningHistoriPelayananCs();
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getListPlanningHistoriPelayanan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getListPlanningHistoriPelayananCs", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getListPlanningHistoriPelayanan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getListPlanningHistoriPelayananCs", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-load-planning-histori-pelayanan",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadData(
@RequestParam(value = "ruanganId", required = true) Integer ruanganId, HttpServletRequest request) {
@RequestMapping(value = "/get-load-planning-histori-pelayanan", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadData(@RequestParam(value = "ruanganId") Integer ruanganId,
HttpServletRequest request) {
try {
Map<String, Object> result = this.planningHistoriPelayananCsService.getLoadData(ruanganId);
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getLoadData", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getLoadData", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadData", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getLoadData", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-load-produk-histori-pelayanan",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataProdukHistori(HttpServletRequest request) {
@RequestMapping(value = "/get-load-produk-histori-pelayanan", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataProdukHistori(HttpServletRequest request) {
try {
Map<String, Object> result = this.planningHistoriPelayananCsService.getProdukPlanningHistori();
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getLoadDataProdukHistori", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getProdukPlanningHistori", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadDataProdukHistori", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getProdukPlanningHistori", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,196 +1,100 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PlanningPelayananSistemService;
import com.jasamedika.medifirst2000.vo.PlanningPelayananSistemVO;
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.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.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PlanningPelayananSistemService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.AkunVO;
import com.jasamedika.medifirst2000.vo.PlanningPelayananSistemVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController
@RequestMapping("/planningpelayanansistem")
public class PlanningPelayananSistemController extends LocaleController<AkunVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PlanningPelayananSistemController.class);
public class PlanningPelayananSistemController extends LocaleController<PlanningPelayananSistemVO> {
private static final Logger LOGGER = getLogger(PlanningPelayananSistemController.class);
@Autowired
private PlanningPelayananSistemService ppsService;
@RequestMapping(
value = "/save-planning-sistem",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePlanningSistem(
@Valid @RequestBody PlanningPelayananSistemVO vo, HttpServletRequest request) {
@RequestMapping(value = "/save-planning-sistem", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePlanningSistem(@Valid @RequestBody PlanningPelayananSistemVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = this.ppsService.savePlanningSistem(vo);
if (result != null)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when savePlanningDHM", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePlanningSistem", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when savePlanningDHM", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-list-planningsistem-bynoplanning",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataPlanningSistemByNoPlanning(
@RequestParam(value = "noPlanning", required = true) String noPlanning, HttpServletRequest request) {
try {
Map<String, Object> result = this.ppsService.getPlanningSisteByNoPlanning(noPlanning);
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getLoadDataByNoPlanning", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadDataByNoPlanning", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when savePlanningSistem", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-load-planning-sistem-noplanning",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadData(HttpServletRequest request) {
try {
Map<String, Object> result = this.ppsService.getLoadData();
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getLoadData", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadData", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-load-allplanning-sistem",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-load-allplanning-sistem", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataAllPlanningSI(HttpServletRequest request) {
try {
Map<String, Object> result = this.ppsService.getDataAllPlanningSI();
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getLoadDataAllPlanningSI", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getDataAllPlanningSI", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadDataAllPlanningSI", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getDataAllPlanningSI", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-load-noplanning-desc",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataNoPlanningDesc(HttpServletRequest request) {
@RequestMapping(value = "/get-load-noplanning-desc", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataNoPlanningDesc(HttpServletRequest request) {
try {
Map<String, Object> result = this.ppsService.getNoPlanningDesc();
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getLoadDataNoPlanningDesc", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getNoPlanningDesc", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadDataNoPlanningDesc", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getNoPlanningDesc", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,99 +1,79 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PlanningPelayananSistemPetugasService;
import com.jasamedika.medifirst2000.vo.PlanningPelayananSistemPetugasVO;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PlanningPelayananSistemPetugasService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PlanningPelayananSistemPetugasVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController
@RequestMapping("/planningpelayanansistempetugas")
public class PlanningPelayananSistemPetugasController extends LocaleController<PlanningPelayananSistemPetugasVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PlanningDiklatHumasMarketBiayaController.class);
public class PlanningPelayananSistemPetugasController extends LocaleController<PlanningPelayananSistemPetugasVO> {
private static final Logger LOGGER = getLogger(PlanningPelayananSistemPetugasController.class);
@Autowired
private PlanningPelayananSistemPetugasService planningPelayananSistemPetugasService;
@RequestMapping(
value = "/save-planning-peyanan-sistem-petugas",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-planning-peyanan-sistem-petugas", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePlanningDHMPeserta(
@Valid @RequestBody PlanningPelayananSistemPetugasVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = this.planningPelayananSistemPetugasService.savePlanningPelayananSisPetugas(vo);
if (result != null)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when PlanningPelayananSistemPetugasVO", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePlanningPelayananSisPetugas", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when PlanningPelayananSistemPetugasVO", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-load-pelayanan-sistem-petugas",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPelayananSistemPetugas(HttpServletRequest request) {
try {
Map<String, Object> result = this.planningPelayananSistemPetugasService.getPelayanSistemPetugas();
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getPelayananSistemPetugas", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getPelayananSistemPetugas", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when savePlanningPelayananSisPetugas", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-load-pelayanan-sistem-petugas", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPelayananSistemPetugas(HttpServletRequest request) {
try {
Map<String, Object> result = this.planningPelayananSistemPetugasService.getPelayanSistemPetugas();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getPelayanSistemPetugas", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getPelayanSistemPetugas", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,130 +1,103 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PostOperasiAnestesiService;
import com.jasamedika.medifirst2000.vo.AsuhanKeperawatanPeriOperasiHeaderVO;
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.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.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PostOperasiAnestesiService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.AsuhanKeperawatanPeriOperasiHeaderVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController
@RequestMapping("/post-operasi-anestesi")
public class PostOperasiAnestesiController extends LocaleController<AsuhanKeperawatanPeriOperasiHeaderVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PostOperasiAnestesiController.class);
public class PostOperasiAnestesiController extends LocaleController<AsuhanKeperawatanPeriOperasiHeaderVO> {
private static final Logger LOGGER = getLogger(PostOperasiAnestesiController.class);
@Autowired
private PostOperasiAnestesiService postOperasiAnestesiService;
@RequestMapping(
value = "/save-post-operasi-anestesi",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-post-operasi-anestesi", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePostOperasiAnestesi(
@Valid @RequestBody AsuhanKeperawatanPeriOperasiHeaderVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = this.postOperasiAnestesiService.savePostOperasiAnestesi(vo);
if (result != null)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when savePostOperasiAnestesi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePostOperasiAnestesi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when savePostOperasiAnestesi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
LOGGER.error("Got JpaSystemException {} when savePostOperasiAnestesi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-list-post-operasi-anestesi-by-notrans",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataByNoTrans(
@RequestParam(value = "notrans", required = true) String notrans, HttpServletRequest request) {
@RequestMapping(value = "/get-list-post-operasi-anestesi-by-notrans", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataByNoTrans(@RequestParam(value = "notrans") String notrans,
HttpServletRequest request) {
try {
Map<String, Object> result = this.postOperasiAnestesiService.getPostOperasiAnestesi(notrans);
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getLoadDataByNoTrans", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getPostOperasiAnestesi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadDataByNoTrans", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getPostOperasiAnestesi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-pasien-operasi",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPasienDaftarOperasi(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
@RequestMapping(value = "/get-pasien-operasi", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPasienDaftarOperasi(@RequestParam(value = "noRec") String noRec,
HttpServletRequest request) {
try {
Map<String, Object> result = this.postOperasiAnestesiService.getPasienDaftarOperasi(noRec);
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getPasienDaftarOperasi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getPasienDaftarOperasi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getPasienDaftarOperasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getPasienDaftarOperasi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,127 +1,103 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PostOperasiPerawatBedahService;
import com.jasamedika.medifirst2000.vo.AsuhanKeperawatanPeriOperasiHeaderVO;
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.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.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PostOperasiPerawatBedahService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.AsuhanKeperawatanPeriOperasiHeaderVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController
@RequestMapping("/post-operasi-perawat-bedah")
public class PostOperasiPerawatBedahController extends LocaleController<AsuhanKeperawatanPeriOperasiHeaderVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PostOperasiPerawatBedahController.class);
public class PostOperasiPerawatBedahController extends LocaleController<AsuhanKeperawatanPeriOperasiHeaderVO> {
private static final Logger LOGGER = getLogger(PostOperasiPerawatBedahController.class);
@Autowired
private PostOperasiPerawatBedahService postOperasiPerawatBedahService;
@RequestMapping(
value = "/save-post-operasi-bedah",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-post-operasi-bedah", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePostOperasiPerawatBedah(
@Valid @RequestBody AsuhanKeperawatanPeriOperasiHeaderVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = this.postOperasiPerawatBedahService.saveInteraOperasiPerawatBedah(vo);
if (result != null)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when savePostOperasiPerawatBedah", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveInteraOperasiPerawatBedah", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when savePostOperasiPerawatBedah", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
LOGGER.error("Got JpaSystemException {} when saveInteraOperasiPerawatBedah", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-list-post-operasi-perawat-bedah-by-notrans",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataByNoTrans(
@RequestParam(value = "notrans", required = true) String notrans, HttpServletRequest request) {
@RequestMapping(value = "/get-list-post-operasi-perawat-bedah-by-notrans", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataByNoTrans(@RequestParam(value = "notrans") String notrans,
HttpServletRequest request) {
try {
Map<String, Object> result = this.postOperasiPerawatBedahService.getInteraOperasiPerwatanBedah(notrans);
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getLoadDataByNoTrans", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getInteraOperasiPerwatanBedah", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadDataByNoTrans", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getInteraOperasiPerwatanBedah", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "get-pasien-operasi",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPasienDaftarOperasi(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
@RequestMapping(value = "get-pasien-operasi", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPasienDaftarOperasi(@RequestParam(value = "noRec") String noRec,
HttpServletRequest request) {
try {
Map<String, Object> result = this.postOperasiPerawatBedahService.getPasienDaftarOperasi(noRec);
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getPasienDaftarOperasi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getPasienDaftarOperasi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getPasienDaftarOperasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getPasienDaftarOperasi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,98 +1,73 @@
package com.jasamedika.medifirst2000.controller;
import java.util.HashMap;
import java.util.Map;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PphpService;
import com.jasamedika.medifirst2000.vo.SppbVO;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.Map;
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.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.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PphpService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
import com.jasamedika.medifirst2000.vo.SppbVO;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController
@RequestMapping("/pphp")
public class PphpController extends LocaleController<RegistrasiPelayananVO> {
public class PphpController extends LocaleController<SppbVO> {
private static final Logger LOGGER = getLogger(PphpController.class);
@Autowired
private PphpService service;
private static final Logger LOGGER = LoggerFactory.getLogger(PphpController.class);
@SuppressWarnings("unchecked")
@RequestMapping(value = "/pre-add-pphp")
@ResponseBody
public Map<String, Object> preAddPphp(
@RequestParam(value = "dateStart", required = false) String dateStart,
public Map<String, Object> preAddPphp(@RequestParam(value = "dateStart", required = false) String dateStart,
@RequestParam(value = "dateEnd", required = false) String dateEnd,
@RequestParam(value = "supplierId", required = false) Integer supplierId) {
Map<String, Object> resultPageMap = service.preAddPphp(dateStart, dateEnd, supplierId);
return resultPageMap;
return service.preAddPphp(dateStart, dateEnd, supplierId);
}
// Menampilkan Kartu Pengendali Berdasarkan Norec (array)
@RequestMapping(value = "/detail-sppb", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> detailSppb(@RequestParam(value = "noRec", required = true) String noRec) {
Map<String, Object> result = service.detailSppb(noRec);
return result;
@RequestMapping(value = "/detail-sppb", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> detailSppb(@RequestParam(value = "noRec") String noRec) {
return service.detailSppb(noRec);
}
// Menampilkan Kartu Pengendali Berdasarkan Norec (array)
@RequestMapping(value = "/detail-pphp", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> detailPphp(@RequestParam(value = "noRec", required = true) String noRec) {
Map<String, Object> result = service.detailPphp(noRec);
return result;
}
@RequestMapping(value = "/save-pphp/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveSppb(@Valid @RequestBody SppbVO vo,HttpServletRequest request,HttpServletResponse response) {
@RequestMapping(value = "/save-pphp/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveSppb(@Valid @RequestBody SppbVO vo, HttpServletRequest request,
HttpServletResponse response) {
try {
Map<String, Object> result = service.savePphp(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Sppb", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePphp", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Sppb", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when savePphp", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/list-pphp")
@ResponseBody
public Map<String, Object> listPphp(
@ -103,23 +78,17 @@ public class PphpController extends LocaleController<RegistrasiPelayananVO> {
@RequestParam(value = "dateStart", required = false) String dateStart,
@RequestParam(value = "dateEnd", required = false) String dateEnd,
@RequestParam(value = "supplierId", required = false) Integer supplierId) {
Map<String, Object> resultPageMap = service.daftarPphp(page, limit, sort, dir, dateStart, dateEnd, supplierId);
return resultPageMap;
return service.daftarPphp(page, limit, sort, dir, dateStart, dateEnd, supplierId);
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/konversi")
@ResponseBody
public Map<String, Object> konversi(
@RequestParam(value = "satuanAwal", required = true) Integer satuanAwal,
@RequestParam(value = "satuanAhir", required = true) Integer satuanAhir,
public Map<String, Object> konversi(@RequestParam(value = "satuanAwal") Integer satuanAwal,
@RequestParam(value = "satuanAhir") Integer satuanAhir,
@RequestParam(value = "qty", required = false, defaultValue = "0.0") Double qty) {
Double k=service.konversi(satuanAwal,satuanAhir,qty);
Map<String, Object> resultPageMap = new HashMap<String, Object>();
Double k = service.konversi(satuanAwal, satuanAhir, qty);
Map<String, Object> resultPageMap = new HashMap<>();
resultPageMap.put("value", k);
return resultPageMap;
}

View File

@ -1,157 +1,57 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PraAnestesiService;
import com.jasamedika.medifirst2000.vo.PraAnestesiVO;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PraAnestesiService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PraAnestesiVO;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
@RestController
@RequestMapping("/pranestesi")
public class PraAnestesiController extends LocaleController<PraAnestesiVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PraAnestesiController.class);
private static final Logger LOGGER = getLogger(PraAnestesiController.class);
@Autowired
private PraAnestesiService praAnestesiService;
@RequestMapping(
value = "/get-pra-anestesi-pasien",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPraAnestesiPasien(HttpServletRequest request){
@RequestMapping(value = "/get-pasien-by-rencanoperasi", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPasienByRencanaOperasi(HttpServletRequest request) {
try {
Map<String,Object> result = this.praAnestesiService.getPraAnestesiPasien();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = this.praAnestesiService.getPasienByRencanaOperasi();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getPraAnestesiPasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getPasienByRencanaOperasi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getPraAnestesiPasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getPasienByRencanaOperasi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-pasien-by-rencanoperasi",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPasienByRencanaOperasi(HttpServletRequest request){
try {
Map<String,Object> result = this.praAnestesiService.getPasienByRencanaOperasi();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getPasienByRencanaOperasi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getPasienByRencanaOperasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-pasien-by-id",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPasienById(@RequestParam("id") int id, HttpServletRequest request){
try {
Map<String,Object> result = this.praAnestesiService.getPasienById(id);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getPasienById", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getPasienById", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-pra-anestesi-perawat",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPraAnestesiPerawat(HttpServletRequest request){
try {
Map<String,Object> result = this.praAnestesiService.getPraAnestesiPerawat();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getPraAnestesiPerawat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getPraAnestesiPerawat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,155 +1,124 @@
package com.jasamedika.medifirst2000.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PraAnestesiDokterBedahService;
import com.jasamedika.medifirst2000.vo.PraAnestesiDokterBedahHeaderVO;
import com.jasamedika.medifirst2000.vo.PraAnestesiDokterBedahVO;
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.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.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PraAnestesiDokterBedahService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PraAnestesiDokterBedahHeaderVO;
import com.jasamedika.medifirst2000.vo.PraAnestesiDokterBedahVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController
@RequestMapping("/pra-anestesi-dokter-bedah")
public class PraAnestesiDokterBedahController extends LocaleController<PraAnestesiDokterBedahVO>{
private static final Logger LOGGER = LoggerFactory.getLogger(PraAnestesiDokterBedahController.class);
public class PraAnestesiDokterBedahController extends LocaleController<PraAnestesiDokterBedahVO> {
private static final Logger LOGGER = getLogger(PraAnestesiDokterBedahController.class);
@Autowired
private PraAnestesiDokterBedahService praAnestesiDokterBedahService;
@RequestMapping(
value = "/save-anestesi-dokter-bedah",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveAnestesiDokterBedah(
@Valid @RequestBody List<PraAnestesiDokterBedahVO> vos,
HttpServletRequest request) {
@RequestMapping(value = "/save-anestesi-dokter-bedah", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveAnestesiDokterBedah(
@Valid @RequestBody List<PraAnestesiDokterBedahVO> vos, HttpServletRequest request) {
try {
Map<String, Object> result = this.praAnestesiDokterBedahService.savePraAnestesiDokterBedah(vos);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when saveAnestesiDokterBedah", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePraAnestesiDokterBedah", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveAnestesiDokterBedah", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when savePraAnestesiDokterBedah", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/save-anestesi-dokter-bedah-rev1",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveAnestesiDokterBedahRev1(@Valid @RequestBody PraAnestesiDokterBedahHeaderVO vo,
HttpServletRequest request) {
@RequestMapping(value = "/save-anestesi-dokter-bedah-rev1", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveAnestesiDokterBedahRev1(
@Valid @RequestBody PraAnestesiDokterBedahHeaderVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = this.praAnestesiDokterBedahService.savePraAnestesiDokter(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when saveAnestesiDokterBedahRev1", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePraAnestesiDokter", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveAnestesiDokterBedahRev1", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-pranestesi-dokter-by-norec",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPraAnestesiDokterByNoRec(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request){
try {
Map<String,Object> result = this.praAnestesiDokterBedahService.getPraAnestesiDokterByNoRec(noRec);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getPraAnestesiDokterByNoRec", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getPraAnestesiDokterByNoRec", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-pranestesi-dokter-norec-antrian",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPraAnestesiDokterByNoRecAntrian(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request){
try {
Map<String,Object> result = this.praAnestesiDokterBedahService.getPraAnestesiDokterByNoRecAntrian(noRec);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getPraAnestesiDokterByNoRecAntrian", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getPraAnestesiDokterByNoRecAntrian", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when savePraAnestesiDokter", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-pranestesi-dokter-by-norec", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPraAnestesiDokterByNoRec(@RequestParam(value = "noRec") String noRec,
HttpServletRequest request) {
try {
Map<String, Object> result = this.praAnestesiDokterBedahService.getPraAnestesiDokterByNoRec(noRec);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getPraAnestesiDokterByNoRec", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getPraAnestesiDokterByNoRec", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-pranestesi-dokter-norec-antrian", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPraAnestesiDokterByNoRecAntrian(
@RequestParam(value = "noRec") String noRec, HttpServletRequest request) {
try {
Map<String, Object> result = this.praAnestesiDokterBedahService.getPraAnestesiDokterByNoRecAntrian(noRec);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getPraAnestesiDokterByNoRecAntrian", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getPraAnestesiDokterByNoRecAntrian", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,226 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
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.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.KajianSistemService;
import com.jasamedika.medifirst2000.service.PemeriksaanFisikService;
import com.jasamedika.medifirst2000.service.PerencanaanAnestesiService;
import com.jasamedika.medifirst2000.service.PraAnestesiDokterService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.KajianSistemVO;
import com.jasamedika.medifirst2000.vo.PemeriksaanFisikVO;
import com.jasamedika.medifirst2000.vo.PerencanaanAnestesiVO;
import com.jasamedika.medifirst2000.vo.PraAnestesiDokterVO;
@RestController
@RequestMapping("/pra-anestesi-dokter")
public class PraAnestesiDokterController extends LocaleController<PraAnestesiDokterVO> implements
IBaseRestController<PraAnestesiDokterVO> {
@Autowired
private PraAnestesiDokterService praAnestesiDokterService;
@Autowired
private KajianSistemService kajianSistemService;
@Autowired
private PemeriksaanFisikService pemeriksaanFisikService;
@Autowired
private PerencanaanAnestesiService perencanaanAnestesiService;
private static final Logger LOGGER = LoggerFactory
.getLogger(PraAnestesiDokterController.class);
@Override
public ResponseEntity<Collection<PraAnestesiDokterVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PraAnestesiDokterVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PraAnestesiDokterVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PraAnestesiDokterVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PraAnestesiDokterVO>> getAllVO() {
return null;
}
@RequestMapping(value = "/save-pra-anestesi-dokter/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody PraAnestesiDokterVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=praAnestesiDokterService.save(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 PraAnestesi Dokter", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add PraAnestesi Dokter", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/save-kajian-sistem/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody KajianSistemVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=kajianSistemService.saveKajianSistem(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 Kajian Sistem", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Kajian Sistem", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/save-pemeriksaan-fisik/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody PemeriksaanFisikVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=pemeriksaanFisikService.savePemeriksaanFisik(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 Pemeriksaan Fisik", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pemeriksaan Fisik", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/save-perencanaan-anestesi/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody PerencanaanAnestesiVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=perencanaanAnestesiService.save(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 Perencanaan Anestesi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Perencanaan Anestesi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/update-pemeriksaan-fisik/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody PemeriksaanFisikVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=pemeriksaanFisikService.updatePemeriksaanFisik(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 Pemeriksaan Fisik", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update Pemeriksaan Fisik", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/update-perencanaan-anestesi/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody PerencanaanAnestesiVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=perencanaanAnestesiService.edit(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 Perencanaan Anestesi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update Perencanaan Anestesi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
}

View File

@ -1,183 +1,145 @@
package com.jasamedika.medifirst2000.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PraAnestesiPasienBedahService;
import com.jasamedika.medifirst2000.vo.PraAnestesiPasienBedahVO;
import com.jasamedika.medifirst2000.vo.PraAnestesiPasienHeaderVO;
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.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.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PraAnestesiPasienBedahService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PraAnestesiPasienBedahVO;
import com.jasamedika.medifirst2000.vo.PraAnestesiPasienHeaderVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController
@RequestMapping("/pra-anestesi-pasien-bedah")
public class PraAnestesiPasienBedahController extends LocaleController<PraAnestesiPasienBedahVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PraAnestesiPasienBedahController.class);
private static final Logger LOGGER = getLogger(PraAnestesiPasienBedahController.class);
@Autowired
private PraAnestesiPasienBedahService praAnestesiPasienBedahService;
@RequestMapping(
value = "/save-anestesi-pasien-bedah",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveAnestesiPasienBedah(@Valid @RequestBody List<PraAnestesiPasienBedahVO> vos,
HttpServletRequest request) {
@RequestMapping(value = "/save-anestesi-pasien-bedah", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveAnestesiPasienBedah(
@Valid @RequestBody List<PraAnestesiPasienBedahVO> vos, HttpServletRequest request) {
try {
Map<String, Object> result = this.praAnestesiPasienBedahService.savePraAnestesiPasienBedah(vos);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when saveAnestesiPasienBedah", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePraAnestesiPasienBedah", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveAnestesiPasienBedah", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when savePraAnestesiPasienBedah", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-list-pasien-bedah",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataPasienBedah(HttpServletRequest request) {
@RequestMapping(value = "/get-list-pasien-bedah", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataPasienBedah(HttpServletRequest request) {
try {
Map<String, Object> result = this.praAnestesiPasienBedahService.getListPasien();
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getLoadDataPasienBedah", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getListPasien", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadDataPasienBedah", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getListPasien", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/save-anestesi-pasien-bedah-rev1",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveAnestesiPasienBedahRev1(@Valid @RequestBody PraAnestesiPasienHeaderVO vo,
HttpServletRequest request) {
@RequestMapping(value = "/save-anestesi-pasien-bedah-rev1", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveAnestesiPasienBedahRev1(
@Valid @RequestBody PraAnestesiPasienHeaderVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = this.praAnestesiPasienBedahService.savePraAnestesiPasien(vo);;
Map<String, Object> result = this.praAnestesiPasienBedahService.savePraAnestesiPasien(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when saveAnestesiPasienBedahRev1", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePraAnestesiPasien", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveAnestesiPasienBedahRev1", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-pranestesi-pasien-by-norec",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPraAnestesiPasienByNoRec(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request){
try {
Map<String,Object> result = this.praAnestesiPasienBedahService.getPraAnestesiPasienByNoRec(noRec);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getPraAnestesiPasienByNoRec", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getPraAnestesiPasienByNoRec", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-pranestesi-pasien-norec-antrian",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPraAnestesiPasienByNoRecAntrian(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request){
try {
Map<String,Object> result = this.praAnestesiPasienBedahService.getPraAnestesiPasienByNoRecAntrian(noRec);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getPraAnestesiPasienByNoRecAntrian", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getPraAnestesiPasienByNoRecAntrian", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when savePraAnestesiPasien", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-pranestesi-pasien-by-norec", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPraAnestesiPasienByNoRec(@RequestParam(value = "noRec") String noRec,
HttpServletRequest request) {
try {
Map<String, Object> result = this.praAnestesiPasienBedahService.getPraAnestesiPasienByNoRec(noRec);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getPraAnestesiPasienByNoRec", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getPraAnestesiPasienByNoRec", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-pranestesi-pasien-norec-antrian", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPraAnestesiPasienByNoRecAntrian(
@RequestParam(value = "noRec") String noRec, HttpServletRequest request) {
try {
Map<String, Object> result = this.praAnestesiPasienBedahService.getPraAnestesiPasienByNoRecAntrian(noRec);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getPraAnestesiPasienByNoRecAntrian", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getPraAnestesiPasienByNoRecAntrian", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,97 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
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.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PraAnestesiPasienService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PraAnestesiPasienVO;
@RestController
@RequestMapping("/pra-anestesi-pasien")
public class PraAnestesiPasienController extends LocaleController<PraAnestesiPasienVO> implements
IBaseRestController<PraAnestesiPasienVO> {
@Autowired
private PraAnestesiPasienService praAnestesiPasienService;
private static final Logger LOGGER = LoggerFactory
.getLogger(PraAnestesiPasienController.class);
@Override
public ResponseEntity<Collection<PraAnestesiPasienVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PraAnestesiPasienVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PraAnestesiPasienVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PraAnestesiPasienVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PraAnestesiPasienVO>> getAllVO() {
return null;
}
@RequestMapping(value = "/update-pra-anestesi-pasien/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody PraAnestesiPasienVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=praAnestesiPasienService.edit(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 PraAnestesi Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add PraAnestesi Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
}

View File

@ -1,688 +1,256 @@
package com.jasamedika.medifirst2000.controller;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
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.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.RestController;
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.dao.BentukProdukDao;
import com.jasamedika.medifirst2000.dao.MapGenerikToProdukDao;
import com.jasamedika.medifirst2000.dao.StrukPelayananDetailDao;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.ProdukService;
import com.jasamedika.medifirst2000.util.JsonUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.DetailJenisProdukVO;
import com.jasamedika.medifirst2000.vo.JenisLimbahB3MasukVO;
import com.jasamedika.medifirst2000.vo.JenisProdukVO;
import com.jasamedika.medifirst2000.vo.KelompokProdukVO;
import com.jasamedika.medifirst2000.vo.ProdukDetailLaboratoriumHasilVO;
import com.jasamedika.medifirst2000.vo.ProdukVO;
import com.jasamedika.medifirst2000.vo.SatuanStandarVO;
import com.jasamedika.medifirst2000.vo.*;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.net.URLDecoder;
import java.util.List;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.JsonUtil.ToMaps;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
@RestController
@RequestMapping("/product")
public class ProductController extends LocaleController<ProdukVO> implements
IBaseRestController<ProdukVO> {
public class ProductController extends LocaleController<ProdukVO> {
private static final Logger LOGGER = getLogger(ProductController.class);
@Autowired
private ProdukService produkService;
@Autowired
private BentukProdukDao bentukProdukDao;
@Autowired
private StrukPelayananDetailDao strukPelayananDetailDao;
private static final Logger LOGGER = LoggerFactory
.getLogger(ProductController.class);
@SuppressWarnings("deprecation")
@RequestMapping(value = "/find-tindakan-by-ruangan", method = RequestMethod.GET)
public ResponseEntity<List<ProdukVO>> findTindakanProduByRuangank(
@RequestParam(value = "idRuangan", required = false) Integer idRuangan,HttpServletRequest request){
String data =request.getQueryString();
data = URLDecoder.decode(data);
String criteria="";
String values="";
String[] arrQueries = data.split("&");
for(String query : arrQueries)
{
if(query.indexOf("filter[filters][0][filter][field]")>=0)
{
if(criteria==null)
criteria=query.replace("filter[filters][0][filter][field]=", "");
else
criteria+=query.replace("filter[filters][0][filter][field]=", "");
}
else if(query.indexOf("filter[filters][0][value]")>=0)
{
if(values==null)
values=query.replace("filter[filters][0][value]=", "");
else
values+=query.replace("filter[filters][0][value]=", "");
}
}
List<ProdukVO> resultPageMap = produkService.findTindakanByName(values,idRuangan);
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK);
}
@RequestMapping(value = "/find-same-generic", method = RequestMethod.GET)
public ResponseEntity<List<Map<String,Object>>> findSameGeneric(
@RequestParam(value = "idGeneric", required = false) Integer idGeneric){
List<Map<String, Object>> resultPageMap = new ArrayList<>();
try {
resultPageMap = JsonUtil.ToMaps( produkService.findByGenericId(idGeneric));
} catch (IllegalArgumentException | IllegalAccessException e) {
LOGGER.debug(e.getMessage());
}
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK);
}
@Autowired
private MapGenerikToProdukDao mapGenerikToProdukDao;
@RequestMapping(value = "/find-kekuatan", method = RequestMethod.GET)
public ResponseEntity<List<Map<String,Object>>> findKekuatan(
@RequestMapping(value = "/find-same-generic", method = GET)
public ResponseEntity<List<Map<String, Object>>> findSameGeneric(
@RequestParam(value = "idGeneric", required = false) Integer idGeneric) {
try {
List<Map<String, Object>> resultPageMap = ToMaps(produkService.findByGenericId(idGeneric));
return getJsonResponse(resultPageMap, OK);
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new ServiceVOException(e.getMessage());
}
}
@RequestMapping(value = "/find-kekuatan", method = GET)
public ResponseEntity<List<Map<String, Object>>> findKekuatan(
@RequestParam(value = "idProduk", required = false) Integer idProduk,
@RequestParam(value = "idGenerik", required = false) Integer idGenerik){
List<Map<String, Object>> resultPageMap = new ArrayList<>();
try {
resultPageMap = JsonUtil.ToMaps( mapGenerikToProdukDao.findByGenerik(idGenerik));
} catch (IllegalArgumentException | IllegalAccessException e) {
LOGGER.debug(e.getMessage());
}
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK);
}
@RequestMapping(value = "/find-stok-produk-darah", method = RequestMethod.GET)
public ResponseEntity<List<Map<String,Object>>> finStokProdukDarah(
@RequestParam(value = "idProduk", required = false) Integer idProduk){
List<Map<String, Object>> resultPageMap = new ArrayList<>();
@RequestParam(value = "idGenerik", required = false) Integer idGenerik) {
try {
resultPageMap = JsonUtil.ToMaps( strukPelayananDetailDao.findByProdukId(idProduk));
List<Map<String, Object>> resultPageMap = ToMaps(mapGenerikToProdukDao.findByGenerik(idGenerik));
return getJsonResponse(resultPageMap, OK);
} catch (IllegalArgumentException | IllegalAccessException e) {
LOGGER.debug(e.getMessage());
throw new ServiceVOException(e.getMessage());
}
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK);
}
@RequestMapping(value = "/find-bentuk-darah", method = RequestMethod.GET)
public ResponseEntity<List<Map<String,Object>>> findBentukProdukDarah(
@RequestParam(value = "namaBentuk", required = false) String namaBentuk){
List<Map<String, Object>> resultPageMap = new ArrayList<>();
@RequestMapping(value = "/find-stok-produk-darah", method = GET)
public ResponseEntity<List<Map<String, Object>>> finStokProdukDarah(
@RequestParam(value = "idProduk", required = false) Integer idProduk) {
try {
if(namaBentuk==null)
namaBentuk="";
resultPageMap = JsonUtil.ToMaps( bentukProdukDao.findByDepartemenIdAndNamaBentukProdukContains(Integer.parseInt(GetSettingDataFixed("KdDepartemenBankDarah")),namaBentuk));
List<Map<String, Object>> resultPageMap = ToMaps(strukPelayananDetailDao.findByProdukId(idProduk));
return getJsonResponse(resultPageMap, OK);
} catch (IllegalArgumentException | IllegalAccessException e) {
LOGGER.debug(e.getMessage());
throw new ServiceVOException(e.getMessage());
}
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK);
}
@RequestMapping(value = "/find-detail-jenis-produk", method = RequestMethod.GET)
@RequestMapping(value = "/find-bentuk-darah", method = GET)
public ResponseEntity<List<Map<String, Object>>> findBentukProdukDarah(
@RequestParam(value = "namaBentuk", required = false) String namaBentuk) {
try {
if (namaBentuk == null)
namaBentuk = "";
List<Map<String, Object>> resultPageMap = ToMaps(
bentukProdukDao.findByDepartemenIdAndNamaBentukProdukContains(
Integer.parseInt(GetSettingDataFixed("KdDepartemenBankDarah")), namaBentuk));
return getJsonResponse(resultPageMap, OK);
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new ServiceVOException(e.getMessage());
}
}
@RequestMapping(value = "/find-detail-jenis-produk", method = GET)
public ResponseEntity<List<DetailJenisProdukVO>> findDetailJenisProdukByJenisProduk(
@RequestParam(value = "idJenisProduk", required = false) Integer idJenisProduk){
@RequestParam(value = "idJenisProduk", required = false) Integer idJenisProduk) {
List<DetailJenisProdukVO> resultPageMap = produkService.findDetailJenisProdukByJenisProduk(idJenisProduk);
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK);
return getJsonResponse(resultPageMap, OK);
}
@RequestMapping(value = "/kelompok-produk-have-stok", method = RequestMethod.GET)
public ResponseEntity<List<KelompokProdukVO>> kelompokProdukHaveStok(){
@RequestMapping(value = "/kelompok-produk-have-stok", method = GET)
public ResponseEntity<List<KelompokProdukVO>> kelompokProdukHaveStok() {
List<KelompokProdukVO> resultPageMap = produkService.findKelompokProdukHaveStok();
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK);
return getJsonResponse(resultPageMap, OK);
}
@RequestMapping(value = "/get-hirarki-satuan-produk", method = RequestMethod.GET)
public ResponseEntity<List<SatuanStandarVO>> getHirarkiSatuanProduk(@RequestParam(value = "id", required = false) String id){
@RequestMapping(value = "/get-hirarki-satuan-produk", method = GET)
public ResponseEntity<List<SatuanStandarVO>> getHirarkiSatuanProduk(
@RequestParam(value = "id", required = false) String id) {
List<SatuanStandarVO> resultPageMap = produkService.findAllSatuanStandardProduk(id);
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK);
return getJsonResponse(resultPageMap, OK);
}
@RequestMapping(value = "/get-satuan-produk", method = RequestMethod.GET)
public Map<String,Object> getSatuanProduk(@RequestParam(value = "id", required = false) Integer id){
return produkService.getSatuanProduk(id);
}
@RequestMapping(value = "/save-deposit", method = RequestMethod.GET)
public ResponseEntity<Map<String,Object>> saveDeposit(@RequestParam(value = "noRec", required = false) String noRec,
@RequestMapping(value = "/save-deposit", method = GET)
public ResponseEntity<Map<String, Object>> saveDeposit(
@RequestParam(value = "noRec", required = false) String noRec,
@RequestParam(value = "deposite", required = false) Double deposite,
@RequestParam(value = "tanggal", required = false) String tanggal){
Map<String,Object> resultPageMap = produkService.saveDeposite(noRec,deposite,tanggal);
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK);
@RequestParam(value = "tanggal", required = false) String tanggal) {
Map<String, Object> resultPageMap = produkService.saveDeposite(noRec, deposite, tanggal);
return getJsonResponse(resultPageMap, OK);
}
@RequestMapping(value = "/update-total-biaya", method = RequestMethod.GET)
public ResponseEntity<Map<String,Object>> updateTotalBiaya(@RequestParam(value = "noRec", required = false) String noRec,
@RequestParam(value = "total", required = false) Double total){
Map<String,Object> resultPageMap = produkService.saveTotalBiaya(noRec,total);
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK);
@RequestMapping(value = "/update-total-biaya", method = GET)
public ResponseEntity<Map<String, Object>> updateTotalBiaya(
@RequestParam(value = "noRec", required = false) String noRec,
@RequestParam(value = "total", required = false) Double total) {
Map<String, Object> resultPageMap = produkService.saveTotalBiaya(noRec, total);
return getJsonResponse(resultPageMap, OK);
}
@RequestMapping(value = "/find-detail-produk", method = RequestMethod.GET)
public ResponseEntity<List<ProdukVO>> findDetailProdukByJenisProduk(
@RequestParam(value = "idJenisProduk", required = false) Integer idJenisProduk){
List<ProdukVO> resultPageMap = produkService.findDetailProdukByDetailJenisProduk(idJenisProduk);
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK);
@RequestMapping(value = "/find-menu-diet", method = GET)
public ResponseEntity<List<ProdukVO>> findMenuDiet(HttpServletRequest request) {
List<ProdukVO> resultPageMap2 = produkService
.findProdukByDetailJenisProduk(Integer.valueOf(GetSettingDataFixed("IdDetailJenisProduk")));
return getJsonResponse(resultPageMap2, OK);
}
@SuppressWarnings("deprecation")
@RequestMapping(value = "/find-menu-diet", method = RequestMethod.GET)
public ResponseEntity<List<ProdukVO>> findMenuDiet(HttpServletRequest request){
String data =request.getQueryString();
data = URLDecoder.decode(data);
String[] arrQueries = data.split("&");
String criteria="";
String values="";
for(String query : arrQueries)
{
if(query.indexOf("filter[filters][0][field]")>=0)
{
if(criteria==null)
criteria=query.replace("filter[filters][0][field]=", "");
else
criteria+=","+query.replace("filter[filters][0][field]=", "");
}
else if(query.indexOf("filter[filters][0][value]")>=0)
{
if(values==null)
values=query.replace("filter[filters][0][value]=", "");
else
values+=query.replace("filter[filters][0][value]=", "");
}
}
//edit by askur 01122016
//List<ProdukVO> resultPageMap = produkService.findProdukByKelompokProduk(Integer.parseInt(GetSettingDataFixed("KdKelompokProdukGizi")),values);
//
//add by askur 01122016
List<ProdukVO> resultPageMap2 = produkService.findProdukByDetailJenisProduk(Integer.valueOf(GetSettingDataFixed("IdDetailJenisProduk")));
//
return RestUtil.getJsonResponse(resultPageMap2, HttpStatus.OK);
}
@SuppressWarnings("deprecation")
@RequestMapping(value = "/find-barang-by-kelompok-produk", method = RequestMethod.GET)
public ResponseEntity<List<ProdukVO>> findBarangByKelompokProduk(@RequestParam(value = "id", required = false) String id,HttpServletRequest request){
String data =request.getQueryString();
data = URLDecoder.decode(data);
String[] arrQueries = data.split("&");
String criteria="";
String values="";
for(String query : arrQueries)
{
if(query.indexOf("filter[filters][0][field]")>=0)
{
if(criteria==null)
criteria=query.replace("filter[filters][0][field]=", "");
else
criteria+=","+query.replace("filter[filters][0][field]=", "");
}
else if(query.indexOf("filter[filters][0][value]")>=0)
{
if(values==null)
values=query.replace("filter[filters][0][value]=", "");
else
values+=query.replace("filter[filters][0][value]=", "");
}
}
List<ProdukVO> resultPageMap = produkService.findProdukByKelompokProduk(id,values);
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK);
}
@SuppressWarnings("deprecation")
@RequestMapping(value = "/find-barang-by-kelompok", method = RequestMethod.GET)
public Map<String,Object> findProdukByKelompokProduk(@RequestParam(value = "id", required = false) Integer id, HttpServletRequest request) {
@RequestMapping(value = "/find-barang-by-kelompok", method = GET)
public Map<String, Object> findProdukByKelompokProduk(@RequestParam(value = "id", required = false) Integer id,
HttpServletRequest request) {
String data = request.getQueryString();
data = URLDecoder.decode(data);
String[] arrQueries = data.split("&");
String criteria = "";
String values = "";
for (String query : arrQueries) {
if (query.indexOf("filter[filters][0][field]") >= 0) {
if (criteria == null)
criteria = query.replace("filter[filters][0][field]=", "");
else
criteria += "," + query.replace("filter[filters][0][field]=", "");
} else if (query.indexOf("filter[filters][0][value]") >= 0) {
if (values == null)
values = query.replace("filter[filters][0][value]=", "");
else
values += query.replace("filter[filters][0][value]=", "");
}
}
Map<String,Object>resultPageMap = produkService.findProdukByKelompok(id, values);
return resultPageMap;
StringBuilder values = new StringBuilder();
for (String query : arrQueries)
if (query.contains("filter[filters][0][value]"))
values.append(query.replace("filter[filters][0][value]=", ""));
return produkService.findProdukByKelompok(id, values.toString());
}
@SuppressWarnings("deprecation")
@RequestMapping(value = "/find-obat", method = RequestMethod.GET)
@RequestMapping(value = "/find-obat", method = GET)
public ResponseEntity<List<ProdukVO>> findObatProduk(
@RequestParam(value = "namaObat", required = false) String namaObat,HttpServletRequest request){
String data =request.getQueryString();
@RequestParam(value = "namaObat", required = false) String namaObat, HttpServletRequest request) {
String data = request.getQueryString();
data = URLDecoder.decode(data);
String criteria="";
String values="";
StringBuilder values = new StringBuilder();
String[] arrQueries = data.split("&");
for(String query : arrQueries)
{
if(query.indexOf("filter[filters][0][filter][field]")>=0)
{
if(criteria==null)
criteria=query.replace("filter[filters][0][filter][field]=", "");
else
criteria+=query.replace("filter[filters][0][filter][field]=", "");
}
else if(query.indexOf("filter[filters][0][value]")>=0)
{
if(values==null)
values=query.replace("filter[filters][0][value]=", "");
else
values+=query.replace("filter[filters][0][value]=", "");
}
}
List<ProdukVO> resultPageMap = produkService.findObatByName(values);
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK);
for (String query : arrQueries)
if (query.contains("filter[filters][0][value]"))
values.append(query.replace("filter[filters][0][value]=", ""));
List<ProdukVO> resultPageMap = produkService.findObatByName(values.toString());
return getJsonResponse(resultPageMap, OK);
}
@RequestMapping(value = "/find-produk", method = RequestMethod.GET)
@RequestMapping(value = "/find-produk", method = GET)
public ResponseEntity<List<ProdukVO>> findProdukByJenisProduk(
@RequestParam(value = "idDetailJenisProduk", required = false) Integer idDetailJenisProduk){
@RequestParam(value = "idDetailJenisProduk", required = false) Integer idDetailJenisProduk) {
List<ProdukVO> resultPageMap = produkService.findDetailProdukByDetailJenisProduk(idDetailJenisProduk);
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK);
return getJsonResponse(resultPageMap, OK);
}
@RequestMapping(value = "/find-stok-produk", method = RequestMethod.GET)
@RequestMapping(value = "/find-stok-produk", method = GET)
public ResponseEntity<Integer> findStokProduk(@RequestParam(value = "idProduk", required = false) Integer idProduk,
@RequestParam(value = "idRuangan", required = false) Integer idRuangan){
Integer resultPageMap = produkService.findStokProdukService(idProduk,idRuangan);
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK);
@RequestParam(value = "idRuangan", required = false) Integer idRuangan) {
Integer resultPageMap = produkService.findStokProdukService(idProduk, idRuangan);
return getJsonResponse(resultPageMap, OK);
}
@RequestMapping(value = "/find-stok-produk-konversi", method = RequestMethod.GET)
public Map<String,Object> findStokProdukKonversi(
@RequestParam(value = "idProduk", required = false) Integer idProduk,
@RequestParam(value = "idRuangan", required = false) Integer idRuangan,
@RequestParam(value = "satuanStandarId", required = false) Integer satuanStandarId){
Double data=produkService.findStokProdukServiceKonversi(idProduk, idRuangan, satuanStandarId);
Map<String,Object> result=new HashMap<String,Object>();
result.put("data", data);
return result;
}
@RequestMapping(value = "/find-jenis-produk", method = RequestMethod.GET)
@RequestMapping(value = "/find-jenis-produk", method = GET)
public ResponseEntity<List<JenisProdukVO>> findJenisProdukByJenisProduk(
@RequestParam(value = "idKelompokProduk", required = false) Integer idKelompokProduk){
@RequestParam(value = "idKelompokProduk", required = false) Integer idKelompokProduk) {
List<JenisProdukVO> resultPageMap = produkService.findJenisProdukByKelompokProduk(idKelompokProduk);
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK);
return getJsonResponse(resultPageMap, OK);
}
@RequestMapping(value = "/save-barangmedis/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> addVOBaramgMedis(@Valid @RequestBody ProdukVO vo, HttpServletRequest request) {
@RequestMapping(value = "/find-produk-by-detail-jenis-produk-and-nama-produk", method = GET)
public ResponseEntity<Map<String, Object>> findProdukByDetailJenisProdukAndNamaProduk(HttpServletRequest request,
@RequestParam(value = "idDetailJenisProduk", required = false) Integer idDetailJenisProduk) {
try {
Map<String, Object> result = produkService.addBarangMedis(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
Map<String, Object> result = produkService.findProdukByDetailJenisProdukAndNamaProduk(idDetailJenisProduk);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add BarangMedis", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when findProdukByDetailJenisProdukAndNamaProduk", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add BarangMedis", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-barangmedis/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateVOBarangMedis(@Valid @RequestBody ProdukVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = produkService.updateBarangMedis(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 BarangMedis", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add BarangMedis", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-barang-non-medis/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVOBarangNonMedis(@Valid @RequestBody ProdukVO vo,HttpServletRequest request) {
try{
Map<String, Object> result = produkService.addBarangNonMedis(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 BarangNonMedis", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add BarangNonMedis", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/update-barang-non-medis/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> updateVOBarangNonMedis(@Valid @RequestBody ProdukVO vo,HttpServletRequest request) {
try{
Map<String, Object> result = produkService.updateBarangNonMedis(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 BarangNonMedis", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update BarangNonMedis", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when findProdukByDetailJenisProdukAndNamaProduk", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-produk-by-nama", method = RequestMethod.GET)
public ResponseEntity<List<ProdukVO>> findProdukByNamaProduk(
@RequestParam(value = "idDetailJenisProduk", required = false) Integer idDetailJenisProduk,
@RequestParam(value = "namaProduk", required = false) String namaProduk){
List<ProdukVO> resultPageMap = produkService.findDetailProdukByDetailJenisProdukAndNamaProduk(idDetailJenisProduk,namaProduk);
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK);
}
@RequestMapping(value = "/save-jenis-limbah-b3-masuk/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody JenisLimbahB3MasukVO vo,HttpServletRequest request) {
try{
Map<String, Object> result = produkService.addJenisLimbahB3(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 jenisLimbahB3Masuk", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add jenisLimbahB3Masuk", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-jenis-limbah-b3-masuk/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
try {
Map<String,Object> result=produkService.findAllJenisLimbah();
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 get all jenisLimbahB3Masuk", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get all jenisLimbahB3Masuk", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/get-produk-hasil-by-id/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> getProdukDetailHasilById(@RequestParam(value = "id") Integer id,HttpServletRequest request) {
Map<String,Object> result = produkService.findByProdukId(id);
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@Override
public ResponseEntity<Collection<ProdukVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
Integer limit, String sort, String dir) {
return null;
}
@RequestMapping(value = "/save-detail-hasil/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> saveDetailHasil(@Valid @RequestBody List<ProdukDetailLaboratoriumHasilVO> vos,HttpServletRequest request) {
try{
Map<String, Object> result = produkService.addDetailHasil(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 detailHasil", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add detailHasil", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@Override
public ResponseEntity<ProdukVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(ProdukVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(ProdukVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<ProdukVO>> getAllVO() {
return null;
}
@RequestMapping(value = "/find-produk-by-detail-jenis-produk-and-nama-produk", method = RequestMethod.GET)
public ResponseEntity<Map<String,Object>> findProdukByDetailJenisProdukAndNamaProduk(HttpServletRequest request,@RequestParam(value = "idDetailJenisProduk", required = false) Integer idDetailJenisProduk) {
try {
Map<String,Object> result = produkService.findProdukByDetailJenisProdukAndNamaProduk(idDetailJenisProduk);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get all produk", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get all produk", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@SuppressWarnings("deprecation")
@RequestMapping(value = "/find-produk-by-jenis-produk-and-nama-produk", method = RequestMethod.GET)
public Map<String,Object> findProdukByJenisProdukAndNamaProduk(HttpServletRequest request,@RequestParam(value = "idDetailJenisProduk", required = false) Integer idDetailJenisProduk) {
@RequestMapping(value = "/find-produk-by-jenis-produk-and-nama-produk", method = GET)
public Map<String, Object> findProdukByJenisProdukAndNamaProduk(HttpServletRequest request,
@RequestParam(value = "idDetailJenisProduk", required = false) Integer idDetailJenisProduk) {
String data = request.getQueryString();
data = URLDecoder.decode(data);
String[] arrQueries = data.split("&");
String criteria = "";
String values = "";
for (String query : arrQueries) {
if (query.indexOf("filter[filters][0][field]") >= 0) {
if (criteria == null)
criteria = query.replace("filter[filters][0][field]=", "");
else
criteria += "," + query.replace("filter[filters][0][field]=", "");
} else if (query.indexOf("filter[filters][0][value]") >= 0) {
if (values == null)
values = query.replace("filter[filters][0][value]=", "");
else
values += query.replace("filter[filters][0][value]=", "");
}
}
Map<String,Object>resultPageMap = produkService.findProdukByJenisProdukAndNamaProduk(idDetailJenisProduk, values);
return resultPageMap;
StringBuilder values = new StringBuilder();
for (String query : arrQueries)
if (query.contains("filter[filters][0][value]"))
values.append(query.replace("filter[filters][0][value]=", ""));
return produkService.findProdukByJenisProdukAndNamaProduk(idDetailJenisProduk, values.toString());
}
//dipake di pengadaan
@RequestMapping(value = "/detail-jenis-produk", method = RequestMethod.GET)
public ResponseEntity<Map<String,Object>> findDetailJenisProduk(HttpServletRequest request) {
@RequestMapping(value = "/detail-jenis-produk", method = GET)
public ResponseEntity<Map<String, Object>> findDetailJenisProduk(HttpServletRequest request) {
try {
Map<String,Object> result = produkService.detailJenisProduk();
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
Map<String, Object> result = produkService.detailJenisProduk();
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get all Detail Jenis", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when detailJenisProduk", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get all Detail Jenis", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when detailJenisProduk", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@SuppressWarnings("deprecation")
@RequestMapping(value = "/find-produk-single", method = RequestMethod.GET)
public Map<String,Object> findProduk(HttpServletRequest request) {
@RequestMapping(value = "/find-supplier", method = GET)
public Map<String, Object> findSupplier(HttpServletRequest request) {
String data = request.getQueryString();
data = URLDecoder.decode(data);
String[] arrQueries = data.split("&");
String criteria = "";
String values = "";
for (String query : arrQueries) {
if (query.indexOf("filter[filters][0][field]") >= 0) {
if (criteria == null)
criteria = query.replace("filter[filters][0][field]=", "");
else
criteria += "," + query.replace("filter[filters][0][field]=", "");
} else if (query.indexOf("filter[filters][0][value]") >= 0) {
if (values == null)
values = query.replace("filter[filters][0][value]=", "");
else
values += query.replace("filter[filters][0][value]=", "");
}
}
Map<String,Object>resultPageMap = produkService.findProduk(values);
return resultPageMap;
StringBuilder values = new StringBuilder();
for (String query : arrQueries)
if (query.contains("filter[filters][0][value]"))
values.append(query.replace("filter[filters][0][value]=", ""));
return produkService.findSupplier(values.toString());
}
@SuppressWarnings("deprecation")
@RequestMapping(value = "/find-supplier", method = RequestMethod.GET)
public Map<String,Object> findSupplier(HttpServletRequest request) {
String data = request.getQueryString();
data = URLDecoder.decode(data);
String[] arrQueries = data.split("&");
String criteria = "";
String values = "";
for (String query : arrQueries) {
if (query.indexOf("filter[filters][0][field]") >= 0) {
if (criteria == null)
criteria = query.replace("filter[filters][0][field]=", "");
else
criteria += "," + query.replace("filter[filters][0][field]=", "");
} else if (query.indexOf("filter[filters][0][value]") >= 0) {
if (values == null)
values = query.replace("filter[filters][0][value]=", "");
else
values += query.replace("filter[filters][0][value]=", "");
}
}
Map<String,Object>resultPageMap = produkService.findSupplier(values);
return resultPageMap;
}
@RequestMapping(value = "/find-jenis-produk-laboratorium", method = RequestMethod.GET)
public ResponseEntity<List<JenisProdukVO>> getJenisProdukByJenisProdukLaboratorium(){
List<JenisProdukVO> resultPageMap = produkService.findJenisProdukLaboratorium();
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK);
}
}