163 lines
8.0 KiB
Java
163 lines
8.0 KiB
Java
package com.jasamedika.medifirst2000.controller;
|
|
|
|
import com.jasamedika.medifirst2000.constants.MessageResource;
|
|
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
|
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
|
import com.jasamedika.medifirst2000.service.AsuhanKeperawatanPeriOperatifService;
|
|
import com.jasamedika.medifirst2000.vo.AsuhanKeperawatanPeriOperatifVO;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
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.RestController;
|
|
|
|
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.getJsonHttptatus;
|
|
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
|
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("/asuhan-keperawatan-master")
|
|
public class AsuhanKeperawatanPeriOperasiController extends LocaleController<AsuhanKeperawatanPeriOperatifVO> {
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(AsuhanKeperawatanPeriOperasiController.class);
|
|
|
|
@Autowired
|
|
private AsuhanKeperawatanPeriOperatifService asuhanKeperawatanPeriOperatifService;
|
|
|
|
@RequestMapping(value = "/get-list-data", method = GET, produces = APPLICATION_JSON_VALUE)
|
|
public ResponseEntity<Map<String, Object>> getLoadData(HttpServletRequest request) {
|
|
try {
|
|
Map<String, Object> result = this.asuhanKeperawatanPeriOperatifService.getAllAsuhan();
|
|
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 getAllAsuhan", e.getMessage());
|
|
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
|
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
|
} catch (JpaSystemException jse) {
|
|
LOGGER.error("Got JpaSystemException {} when getAllAsuhan", jse.getMessage());
|
|
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
|
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
|
}
|
|
}
|
|
|
|
@RequestMapping(value = "/get-list-data-intra-operasi", method = GET, produces = APPLICATION_JSON_VALUE)
|
|
public ResponseEntity<Map<String, Object>> getLoadDataIntraOperasi(HttpServletRequest request) {
|
|
try {
|
|
Map<String, Object> result = this.asuhanKeperawatanPeriOperatifService.getAllIntraOperasiPerawatBedah();
|
|
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 getAllIntraOperasiPerawatBedah", e.getMessage());
|
|
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
|
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
|
} catch (JpaSystemException jse) {
|
|
LOGGER.error("Got JpaSystemException {} when getAllIntraOperasiPerawatBedah", jse.getMessage());
|
|
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
|
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
|
}
|
|
}
|
|
|
|
@RequestMapping(value = "/get-list-data-post-operasi", method = GET, produces = APPLICATION_JSON_VALUE)
|
|
public ResponseEntity<Map<String, Object>> getLoadDataPostOperasi(HttpServletRequest request) {
|
|
try {
|
|
Map<String, Object> result = this.asuhanKeperawatanPeriOperatifService.getAllPostOperasiPerawatBedah();
|
|
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 getAllPostOperasiPerawatBedah", e.getMessage());
|
|
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
|
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
|
} catch (JpaSystemException jse) {
|
|
LOGGER.error("Got JpaSystemException {} when getAllPostOperasiPerawatBedah", jse.getMessage());
|
|
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
|
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
|
}
|
|
}
|
|
|
|
@RequestMapping(value = "/get-list-data-intra-operasi-anestesi", method = GET, produces = APPLICATION_JSON_VALUE)
|
|
public ResponseEntity<Map<String, Object>> getLoadDataIntraOperasiAnestesi(HttpServletRequest request) {
|
|
try {
|
|
Map<String, Object> result = this.asuhanKeperawatanPeriOperatifService.getAllIntraOperasiAnestesi();
|
|
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 getAllIntraOperasiAnestesi", e.getMessage());
|
|
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
|
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
|
} catch (JpaSystemException jse) {
|
|
LOGGER.error("Got JpaSystemException {} when getAllIntraOperasiAnestesi", jse.getMessage());
|
|
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
|
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
|
}
|
|
}
|
|
|
|
@RequestMapping(value = "/get-list-data-post-operasi-anestesi", method = GET, produces = APPLICATION_JSON_VALUE)
|
|
public ResponseEntity<Map<String, Object>> getLoadDataPostOperasiAnestesi(HttpServletRequest request) {
|
|
try {
|
|
Map<String, Object> result = this.asuhanKeperawatanPeriOperatifService.getAllPostOperasiAnestesi();
|
|
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 getAllPostOperasiAnestesi", e.getMessage());
|
|
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
|
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
|
} catch (JpaSystemException jse) {
|
|
LOGGER.error("Got JpaSystemException {} when getAllPostOperasiAnestesi", jse.getMessage());
|
|
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
|
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
|
}
|
|
}
|
|
|
|
@RequestMapping(value = "/get-list-data-intra-operasi-perawat-bedah-v1", method = GET, produces = APPLICATION_JSON_VALUE)
|
|
public ResponseEntity<Map<String, Object>> getLoadDataIntraOperasiPerawatBedahV1(HttpServletRequest request) {
|
|
try {
|
|
Map<String, Object> result = this.asuhanKeperawatanPeriOperatifService.getAllIntraOperasiPerawatBedahV1();
|
|
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 getAllIntraOperasiPerawatBedahV1", e.getMessage());
|
|
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
|
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
|
} catch (JpaSystemException jse) {
|
|
LOGGER.error("Got JpaSystemException {} when getAllIntraOperasiPerawatBedahV1", jse.getMessage());
|
|
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
|
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
|
}
|
|
}
|
|
|
|
}
|