Update controller

Clean code
This commit is contained in:
Salman Manoe 2024-12-27 10:55:33 +07:00
parent 71a48a7dfe
commit 352350002b
56 changed files with 1946 additions and 6661 deletions

View File

@ -1,162 +1,115 @@
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.dto.MesinDto;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.MesinService;
import com.jasamedika.medifirst2000.vo.MesinVO;
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.dto.MesinDto;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.MesinService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.MesinVO;
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("/mesin")
public class MesinController extends LocaleController<MesinVO> {
private static final Logger LOGGER = getLogger(MesinController.class);
@Autowired
private MesinService mesinService;
private static final Logger LOGGER = LoggerFactory.getLogger(MesinController.class);
@RequestMapping(value = "/save-mesin/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-mesin/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveMesin(@Valid @RequestBody MesinVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = mesinService.saveMesin(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 Mesin", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveMesin", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Mesin", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveMesin", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-mesin/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/find-all-mesin/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findAllMesin(HttpServletRequest request) {
try {
Map<String, Object> result = mesinService.findAllMesin();
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 get All Mesin", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when findAllMesin", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get All Mesin", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when findAllMesin", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/delete-mesin/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> deleteMesin(@RequestParam(value = "id", required = true) Integer id) {
try {
if (mesinService.deleteMesin(id) == true)
return RestUtil.getJsonResponse(id + " Dihapus", HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when delete Mesin", 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 delete Mesin", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
return RestUtil.getJsonHttpStatus(HttpStatus.NOT_ACCEPTABLE);
}
@RequestMapping(value = "/find-mesin/", method = RequestMethod.GET)
@RequestMapping(value = "/find-mesin/", method = GET)
public ResponseEntity<List<MesinDto>> findMesin(HttpServletRequest request) {
try {
List<MesinDto> listMesinVO = mesinService.findMesin();
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(listMesinVO, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(listMesinVO, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when Find Mesin", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when findMesin", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when Find Mesin", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when findMesin", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-mesin-laundry/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/find-mesin-laundry/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getMesinLaundry(HttpServletRequest request) {
try {
Map<String, Object> result = this.mesinService.findAllMesinLaundry();
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);
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 getMesinLaundry", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when findAllMesinLaundry", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getMesinLaundry", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when findAllMesinLaundry", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-satuan-standar-kg/", method = RequestMethod.GET)
public ResponseEntity<Map<String, Object>> findSatuanStandar(HttpServletRequest request) {
try {
Map<String, Object> result = mesinService.findSatuanStandar();
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 Find Satuan Standar", 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 Find Satuan Standar", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,52 +1,47 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
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.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.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.dto.MonitoringAlatSterilDto;
import com.jasamedika.medifirst2000.service.MonitoringAlatSterilService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
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.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
import static org.springframework.http.HttpStatus.OK;
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("/monitoringalatsteril")
public class MonitoringAlatSterilController extends LocaleController {
public class MonitoringAlatSterilController extends LocaleController<MonitoringAlatSterilDto> {
@Autowired
private MonitoringAlatSterilService monitoringAlatSterilService;
@RequestMapping(value="/save-monitoringalatsteril",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveMonitoringAlatSteril(
@RequestBody MonitoringAlatSterilDto dto, HttpServletRequest request){
@RequestMapping(value = "/save-monitoringalatsteril", method = POST, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveMonitoringAlatSteril(@RequestBody MonitoringAlatSterilDto dto,
HttpServletRequest request) {
Map<String, Object> result = this.monitoringAlatSterilService.saveMonitoringAlatSterilService(dto);
if (!result.isEmpty()) {
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);
}
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
}
@RequestMapping(value="/get-monitoringalatsteril",
method=RequestMethod.GET,
produces=MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getMonitoringAlatSteril(
@RequestParam("startDate")String startDate, @RequestParam("endDate")String endDate, HttpServletRequest request) {
Map<String, Object> result = this.monitoringAlatSterilService.getMonitoringAlatSterilService(startDate, endDate);
return result;
@RequestMapping(value = "/get-monitoringalatsteril", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getMonitoringAlatSteril(@RequestParam("startDate") String startDate,
@RequestParam("endDate") String endDate, HttpServletRequest request) {
return this.monitoringAlatSterilService.getMonitoringAlatSterilService(startDate, endDate);
}
}

View File

@ -1,32 +1,32 @@
package com.jasamedika.medifirst2000.controller;
import java.util.HashMap;
import java.util.List;
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.MonitoringEvaluasiPerundanganService;
import com.jasamedika.medifirst2000.vo.UsulanEvaluasiVO;
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.MonitoringEvaluasiPerundanganService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.UsulanEvaluasiVO;
import javax.servlet.http.HttpServletRequest;
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;
/**
* class Usulan Evaluasi Controller
@ -35,146 +35,75 @@ import com.jasamedika.medifirst2000.vo.UsulanEvaluasiVO;
*/
@RestController
@RequestMapping("/monitoring-evaluasi-perundangan")
public class MonitoringEvaluasiPerundanganController extends LocaleController<UsulanEvaluasiVO>{
private static final Logger LOGGER = LoggerFactory.getLogger(MonitoringEvaluasiPerundanganController.class);
public class MonitoringEvaluasiPerundanganController extends LocaleController<UsulanEvaluasiVO> {
private static final Logger LOGGER = getLogger(MonitoringEvaluasiPerundanganController.class);
@Autowired
private MonitoringEvaluasiPerundanganService monitoringEvaluasiPerundanganService;
@RequestMapping( value = "/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> saveEvaluasiRekanan(
@RequestBody UsulanEvaluasiVO vo, HttpServletRequest request) {
@RequestMapping(value = "/save", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<String> saveEvaluasiRekanan(@RequestBody UsulanEvaluasiVO vo, HttpServletRequest request) {
try {
String result = monitoringEvaluasiPerundanganService.saveMonitoringEvaluasiPerundangan(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 saveMonitoringEvaluasiPerundangan", 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-no-evaluasi", method = RequestMethod.GET)
public ResponseEntity<Map<String,Object>> getNoEvaluasi(HttpServletRequest request) {
try {
String noSurat= monitoringEvaluasiPerundanganService.noMonitoringEvaluasiPerundangan();
Map<String,Object> result=new HashMap<String,Object>();
result.put("noSurat", noSurat);
if (null != result)
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 add nota-dinas", 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 nota-dinas", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveMonitoringEvaluasiPerundangan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-by-ruangan-tujuan", method = RequestMethod.GET)
public ResponseEntity<List<Map<String,Object>>> getListUsulanEvaluasiByRuanganTujuan(
@RequestMapping(value = "/get-by-ruangan-tujuan", method = GET)
public ResponseEntity<List<Map<String, Object>>> getListUsulanEvaluasiByRuanganTujuan(
@RequestParam(value = "noUsulan", required = false) String noUsulan,
@RequestParam(value = "tglAwal", required = true)String tglAwal,
@RequestParam(value = "tglAkhir", required = true)String tglAkhir,
@RequestParam(value = "ruanganId", required = true)Integer ruanganId,
HttpServletRequest request) {
@RequestParam(value = "tglAwal") String tglAwal, @RequestParam(value = "tglAkhir") String tglAkhir,
@RequestParam(value = "ruanganId") Integer ruanganId, HttpServletRequest request) {
try {
List<Map<String,Object>> noSurat= monitoringEvaluasiPerundanganService.listMonitoringEvaluasiPerundanganByRuanganTujuan(tglAwal, tglAkhir,noUsulan,ruanganId);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(noSurat, HttpStatus.OK,mapHeaderMessage);
List<Map<String, Object>> noSurat = monitoringEvaluasiPerundanganService
.listMonitoringEvaluasiPerundanganByRuanganTujuan(tglAwal, tglAkhir, noUsulan, ruanganId);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(noSurat, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add nota-dinas", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
LOGGER.error("Got ServiceVOException {} when listMonitoringEvaluasiPerundanganByRuanganTujuan",
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add nota-dinas", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
LOGGER.error("Got JpaSystemException {} when listMonitoringEvaluasiPerundanganByRuanganTujuan",
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-by-ruangan-pembuat", method = RequestMethod.GET)
public ResponseEntity<List<Map<String,Object>>> getListUsulanEvaluasiByRuanganPembuat(
@RequestMapping(value = "/get-by-ruangan-pembuat", method = GET)
public ResponseEntity<List<Map<String, Object>>> getListUsulanEvaluasiByRuanganPembuat(
@RequestParam(value = "noUsulan", required = false) String noUsulan,
@RequestParam(value = "tglAwal", required = true)String tglAwal,
@RequestParam(value = "tglAkhir", required = true)String tglAkhir,
@RequestParam(value = "ruanganId", required = true)Integer ruanganId,
HttpServletRequest request) {
@RequestParam(value = "tglAwal") String tglAwal, @RequestParam(value = "tglAkhir") String tglAkhir,
@RequestParam(value = "ruanganId") Integer ruanganId, HttpServletRequest request) {
try {
List<Map<String,Object>> noSurat= monitoringEvaluasiPerundanganService.listMonitoringEvaluasiPerundanganByRuanganPembuat(tglAwal, tglAkhir, noUsulan, ruanganId);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(noSurat, HttpStatus.OK,mapHeaderMessage);
List<Map<String, Object>> noSurat = monitoringEvaluasiPerundanganService
.listMonitoringEvaluasiPerundanganByRuanganPembuat(tglAwal, tglAkhir, noUsulan, ruanganId);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(noSurat, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add nota-dinas", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
LOGGER.error("Got ServiceVOException {} when listMonitoringEvaluasiPerundanganByRuanganPembuat",
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add nota-dinas", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
LOGGER.error("Got JpaSystemException {} when listMonitoringEvaluasiPerundanganByRuanganPembuat",
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-by-nousulan/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> getUsulanEvaluasiByNoUsulan(
@RequestParam(value = "noUsulan", required = true) String noUsulan) {
Map<String,Object> resultPageMap = monitoringEvaluasiPerundanganService.monitoringEvaluasiPerundanganByNoUsulan(noUsulan);
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK, mapHeaderMessage);
}
@RequestMapping( value = "/save-rekomendasi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> saveRekomendasi(
@RequestBody UsulanEvaluasiVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = monitoringEvaluasiPerundanganService.saveRekomendasiMonitoringEvaluasiPerundangan(vo);
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 savePlanningDHM", 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 savePlanningDHM", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,52 +1,48 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
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.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.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.dto.MonitoringMesinAutoClaveBowidickDto;
import com.jasamedika.medifirst2000.service.MonitoringMesinAutoClaveBowidickService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
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.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
import static org.springframework.http.HttpStatus.OK;
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("/monitoringmesinautoclavebowidick")
public class MonitoringMesinAutoClaveBowidickController extends LocaleController{
public class MonitoringMesinAutoClaveBowidickController extends LocaleController<MonitoringMesinAutoClaveBowidickDto> {
@Autowired
private MonitoringMesinAutoClaveBowidickService monitoringMesinAutoClaveBowidickService;
@RequestMapping(value="/save-monitoring-mesin-clave-bowidick",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveMonitoringMesin(
@RequestBody MonitoringMesinAutoClaveBowidickDto dto, HttpServletRequest request){
Map<String, Object> result = this.monitoringMesinAutoClaveBowidickService.saveMonitoringMesinAutoClaveBowidick(dto);
@RequestMapping(value = "/save-monitoring-mesin-clave-bowidick", method = POST, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveMonitoringMesin(@RequestBody MonitoringMesinAutoClaveBowidickDto dto,
HttpServletRequest request) {
Map<String, Object> result = this.monitoringMesinAutoClaveBowidickService
.saveMonitoringMesinAutoClaveBowidick(dto);
if (!result.isEmpty()) {
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);
}
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
}
@RequestMapping(value="/get-monitoring-mesin-clave-bowidick",
method=RequestMethod.GET,
produces=MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getMonitoringTestMesin(
@RequestParam("startDate")String startDate, @RequestParam("endDate")String endDate, HttpServletRequest request) {
Map<String, Object> result = this.monitoringMesinAutoClaveBowidickService.getMonitoringMesinAutoClaveBowidick(startDate, endDate);
return result;
@RequestMapping(value = "/get-monitoring-mesin-clave-bowidick", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getMonitoringTestMesin(@RequestParam("startDate") String startDate,
@RequestParam("endDate") String endDate, HttpServletRequest request) {
return this.monitoringMesinAutoClaveBowidickService.getMonitoringMesinAutoClaveBowidick(startDate, endDate);
}
}

View File

@ -1,52 +1,47 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
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.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.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.dto.MonitoringTestEntylenOxideDto;
import com.jasamedika.medifirst2000.service.MonitoringTestEntylenOxideService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
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.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
import static org.springframework.http.HttpStatus.OK;
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("/monitoringtestentylenoxide")
public class MonitoringTestEntylenOxideController extends LocaleController{
public class MonitoringTestEntylenOxideController extends LocaleController<MonitoringTestEntylenOxideDto> {
@Autowired
private MonitoringTestEntylenOxideService monitoringTestEntylenOxideService;
@RequestMapping(value="/save-monitoring-test-entylen-oxide",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveMonitoring(
@RequestBody MonitoringTestEntylenOxideDto dto, HttpServletRequest request){
@RequestMapping(value = "/save-monitoring-test-entylen-oxide", method = POST, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveMonitoring(@RequestBody MonitoringTestEntylenOxideDto dto,
HttpServletRequest request) {
Map<String, Object> result = this.monitoringTestEntylenOxideService.saveMonitoringTestEntylenOxideService(dto);
if (!result.isEmpty()) {
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);
}
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
}
@RequestMapping(value="/get-monitoring-test-entylen-oxide",
method=RequestMethod.GET,
produces=MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getMonitoring(
@RequestParam("startDate")String startDate, @RequestParam("endDate")String endDate, HttpServletRequest request) {
Map<String, Object> result = this.monitoringTestEntylenOxideService.getMonitoringTestEntylenOxideService(startDate, endDate);
return result;
@RequestMapping(value = "/get-monitoring-test-entylen-oxide", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getMonitoring(@RequestParam("startDate") String startDate,
@RequestParam("endDate") String endDate, HttpServletRequest request) {
return this.monitoringTestEntylenOxideService.getMonitoringTestEntylenOxideService(startDate, endDate);
}
}

View File

@ -1,52 +1,47 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
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.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.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.dto.MonitoringTestMesinAutoclaveDto;
import com.jasamedika.medifirst2000.service.MonitoringTestmesinAutoClaveService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
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.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
import static org.springframework.http.HttpStatus.OK;
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("/monitoringtestmesinautoclave")
public class MonitoringTestMesinAutoClaveController extends LocaleController{
public class MonitoringTestMesinAutoClaveController extends LocaleController<MonitoringTestMesinAutoclaveDto> {
@Autowired
private MonitoringTestmesinAutoClaveService monitoringTestmesinAutoClaveService;
@RequestMapping(value="/save-monitoring-test-mesin-clave",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-monitoring-test-mesin-clave", method = POST, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveMonitoringTestMesinClave(
@RequestBody MonitoringTestMesinAutoclaveDto dto, HttpServletRequest request){
@RequestBody MonitoringTestMesinAutoclaveDto dto, HttpServletRequest request) {
Map<String, Object> result = this.monitoringTestmesinAutoClaveService.saveMonitoringTestMesinAutoClave(dto);
if (!result.isEmpty()) {
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);
}
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
}
@RequestMapping(value="/get-monitoring-test-mesin-clave",
method=RequestMethod.GET,
produces=MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getMonitoringTestMesinClave(
@RequestParam("startDate")String startDate, @RequestParam("endDate")String endDate, HttpServletRequest request) {
Map<String, Object> result = this.monitoringTestmesinAutoClaveService.getMonitoringTestMesinAutoClave(startDate, endDate);
return result;
@RequestMapping(value = "/get-monitoring-test-mesin-clave", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getMonitoringTestMesinClave(@RequestParam("startDate") String startDate,
@RequestParam("endDate") String endDate, HttpServletRequest request) {
return this.monitoringTestmesinAutoClaveService.getMonitoringTestMesinAutoClave(startDate, endDate);
}
}

View File

@ -1,152 +1,108 @@
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.NeracaLimbahService;
import com.jasamedika.medifirst2000.vo.NeracaLimbahVO;
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.NeracaLimbahService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.NeracaLimbahVO;
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("/neraca-limbah")
public class NeracaLimbahController extends LocaleController<NeracaLimbahVO> {
private static final Logger LOGGER = getLogger(NeracaLimbahController.class);
@Autowired
private NeracaLimbahService neracaLimbahService;
private static final Logger LOGGER = LoggerFactory.getLogger(NeracaLimbahController.class);
@RequestMapping(value = "/save-neraca-limbah/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody NeracaLimbahVO vo, HttpServletRequest request) {
@RequestMapping(value = "/save-neraca-limbah/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody NeracaLimbahVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result=neracaLimbahService.add(vo);
Map<String, Object> result = neracaLimbahService.add(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 add NeracaLimbah", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when add", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add NeracaLimbah", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when add", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-neraca-limbah/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody NeracaLimbahVO vo, HttpServletRequest request) {
/* TODO: No service called */
@RequestMapping(value = "/update-neraca-limbah/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateVO(@Valid @RequestBody NeracaLimbahVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result=null;
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
return getJsonResponse(null, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when update NeracaLimbah", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when update", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update NeracaLimbah", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when update", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-neraca-limbah/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
try {
Map<String,Object> result=null;
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 sasaran strategis", 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 sasaran strategis", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/list-neraca-limbah")
public Map<String,Object> lisLimbahB3Masuk(
public Map<String, Object> lisLimbahB3Masuk(
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "take", required = false, defaultValue = "100") Integer limit,
@RequestParam(value = "sort", required = false, defaultValue = "noRec") String sort,
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir) {
Map<String, Object> resultPageMap = neracaLimbahService.listNeracaLimbah(page, limit, sort, dir);
return resultPageMap;
return neracaLimbahService.listNeracaLimbah(page, limit, sort, dir);
}
@RequestMapping(value = "/neraca-limbah-by-id")
public Map<String,Object> neracaLimbahDetail(
@RequestParam(value = "noRec", required = true) String noRec) {
Map<String, Object> resultPageMap = neracaLimbahService.neracaLimbahDetail(noRec);
return resultPageMap;
public Map<String, Object> neracaLimbahDetail(@RequestParam(value = "noRec") String noRec) {
return neracaLimbahService.neracaLimbahDetail(noRec);
}
@RequestMapping(value = "/get-jumlah-jenis-limbah-b3-by-periode", method = RequestMethod.GET)
public ResponseEntity<Map<String,Object>> getJumlahLimbahByJenisLimbahB3(
HttpServletRequest request,
@RequestParam(value = "startDate", required = true) String startDate,
@RequestParam(value = "endDate", required = true) String endDate) {
@RequestMapping(value = "/get-jumlah-jenis-limbah-b3-by-periode", method = GET)
public ResponseEntity<Map<String, Object>> getJumlahLimbahByJenisLimbahB3(HttpServletRequest request,
@RequestParam(value = "startDate") String startDate, @RequestParam(value = "endDate") String endDate) {
try {
Map<String,Object> result = this.neracaLimbahService.getJumlahJenisLimbahB3ByPeriode(startDate,endDate);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
Map<String, Object> result = this.neracaLimbahService.getJumlahJenisLimbahB3ByPeriode(startDate, endDate);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get all pengendali", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getJumlahJenisLimbahB3ByPeriode", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get all dokter", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getJumlahJenisLimbahB3ByPeriode", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,34 +1,33 @@
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 com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.NilaiNilai;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.NilaiNilaiService;
import com.jasamedika.medifirst2000.vo.NilaiNilaiVO;
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.NilaiNilaiService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.NilaiNilaiVO;
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_ERROR;
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.POST;
/**
* Controller class for NilaiNilaiController
@ -37,70 +36,34 @@ import com.jasamedika.medifirst2000.vo.NilaiNilaiVO;
*/
@RestController
@RequestMapping("/nilai-nilai")
@JsonIgnoreProperties(ignoreUnknown = true)
public class NilaiNilaiController extends LocaleController<NilaiNilaiVO> implements
IBaseRestController<NilaiNilaiVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(NilaiNilaiController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class NilaiNilaiController extends LocaleController<NilaiNilaiVO> {
private static final Logger LOGGER = getLogger(NilaiNilaiController.class);
@Autowired
private NilaiNilaiService nilaiNilaiService;
private NilaiNilaiService<NilaiNilai> nilaiNilaiService;
@RequestMapping(value = "/save-nilai-nilai", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody NilaiNilaiVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-nilai-nilai", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody NilaiNilaiVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = nilaiNilaiService.addNilaiNilai(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
Map<String, Object> result = nilaiNilaiService.addNilaiNilai(vo);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
SaveLog("Nilai Nilai", "Pemeriksaan",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
SaveLog("Nilai Nilai", "Pemeriksaan", request);
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addNilaiNilai", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addNilaiNilai", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@Override
public ResponseEntity<Collection<NilaiNilaiVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<NilaiNilaiVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(NilaiNilaiVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(NilaiNilaiVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<NilaiNilaiVO>> getAllVO() {
return null;
}
}

View File

@ -1,211 +1,109 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.NotaDinasService;
import com.jasamedika.medifirst2000.vo.NotaDinasVO;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
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.data.jpa.domain.Specification;
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.IBaseRestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.entities.NotaDinasJabatan;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.NotaDinasService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.NotaDinasJabatanVO;
import com.jasamedika.medifirst2000.vo.NotaDinasVO;
import net.kaczmarzyk.spring.data.jpa.domain.DateBetween;
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
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("/nota-dinas")
public class NotaDinasController extends LocaleController<NotaDinasVO> implements IBaseRestController<NotaDinasVO>{
public class NotaDinasController extends LocaleController<NotaDinasVO> {
private static final Logger LOGGER = getLogger(NotaDinasController.class);
@Autowired
private NotaDinasService notaDinasService;
private static final Logger LOGGER = LoggerFactory.getLogger(NotaDinasController.class);
@RequestMapping(value = "/save-nota-dinas/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody NotaDinasVO vo, HttpServletRequest request) {
@RequestMapping(value = "/save-nota-dinas/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody NotaDinasVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=notaDinasService.addNotaDinas(vo);
Map<String, Object> result = notaDinasService.addNotaDinas(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 add nota-dinas", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addNotaDinas", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add nota-dinas", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addNotaDinas", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-no-surat/", method = RequestMethod.GET)
public ResponseEntity<Map<String,Object>> getNoSurat(HttpServletRequest request) {
@RequestMapping(value = "/get-no-surat/", method = GET)
public ResponseEntity<Map<String, Object>> getNoSurat(HttpServletRequest request) {
try {
String noSurat=notaDinasService.getNoSurat();
System.out.println("Lukman debug "+ noSurat);
Map<String,Object> result=new HashMap<String,Object>();
String noSurat = notaDinasService.getNoSurat();
Map<String, Object> result = new HashMap<>();
result.put("noSurat", noSurat);
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);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add nota-dinas", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getNoSurat", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add nota-dinas", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getNoSurat", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/grid-nota-dinas")
@ResponseBody
public ResponseEntity<List<Object>> andCondition(
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "take", required = false, defaultValue = "10") Integer limit,
@RequestParam(value = "sort", required = false, defaultValue = "noRec") String sort,
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
@Spec(path = "notaDinas.tanggal", params = {"tanggalAwal", "tanggalAhir"}, config = "yyyy-MM-dd", spec = DateBetween.class)Specification<NotaDinasJabatan> spec){
Map<String, Object> resultPageMap = notaDinasService.gridNotaDinas(page, limit, sort, dir, spec);
return constructListPageResult(resultPageMap);
}
@RequestMapping(value = "/get-detail-nota-dinas", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<NotaDinasVO> findByNoRec(@RequestParam(value = "noRec", required = true) String noRec){
NotaDinasVO notaDinas = notaDinasService.findByNoRec(noRec);
try {
return RestUtil.getJsonResponse(notaDinas, HttpStatus.OK, mapHeaderMessage);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
return RestUtil.getJsonResponse(null, HttpStatus.NOT_FOUND, mapHeaderMessage);
}
@RequestMapping(value = "/get-inbox-nota-dinas", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> getInboxNotaDinas(
@RequestMapping(value = "/get-inbox-nota-dinas", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> getInboxNotaDinas(
@RequestParam(value = "flag", required = false) String flag,
@RequestParam(value = "dateStart", required = false) String dateStart,
@RequestParam(value = "dateEnd", required = false) String dateEnd,
@RequestParam(value = "idRuangan", required = false) Integer idRuangan,
@RequestParam(value = "idPegawai", required = false) Integer idPegawai){
List<Map<String, Object>> notaDinas = notaDinasService.getInboxNotaDinas(dateStart, dateEnd, idRuangan, flag,idPegawai);
@RequestParam(value = "idPegawai", required = false) Integer idPegawai) {
try {
return RestUtil.getJsonResponse(notaDinas, HttpStatus.OK, mapHeaderMessage);
List<Map<String, Object>> notaDinas = notaDinasService.getInboxNotaDinas(dateStart, dateEnd, idRuangan,
flag, idPegawai);
return getJsonResponse(notaDinas, OK, mapHeaderMessage);
} catch (IllegalArgumentException e) {
e.printStackTrace();
throw new ServiceVOException(e.getMessage());
}
return RestUtil.getJsonResponse(null, HttpStatus.NOT_FOUND, mapHeaderMessage);
}
@RequestMapping(value = "/get-outbox-nota-dinas", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> getOutboxNotaDinas(
@RequestMapping(value = "/get-outbox-nota-dinas", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> getOutboxNotaDinas(
@RequestParam(value = "flag", required = false) String flag,
@RequestParam(value = "dateStart", required = false) String dateStart,
@RequestParam(value = "dateEnd", required = false) String dateEnd,
@RequestParam(value = "idRuangan", required = false) Integer idRuangan,
@RequestParam(value = "idPegawai", required = false) Integer idPegawai){
List<Map<String, Object>> notaDinas = notaDinasService.getOutboxNotaDinas(dateStart,dateEnd,idRuangan,flag,idPegawai);
@RequestParam(value = "idPegawai", required = false) Integer idPegawai) {
try {
return RestUtil.getJsonResponse(notaDinas, HttpStatus.OK, mapHeaderMessage);
List<Map<String, Object>> notaDinas = notaDinasService.getOutboxNotaDinas(dateStart, dateEnd, idRuangan,
flag, idPegawai);
return getJsonResponse(notaDinas, HttpStatus.OK, mapHeaderMessage);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
return RestUtil.getJsonResponse(null, HttpStatus.NOT_FOUND, mapHeaderMessage);
}
@RequestMapping(value = "/save-nota-dinas-as-read/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> saveAsReadNotaDinas(@RequestBody NotaDinasJabatanVO vo, HttpServletRequest request) {
try {
String result=notaDinasService.saveAsRead(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 nota-dinas", 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 nota-dinas", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
throw new ServiceVOException(e.getMessage());
}
}
@Override
public ResponseEntity<Collection<NotaDinasVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<NotaDinasVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(NotaDinasVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(NotaDinasVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<NotaDinasVO>> getAllVO() {
return null;
}
}

View File

@ -1,88 +0,0 @@
package com.jasamedika.medifirst2000.controller;
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.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.ObjekModulAplikasiService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.ObjekModulAplikasiVO;
@RestController
@RequestMapping("/objek-modul-aplikasi")
public class ObjekModulAplikasiController extends LocaleController<ObjekModulAplikasiVO> {
@Autowired
private ObjekModulAplikasiService objekModulAplikasiService;
private static final Logger LOGGER = LoggerFactory
.getLogger(ObjekModulAplikasiController.class);
@RequestMapping(value = "/save-objek-modul-aplikasi/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody ObjekModulAplikasiVO vo,HttpServletRequest request) {
try{
Map<String, Object> result = objekModulAplikasiService.addObjekModulAplikasi(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 ObjekModulAplikasi", 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 ObjekModulAplikasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/update-objek-modul-aplikasi/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody ObjekModulAplikasiVO vo,HttpServletRequest request) {
try{
Map<String, Object> result = objekModulAplikasiService.updateObjekModulAplikasi(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 ObjekModulAplikasi", 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 ObjekModulAplikasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
}

View File

@ -1,91 +1,85 @@
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.ObservasiTransaksiService;
import com.jasamedika.medifirst2000.vo.ObservasiCustomVO;
import com.jasamedika.medifirst2000.vo.ObservasiVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.ObservasiTransaksiService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.ObservasiCustomVO;
import com.jasamedika.medifirst2000.vo.ObservasiVO;
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("/observasi")
public class ObservasiController extends LocaleController<ObservasiVO>{
public class ObservasiController extends LocaleController<ObservasiVO> {
private static final Logger LOGGER = getLogger(ObservasiController.class);
@Autowired
private ObservasiTransaksiService service;
private static final Logger LOGGER = LoggerFactory.getLogger(ObservasiController.class);
@RequestMapping(value = "/save-observasi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePengkajian(@Valid @RequestBody ObservasiCustomVO vo, HttpServletRequest request) {
@RequestMapping(value = "/save-observasi", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePengkajian(@Valid @RequestBody ObservasiCustomVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result = service.save(vo);
Map<String, Object> result = service.save(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 savePengkajian", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when save", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when savePengkajian", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when save", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-observasi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> getObservasi( HttpServletRequest request) {
List<Map<String, Object>> result = null;
@RequestMapping(value = "/get-observasi", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> getObservasi(HttpServletRequest request) {
try {
result = service.getObservasi();
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
List<Map<String, Object>> result = service.getObservasi();
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK);
} catch (Exception e) {
e.printStackTrace();
throw new ServiceVOException(e.getMessage());
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/get-value-observasi/{startDate}/{endDate}/{noRegistrasi}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> getValueObservasi( @PathVariable("startDate") String startDate,@PathVariable("endDate") String endDate,
@PathVariable("noRegistrasi") String noRegistrasi,HttpServletRequest request) {
List<Map<String, Object>> result = null;
@RequestMapping(value = "/get-value-observasi/{startDate}/{endDate}/{noRegistrasi}", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> getValueObservasi(@PathVariable("startDate") String startDate,
@PathVariable("endDate") String endDate, @PathVariable("noRegistrasi") String noRegistrasi,
HttpServletRequest request) {
try {
result = service.getObservasiValue(startDate, endDate,noRegistrasi);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
List<Map<String, Object>> result = service.getObservasiValue(startDate, endDate, noRegistrasi);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK);
} catch (Exception e) {
e.printStackTrace();
throw new ServiceVOException(e.getMessage());
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
}

View File

@ -1,183 +1,82 @@
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 com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.LayananService;
import com.jasamedika.medifirst2000.service.ObservasiIGDService;
import com.jasamedika.medifirst2000.vo.LayananVOCustom;
import com.jasamedika.medifirst2000.vo.ObservasiIGDVO;
import com.jasamedika.medifirst2000.vo.ObservasiIGDVOCustom;
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.LayananService;
import com.jasamedika.medifirst2000.service.ObservasiIGDService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.LayananVOCustom;
import com.jasamedika.medifirst2000.vo.ObservasiIGDVO;
import com.jasamedika.medifirst2000.vo.ObservasiIGDVOCustom;
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.POST;
@RestController
@RequestMapping("/observasiIGD")
public class ObservasiIGDController extends LocaleController<ObservasiIGDVO> implements IBaseRestController<ObservasiIGDVO>{
public class ObservasiIGDController extends LocaleController<ObservasiIGDVO> {
private static final Logger LOGGER = getLogger(ObservasiIGDController.class);
@Autowired
private ObservasiIGDService observasiIGDService;
@Autowired
private LayananService layananService;
private static final Logger LOGGER = LoggerFactory
.getLogger(ObservasiIGDController.class);
@Override
public ResponseEntity<Collection<ObservasiIGDVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<ObservasiIGDVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(ObservasiIGDVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(ObservasiIGDVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<ObservasiIGDVO>> getAllVO() {
return null;
}
@RequestMapping(value = "/save-observasi-igd/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody ObservasiIGDVOCustom vo, HttpServletRequest request) {
@RequestMapping(value = "/save-observasi-igd/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody ObservasiIGDVOCustom vo,
HttpServletRequest request) {
try {
Map<String,Object> result=observasiIGDService.saveObservasiIGD(vo);
Map<String, Object> result = observasiIGDService.saveObservasiIGD(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 add Observasi IGD", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveObservasiIGD", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Observasi IGD", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveObservasiIGD", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-layanan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addLayananVO(@Valid @RequestBody LayananVOCustom vo, HttpServletRequest request) {
@RequestMapping(value = "/save-layanan/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> addLayananVO(@Valid @RequestBody LayananVOCustom vo,
HttpServletRequest request) {
try {
Map<String,Object> result=layananService.saveLayanan(vo);
Map<String, Object> result = layananService.saveLayanan(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 add Layanan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveLayanan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Layanan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveLayanan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-observasi-igd/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> editVO(@Valid @RequestBody ObservasiIGDVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=observasiIGDService.updateObservasiIGD(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 Observasi IGD", 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 Observasi IGD", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
/*@RequestMapping(value = "/update-layanan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> updateLayananVO(@Valid @RequestBody LayananVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=layananService.updateLayanan(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 Layanan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update Layanan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}*/
// @SuppressWarnings("unchecked")
// @RequestMapping(value = "/find-by-noCm/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<Map<String,Object>> findByNoCm(@RequestParam(value = "noCm", required = false, defaultValue = "000000000000001") String noCm,HttpServletRequest request) {
// Map<String,Object> result = observasiIGDService.findByNoCm(noCm);
// Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
// if(dataFound){
// mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
// }else{
// mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
// }
// return RestUtil.getJsonResponse(result, HttpStatus.OK);
// }
}

View File

@ -1,101 +0,0 @@
package com.jasamedika.medifirst2000.controller;
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.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.ObservasiTerintegrasiPasienService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.ObservasiTerintegrasiPasienVO;
@RestController
@RequestMapping("/observasi-terintegrasi")
public class ObservasiTerintegrasiPasienController extends LocaleController{
private static final Logger LOGGER = LoggerFactory.getLogger(ObservasiTerintegrasiPasienController.class);
@Autowired
private ObservasiTerintegrasiPasienService service;
@RequestMapping(value = "/get-observasi-terintegrasi")
@ResponseBody
public List<Map<String, Object>> findReturStruk(
@RequestParam(value = "pegawaiId", required = true) Integer pegawaiId,
@RequestParam(value = "pasienId", required = true) Integer pasienId,
@RequestParam(value = "tglAwal", required = true) String tglAwal,
@RequestParam(value = "tglAhir", required = true) String tglAhir) {
return service.getAll(pegawaiId, pasienId, tglAwal, tglAhir);
}
@RequestMapping(value = "/save-observasi-terintegrasi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveObservasiTerintegrasiPasien(@Valid @RequestBody ObservasiTerintegrasiPasienVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = service.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 saveObservasiTerintegrasiPasien", 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 saveObservasiTerintegrasiPasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-konfirmasi-perawat", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateKonfirmasiPerawat(@Valid @RequestBody ObservasiTerintegrasiPasienVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = service.update(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 updateKonfirmasiPerawat", 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 updateKonfirmasiPerawat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-konfirmasi-dokter", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateKonfirmasiDokter(@Valid @RequestBody ObservasiTerintegrasiPasienVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = service.update(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 updateKonfirmasiDokter", 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 updateKonfirmasiDokter", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,35 +1,35 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CheckOutOperationService;
import com.jasamedika.medifirst2000.service.SignOutOperationService;
import com.jasamedika.medifirst2000.vo.CheckOutOperationVO;
import com.jasamedika.medifirst2000.vo.SignOutOperationVO;
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.fasterxml.jackson.annotation.JsonIgnoreProperties;
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.CheckOutOperationService;
import com.jasamedika.medifirst2000.service.SignOutOperationService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.CheckOutOperationVO;
import com.jasamedika.medifirst2000.vo.SignOutOperationVO;
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;
/******************
* @author Shakato
@ -37,178 +37,139 @@ import com.jasamedika.medifirst2000.vo.SignOutOperationVO;
@RestController
@RequestMapping("/operation")
@JsonIgnoreProperties(ignoreUnknown = true)
public class OperationController extends LocaleController<SignOutOperationVO>
{
public class OperationController extends LocaleController<SignOutOperationVO> {
private static final Logger LOGGER = getLogger(OperationController.class);
@Autowired
private SignOutOperationService signOutOperationService;
@Autowired
private CheckOutOperationService checkOutOperationService;
private static final Logger LOGGER = LoggerFactory.getLogger(OperationController.class);
@RequestMapping(value = "/save-signout-operation", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> saveSignInOperation(@Valid @RequestBody SignOutOperationVO vo, HttpServletRequest request) {
@RequestMapping(value = "/save-signout-operation", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<String> saveSignInOperation(@Valid @RequestBody SignOutOperationVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result = signOutOperationService.saveSignOutOperationService(vo);
Map<String, Object> result = signOutOperationService.saveSignOutOperationService(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);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse("Status Sukses", CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save SignOutOperation1", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveSignOutOperationService", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update SignOutOperation2", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-checkout-operation", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> saveCheckOutOperation(@Valid @RequestBody CheckOutOperationVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = checkOutOperationService.saveCheckOutOperationService(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 save CheckOutOperation1", 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 CheckOutOperation2", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-list-kesadaran-check-out",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getKesadaranCheckOut(HttpServletRequest request){
try {
Map<String,Object> result = this.checkOutOperationService.getKesadaranCheckOut();
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 getKesadaranCheckOut", 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 getKesadaranCheckOut", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-list-kelengkapan-check-out",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getKelengkapanCheckOut(HttpServletRequest request){
try {
Map<String,Object> result = this.checkOutOperationService.getKelengkapanCheckOut();
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 getKelengkapanCheckOut", 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 getKelengkapanCheckOut", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-check-out-by-norec",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getCheckOutByNoRec(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request){
try {
Map<String,Object> result = this.checkOutOperationService.getCheckOutByNoRec(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 getCheckOutByNoRec", 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 getCheckOutByNoRec", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-check-out-by-norec-antrian",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getCheckOutByNoRecAntrian(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request){
try {
Map<String,Object> result = this.checkOutOperationService.getCheckOutByNoRecAntrian(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 getCheckOutByNoRecAntrian", 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 getCheckOutByNoRecAntrian", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveSignOutOperationService", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-checkout-operation", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<String> saveCheckOutOperation(@Valid @RequestBody CheckOutOperationVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = checkOutOperationService.saveCheckOutOperationService(vo);
if (null != result)
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getJsonHttpStatus(CREATED);
return getJsonResponse("Status Sukses", CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when saveCheckOutOperationService", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when saveCheckOutOperationService", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-list-kesadaran-check-out", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getKesadaranCheckOut(HttpServletRequest request) {
try {
Map<String, Object> result = this.checkOutOperationService.getKesadaranCheckOut();
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 getKesadaranCheckOut", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getKesadaranCheckOut", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-list-kelengkapan-check-out", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getKelengkapanCheckOut(HttpServletRequest request) {
try {
Map<String, Object> result = this.checkOutOperationService.getKelengkapanCheckOut();
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 getKelengkapanCheckOut", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getKelengkapanCheckOut", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-check-out-by-norec", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getCheckOutByNoRec(@RequestParam(value = "noRec") String noRec,
HttpServletRequest request) {
try {
Map<String, Object> result = this.checkOutOperationService.getCheckOutByNoRec(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 getCheckOutByNoRec", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getCheckOutByNoRec", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-check-out-by-norec-antrian", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getCheckOutByNoRecAntrian(@RequestParam(value = "noRec") String noRec,
HttpServletRequest request) {
try {
Map<String, Object> result = this.checkOutOperationService.getCheckOutByNoRecAntrian(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 getCheckOutByNoRecAntrian", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getCheckOutByNoRecAntrian", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,139 +1,114 @@
package com.jasamedika.medifirst2000.controller;
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.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.dto.AsetDto;
import com.jasamedika.medifirst2000.dto.OrderAmbulanceDto;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.OrderAmbulanceService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.OrderAmbulanceVO;
import com.jasamedika.medifirst2000.vo.PegawaiVO;
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.RequestBody;
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 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("/order-ambulance")
public class OrderAmbulanceController extends LocaleController<OrderAmbulanceVO> {
private static final Logger LOGGER = getLogger(OrderAmbulanceController.class);
@Autowired
private OrderAmbulanceService orderAmbulanceService;
private static final Logger LOGGER = LoggerFactory.getLogger(OrderAmbulanceController.class);
@RequestMapping(value = "/save-order-ambulance/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-order-ambulance/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveOrderAmbulance(@Valid @RequestBody OrderAmbulanceVO vo,
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
@RequestParam(value = "noRec") String noRec, HttpServletRequest request) {
try {
Map<String, Object> result = orderAmbulanceService.saveOrderAmbulance(vo, noRec);
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 Order Ambulance", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveOrderAmbulance", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Order Ambulance", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveOrderAmbulance", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-no-order/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoOrder(
@RequestParam(value = "noOrder", required = false) String noOrder, HttpServletRequest request) {
Map<String, Object> result = orderAmbulanceService.findByNoOrder(noOrder);
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
getMessage(MessageResource.LABEL_ERROR, request));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/find-produk-ambulance/", method = RequestMethod.GET)
@RequestMapping(value = "/find-produk-ambulance/", method = GET)
public ResponseEntity<List<OrderAmbulanceDto>> findProdukAmbulance(HttpServletRequest request) {
try {
List<OrderAmbulanceDto> listAmbulanceVO = orderAmbulanceService.findProdukAmbulance();
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(listAmbulanceVO, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(listAmbulanceVO, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when Find Order Ambulance", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when findProdukAmbulance", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when Find Order Ambulance", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when findProdukAmbulance", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-asset-ambulance/", method = RequestMethod.GET)
@RequestMapping(value = "/find-asset-ambulance/", method = GET)
public ResponseEntity<List<AsetDto>> findAssetAmbulance(HttpServletRequest request) {
try {
List<AsetDto> listAssetVO = orderAmbulanceService.findAssetAmbulance();
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(listAssetVO, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(listAssetVO, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when Find Aset Ambulance", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when findAssetAmbulance", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when Find Aset Ambulance", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when findAssetAmbulance", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-supir-ambulance/", method = RequestMethod.GET)
@RequestMapping(value = "/get-supir-ambulance/", method = GET)
public ResponseEntity<List<PegawaiVO>> getSupirAmbulance(HttpServletRequest request) {
try {
List<PegawaiVO> listSupirVO = orderAmbulanceService.getSupirAmbulance();
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(listSupirVO, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(listSupirVO, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get All Supir Ambulance", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getSupirAmbulance", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get All Supir Ambulance", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getSupirAmbulance", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,126 +1,72 @@
package com.jasamedika.medifirst2000.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.OrderGiziService;
import com.jasamedika.medifirst2000.vo.MapProdukMenuToBahanVO;
import com.jasamedika.medifirst2000.vo.RequestBarangDariRuanganVO;
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.OrderGiziService;
import com.jasamedika.medifirst2000.service.StrukOrderService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.GiziProduksiOrderVO;
import com.jasamedika.medifirst2000.vo.MapProdukMenuToBahanVO;
import com.jasamedika.medifirst2000.vo.RequestBarangDariRuanganVO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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(value="/order-gizi")
public class OrderGiziController extends LocaleController<MapProdukMenuToBahanVO>{
@RequestMapping(value = "/order-gizi")
public class OrderGiziController extends LocaleController<MapProdukMenuToBahanVO> {
private static final Logger LOGGER = getLogger(OrderGiziController.class);
@Autowired
private OrderGiziService orderService;
@Autowired
private StrukOrderService strukOrderService;
private static final Logger LOGGER = LoggerFactory
.getLogger(OrderGiziController.class);
@RequestMapping(value="/get-bahan-order/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> getBahanOrderGizi(
@RequestParam(value="noOrder",required=true) String noOrder,
@RequestParam(value="jenisWaktu",required=false,defaultValue="-1") Integer jenisWaktu,
HttpServletRequest request)
{
Map<String, Object> result = new HashMap<String, Object>();
result = orderService.getBahanOrder(noOrder,jenisWaktu);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
@RequestMapping(value = "/get-bahan-order/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getBahanOrderGizi(@RequestParam(value = "noOrder") String noOrder,
@RequestParam(value = "jenisWaktu", required = false, defaultValue = "-1") Integer jenisWaktu,
HttpServletRequest request) {
Map<String, Object> result = orderService.getBahanOrder(noOrder, jenisWaktu);
if (null != result)
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
}
//Untuk Pesan Bahan ke Logistik. namun belum berdasarkan siklus Gizi dan auto generate belum dibuat
@RequestMapping(value = "/save-request-permintaan-barang/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveRequestPermintaanBarang(@Valid @RequestBody RequestBarangDariRuanganVO vo,HttpServletRequest request,HttpServletResponse response) {
@RequestMapping(value = "/save-request-permintaan-barang/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveRequestPermintaanBarang(
@Valid @RequestBody RequestBarangDariRuanganVO vo, HttpServletRequest request,
HttpServletResponse response) {
try {
Map<String, Object> result = orderService.savePermintanBarangDariRuangan(vo);
// Map<String, Object> result = strukOrderService.savePermintanBarangDariRuangan(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 Penerimaan Barang", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePermintanBarangDariRuangan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Penerimaan Barang", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when savePermintanBarangDariRuangan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}
@RequestMapping(value="/get-order-siklus/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> generateOrderSiklus(
HttpServletRequest request)
{
Map<String, Object> result = new HashMap<String, Object>();
result = orderService.generateMenuSiklus();
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
}
@RequestMapping(value="/get-order-gizi/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> getOrderGizi(
@RequestParam(value="startDate") String startDate,
@RequestParam(value="endDate") String endDate,
HttpServletRequest request)
{
Map<String, Object> result = new HashMap<String, Object>();
result = orderService.generateMenuSiklus();
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
}
@RequestMapping(value="/produksi/",method= RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> produksiOrder(@Valid @RequestBody List<GiziProduksiOrderVO> vos,HttpServletRequest request){
try {
Map<String, Object> result = orderService.produksiOrder(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 Produksi Order", 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 Produksi Order", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,61 +1,57 @@
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.OrderKendaraanDinasService;
import com.jasamedika.medifirst2000.vo.OrderKendaraanDinasVO;
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.OrderKendaraanDinasService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.OrderKendaraanDinasVO;
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.POST;
@RestController
@RequestMapping("/order-kendaraan-dinas")
public class OrderKendaraanDinasController extends LocaleController<OrderKendaraanDinasVO> {
private static final Logger LOGGER = getLogger(OrderKendaraanDinasController.class);
@Autowired
private OrderKendaraanDinasService orderKendaraanDinasService;
private static final Logger LOGGER = LoggerFactory.getLogger(OrderKendaraanDinasController.class);
@RequestMapping(value = "/save-order-kendaraan-dinas/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE, headers = "content-type=application/json")
@RequestMapping(value = "/save-order-kendaraan-dinas/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveOrderKendaraanDinas(@Valid @RequestBody OrderKendaraanDinasVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = orderKendaraanDinasService.saveOrderKendaraanDinas(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 Order Kendaraan Dinas & Pejabat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveOrderKendaraanDinas", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Order Kendaraan Dinas & Pejabat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveOrderKendaraanDinas", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,250 +1,163 @@
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.OrderPelayananSistemService;
import com.jasamedika.medifirst2000.vo.OrderPelayananSistemVO;
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.OrderPelayananSistemService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.OrderPelayananSistemVO;
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("/orderpelayanansistem")
public class OrderPelayananSistemController extends LocaleController<OrderPelayananSistemVO>{
private static final Logger LOGGER = LoggerFactory.getLogger(OrderPelayananSistemController.class);
public class OrderPelayananSistemController extends LocaleController<OrderPelayananSistemVO> {
private static final Logger LOGGER = getLogger(OrderPelayananSistemController.class);
@Autowired
private OrderPelayananSistemService orderPelayananSistemService;
@RequestMapping(
value = "/save-order-pelayanan-sistem",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveOrderPelayananSistem(
@Valid @RequestBody OrderPelayananSistemVO vo, HttpServletRequest request) {
private OrderPelayananSistemService orderPelayananSistemService;
@RequestMapping(value = "/save-order-pelayanan-sistem", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveOrderPelayananSistem(@Valid @RequestBody OrderPelayananSistemVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = this.orderPelayananSistemService.saveOrderPelayananSistem(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 saveOrderPelayananSistem", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveOrderPelayananSistem", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveOrderPelayananSistem", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-list-order-pelayanan-sistem",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataByNoOrder(
@RequestParam(value = "noOrder", required = true) String noOrder, HttpServletRequest request) {
try {
Map<String, Object> result = this.orderPelayananSistemService.getOrderSIbyNoOrder(noOrder);
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 getLoadDataByNoOrder", 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 getLoadDataByNoOrder", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveOrderPelayananSistem", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-order-sistem-all",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataSI(HttpServletRequest request) {
@RequestMapping(value = "/get-order-sistem-all", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataSI(HttpServletRequest request) {
try {
Map<String, Object> result = this.orderPelayananSistemService.getOrderSI();
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 getLoadDataSI", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getOrderSI", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadDataSI", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getOrderSI", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-load-order-pelayanan-sistem",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadData(HttpServletRequest request) {
@RequestMapping(value = "/get-load-order-pelayanan-sistem", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadData(HttpServletRequest request) {
try {
Map<String, Object> result = this.orderPelayananSistemService.getLoadData();
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",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadProduk(HttpServletRequest request) {
@RequestMapping(value = "/get-load-produk", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadProduk(HttpServletRequest request) {
try {
Map<String, Object> result = this.orderPelayananSistemService.getLoadProduk();
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 getLoadProduk", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getLoadProduk", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadProduk", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getLoadProduk", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-load-rungan-tujuan",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadRuangTujuan(HttpServletRequest request) {
@RequestMapping(value = "/get-load-rungan-tujuan", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadRuangTujuan(HttpServletRequest request) {
try {
Map<String, Object> result = this.orderPelayananSistemService.getLoadRuanganTujuan();
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 getLoadRuangTujuan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getLoadRuanganTujuan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadRuangTujuan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getLoadRuanganTujuan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-load-rungan-jenisdok",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadJenisDok(HttpServletRequest request) {
@RequestMapping(value = "/get-load-rungan-jenisdok", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadJenisDok(HttpServletRequest request) {
try {
Map<String, Object> result = this.orderPelayananSistemService.getLoadJenisDok();
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 getLoadJenisDok", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getLoadJenisDok", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadJenisDok", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getLoadJenisDok", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,147 +1,98 @@
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.dao.OrderPemakaianRuangRapatService;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.vo.OrderPemakaianRuangRapatVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.domain.Specifications;
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.dao.OrderPemakaianRuangRapatService;
import com.jasamedika.medifirst2000.entities.StrukOrder;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.OrderPemakaianRuangRapatVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Map;
import net.kaczmarzyk.spring.data.jpa.domain.GreaterThanOrEqual;
import net.kaczmarzyk.spring.data.jpa.domain.LessThanOrEqual;
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
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("/order-pemakaian-ruang-rapat")
public class OrderPemakaianRuangRapatController extends LocaleController<OrderPemakaianRuangRapatVO> {
private static final Logger LOGGER = getLogger(OrderPemakaianRuangRapatController.class);
@Autowired
private OrderPemakaianRuangRapatService orderPemakaianRuangRapatService;
private static final Logger LOGGER = LoggerFactory.getLogger(OrderPemakaianRuangRapatController.class);
@RequestMapping(value = "/save-order-pemakaian-ruang-rapat/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-order-pemakaian-ruang-rapat/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveOrderPemakaianRuangRapat(
@Valid @RequestBody OrderPemakaianRuangRapatVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = orderPemakaianRuangRapatService.saveOrderPemakaianRuangRapat(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 Order Pemakaian Ruang Rapat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveOrderPemakaianRuangRapat", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Order Pemakaian Ruang Rapat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveOrderPemakaianRuangRapat", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-no-order/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoOrder(
@RequestParam(value = "noOrder", required = false) String noOrder, HttpServletRequest request) {
Map<String, Object> result = orderPemakaianRuangRapatService.findByNoOrder(noOrder);
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
getMessage(MessageResource.LABEL_ERROR, request));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/find-ruang-rapat/", method = RequestMethod.GET)
public ResponseEntity<Map<String, Object>> findRuangRapat(
@RequestParam(value = "namaRuangan", required = true) String namaRuangan, HttpServletRequest request) {
@RequestMapping(value = "/find-ruang-rapat/", method = GET)
public ResponseEntity<Map<String, Object>> findRuangRapat(@RequestParam(value = "namaRuangan") String namaRuangan,
HttpServletRequest request) {
try {
Map<String, Object> listRuangRapatVO = orderPemakaianRuangRapatService.findRuangRapat(namaRuangan);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(listRuangRapatVO, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(listRuangRapatVO, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when Find Ruang Rapat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when findRuangRapat", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when Find Ruang Rapat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when findRuangRapat", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-status-ruang-rapat/", method = RequestMethod.GET)
@RequestMapping(value = "/find-status-ruang-rapat/", method = GET)
public ResponseEntity<Map<String, Object>> findStatusRuangRapat(
@RequestParam(value = "periodeAwal", required = true) Long periodeAwal,
@RequestParam(value = "periodeAkhir", required = true) Long periodeAkhir,
@RequestParam(value = "idRuangan", required = true) Integer idRuangan, HttpServletRequest request) {
@RequestParam(value = "periodeAwal") Long periodeAwal,
@RequestParam(value = "periodeAkhir") Long periodeAkhir,
@RequestParam(value = "idRuangan") Integer idRuangan, HttpServletRequest request) {
try {
Map<String, Object> listRuangRapatVO = orderPemakaianRuangRapatService.findStatusRuangRapat(periodeAwal,
periodeAkhir, idRuangan);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(listRuangRapatVO, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(listRuangRapatVO, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when Find Ruang Rapat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when findStatusRuangRapat", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when Find Ruang Rapat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when findStatusRuangRapat", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/find-status-ruangan-rapat/")
@ResponseBody
public ResponseEntity<List<Object>> findStatusRuanganRapat(
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "take", required = false, defaultValue = "10") Integer limit,
@RequestParam(value = "sort", required = false, defaultValue = "noRec") String sort,
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
@Spec(path = "tglPelayananAwal", params = "periodeAwal", config = "yyyy-MM-dd HH:mm:ss", spec = GreaterThanOrEqual.class) Specification<StrukOrder> spec1,
@Spec(path = "tglPelayananAkhir", params = "periodeAkhir", config = "yyyy-MM-dd HH:mm:ss", spec = LessThanOrEqual.class) Specification<StrukOrder> spec2) {
Specification<StrukOrder> spec = Specifications.where(spec1).and(spec2);
Map<String, Object> resultPageMap = orderPemakaianRuangRapatService.ruangRapatPaging(page, limit, sort, dir,
spec);
return constructListPageResult(resultPageMap);
}
}

View File

@ -1,77 +0,0 @@
package com.jasamedika.medifirst2000.controller;
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.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.OutputService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.OutputVO;
@RestController
@RequestMapping("/output")
public class OutputController extends LocaleController<OutputVO>{
@Autowired
private OutputService outputService;
private static final Logger LOGGER = LoggerFactory
.getLogger(OutputController.class);
@RequestMapping(value = "/save-output",
method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveOutput(@Valid @RequestBody OutputVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = outputService.saveOutput(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 saveOutput", 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 saveOutput", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-output", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findAllOutput(HttpServletRequest request) {
Map<String, Object> result=null;
try {
result = outputService.findAllOutput();
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
}catch(Exception ex){
ex.printStackTrace();
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
}

View File

@ -1,36 +1,32 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.PapAlergi;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapAlergiService;
import com.jasamedika.medifirst2000.vo.PapAlergiVO;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapAlergiService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapAlergiVO;
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.POST;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
@ -39,136 +35,31 @@ import com.jasamedika.medifirst2000.vo.PapAlergiVO;
*/
@RestController
@RequestMapping("/alergi")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapAlergiController extends LocaleController<PapAlergiVO> implements
IBaseRestController<PapAlergiVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapAlergiController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapAlergiController extends LocaleController<PapAlergiVO> {
private static final Logger LOGGER = getLogger(PapAlergiController.class);
@Autowired
private PapAlergiService papAlergiService;
private PapAlergiService<PapAlergi> papAlergiService;
@RequestMapping(value = "/save-alergi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapAlergiVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-alergi", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapAlergiVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = papAlergiService.addAlergi(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
SaveLog("Alergi", "Pemeriksaan",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
Map<String, Object> result = papAlergiService.addAlergi(vo);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
result.put("message", "Berhasil");
SaveLog("Alergi", "Pemeriksaan", request);
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addAlergi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addAlergi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-alergi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapAlergiVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papAlergiService.updateAlergi(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papAlergiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@RequestMapping(value = "/find-registrasi-pelayanan-pasien/{noCm}/{tglRegistrasi}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findRegistrasiPelayanaPasien(@PathVariable("noCm") String noCm,@PathVariable("tglRegistrasi") String tglRegistrasi,HttpServletRequest request) {
Map<String,Object> result = papAlergiService.findRegistrasiPelayananPasienByNoCmAndTglRegistrasi(noCm,(short) 0, DateUtil.toDate(tglRegistrasi));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/find-pasien-by-noCm/{noCm}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findPasien(@PathVariable("noCm") String noCm,HttpServletRequest request) {
Map<String,Object> result = papAlergiService.findPasienByNoCm(noCm);
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@Override
public ResponseEntity<Collection<PapAlergiVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapAlergiVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapAlergiVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapAlergiVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapAlergiVO>> getAllVO() {
return null;
}
}

View File

@ -1,36 +1,32 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.PapAnamesis;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapAnamesisService;
import com.jasamedika.medifirst2000.vo.PapAnamesisVO;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapAnamesisService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapAnamesisVO;
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.POST;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
@ -39,136 +35,31 @@ import com.jasamedika.medifirst2000.vo.PapAnamesisVO;
*/
@RestController
@RequestMapping("/anamesis")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapAnamesisController extends LocaleController<PapAnamesisVO> implements
IBaseRestController<PapAnamesisVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapAnamesisController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapAnamesisController extends LocaleController<PapAnamesisVO> {
private static final Logger LOGGER = getLogger(PapAnamesisController.class);
@Autowired
private PapAnamesisService papAnamesisService;
private PapAnamesisService<PapAnamesis> papAnamesisService;
@RequestMapping(value = "/save-anamesis", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapAnamesisVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-anamesis", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapAnamesisVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = papAnamesisService.addAnamesis(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
SaveLog("Anamnesis", "Pemeriksaan",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
Map<String, Object> result = papAnamesisService.addAnamesis(vo);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
result.put("message", "Berhasil");
SaveLog("Anamnesis", "Pemeriksaan", request);
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addAnamesis", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addAnamesis", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-anamesis", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapAnamesisVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papAnamesisService.updateAnamesis(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papAnamesisService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@RequestMapping(value = "/find-registrasi-pelayanan-pasien/{noCm}/{tglRegistrasi}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findRegistrasiPelayanaPasien(@PathVariable("noCm") String noCm,@PathVariable("tglRegistrasi") String tglRegistrasi,HttpServletRequest request) {
Map<String,Object> result = papAnamesisService.findRegistrasiPelayananPasienByNoCmAndTglRegistrasi(noCm,(short) 0, DateUtil.toDate(tglRegistrasi));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/find-pasien-by-noCm/{noCm}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findPasien(@PathVariable("noCm") String noCm,HttpServletRequest request) {
Map<String,Object> result = papAnamesisService.findPasienByNoCm(noCm);
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@Override
public ResponseEntity<Collection<PapAnamesisVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapAnamesisVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapAnamesisVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapAnamesisVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapAnamesisVO>> getAllVO() {
return null;
}
}

View File

@ -1,175 +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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapAssesmentGiziService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapAssesmentGiziVO;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
*
* @author Askur
*/
@RestController
@RequestMapping("/assesment-gizi")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapAssesmentGiziController extends LocaleController<PapAssesmentGiziVO> implements
IBaseRestController<PapAssesmentGiziVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapAssesmentGiziController.class);
@Autowired
private PapAssesmentGiziService papAssesmentGiziService;
@RequestMapping(value = "/save-assesment-gizi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapAssesmentGiziVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papAssesmentGiziService.addAssesmentGizi(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
SaveLog("Assesment Gizi Awal", "Pemeriksaan",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-assesment-gizi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapAssesmentGiziVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papAssesmentGiziService.updateAssesmentGizi(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papAssesmentGiziService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/find-registrasi-pelayanan-pasien/{noCm}/{tglRegistrasi}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findRegistrasiPelayanaPasien(@PathVariable("noCm") String noCm,@PathVariable("tglRegistrasi") String tglRegistrasi,HttpServletRequest request) {
Map<String,Object> result = papAssesmentGiziService.findRegistrasiPelayananPasienByNoCmAndTglRegistrasi(noCm,(short) 0, DateUtil.toDate(tglRegistrasi));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/find-pasien-by-noCm/{noCm}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findPasien(@PathVariable("noCm") String noCm,HttpServletRequest request) {
Map<String,Object> result = papAssesmentGiziService.findPasienByNoCm(noCm);
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@Override
public ResponseEntity<Collection<PapAssesmentGiziVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapAssesmentGiziVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapAssesmentGiziVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapAssesmentGiziVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapAssesmentGiziVO>> getAllVO() {
return null;
}
}

View File

@ -1,36 +1,32 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.PapBedah;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapBedahService;
import com.jasamedika.medifirst2000.vo.PapBedahVO;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapBedahService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapBedahVO;
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.POST;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
@ -39,136 +35,30 @@ import com.jasamedika.medifirst2000.vo.PapBedahVO;
*/
@RestController
@RequestMapping("/bedah")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapBedahController extends LocaleController<PapBedahVO> implements
IBaseRestController<PapBedahVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapBedahController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapBedahController extends LocaleController<PapBedahVO> {
private static final Logger LOGGER = getLogger(PapBedahController.class);
@Autowired
private PapBedahService papBedahService;
private PapBedahService<PapBedah> papBedahService;
@RequestMapping(value = "/save-bedah", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapBedahVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-bedah", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapBedahVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = papBedahService.addBedah(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
Map<String, Object> result = papBedahService.addBedah(vo);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
result.put("message", "Berhasil");
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addBedah", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addBedah", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-bedah", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapBedahVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papBedahService.updateBedah(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papBedahService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@RequestMapping(value = "/find-registrasi-pelayanan-pasien/{noCm}/{tglRegistrasi}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findRegistrasiPelayanaPasien(@PathVariable("noCm") String noCm,@PathVariable("tglRegistrasi") String tglRegistrasi,HttpServletRequest request) {
Map<String,Object> result = papBedahService.findRegistrasiPelayananPasienByNoCmAndTglRegistrasi(noCm,(short) 0, DateUtil.toDate(tglRegistrasi));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@RequestMapping(value = "/find-pasien-by-noCm/{noCm}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findPasien(@PathVariable("noCm") String noCm,HttpServletRequest request) {
Map<String,Object> result = papBedahService.findPasienByNoCm(noCm);
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@Override
public ResponseEntity<Collection<PapBedahVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapBedahVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapBedahVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapBedahVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapBedahVO>> getAllVO() {
return null;
}
}

View File

@ -1,34 +1,33 @@
package com.jasamedika.medifirst2000.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapCatatanService;
import com.jasamedika.medifirst2000.vo.PapCatatanVO;
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.fasterxml.jackson.annotation.JsonIgnoreProperties;
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.PapCatatanService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapCatatanVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.HashMap;
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.POST;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
@ -37,59 +36,36 @@ import com.jasamedika.medifirst2000.vo.PapCatatanVO;
*/
@RestController
@RequestMapping("/catatan")
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapCatatanController extends LocaleController<PapCatatanVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapCatatanController.class);
private static final Logger LOGGER = getLogger(PapCatatanController.class);
@Autowired
private PapCatatanService papCatatanService;
@RequestMapping(value = "/save-catatan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody List<PapCatatanVO> vos,HttpServletRequest request) {
@RequestMapping(value = "/save-catatan", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody List<PapCatatanVO> vos,
HttpServletRequest request) {
try {
Map<String,Object> result = papCatatanService.addCatatan(vos);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} else{
Map<String, Object> result = papCatatanService.addCatatan(vos);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} else {
Map<String, String> headerMessageCustom = new HashMap<>();
headerMessageCustom.put("label-success", "Pasien belum melakukan pendaftaran");
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, headerMessageCustom);
return getJsonResponse(null, CREATED, headerMessageCustom);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addCatatan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-catatan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getCatatan(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
try {
Map<String, Object> result = papCatatanService.getCatatan(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 getCatatan", 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 getCatatan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addCatatan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,148 +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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapDiagnosisService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapDiagnosisVO;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
*
* @author Askur
*/
@RestController
@RequestMapping("/diagnosis")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapDiagnosisController extends LocaleController<PapDiagnosisVO> implements
IBaseRestController<PapDiagnosisVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapDiagnosisController.class);
@Autowired
private PapDiagnosisService papDiagnosisService;
@RequestMapping(value = "/save-diagnosis", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapDiagnosisVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papDiagnosisService.addDiagnosis(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-diagnosis", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapDiagnosisVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papDiagnosisService.updateDiagnosis(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papDiagnosisService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@Override
public ResponseEntity<Collection<PapDiagnosisVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapDiagnosisVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapDiagnosisVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapDiagnosisVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapDiagnosisVO>> getAllVO() {
return null;
}
}

View File

@ -1,36 +1,32 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.PapEliminasi;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapEliminasiService;
import com.jasamedika.medifirst2000.vo.PapEliminasiVO;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapEliminasiService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapEliminasiVO;
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.POST;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
@ -39,111 +35,31 @@ import com.jasamedika.medifirst2000.vo.PapEliminasiVO;
*/
@RestController
@RequestMapping("/eliminasi")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapEliminasiController extends LocaleController<PapEliminasiVO> implements
IBaseRestController<PapEliminasiVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapEliminasiController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapEliminasiController extends LocaleController<PapEliminasiVO> {
private static final Logger LOGGER = getLogger(PapEliminasiController.class);
@Autowired
private PapEliminasiService papEliminasiService;
private PapEliminasiService<PapEliminasi> papEliminasiService;
@RequestMapping(value = "/save-eliminasi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapEliminasiVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-eliminasi", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapEliminasiVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = papEliminasiService.addEliminasi(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
SaveLog("Eliminasi", "Pemeriksaan",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
Map<String, Object> result = papEliminasiService.addEliminasi(vo);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
result.put("message", "Berhasil");
SaveLog("Eliminasi", "Pemeriksaan", request);
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addEliminasi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addEliminasi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-eliminasi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapEliminasiVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papEliminasiService.updateEliminasi(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papEliminasiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@Override
public ResponseEntity<Collection<PapEliminasiVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapEliminasiVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapEliminasiVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapEliminasiVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapEliminasiVO>> getAllVO() {
return null;
}
}

View File

@ -1,36 +1,32 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.PapGastrointestinal;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapGastrointestinalService;
import com.jasamedika.medifirst2000.vo.PapGastrointestinalVO;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapGastrointestinalService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapGastrointestinalVO;
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.POST;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
@ -39,111 +35,32 @@ import com.jasamedika.medifirst2000.vo.PapGastrointestinalVO;
*/
@RestController
@RequestMapping("/gastrointestinal")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapGastrointestinalController extends LocaleController<PapGastrointestinalVO> implements
IBaseRestController<PapGastrointestinalVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapGastrointestinalController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapGastrointestinalController extends LocaleController<PapGastrointestinalVO> {
private static final Logger LOGGER = getLogger(PapGastrointestinalController.class);
@Autowired
private PapGastrointestinalService papGastrointestinalService;
private PapGastrointestinalService<PapGastrointestinal> papGastrointestinalService;
@RequestMapping(value = "/save-gastrointestinal", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapGastrointestinalVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-gastrointestinal", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapGastrointestinalVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result = papGastrointestinalService.addGastrointestinal(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
SaveLog("Gastrointestinal", "Pemeriksaan",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
Map<String, Object> result = papGastrointestinalService.addGastrointestinal(vo);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
result.put("message", "Berhasil");
SaveLog("Gastrointestinal", "Pemeriksaan", request);
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addGastrointestinal", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addGastrointestinal", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-gastrointestinal", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapGastrointestinalVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papGastrointestinalService.updateGastrointestinal(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papGastrointestinalService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@Override
public ResponseEntity<Collection<PapGastrointestinalVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapGastrointestinalVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapGastrointestinalVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapGastrointestinalVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapGastrointestinalVO>> getAllVO() {
return null;
}
}

View File

@ -1,36 +1,36 @@
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 com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.PapGenatalia;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapGenataliaService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.vo.PapGenataliaVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapGenataliaService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapGenataliaVO;
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_ERROR;
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;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
@ -39,111 +39,62 @@ import com.jasamedika.medifirst2000.vo.PapGenataliaVO;
*/
@RestController
@RequestMapping("/genatalia")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapGenataliaController extends LocaleController<PapGenataliaVO> implements
IBaseRestController<PapGenataliaVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapGenataliaController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapGenataliaController extends LocaleController<PapGenataliaVO> {
private static final Logger LOGGER = getLogger(PapGenataliaController.class);
@Autowired
private PapGenataliaService papGenataliaService;
private PapGenataliaService<PapGenatalia> papGenataliaService;
@RequestMapping(value = "/save-genatalia", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapGenataliaVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-genatalia", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapGenataliaVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = papGenataliaService.addGenatalia(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
SaveLog("Genatalia", "Pemeriksaan",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
Map<String, Object> result = papGenataliaService.addGenatalia(vo);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
result.put("message", "Berhasil");
SaveLog("Genatalia", "Pemeriksaan", request);
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addGenatalia", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addGenatalia", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-genatalia", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapGenataliaVO vo,HttpServletRequest request) {
@RequestMapping(value = "/edit-genatalia", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> edit(@Valid @RequestBody PapGenataliaVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = papGenataliaService.updateGenatalia(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
Map<String, Object> result = papGenataliaService.updateGenatalia(vo);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
result.put("message", "Berhasil");
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when updateGenatalia", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when updateGenatalia", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papGenataliaService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoCm(@PathVariable("noCm") String noCm,
@PathVariable("tglInput") String tglInput, HttpServletRequest request) {
Map<String, Object> result = papGenataliaService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
return getJsonResponse(result, OK, mapHeaderMessage);
}
@Override
public ResponseEntity<Collection<PapGenataliaVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapGenataliaVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapGenataliaVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapGenataliaVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapGenataliaVO>> getAllVO() {
return null;
}
}

View File

@ -3,7 +3,6 @@ package com.jasamedika.medifirst2000.controller;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.dao.PapAlergiDao;
import com.jasamedika.medifirst2000.entities.GenericView;
import com.jasamedika.medifirst2000.service.GenericViewService;
import com.jasamedika.medifirst2000.vo.PapAlergiVO;
@ -36,9 +35,6 @@ public class PapGenericController extends LocaleController<PapAlergiVO> {
@Autowired
private GenericViewService<GenericView> genericViewService;
@Autowired
private PapAlergiDao papAlergiDao;
@RequestMapping(value = "/find-medical-record-noRec/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findMedicalRecordByNoRec(
@RequestParam(value = "i", required = false) String i,

View File

@ -1,36 +1,32 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.PapGigiMulut;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapGigiMulutService;
import com.jasamedika.medifirst2000.vo.PapGigiMulutVO;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapGigiMulutService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapGigiMulutVO;
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.POST;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
@ -39,137 +35,31 @@ import com.jasamedika.medifirst2000.vo.PapGigiMulutVO;
*/
@RestController
@RequestMapping("/gigi-mulut")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapGigiMulutController extends LocaleController<PapGigiMulutVO> implements
IBaseRestController<PapGigiMulutVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapGigiMulutController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapGigiMulutController extends LocaleController<PapGigiMulutVO> {
private static final Logger LOGGER = getLogger(PapGigiMulutController.class);
@Autowired
private PapGigiMulutService papGigiMulutService;
private PapGigiMulutService<PapGigiMulut> papGigiMulutService;
@RequestMapping(value = "/save-gigi-mulut", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapGigiMulutVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-gigi-mulut", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapGigiMulutVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = papGigiMulutService.addGigiMulut(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
SaveLog("Gigi Mulut", "Pemeriksaan Khusus",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
Map<String, Object> result = papGigiMulutService.addGigiMulut(vo);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
result.put("message", "Berhasil");
SaveLog("Gigi Mulut", "Pemeriksaan Khusus", request);
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addGigiMulut", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addGigiMulut", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-gigi-mulut", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapGigiMulutVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papGigiMulutService.updateGigiMulut(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papGigiMulutService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@RequestMapping(value = "/find-registrasi-pelayanan-pasien/{noCm}/{tglRegistrasi}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findRegistrasiPelayanaPasien(@PathVariable("noCm") String noCm,@PathVariable("tglRegistrasi") String tglRegistrasi,HttpServletRequest request) {
Map<String,Object> result = papGigiMulutService.findRegistrasiPelayananPasienByNoCmAndTglRegistrasi(noCm,(short) 0, DateUtil.toDate(tglRegistrasi));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@RequestMapping(value = "/find-pasien-by-noCm/{noCm}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findPasien(@PathVariable("noCm") String noCm,HttpServletRequest request) {
Map<String,Object> result = papGigiMulutService.findPasienByNoCm(noCm);
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@Override
public ResponseEntity<Collection<PapGigiMulutVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapGigiMulutVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapGigiMulutVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapGigiMulutVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapGigiMulutVO>> getAllVO() {
return null;
}
}

View File

@ -1,37 +1,36 @@
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 com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.PapGinekologi;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapGinekologiService;
import com.jasamedika.medifirst2000.vo.PapGinekologiVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.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.PapGinekologiService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapGinekologiVO;
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_ERROR;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.DateUtil.toDate;
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;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
@ -40,146 +39,44 @@ import com.jasamedika.medifirst2000.vo.PapGinekologiVO;
*/
@RestController
@RequestMapping("/ginekologi")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapGinekologiController extends LocaleController<PapGinekologiVO> implements
IBaseRestController<PapGinekologiVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapGinekologiController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapGinekologiController extends LocaleController<PapGinekologiVO> {
private static final Logger LOGGER = getLogger(PapGinekologiController.class);
@Autowired
private PapGinekologiService papGinekologiService;
private PapGinekologiService<PapGinekologi> papGinekologiService;
@RequestMapping(value = "/save-ginekologi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapGinekologiVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-ginekologi", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapGinekologiVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result = papGinekologiService.addGinekologi(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
Map<String, Object> result = papGinekologiService.addGinekologi(vo);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addGinekologi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addGinekologi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-ginekologi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapGinekologiVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papGinekologiService.updateGinekologi(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
@RequestMapping(value = "/find-noCm-and-tglInput/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoCmAndTglInput(
@RequestParam(value = "noCm", required = false) String noCm,
@RequestParam(value = "tglInput", required = false) String tglInput, HttpServletRequest request) {
Map<String, Object> result = papGinekologiService.findByNoCmAndTglInput(noCm, toDate(tglInput));
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
return getJsonResponse(result, OK, mapHeaderMessage);
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papGinekologiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@RequestMapping(value = "/find-noCm-and-tglInput/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCmAndTglInput(@RequestParam(value = "noCm", required = false) String noCm,
@RequestParam(value = "tglInput", required = false) String tglInput,HttpServletRequest request) {
Map<String,Object> result = papGinekologiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@RequestMapping(value = "/find-registrasi-pelayanan-pasien/{noCm}/{tglRegistrasi}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findRegistrasiPelayanaPasien(@PathVariable("noCm") String noCm,@PathVariable("tglRegistrasi") String tglRegistrasi,HttpServletRequest request) {
Map<String,Object> result = papGinekologiService.findRegistrasiPelayananPasienByNoCmAndTglRegistrasi(noCm,(short) 0, DateUtil.toDate(tglRegistrasi));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@RequestMapping(value = "/find-pasien-by-noCm/{noCm}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findPasien(@PathVariable("noCm") String noCm,HttpServletRequest request) {
Map<String,Object> result = papGinekologiService.findPasienByNoCm(noCm);
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@Override
public ResponseEntity<Collection<PapGinekologiVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapGinekologiVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapGinekologiVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapGinekologiVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapGinekologiVO>> getAllVO() {
return null;
}
}

View File

@ -1,38 +1,34 @@
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 com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapInstruksiPerjanjianService;
import com.jasamedika.medifirst2000.vo.PapInstruksiPerjanjianVO;
import com.jasamedika.medifirst2000.vo.PasienInstruksiPerjanjianVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.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.PapInstruksiPerjanjianService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapInstruksiPerjanjianVO;
import com.jasamedika.medifirst2000.vo.PasienInstruksiPerjanjianVO;
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;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
@ -41,159 +37,49 @@ import com.jasamedika.medifirst2000.vo.PasienInstruksiPerjanjianVO;
*/
@RestController
@RequestMapping("/instruksi-perjanjian")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapInstruksiPerjanjianController extends LocaleController<PapInstruksiPerjanjianVO> implements
IBaseRestController<PapInstruksiPerjanjianVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapInstruksiPerjanjianController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapInstruksiPerjanjianController extends LocaleController<PapInstruksiPerjanjianVO> {
private static final Logger LOGGER = getLogger(PapInstruksiPerjanjianController.class);
@Autowired
private PapInstruksiPerjanjianService papInstruksiPerjanjianService;
@RequestMapping(value = "/save-instruksi-perjanjian", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PasienInstruksiPerjanjianVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-instruksi-perjanjian", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PasienInstruksiPerjanjianVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result = papInstruksiPerjanjianService.addInstruksiPerjanjian(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
SaveLog("Perjanjian", "Instruksi",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
Map<String, Object> result = papInstruksiPerjanjianService.addInstruksiPerjanjian(vo);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
result.put("message", "Berhasil");
SaveLog("Perjanjian", "Instruksi", request);
return getJsonResponse(result, CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addInstruksiPerjanjian", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addInstruksiPerjanjian", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-jadwal-instruksi-perjanjian", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> update(@Valid @RequestBody PapInstruksiPerjanjianVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papInstruksiPerjanjianService.updateJadwal(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
SaveLog("Perjanjian", "Instruksi",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-instruksi-perjanjian", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapInstruksiPerjanjianVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papInstruksiPerjanjianService.updateInstruksiPerjanjian(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papInstruksiPerjanjianService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/get-informasi-perjanjian", method = RequestMethod.GET)
public ResponseEntity<Map<String,Object>> getInformasiPerjanjian(HttpServletRequest request,
@RequestParam(value = "pasienId", required = true) Integer pasienId,
@RequestParam(value = "ruanganId", required = true) Integer ruanganId) {
@RequestMapping(value = "/get-informasi-perjanjian", method = GET)
public ResponseEntity<Map<String, Object>> getInformasiPerjanjian(HttpServletRequest request,
@RequestParam(value = "pasienId") Integer pasienId, @RequestParam(value = "ruanganId") Integer ruanganId) {
try {
Map<String, Object> result = papInstruksiPerjanjianService.getInformasiPerjanjian(pasienId, ruanganId);
return RestUtil.getJsonResponse(result, HttpStatus.OK);
return getJsonResponse(result, OK);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get all dokter", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getInformasiPerjanjian", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get all dokter", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getInformasiPerjanjian", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@Override
public ResponseEntity<Collection<PapInstruksiPerjanjianVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapInstruksiPerjanjianVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapInstruksiPerjanjianVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapInstruksiPerjanjianVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapInstruksiPerjanjianVO>> getAllVO() {
return null;
}
}

View File

@ -1,148 +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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapInstruksiPulangService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapInstruksiPulangVO;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
*
* @author Askur
*/
@RestController
@RequestMapping("/instruksi-pulang")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapInstruksiPulangController extends LocaleController<PapInstruksiPulangVO> implements
IBaseRestController<PapInstruksiPulangVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapInstruksiPulangController.class);
@Autowired
private PapInstruksiPulangService papInstruksiPulangService;
@RequestMapping(value = "/save-instruksi-pulang", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapInstruksiPulangVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papInstruksiPulangService.addInstruksiPulang(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-instruksi-pulang", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapInstruksiPulangVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papInstruksiPulangService.updateInstruksiPulang(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papInstruksiPulangService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@Override
public ResponseEntity<Collection<PapInstruksiPulangVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapInstruksiPulangVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapInstruksiPulangVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapInstruksiPulangVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapInstruksiPulangVO>> getAllVO() {
return null;
}
}

View File

@ -1,148 +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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapInstruksiRanapService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapInstruksiRanapVO;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
*
* @author Askur
*/
@RestController
@RequestMapping("/instruksi-ranap")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapInstruksiRanapController extends LocaleController<PapInstruksiRanapVO> implements
IBaseRestController<PapInstruksiRanapVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapInstruksiRanapController.class);
@Autowired
private PapInstruksiRanapService papInstruksiRanapService;
@RequestMapping(value = "/save-instruksi-ranap", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapInstruksiRanapVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papInstruksiRanapService.addInstruksiRanap(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-instruksi-ranap", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapInstruksiRanapVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papInstruksiRanapService.updateInstruksiRanap(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papInstruksiRanapService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@Override
public ResponseEntity<Collection<PapInstruksiRanapVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapInstruksiRanapVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapInstruksiRanapVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapInstruksiRanapVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapInstruksiRanapVO>> getAllVO() {
return null;
}
}

View File

@ -1,36 +1,32 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.PapIntegumen;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapIntegumenService;
import com.jasamedika.medifirst2000.vo.PapIntegumenVO;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapIntegumenService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapIntegumenVO;
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.POST;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
@ -39,110 +35,31 @@ import com.jasamedika.medifirst2000.vo.PapIntegumenVO;
*/
@RestController
@RequestMapping("/integumen")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapIntegumenController extends LocaleController<PapIntegumenVO> implements
IBaseRestController<PapIntegumenVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapIntegumenController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapIntegumenController extends LocaleController<PapIntegumenVO> {
private static final Logger LOGGER = getLogger(PapIntegumenController.class);
@Autowired
private PapIntegumenService papIntegumenService;
private PapIntegumenService<PapIntegumen> papIntegumenService;
@RequestMapping(value = "/save-integumen", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapIntegumenVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-integumen", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapIntegumenVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = papIntegumenService.addIntegumen(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
SaveLog("Integumen", "Pemeriksaan",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
Map<String, Object> result = papIntegumenService.addIntegumen(vo);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
result.put("message", "Berhasil");
SaveLog("Integumen", "Pemeriksaan", request);
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addIntegumen", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addIntegumen", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-integumen", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapIntegumenVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papIntegumenService.updateIntegumen(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papIntegumenService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@Override
public ResponseEntity<Collection<PapIntegumenVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapIntegumenVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapIntegumenVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapIntegumenVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapIntegumenVO>> getAllVO() {
return null;
}
}

View File

@ -1,138 +1,61 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.PapKebutuhanEdukasi;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapKebutuhanEdukasiService;
import com.jasamedika.medifirst2000.vo.PapKebutuhanEdukasiVO;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapKebutuhanEdukasiService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapKebutuhanEdukasiVO;
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.POST;
@RestController
@RequestMapping("/kebutuhan-edukasi")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapKebutuhanEdukasiController extends LocaleController<PapKebutuhanEdukasiVO> implements IBaseRestController<PapKebutuhanEdukasiVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapKebutuhanEdukasiController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapKebutuhanEdukasiController extends LocaleController<PapKebutuhanEdukasiVO> {
private static final Logger LOGGER = getLogger(PapKebutuhanEdukasiController.class);
@Autowired
private PapKebutuhanEdukasiService papKebutuhanEdukasiService;
private PapKebutuhanEdukasiService<PapKebutuhanEdukasi> papKebutuhanEdukasiService;
@Override
public ResponseEntity<Collection<PapKebutuhanEdukasiVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapKebutuhanEdukasiVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapKebutuhanEdukasiVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapKebutuhanEdukasiVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapKebutuhanEdukasiVO>> getAllVO() {
return null;
}
@RequestMapping(value = "/save-kebutuhan-edukasi/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody PapKebutuhanEdukasiVO vo, HttpServletRequest request) {
@RequestMapping(value = "/save-kebutuhan-edukasi/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody PapKebutuhanEdukasiVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result=papKebutuhanEdukasiService.addKebutuhanEdukasi(vo);
Map<String, Object> result = papKebutuhanEdukasiService.addKebutuhanEdukasi(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
SaveLog("Kebutuhan Edukasi", "Pemeriksaan",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
SaveLog("Kebutuhan Edukasi", "Pemeriksaan", request);
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Kebutuhan Edukasi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addKebutuhanEdukasi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Kebutuhan Edukasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addKebutuhanEdukasi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-kebutuhan-edukasi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapKebutuhanEdukasiVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papKebutuhanEdukasiService.updateKebutuhanEdukasi(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papKebutuhanEdukasiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
}

View File

@ -1,36 +1,34 @@
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.RequestParam;
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.entities.PapKeluhanTambahan;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapKeluhanTambahanService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapKeluhanTambahanVO;
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.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
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;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
@ -39,130 +37,46 @@ import com.jasamedika.medifirst2000.vo.PapKeluhanTambahanVO;
*/
@RestController
@RequestMapping("/keluhan-tambahan")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapKeluhanTambahanController extends LocaleController<PapKeluhanTambahanVO> implements
IBaseRestController<PapKeluhanTambahanVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapKeluhanTambahanController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapKeluhanTambahanController extends LocaleController<PapKeluhanTambahanVO> {
private static final Logger LOGGER = getLogger(PapKeluhanTambahanController.class);
@Autowired
private PapKeluhanTambahanService papKeluhanTambahanService;
private PapKeluhanTambahanService<PapKeluhanTambahan> papKeluhanTambahanService;
@RequestMapping(value = "/save-keluhan-tambahan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(/*@Valid @RequestBody PapKeluhanTambahanVO vo,*/HttpServletRequest request) {
@RequestMapping(value = "/save-keluhan-tambahan", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(HttpServletRequest request) {
try {
PapKeluhanTambahanVO vo=(PapKeluhanTambahanVO) this.getItem(request, new PapKeluhanTambahanVO());
Map<String,Object> result = papKeluhanTambahanService.addKeluhanTambahan(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
RestUtil.getJsonHttpStatus(HttpStatus.CREATED);
SaveLog("Keluhan Tambahan", "Pemeriksaan",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
PapKeluhanTambahanVO vo = (PapKeluhanTambahanVO) this.getItem(request, new PapKeluhanTambahanVO());
Map<String, Object> result = papKeluhanTambahanService.addKeluhanTambahan(vo);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
result.put("message", "Berhasil");
SaveLog("Keluhan Tambahan", "Pemeriksaan", request);
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addKeluhanTambahan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addKeluhanTambahan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-keluhan-tambahan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapKeluhanTambahanVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papKeluhanTambahanService.updateKeluhanTambahan(vo);
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
result.put("message", "Berhasil");
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
result.put("message", "Gagal");
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
RestUtil.getJsonHttpStatus(HttpStatus.CREATED);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
@RequestMapping(value = "/find-noCm-and-tglKeluhan/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoCmAndTglKeluhan(
@RequestParam(value = "noCm", required = false) String noCm,
@RequestParam(value = "tglInput", required = false) String tglInput, HttpServletRequest request) {
Map<String, Object> result = papKeluhanTambahanService.findByNoCmAndTglkeluhan(DateUtil.toDate(tglInput), noCm);
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
return getJsonResponse(result, OK, mapHeaderMessage);
}
@RequestMapping(value = "/find-noCm-and-tglInput/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCmAndTglInput(@RequestParam(value = "noCm", required = false) String noCm,
@RequestParam(value = "tglInput", required = false) String tglInput,HttpServletRequest request) {
Map<String,Object> result = papKeluhanTambahanService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@RequestMapping(value = "/find-noCm-and-tglKeluhan/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCmAndTglKeluhan(@RequestParam(value = "noCm", required = false) String noCm,
@RequestParam(value = "tglInput", required = false) String tglInput,HttpServletRequest request) {
Map<String,Object> result = papKeluhanTambahanService.findByNoCmAndTglkeluhan(DateUtil.toDate(tglInput), noCm);
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@Override
public ResponseEntity<Collection<PapKeluhanTambahanVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapKeluhanTambahanVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapKeluhanTambahanVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapKeluhanTambahanVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapKeluhanTambahanVO>> getAllVO() {
return null;
}
}

View File

@ -1,39 +1,36 @@
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 com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.PapKeluhanUtama;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapKeluhanUtamaService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.vo.PapKeluhanUtamaVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.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.dao.LoginUserDao;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.ActivityPegawaiService;
import com.jasamedika.medifirst2000.service.PapKeluhanUtamaService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapKeluhanUtamaVO;
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_ERROR;
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;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
@ -42,170 +39,64 @@ import com.jasamedika.medifirst2000.vo.PapKeluhanUtamaVO;
*/
@RestController
@RequestMapping("/keluhan-utama")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapKeluhanUtamaController extends LocaleController<PapKeluhanUtamaVO> implements
IBaseRestController<PapKeluhanUtamaVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapKeluhanUtamaController.class);
@Autowired
private LoginUserDao loginUserDao;
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapKeluhanUtamaController extends LocaleController<PapKeluhanUtamaVO> {
private static final Logger LOGGER = getLogger(PapKeluhanUtamaController.class);
@Autowired
private PapKeluhanUtamaService papKeluhanUtamaService;
@Autowired
private ActivityPegawaiService activityPegawaiServiceImpl;
private PapKeluhanUtamaService<PapKeluhanUtama> papKeluhanUtamaService;
@RequestMapping(value = "/save-keluhan-utama", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapKeluhanUtamaVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-keluhan-utama", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapKeluhanUtamaVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result = papKeluhanUtamaService.addKeluhanUtama(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
SaveLog("Keluhan Utama", "Pemeriksaan",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
Map<String, Object> result = papKeluhanUtamaService.addKeluhanUtama(vo);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
result.put("message", "Berhasil");
SaveLog("Keluhan Utama", "Pemeriksaan", request);
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addKeluhanUtama", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addKeluhanUtama", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-keluhan-utama", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapKeluhanUtamaVO vo,HttpServletRequest request) {
@RequestMapping(value = "/edit-keluhan-utama", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> edit(@Valid @RequestBody PapKeluhanUtamaVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result = papKeluhanUtamaService.updateKeluhanUtama(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
Map<String, Object> result = papKeluhanUtamaService.updateKeluhanUtama(vo);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
result.put("message", "Berhasil");
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when updateKeluhanUtama", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when updateKeluhanUtama", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papKeluhanUtamaService.findByNoCmAndTglInputList(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoCm(@PathVariable("noCm") String noCm,
@PathVariable("tglInput") String tglInput, HttpServletRequest request) {
Map<String, Object> result = papKeluhanUtamaService.findByNoCmAndTglInputList(noCm, DateUtil.toDate(tglInput));
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
return getJsonResponse(result, OK, mapHeaderMessage);
}
@RequestMapping(value = "/find-noCm-and-tglInput/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCmAndTglInput(@RequestParam(value = "noCm", required = false) String noCm,
@RequestParam(value = "tglInput", required = false) String tglInput,HttpServletRequest request) {
Map<String,Object> result = papKeluhanUtamaService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@RequestMapping(value = "/find-noCm-and-tglInput-2/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCmAndTglInput2(@RequestParam(value = "noCm", required = false) String noCm,
@RequestParam(value = "tglInput", required = false) String tglInput,HttpServletRequest request) {
Map<String,Object> result = papKeluhanUtamaService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@RequestMapping(value = "/find-registrasi-pelayanan-pasien/{noCm}/{tglRegistrasi}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findRegistrasiPelayanaPasien(@PathVariable("noCm") String noCm,@PathVariable("tglRegistrasi") String tglRegistrasi,HttpServletRequest request) {
Map<String,Object> result = papKeluhanUtamaService.findRegistrasiPelayananPasienByNoCmAndTglRegistrasi(noCm,(short) 0, DateUtil.toDate(tglRegistrasi));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/find-pasien-by-noCm/{noCm}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findPasien(@PathVariable("noCm") String noCm,HttpServletRequest request) {
Map<String,Object> result = papKeluhanUtamaService.findPasienByNoCm(noCm);
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@Override
public ResponseEntity<Collection<PapKeluhanUtamaVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapKeluhanUtamaVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapKeluhanUtamaVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapKeluhanUtamaVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapKeluhanUtamaVO>> getAllVO() {
return null;
}
}

View File

@ -1,37 +1,32 @@
package com.jasamedika.medifirst2000.controller;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.PapMata;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapMataService;
import com.jasamedika.medifirst2000.vo.PapMataVO;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapMataService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapMataVO;
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.POST;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
@ -40,215 +35,31 @@ import com.jasamedika.medifirst2000.vo.PapMataVO;
*/
@RestController
@RequestMapping("/mata")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapMataController extends LocaleController<PapMataVO> implements
IBaseRestController<PapMataVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapMataController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapMataController extends LocaleController<PapMataVO> {
private static final Logger LOGGER = getLogger(PapMataController.class);
@Autowired
private PapMataService papMataService;
private PapMataService<PapMata> papMataService;
@RequestMapping(value = "/save-mata", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-mata", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveProgramPengajaran(@Valid @RequestBody PapMataVO vo,
HttpServletRequest request) {
try {
SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy");
Map<String, Object> result = papMataService.addMata(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 add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addMata", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addMata", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-mata", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapMataVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papMataService.updateMata(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papMataService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@RequestMapping(value = "/find-registrasi-pelayanan-pasien/{noCm}/{tglRegistrasi}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findRegistrasiPelayanaPasien(@PathVariable("noCm") String noCm,@PathVariable("tglRegistrasi") String tglRegistrasi,HttpServletRequest request) {
Map<String,Object> result = papMataService.findRegistrasiPelayananPasienByNoCmAndTglRegistrasi(noCm,(short) 0, DateUtil.toDate(tglRegistrasi));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@RequestMapping(value = "/find-pasien-by-noCm/{noCm}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findPasien(@PathVariable("noCm") String noCm,HttpServletRequest request) {
Map<String,Object> result = papMataService.findPasienByNoCm(noCm);
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@Override
public ResponseEntity<Collection<PapMataVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapMataVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapMataVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapMataVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapMataVO>> getAllVO() {
return null;
}
@RequestMapping(value = "/get-list-papMata/{startDate}/{endDate}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> findlistMata(@PathVariable("startDate") String startDate,@PathVariable("endDate") String endDate,
HttpServletRequest request) {
List<Map<String, Object>> result = null;
try {
result = papMataService.findByTglInput(startDate, endDate);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
} catch (Exception e) {
e.printStackTrace();
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/get-list-dataMata/{jenis}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> findlistDataMata(@PathVariable("jenis") String jenis,
HttpServletRequest request) {
List<Map<String, Object>> result = null;
try {
result = papMataService.findListData(jenis);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
} catch (Exception e) {
e.printStackTrace();
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/get-detail-papMata/{noRec}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findDetailPapMata(@PathVariable("noRec") String noRec,
HttpServletRequest request) {
Map<String, Object> result = null;
try {
result = papMataService.findPapMataByNoRec(noRec);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
} catch (Exception e) {
e.printStackTrace();
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/get-list-kategori-mata", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> findlistKategoriMata(
HttpServletRequest request) {
List<Map<String, Object>> result = null;
try {
result = papMataService.findKategoriMata();
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
} catch (Exception e) {
e.printStackTrace();
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/get-list-streak", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> findlistStreak(
HttpServletRequest request) {
List<Map<String, Object>> result = null;
try {
result = papMataService.findStreak();
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
} catch (Exception e) {
e.printStackTrace();
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
}

View File

@ -1,36 +1,32 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.PapMuskuloskeletal;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapMuskuloskeletalService;
import com.jasamedika.medifirst2000.vo.PapMuskuloskeletalVO;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapMuskuloskeletalService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapMuskuloskeletalVO;
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.POST;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
@ -39,111 +35,32 @@ import com.jasamedika.medifirst2000.vo.PapMuskuloskeletalVO;
*/
@RestController
@RequestMapping("/muskuloskeletal")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapMuskuloskeletalController extends LocaleController<PapMuskuloskeletalVO> implements
IBaseRestController<PapMuskuloskeletalVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapMuskuloskeletalController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapMuskuloskeletalController extends LocaleController<PapMuskuloskeletalVO> {
private static final Logger LOGGER = getLogger(PapMuskuloskeletalController.class);
@Autowired
private PapMuskuloskeletalService papMuskuloskeletalService;
private PapMuskuloskeletalService<PapMuskuloskeletal> papMuskuloskeletalService;
@RequestMapping(value = "/save-muskuloskeletal", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapMuskuloskeletalVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-muskuloskeletal", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapMuskuloskeletalVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result = papMuskuloskeletalService.addMuskuloskeletal(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
SaveLog("Muskuloskeletal", "Pemeriksaan",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
Map<String, Object> result = papMuskuloskeletalService.addMuskuloskeletal(vo);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
result.put("message", "Berhasil");
SaveLog("Muskuloskeletal", "Pemeriksaan", request);
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addMuskuloskeletal", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addMuskuloskeletal", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-muskuloskeletal", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapMuskuloskeletalVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papMuskuloskeletalService.updateMuskuloskeletal(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papMuskuloskeletalService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@Override
public ResponseEntity<Collection<PapMuskuloskeletalVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapMuskuloskeletalVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapMuskuloskeletalVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapMuskuloskeletalVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapMuskuloskeletalVO>> getAllVO() {
return null;
}
}

View File

@ -1,36 +1,32 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.PapNeurologi;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapNeurologiService;
import com.jasamedika.medifirst2000.vo.PapNeurologiVO;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapNeurologiService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapNeurologiVO;
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.POST;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
@ -39,111 +35,31 @@ import com.jasamedika.medifirst2000.vo.PapNeurologiVO;
*/
@RestController
@RequestMapping("/neurologi")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapNeurologiController extends LocaleController<PapNeurologiVO> implements
IBaseRestController<PapNeurologiVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapNeurologiController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapNeurologiController extends LocaleController<PapNeurologiVO> {
private static final Logger LOGGER = getLogger(PapNeurologiController.class);
@Autowired
private PapNeurologiService papNeurologiService;
private PapNeurologiService<PapNeurologi> papNeurologiService;
@RequestMapping(value = "/save-neurologi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapNeurologiVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-neurologi", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapNeurologiVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = papNeurologiService.addNeurologi(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
SaveLog("Neurologi", "Pemeriksaan",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
Map<String, Object> result = papNeurologiService.addNeurologi(vo);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
result.put("message", "Berhasil");
SaveLog("Neurologi", "Pemeriksaan", request);
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addNeurologi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addNeurologi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-neurologi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapNeurologiVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papNeurologiService.updateNeurologi(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papNeurologiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@Override
public ResponseEntity<Collection<PapNeurologiVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapNeurologiVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapNeurologiVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapNeurologiVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapNeurologiVO>> getAllVO() {
return null;
}
}

View File

@ -1,34 +1,32 @@
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 com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapObstetriService;
import com.jasamedika.medifirst2000.vo.PapObstetriVO;
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.PapObstetriService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapObstetriVO;
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_ERROR;
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.POST;
/**
* Controller class for PapObstetriController
@ -37,73 +35,35 @@ import com.jasamedika.medifirst2000.vo.PapObstetriVO;
*/
@RestController
@RequestMapping("/obstetri")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapObstetriController extends LocaleController<PapObstetriVO> implements
IBaseRestController<PapObstetriVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapObstetriController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapObstetriController extends LocaleController<PapObstetriVO> {
private static final Logger LOGGER = getLogger(PapObstetriController.class);
@Autowired
private PapObstetriService papObstetriService;
@RequestMapping(value = "/save-obstetri", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapObstetriVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-obstetri", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapObstetriVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = papObstetriService.savePapObstetri(vo);
if (null != result){
mapHeaderMessage.clear();
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.clear();
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
Map<String, Object> result = papObstetriService.savePapObstetri(vo);
mapHeaderMessage.clear();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
SaveLog("Pengkajian Khusus Obstetri", "Pengkajian Khusus",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
SaveLog("Pengkajian Khusus Obstetri", "Pengkajian Khusus", request);
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePapObstetri", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when savePapObstetri", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@Override
public ResponseEntity<Collection<PapObstetriVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapObstetriVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapObstetriVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapObstetriVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapObstetriVO>> getAllVO() {
return null;
}
}

View File

@ -1,64 +0,0 @@
package com.jasamedika.medifirst2000.controller;
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.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapObstetriService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapObstetriVO;
/**
* Controller class for Registrasi Pasien Business
*
* @author Adik
*/
@RestController
@RequestMapping("/pap-obstetri")
public class PapOpstetriController extends LocaleController<PapObstetriVO>{
@Autowired
private PapObstetriService papObstetriService;
private static final Logger LOGGER = LoggerFactory
.getLogger(PapOpstetriController.class);
@RequestMapping(value = "/save-pap-obstetri", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePapObstetri(@Valid @RequestBody PapObstetriVO vo,HttpServletRequest request) {
try {
Map<String,Object> result=papObstetriService.savePapObstetri(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 savePapObstetri", 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 savePapObstetri", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,160 +1,76 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
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.PapPengambilanSpesimenService;
import com.jasamedika.medifirst2000.vo.PapPengambilanSpesimenCustomVO;
import com.jasamedika.medifirst2000.vo.PapPengambilanSpesimenVO;
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.validation.Valid;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapPengambilanSpesimenService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapPengambilanSpesimenCustomVO;
import com.jasamedika.medifirst2000.vo.PapPengambilanSpesimenVO;
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("/papPengambilanSpesimen")
public class PapPengambilanSpesimenController extends LocaleController<PapPengambilanSpesimenVO> implements IBaseRestController<PapPengambilanSpesimenVO>{
public class PapPengambilanSpesimenController extends LocaleController<PapPengambilanSpesimenVO> {
private static final Logger LOGGER = getLogger(PapPengambilanSpesimenController.class);
@Autowired
private PapPengambilanSpesimenService papPengambilanSpesimenService;
private static final Logger LOGGER = LoggerFactory
.getLogger(PapPengambilanSpesimenController.class);
@Override
public ResponseEntity<Collection<PapPengambilanSpesimenVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapPengambilanSpesimenVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapPengambilanSpesimenVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapPengambilanSpesimenVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapPengambilanSpesimenVO>> getAllVO() {
return null;
}
@RequestMapping(value = "/save-pengambilan-spesimen/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody PapPengambilanSpesimenCustomVO vo, HttpServletRequest request) {
@RequestMapping(value = "/save-pengambilan-spesimen/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody PapPengambilanSpesimenCustomVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result=papPengambilanSpesimenService.savePapPengambilanSpesimen(vo);
Map<String, Object> result = papPengambilanSpesimenService.savePapPengambilanSpesimen(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 add Pengambilan Spesimen", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePapPengambilanSpesimen", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pengambilan Spesimen", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when savePapPengambilanSpesimen", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-pengambilan-spesimen/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> editVO(@Valid @RequestBody PapPengambilanSpesimenCustomVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=papPengambilanSpesimenService.updatePapPengambilanSpesimen(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 Pengambilan Spesimen", 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 Pengambilan Spesimen", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/verifikasi-pemeriksaan/{noRec}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> verifikasiPemeriksaan(@PathVariable("noRec") String noRec, HttpServletRequest request) {
@RequestMapping(value = "/verifikasi-pemeriksaan/{noRec}", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> verifikasiPemeriksaan(@PathVariable("noRec") String noRec,
HttpServletRequest request) {
try {
System.out.println("VERIFIKASI-PEMERIKSAAN-RAIDOLOGI");
Map<String,Object> result =papPengambilanSpesimenService.updatePemeriksaan(noRec.split(","));
Map<String, Object> result = papPengambilanSpesimenService.updatePemeriksaan(noRec.split(","));
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 update Pengambilan Spesimen", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when updatePemeriksaan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update Pengambilan Spesimen", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when updatePemeriksaan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noOrder-and-tglOrder/{noOrder}/{tglOrder}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoOrder(@PathVariable("noOrder") String noOrder,@PathVariable("tglOrder") String tglOrder, HttpServletRequest request) {
Map<String,Object> result =papPengambilanSpesimenService.findByNoOrderAndTglOrder(noOrder, DateUtil.toDate(tglOrder));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
}

View File

@ -1,37 +1,32 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.PapPernapasan;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapPernapasanService;
import com.jasamedika.medifirst2000.vo.PapPernapasanVO;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.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.PapPernapasanService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapPernapasanVO;
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.POST;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
@ -40,125 +35,32 @@ import com.jasamedika.medifirst2000.vo.PapPernapasanVO;
*/
@RestController
@RequestMapping("/pernapasan")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapPernapasanController extends LocaleController<PapPernapasanVO> implements
IBaseRestController<PapPernapasanVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapPernapasanController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapPernapasanController extends LocaleController<PapPernapasanVO> {
private static final Logger LOGGER = getLogger(PapPernapasanController.class);
@Autowired
private PapPernapasanService papPernapasanService;
private PapPernapasanService<PapPernapasan> papPernapasanService;
@RequestMapping(value = "/save-pernapasan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapPernapasanVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-pernapasan", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapPernapasanVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result = papPernapasanService.addPernapasan(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
SaveLog("Pernapasan", "Pemeriksaan",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
Map<String, Object> result = papPernapasanService.addPernapasan(vo);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
result.put("message", "Berhasil");
SaveLog("Pernapasan", "Pemeriksaan", request);
return getJsonResponse(result, CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addPernapasan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addPernapasan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-pernapasan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapPernapasanVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papPernapasanService.updatePernapasan(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papPernapasanService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@RequestMapping(value = "/find-noCm-and-tglInput/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCmAndTglInput(@RequestParam(value = "noCm", required = false) String noCm,
@RequestParam(value = "tglInput", required = false) String tglInput,HttpServletRequest request) {
Map<String,Object> result = papPernapasanService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@Override
public ResponseEntity<Collection<PapPernapasanVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapPernapasanVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapPernapasanVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapPernapasanVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapPernapasanVO>> getAllVO() {
return null;
}
}

View File

@ -1,171 +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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapRehabilitasiService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapRehabilitasiVO;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
*
* @author Askur
*/
@RestController
@RequestMapping("/rehabilitasi")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapRehabilitasiController extends LocaleController<PapRehabilitasiVO> implements
IBaseRestController<PapRehabilitasiVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapRehabilitasiController.class);
@Autowired
private PapRehabilitasiService papRehabilitasiService;
@RequestMapping(value = "/save-rehabilitasi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapRehabilitasiVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papRehabilitasiService.addRehabilitasi(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
SaveLog("Rehabilitasi", "Pemeriksaan Khusus",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-rehabilitasi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapRehabilitasiVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papRehabilitasiService.updateRehabilitasi(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papRehabilitasiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@RequestMapping(value = "/find-registrasi-pelayanan-pasien/{noCm}/{tglRegistrasi}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findRegistrasiPelayanaPasien(@PathVariable("noCm") String noCm,@PathVariable("tglRegistrasi") String tglRegistrasi,HttpServletRequest request) {
Map<String,Object> result = papRehabilitasiService.findRegistrasiPelayananPasienByNoCmAndTglRegistrasi(noCm,(short) 0, DateUtil.toDate(tglRegistrasi));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@RequestMapping(value = "/find-pasien-by-noCm/{noCm}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findPasien(@PathVariable("noCm") String noCm,HttpServletRequest request) {
Map<String,Object> result = papRehabilitasiService.findPasienByNoCm(noCm);
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@Override
public ResponseEntity<Collection<PapRehabilitasiVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapRehabilitasiVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapRehabilitasiVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapRehabilitasiVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapRehabilitasiVO>> getAllVO() {
return null;
}
}

View File

@ -1,157 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.text.ParseException;
import java.text.SimpleDateFormat;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapRencanaKonsultasiService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapRencanaKonsultasiVO;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
*
* @author Askur
*/
@RestController
@RequestMapping("/rencana-konsultasi")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapRencanaKonsultasiController extends LocaleController<PapRencanaKonsultasiVO> implements
IBaseRestController<PapRencanaKonsultasiVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapRencanaKonsultasiController.class);
@Autowired
private PapRencanaKonsultasiService papRencanaKonsultasiService;
@RequestMapping(value = "/save-rencana-konsultasi/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapRencanaKonsultasiVO vo,HttpServletRequest request) throws ParseException {
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (vo.getTanggalPendaftaran().indexOf("-") < -1)
vo.setTglRegistrasi(format.parse(vo.getTanggalPendaftaran()));
else
vo.setTglRegistrasi(format.parse(vo.getTanggalPendaftaran()));
Map<String,Object> result = papRencanaKonsultasiService.addRencanaKonsultasi(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
SaveLog("Rencana Konsultasi", "Konsultasi",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-rencana-konsultasi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapRencanaKonsultasiVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papRencanaKonsultasiService.updateRencanaKonsultasi(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papRencanaKonsultasiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@Override
public ResponseEntity<Collection<PapRencanaKonsultasiVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapRencanaKonsultasiVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapRencanaKonsultasiVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapRencanaKonsultasiVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapRencanaKonsultasiVO>> getAllVO() {
return null;
}
}

View File

@ -1,148 +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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapRencanaOrderFarmasiService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapRencanaOrderFarmasiVO;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
*
* @author Askur
*/
@RestController
@RequestMapping("/rencana-order-farmasi")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapRencanaOrderFarmasiController extends LocaleController<PapRencanaOrderFarmasiVO> implements
IBaseRestController<PapRencanaOrderFarmasiVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapRencanaOrderFarmasiController.class);
@Autowired
private PapRencanaOrderFarmasiService papRencanaOrderFarmasiService;
@RequestMapping(value = "/save-rencana-order-farmasi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapRencanaOrderFarmasiVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papRencanaOrderFarmasiService.addRencanaOrderFarmasi(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-rencana-order-farmasi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapRencanaOrderFarmasiVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papRencanaOrderFarmasiService.updateRencanaOrderFarmasi(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papRencanaOrderFarmasiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@Override
public ResponseEntity<Collection<PapRencanaOrderFarmasiVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapRencanaOrderFarmasiVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapRencanaOrderFarmasiVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapRencanaOrderFarmasiVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapRencanaOrderFarmasiVO>> getAllVO() {
return null;
}
}

View File

@ -1,148 +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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapRencanaOrderLaboratoriumService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapRencanaOrderLaboratoriumVO;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
*
* @author Askur
*/
@RestController
@RequestMapping("/rencana-order-laboratorium")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapRencanaOrderLaboratoriumController extends LocaleController<PapRencanaOrderLaboratoriumVO> implements
IBaseRestController<PapRencanaOrderLaboratoriumVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapRencanaOrderLaboratoriumController.class);
@Autowired
private PapRencanaOrderLaboratoriumService papRencanaOrderLaboratoriumService;
@RequestMapping(value = "/save-rencana-order-laboratorium", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapRencanaOrderLaboratoriumVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papRencanaOrderLaboratoriumService.addRencanaOrderLaboratorium(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-rencana-order-radiologi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapRencanaOrderLaboratoriumVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papRencanaOrderLaboratoriumService.updateRencanaOrderLaboratorium(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papRencanaOrderLaboratoriumService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@Override
public ResponseEntity<Collection<PapRencanaOrderLaboratoriumVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapRencanaOrderLaboratoriumVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapRencanaOrderLaboratoriumVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapRencanaOrderLaboratoriumVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapRencanaOrderLaboratoriumVO>> getAllVO() {
return null;
}
}

View File

@ -1,174 +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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapRencanaOrderRadiologiService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapRencanaOrderRadiologiVO;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
*
* @author Askur
*/
@RestController
@RequestMapping("/rencana-order-radiologi")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapRencanaOrderRadiologiController extends LocaleController<PapRencanaOrderRadiologiVO> implements
IBaseRestController<PapRencanaOrderRadiologiVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapRencanaOrderRadiologiController.class);
@Autowired
private PapRencanaOrderRadiologiService papRencanaOrderRadiologiService;
@RequestMapping(value = "/save-rencana-order-radiologi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapRencanaOrderRadiologiVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papRencanaOrderRadiologiService.addRencanaOrderRadiologi(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
/*
@RequestMapping(value = "/save-rencana-order-radiologi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody InputRencanaOrderRadiologiVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papRencanaOrderRadiologiService.addRencanaOrderRadiologi(vo.getPapRencanaOrderRadiologi());
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
*/
@RequestMapping(value = "/edit-rencana-order-radiologi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapRencanaOrderRadiologiVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papRencanaOrderRadiologiService.updateRencanaOrderRadiologi(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papRencanaOrderRadiologiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@Override
public ResponseEntity<Collection<PapRencanaOrderRadiologiVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapRencanaOrderRadiologiVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapRencanaOrderRadiologiVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapRencanaOrderRadiologiVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapRencanaOrderRadiologiVO>> getAllVO() {
return null;
}
}

View File

@ -1,148 +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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapRencanaTindakanService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapRencanaTindakanVO;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
*
* @author Askur
*/
@RestController
@RequestMapping("/rencana-tindakan")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapRencanaTindakanController extends LocaleController<PapRencanaTindakanVO> implements
IBaseRestController<PapRencanaTindakanVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapRencanaTindakanController.class);
@Autowired
private PapRencanaTindakanService papRencanaTindakanService;
@RequestMapping(value = "/save-rencana-tindakan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapRencanaTindakanVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papRencanaTindakanService.addRencanaTindakan(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-rencana-tindakan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapRencanaTindakanVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papRencanaTindakanService.updateRencanaTindakan(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papRencanaTindakanService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@Override
public ResponseEntity<Collection<PapRencanaTindakanVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapRencanaTindakanVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapRencanaTindakanVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapRencanaTindakanVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapRencanaTindakanVO>> getAllVO() {
return null;
}
}

View File

@ -1,38 +1,32 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.PapRiwayatImunisasi;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapRiwayatImunisasiService;
import com.jasamedika.medifirst2000.vo.PapRiwayatImunisasiVO;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.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.PapRiwayatImunisasiService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapRiwayatImunisasiVO;
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.POST;
/**
* Controller class for PapRiwayatImunisasiController
@ -41,96 +35,30 @@ import com.jasamedika.medifirst2000.vo.PapRiwayatImunisasiVO;
*/
@RestController
@RequestMapping("/riwayat-imunisasi")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapRiwayatImunisasiController extends LocaleController<PapRiwayatImunisasiVO> implements
IBaseRestController<PapRiwayatImunisasiVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapRiwayatImunisasiController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapRiwayatImunisasiController extends LocaleController<PapRiwayatImunisasiVO> {
private static final Logger LOGGER = getLogger(PapRiwayatImunisasiController.class);
@Autowired
private PapRiwayatImunisasiService papRiwayatImunisasiService;
private PapRiwayatImunisasiService<PapRiwayatImunisasi> papRiwayatImunisasiService;
@RequestMapping(value = "/save-riwayat-imunisasi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapRiwayatImunisasiVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-riwayat-imunisasi", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapRiwayatImunisasiVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result = papRiwayatImunisasiService.addRiwayatImunisasi(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} else{
Map<String, String> headerMessageCustom = new HashMap<>();
headerMessageCustom.put("label-success", "Pasien belum melakukan pendaftaran");
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, headerMessageCustom);
}
Map<String, Object> result = papRiwayatImunisasiService.addRiwayatImunisasi(vo);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addRiwayatImunisasi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addRiwayatImunisasi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-noCm-and-tglInput/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCmAndTglInput(@RequestParam(value = "noCm", required = false) String noCm,
@RequestParam(value = "tglInput", required = false) String tglInput,HttpServletRequest request) {
Map<String,Object> result = papRiwayatImunisasiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@RequestMapping(value = "/find-pasien-by-noCm/{noCm}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findPasien(@PathVariable("noCm") String noCm,HttpServletRequest request) {
Map<String,Object> result = papRiwayatImunisasiService.findPasienByNoCm(noCm);
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@Override
public ResponseEntity<Collection<PapRiwayatImunisasiVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapRiwayatImunisasiVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapRiwayatImunisasiVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapRiwayatImunisasiVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapRiwayatImunisasiVO>> getAllVO() {
return null;
}
}

View File

@ -1,67 +1,57 @@
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.PapRiwayatKelahiranService;
import com.jasamedika.medifirst2000.vo.PapRiwayatKelahiranVO;
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.PapRiwayatKelahiranService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapRiwayatKelahiranVO;
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.POST;
@RestController
@RequestMapping("/pap-riwayat-kelahiran")
public class PapRiwayatKelahiranController extends LocaleController<PapRiwayatKelahiranVO> {
private static final Logger LOGGER = getLogger(PapRiwayatKelahiranController.class);
@Autowired
private PapRiwayatKelahiranService papRiwayatKelahiranService;
private static final Logger LOGGER = LoggerFactory
.getLogger(PapRiwayatKelahiranController.class);
@RequestMapping(value = "/save-pap-riwayat-kelahiran/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody PapRiwayatKelahiranVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-pap-riwayat-kelahiran/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody PapRiwayatKelahiranVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = papRiwayatKelahiranService.add(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 = papRiwayatKelahiranService.add(vo);
if (null != result)
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add PapRiwayatKelahiran", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when add", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add PapRiwayatKelahiran", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when add", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,112 +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.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.PapRiwayatKeluargaService;
import com.jasamedika.medifirst2000.service.ThtService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapRiwayatKeluargaVO;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
*
* @author Askur
*/
@RestController
@RequestMapping("/riwayat-keluarga")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapRiwayatKeluargaController extends LocaleController<PapRiwayatKeluargaVO> implements
IBaseRestController<PapRiwayatKeluargaVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapRiwayatKeluargaController.class);
@Autowired
private PapRiwayatKeluargaService papRiwayatKeluargaService;
@Autowired
private ThtService thtService;
@RequestMapping(value = "/save-riwayat-keluarga", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapRiwayatKeluargaVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papRiwayatKeluargaService.addRiwayatKeluarga(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@Override
public ResponseEntity<Collection<PapRiwayatKeluargaVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapRiwayatKeluargaVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapRiwayatKeluargaVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapRiwayatKeluargaVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapRiwayatKeluargaVO>> getAllVO() {
return null;
}
}

View File

@ -1,36 +1,32 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.PapRiwayatPsikososial;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PapRiwayatPsikososialService;
import com.jasamedika.medifirst2000.vo.PapRiwayatPsikososialVO;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PapRiwayatPsikososialService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PapRiwayatPsikososialVO;
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.POST;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
@ -39,137 +35,32 @@ import com.jasamedika.medifirst2000.vo.PapRiwayatPsikososialVO;
*/
@RestController
@RequestMapping("/riwayat-psikososial")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapRiwayatPsikososialController extends LocaleController<PapRiwayatPsikososialVO> implements
IBaseRestController<PapRiwayatPsikososialVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(PapRiwayatPsikososialController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class PapRiwayatPsikososialController extends LocaleController<PapRiwayatPsikososialVO> {
private static final Logger LOGGER = getLogger(PapRiwayatPsikososialController.class);
@Autowired
private PapRiwayatPsikososialService papRiwayatPsikososialService;
private PapRiwayatPsikososialService<PapRiwayatPsikososial> papRiwayatPsikososialService;
@RequestMapping(value = "/save-riwayat-psikososial", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapRiwayatPsikososialVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-riwayat-psikososial", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapRiwayatPsikososialVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result = papRiwayatPsikososialService.addRiwayatPsikososial(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
SaveLog("Riwayat Psikososial", "Pemeriksaan",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
Map<String, Object> result = papRiwayatPsikososialService.addRiwayatPsikososial(vo);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
result.put("message", "Berhasil");
SaveLog("Riwayat Psikososial", "Pemeriksaan", request);
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addRiwayatPsikososial", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addRiwayatPsikososial", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/edit-riwayat-psikososial", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapRiwayatPsikososialVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = papRiwayatPsikososialService.updateRiwayatPsikososial(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
Map<String,Object> result = papRiwayatPsikososialService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@RequestMapping(value = "/find-registrasi-pelayanan-pasien/{noCm}/{tglRegistrasi}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findRegistrasiPelayanaPasien(@PathVariable("noCm") String noCm,@PathVariable("tglRegistrasi") String tglRegistrasi,HttpServletRequest request) {
Map<String,Object> result = papRiwayatPsikososialService.findRegistrasiPelayananPasienByNoCmAndTglRegistrasi(noCm,(short) 0, DateUtil.toDate(tglRegistrasi));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/find-pasien-by-noCm/{noCm}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findPasien(@PathVariable("noCm") String noCm,HttpServletRequest request) {
Map<String,Object> result = papRiwayatPsikososialService.findPasienByNoCm(noCm);
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@Override
public ResponseEntity<Collection<PapRiwayatPsikososialVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PapRiwayatPsikososialVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PapRiwayatPsikososialVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PapRiwayatPsikososialVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PapRiwayatPsikososialVO>> getAllVO() {
return null;
}
}