Update controller
Clean code
This commit is contained in:
parent
352350002b
commit
f987c74db4
@ -1,38 +1,33 @@
|
||||
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.PapRiwayatTumbuhKembang;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.PapRiwayatTumbuhKembangService;
|
||||
import com.jasamedika.medifirst2000.vo.PapRiwayatTumbuhKembangVO;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.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.PapRiwayatTumbuhKembangService;
|
||||
import com.jasamedika.medifirst2000.util.DateUtil;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.PapRiwayatTumbuhKembangVO;
|
||||
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 PapRiwayatTumbuhKembangController
|
||||
@ -41,96 +36,36 @@ import com.jasamedika.medifirst2000.vo.PapRiwayatTumbuhKembangVO;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/riwayat-tumbuh-kembang")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class PapRiwayatTumbuhKembangController extends LocaleController<PapRiwayatTumbuhKembangVO> implements
|
||||
IBaseRestController<PapRiwayatTumbuhKembangVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PapRiwayatTumbuhKembangController.class);
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class PapRiwayatTumbuhKembangController extends LocaleController<PapRiwayatTumbuhKembangVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(PapRiwayatTumbuhKembangController.class);
|
||||
|
||||
@Autowired
|
||||
private PapRiwayatTumbuhKembangService papRiwayatTumbuhKembangService;
|
||||
private PapRiwayatTumbuhKembangService<PapRiwayatTumbuhKembang> papRiwayatTumbuhKembangService;
|
||||
|
||||
@RequestMapping(value = "/save-riwayat-tumbuh-kembang", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapRiwayatTumbuhKembangVO vo,HttpServletRequest request) {
|
||||
@RequestMapping(value = "/save-riwayat-tumbuh-kembang", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapRiwayatTumbuhKembangVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = papRiwayatTumbuhKembangService.addRiwayatTumbuhKembang(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, Object> result = papRiwayatTumbuhKembangService.addRiwayatTumbuhKembang(vo);
|
||||
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 addRiwayatTumbuhKembang", 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 addRiwayatTumbuhKembang", 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 = papRiwayatTumbuhKembangService.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 = papRiwayatTumbuhKembangService.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<PapRiwayatTumbuhKembangVO>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<PapRiwayatTumbuhKembangVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(PapRiwayatTumbuhKembangVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(PapRiwayatTumbuhKembangVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<PapRiwayatTumbuhKembangVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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.PapSirkulasi;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.PapSirkulasiService;
|
||||
import com.jasamedika.medifirst2000.vo.PapSirkulasiVO;
|
||||
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.PapSirkulasiService;
|
||||
import com.jasamedika.medifirst2000.util.DateUtil;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.PapSirkulasiVO;
|
||||
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.PapSirkulasiVO;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sirkulasi")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class PapSirkulasiController extends LocaleController<PapSirkulasiVO> implements
|
||||
IBaseRestController<PapSirkulasiVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PapSirkulasiController.class);
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class PapSirkulasiController extends LocaleController<PapSirkulasiVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(PapSirkulasiController.class);
|
||||
|
||||
@Autowired
|
||||
private PapSirkulasiService papSirkulasiService;
|
||||
private PapSirkulasiService<PapSirkulasi> papSirkulasiService;
|
||||
|
||||
@RequestMapping(value = "/save-sirkulasi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapSirkulasiVO vo,HttpServletRequest request) {
|
||||
@RequestMapping(value = "/save-sirkulasi", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapSirkulasiVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = papSirkulasiService.addSirkulasi(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("Sirkulasi", "Pemeriksaan",request);
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
Map<String, Object> result = papSirkulasiService.addSirkulasi(vo);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
result.put("message", "Berhasil");
|
||||
SaveLog("Sirkulasi", "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 addSirkulasi", 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 addSirkulasi", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/edit-sirkulasi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapSirkulasiVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = papSirkulasiService.updateSirkulasi(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 = papSirkulasiService.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<PapSirkulasiVO>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<PapSirkulasiVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(PapSirkulasiVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(PapSirkulasiVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<PapSirkulasiVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,46 +1,35 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.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.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.fasterxml.jackson.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.PapSkriningGizi;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.PapSkriningGiziService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.PapSkriningGiziVO;
|
||||
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 net.kaczmarzyk.spring.data.jpa.domain.In;
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Like;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Or;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
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
|
||||
@ -49,171 +38,63 @@ import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/skrining-gizi")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class PapSkriningGiziController extends LocaleController<PapSkriningGiziVO> implements
|
||||
IBaseRestController<PapSkriningGiziVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PapSkriningGiziController.class);
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class PapSkriningGiziController extends LocaleController<PapSkriningGiziVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(PapSkriningGiziController.class);
|
||||
|
||||
@Autowired
|
||||
private PapSkriningGiziService papSkriningGiziService;
|
||||
private PapSkriningGiziService<PapSkriningGizi> papSkriningGiziService;
|
||||
|
||||
@RequestMapping(value = "/save-skrining-gizi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> savePasien(@Valid @RequestBody PapSkriningGiziVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = papSkriningGiziService.addSkriningGizi(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);
|
||||
}
|
||||
} 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") Date tglInput,HttpServletRequest request) {
|
||||
Map<String,Object> result = papSkriningGiziService.findByNoCmAndTglInput(noCm, tglInput);
|
||||
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 ));
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/findskoring", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> findSkoring(HttpServletRequest request) {
|
||||
Map<String,Object> result = papSkriningGiziService.findSkoring();
|
||||
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
|
||||
if(dataFound){
|
||||
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 ));
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-skoring/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> findSkoringParam(
|
||||
@RequestParam(value = "dateStart", required = false) String startDate,
|
||||
@RequestParam(value = "dateEnd", required = false) String endDate,
|
||||
@RequestParam(value = "namaPasien", required = false) String namaPasien,
|
||||
@RequestParam(value = "pilih", required = false) String pilih,
|
||||
@RequestMapping(value = "/save-skrining-gizi", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> savePasien(@Valid @RequestBody PapSkriningGiziVO vo,
|
||||
HttpServletRequest request) {
|
||||
String namaPasienBaru="";
|
||||
if(namaPasien!=null)
|
||||
namaPasienBaru=namaPasien.toLowerCase();
|
||||
Map<String,Object> result = papSkriningGiziService.findSkoring(startDate,endDate,namaPasienBaru,pilih);
|
||||
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
|
||||
if(dataFound){
|
||||
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 ));
|
||||
try {
|
||||
Map<String, Object> result = papSkriningGiziService.addSkriningGizi(vo);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got ServiceVOException {} when addSkriningGizi", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when addSkriningGizi", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-skoring-all", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> findSkoringAll(HttpServletRequest request) {
|
||||
Map<String,Object> result = papSkriningGiziService.findSkoringAll();
|
||||
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
|
||||
if(dataFound){
|
||||
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 ));
|
||||
@RequestMapping(value = "/findskoring", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findSkoring(HttpServletRequest request) {
|
||||
Map<String, Object> result = papSkriningGiziService.findSkoring();
|
||||
boolean dataFound = (boolean) result.get("dataFound");
|
||||
mapHeaderMessage.clear();
|
||||
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);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/find-skoring-paging/")
|
||||
@ResponseBody
|
||||
public ResponseEntity<List<Object>> findSkoringParamPaging(
|
||||
@RequestMapping(value = "/find-skoring/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findSkoringParam(
|
||||
@RequestParam(value = "dateStart", required = false) String startDate,
|
||||
@RequestParam(value = "dateEnd", required = false) String endDate,
|
||||
@RequestParam(value = "namaPasien", required = false) String namaPasien,
|
||||
@RequestParam(value = "pilih", required = false) String pilih,
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "10") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@Spec(path = "qRuangan", params = "qRuangan", spec = In.class) Specification<PapSkriningGizi> noRuangan,
|
||||
@Or({ @Spec(params = "namaRuangan", path = "namaRuangan", spec = Like.class),
|
||||
@Spec(params = "kdRuangan", path = "kdRuangan", spec = Like.class) }) Specification<PapSkriningGizi> nameSpec) {
|
||||
String namaPasienBaru="";
|
||||
if(namaPasien!=null)
|
||||
namaPasienBaru=namaPasien.toLowerCase();
|
||||
|
||||
Map<String, Object> resultPageMap = papSkriningGiziService.findSkoringPaging(startDate,endDate,namaPasienBaru,pilih,page,limit,sort,dir);
|
||||
|
||||
return constructListPageResult(resultPageMap);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/find-skrining-gizi-detail", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> findSkriningGiziDetailByNoRecSkriningGizi(@RequestParam(value = "noRec", required = true) String noRec,HttpServletRequest request) {
|
||||
Map<String,Object> result = papSkriningGiziService.findSkriningGiziDetailByNoRecSkriningGizi(noRec);
|
||||
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
|
||||
if(dataFound){
|
||||
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 ));
|
||||
@RequestParam(value = "pilih", required = false) String pilih, HttpServletRequest request) {
|
||||
String namaPasienBaru = "";
|
||||
if (namaPasien != null)
|
||||
namaPasienBaru = namaPasien.toLowerCase();
|
||||
Map<String, Object> result = papSkriningGiziService.findSkoring(startDate, endDate, namaPasienBaru, pilih);
|
||||
boolean dataFound = (boolean) result.get("dataFound");
|
||||
mapHeaderMessage.clear();
|
||||
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<PapSkriningGiziVO>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<PapSkriningGiziVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(PapSkriningGiziVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(PapSkriningGiziVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<PapSkriningGiziVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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.PapSkriningNyeri;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.PapSkriningNyeriService;
|
||||
import com.jasamedika.medifirst2000.vo.PapSkriningNyeriVO;
|
||||
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.PapSkriningNyeriService;
|
||||
import com.jasamedika.medifirst2000.util.DateUtil;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.PapSkriningNyeriVO;
|
||||
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
|
||||
@ -41,146 +35,30 @@ import com.jasamedika.medifirst2000.vo.PapSkriningNyeriVO;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/skrining-nyeri")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class PapSkriningNyeriController extends LocaleController<PapSkriningNyeriVO> implements
|
||||
IBaseRestController<PapSkriningNyeriVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PapSkriningNyeriController.class);
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class PapSkriningNyeriController extends LocaleController<PapSkriningNyeriVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(PapSkriningNyeriController.class);
|
||||
|
||||
@Autowired
|
||||
private PapSkriningNyeriService papSkriningNyeriService;
|
||||
private PapSkriningNyeriService<PapSkriningNyeri> papSkriningNyeriService;
|
||||
|
||||
@RequestMapping(value = "/save-skrining-nyeri", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapSkriningNyeriVO vo,HttpServletRequest request) {
|
||||
@RequestMapping(value = "/save-skrining-nyeri", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapSkriningNyeriVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = papSkriningNyeriService.addSkriningNyeri(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 = papSkriningNyeriService.addSkriningNyeri(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 addSkriningNyeri", 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 addSkriningNyeri", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/edit-skrining-nyeri", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapSkriningNyeriVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = papSkriningNyeriService.updateSkriningNyeri(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)
|
||||
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) {
|
||||
Map<String,Object> result = papSkriningNyeriService.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 = papSkriningNyeriService.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 = papSkriningNyeriService.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 = papSkriningNyeriService.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<PapSkriningNyeriVO>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<PapSkriningNyeriVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(PapSkriningNyeriVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(PapSkriningNyeriVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<PapSkriningNyeriVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,33 +1,32 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
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.PapStatusFungsionalService;
|
||||
import com.jasamedika.medifirst2000.vo.PapStatusFungsionalVO;
|
||||
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.PapStatusFungsionalService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.PapStatusFungsionalVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.HashMap;
|
||||
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
|
||||
@ -35,55 +34,31 @@ import com.jasamedika.medifirst2000.vo.PapStatusFungsionalVO;
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class PapStatusFungsionalController extends LocaleController<PapStatusFungsionalVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PapStatusFungsionalController.class);
|
||||
private static final Logger LOGGER = getLogger(PapStatusFungsionalController.class);
|
||||
|
||||
@Autowired
|
||||
private PapStatusFungsionalService papStatusFungsionalService;
|
||||
|
||||
@RequestMapping(value = "/save-status-fungsional", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/save-status-fungsional", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapStatusFungsionalVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = papStatusFungsionalService.addStatusFungsional(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);
|
||||
} 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 addStatusFungsional", 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-status-fungsional", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getStatusFungsional(
|
||||
@RequestParam(value = "noRec", required = true) String noRec,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = papStatusFungsionalService.getStatusFungsional(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 getStatusFungsional", 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 getStatusFungsional", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when addStatusFungsional", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,147 +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.PapStatusKemandirianService;
|
||||
import com.jasamedika.medifirst2000.util.DateUtil;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.PapStatusKemandirianVO;
|
||||
|
||||
/**
|
||||
* Controller class for Pengakjian Awal Gawat Darurat Business
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/status-kemandirian")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class PapStatusKemandirianController extends LocaleController<PapStatusKemandirianVO> implements
|
||||
IBaseRestController<PapStatusKemandirianVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PapStatusKemandirianController.class);
|
||||
|
||||
@Autowired
|
||||
private PapStatusKemandirianService papStatusKemandirianService;
|
||||
|
||||
@RequestMapping(value = "/save-status-kemandirian", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapStatusKemandirianVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = papStatusKemandirianService.addStatusKemandirian(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-status-kemandirian", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapStatusKemandirianVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = papStatusKemandirianService.updateStatusKemandirian(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 = papStatusKemandirianService.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<PapStatusKemandirianVO>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<PapStatusKemandirianVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(PapStatusKemandirianVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(PapStatusKemandirianVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<PapStatusKemandirianVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,62 +1,58 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
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.PapTandaVitalService;
|
||||
import com.jasamedika.medifirst2000.vo.PapTandaVitalVO;
|
||||
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.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.PapTandaVitalService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.PapTandaVitalVO;
|
||||
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("/tanda-vital")
|
||||
public class PapTandaVitalController extends LocaleController {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PapTandaVitalController.class);
|
||||
public class PapTandaVitalController extends LocaleController<PapTandaVitalVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(PapTandaVitalController.class);
|
||||
|
||||
@Autowired
|
||||
private PapTandaVitalService service;
|
||||
|
||||
@RequestMapping(value = "/save-tanda-vital", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapTandaVitalVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.addTandaVital(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
@RequestMapping(value = "/save-tanda-vital", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody PapTandaVitalVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.addTandaVital(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 save", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when addTandaVital", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when save", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when addTandaVital", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-tanda-vital")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> getDetailDiagnosaKeperawatanTransaction(
|
||||
@ -66,7 +62,5 @@ public class PapTandaVitalController extends LocaleController {
|
||||
@RequestParam(value = "status", required = false) Integer status) {
|
||||
return service.getAllByPasienDaftar(noCm, startDate, endDate, status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,38 +1,40 @@
|
||||
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.PapTht;
|
||||
import com.jasamedika.medifirst2000.entities.Tht;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.PapThtService;
|
||||
import com.jasamedika.medifirst2000.service.ThtService;
|
||||
import com.jasamedika.medifirst2000.vo.PapThtVO;
|
||||
import com.jasamedika.medifirst2000.vo.ThtVO;
|
||||
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.PapThtService;
|
||||
import com.jasamedika.medifirst2000.service.ThtService;
|
||||
import com.jasamedika.medifirst2000.util.DateUtil;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.PapThtVO;
|
||||
import com.jasamedika.medifirst2000.vo.ThtVO;
|
||||
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_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
|
||||
@ -41,165 +43,47 @@ import com.jasamedika.medifirst2000.vo.ThtVO;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/tht")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class PapThtController extends LocaleController<PapThtVO> implements
|
||||
IBaseRestController<PapThtVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PapThtController.class);
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class PapThtController extends LocaleController<PapThtVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(PapThtController.class);
|
||||
|
||||
@Autowired
|
||||
private PapThtService papThtService;
|
||||
private PapThtService<PapTht> papThtService;
|
||||
|
||||
@Autowired
|
||||
private ThtService thtService;
|
||||
private ThtService<Tht> thtService;
|
||||
|
||||
@RequestMapping(value = "/save-tht-2", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PapThtVO vo,HttpServletRequest request) {
|
||||
@RequestMapping(value = "/save-tht", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> save2(@Valid @RequestBody List<ThtVO> vos, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = papThtService.addTht(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 = thtService.addTht2(vos);
|
||||
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 addTht2", 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 addTht2", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-tht", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> save2(@Valid @RequestBody List<ThtVO> vos,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = thtService.addTht2(vos);
|
||||
|
||||
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-registrasi-pelayanan-pasien/{noCm}/{tglRegistrasi}", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findRegistrasiPelayanaPasien(@PathVariable("noCm") String noCm,
|
||||
@PathVariable("tglRegistrasi") String tglRegistrasi, HttpServletRequest request) {
|
||||
Map<String, Object> result = papThtService.findRegistrasiPelayananPasienByNoCmAndTglRegistrasi(noCm, (short) 0,
|
||||
toDate(tglRegistrasi));
|
||||
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 = "/edit-tht", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody PapThtVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = papThtService.updateTht(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 = papThtService.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 = papThtService.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 = papThtService.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<PapThtVO>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<PapThtVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(PapThtVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(PapThtVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<PapThtVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,140 +1,75 @@
|
||||
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.ParameterService;
|
||||
import com.jasamedika.medifirst2000.vo.ParameterVO;
|
||||
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.ParameterService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.ParameterVO;
|
||||
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("/parameter")
|
||||
public class ParameterController extends LocaleController<ParameterVO> implements IBaseRestController<ParameterVO>{
|
||||
|
||||
public class ParameterController extends LocaleController<ParameterVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(ParameterController.class);
|
||||
|
||||
@Autowired
|
||||
private ParameterService parameterService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ParameterController.class);
|
||||
|
||||
@RequestMapping(value = "/save-parameter/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody ParameterVO vo, HttpServletRequest request) {
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-parameter/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody ParameterVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=parameterService.addParameter(vo);
|
||||
Map<String, Object> result = parameterService.addParameter(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 Parameter", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when addParameter", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Parameter", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when addParameter", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-parameter/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody ParameterVO vo, HttpServletRequest request) {
|
||||
|
||||
|
||||
@RequestMapping(value = "/update-parameter/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> updateVO(@Valid @RequestBody ParameterVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=parameterService.updateParameter(vo);
|
||||
Map<String, Object> result = parameterService.updateParameter(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 update Parameter", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when updateParameter", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when update Parameter", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when updateParameter", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-all-parameter/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=parameterService.findAllParameter();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<ParameterVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<ParameterVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(ParameterVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(ParameterVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<ParameterVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,142 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.ParameterKepuasanService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.ParameterKepuasanVO;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/parameter-kepuasan")
|
||||
public class ParameterKepuasanController extends LocaleController<ParameterKepuasanVO> implements IBaseRestController<ParameterKepuasanVO> {
|
||||
|
||||
@Autowired
|
||||
private ParameterKepuasanService parameterKepuasanService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(ParameterKepuasanController.class);
|
||||
|
||||
@RequestMapping(value = "/save-parameter-kepuasan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody ParameterKepuasanVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=parameterKepuasanService.addParameterKepuasan(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 ParameterKepuasan", 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 ParameterKepuasan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-parameter-kepuasan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody ParameterKepuasanVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=parameterKepuasanService.updateParameterKepuasan(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 ParameterKepuasan", 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 ParameterKepuasan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-all-parameter-kepuasan/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=parameterKepuasanService.findAllParameterKepuasan();
|
||||
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 ParameterKepuasan", 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 ParameterKepuasan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<ParameterKepuasanVO>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<ParameterKepuasanVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(ParameterKepuasanVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(ParameterKepuasanVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<ParameterKepuasanVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,41 +1,31 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.dao.RegistrasiPelayananPasienDao;
|
||||
import com.jasamedika.medifirst2000.entities.AntrianPasienDiPeriksa;
|
||||
import com.jasamedika.medifirst2000.entities.PasienDaftar;
|
||||
import com.jasamedika.medifirst2000.entities.RegistrasiPelayananPasien;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.PapInformasiIbuService;
|
||||
import com.jasamedika.medifirst2000.service.PasienDaftarService;
|
||||
import com.jasamedika.medifirst2000.service.PasienService;
|
||||
import com.jasamedika.medifirst2000.util.CommonUtil;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.PasienVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.INFO_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.util.CommonUtil.isNotNullOrEmpty;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.NOT_FOUND;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Controller class for Pasien Business
|
||||
@ -44,131 +34,21 @@ import com.jasamedika.medifirst2000.vo.PasienVO;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pasien")
|
||||
public class PasienController extends LocaleController<PasienVO> implements
|
||||
IBaseRestController<PasienVO> {
|
||||
|
||||
public class PasienController extends LocaleController<PasienVO> {
|
||||
|
||||
@Autowired
|
||||
private PasienService pasienService;
|
||||
|
||||
@Autowired
|
||||
private RegistrasiPelayananPasienDao registrasiPelayananPasienDao;
|
||||
|
||||
@Autowired
|
||||
private PasienDaftarService pasienDaftarService;
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(PasienController.class);
|
||||
|
||||
// for example
|
||||
/*
|
||||
* @RequestMapping(value = "/test-list", method = RequestMethod.GET) public
|
||||
* ResponseEntity<List<PasienVO>> testList() { List<PasienVO> listPasienVO =
|
||||
* testService.getAllPasienForContoh(); return
|
||||
* RestUtil.getJsonResponse(listPasienVO, HttpStatus.OK); }
|
||||
*/
|
||||
|
||||
// for example
|
||||
/*
|
||||
* @RequestMapping(value = "/test-list2", method = RequestMethod.GET) public
|
||||
* ResponseEntity<List<PasienVO>> testList2() { try { LOGGER.info(
|
||||
* "::Calling PasienController::"); List<PasienVO> listPasienVO =
|
||||
* testService.getAllPasienForContoh(); // add http header messages //
|
||||
* locale ENGLISH addHeaderMessage( Constants.MessageInfo.INFO_MESSAGE,
|
||||
* getMessage(MessageResource.LABEL_SUCCESS, Constants.Locale.EN)); //
|
||||
* locale INDONESIA (default)
|
||||
* addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
* getMessage(MessageResource.LABEL_ERROR));
|
||||
*
|
||||
* return RestUtil.getJsonResponse(listPasienVO, HttpStatus.OK,
|
||||
* mapHeaderMessage);
|
||||
*
|
||||
* } catch (Exception ex) { LOGGER.error("Got exception {}",
|
||||
* ex.getMessage()); addHeaderMessage( Constants.MessageInfo.ERROR_MESSAGE,
|
||||
* getMessage(MessageResource.LABEL_ERROR, Constants.Locale.EN)); return
|
||||
* RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
* mapHeaderMessage); } }
|
||||
*/
|
||||
|
||||
// for example using EM
|
||||
// @RequestMapping(value = "/test-em", method = RequestMethod.GET)
|
||||
// public ResponseEntity<List<PurchasedTest>> testPurchased() {
|
||||
// List<PurchasedTest> listVO = pasienService.getAllPurchasedContoh();
|
||||
// return RestUtil.getJsonResponse(listVO, HttpStatus.OK);
|
||||
// }
|
||||
//
|
||||
// // for example using EM
|
||||
// @RequestMapping(value = "/test-em/{customerId}", method =
|
||||
// RequestMethod.GET)
|
||||
// public ResponseEntity<List<PurchasedTest>> testPurchasedByCustomer(
|
||||
// @PathVariable("customerId") Long customerId) {
|
||||
// List<PurchasedTest> listVO = pasienService
|
||||
// .getAllPurchasedByCustomer(customerId);
|
||||
// return RestUtil.getJsonResponse(listVO, HttpStatus.OK);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-pasien/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> addVO(@Valid @RequestBody PasienVO vo) {
|
||||
try {
|
||||
PasienVO result = pasienService.add(vo);
|
||||
|
||||
if (null != result)
|
||||
return RestUtil.getJsonResponse("", 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);
|
||||
}
|
||||
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.NOT_ACCEPTABLE);
|
||||
}
|
||||
|
||||
public ResponseEntity<String> editVO(@Valid @RequestBody PasienVO vo) {
|
||||
try {
|
||||
PasienVO result = pasienService.update(vo);
|
||||
|
||||
if (null != result)
|
||||
return RestUtil.getJsonResponse("", HttpStatus.OK);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when update 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 update Pasien",
|
||||
jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.NOT_ACCEPTABLE);
|
||||
}
|
||||
|
||||
public ResponseEntity<PasienVO> getVO(@PathVariable("id") Integer id) {
|
||||
PasienVO pasienVO = pasienService.findById(id);
|
||||
|
||||
return RestUtil.getJsonResponse(pasienVO, HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/pasien-list/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/pasien-list/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllVOWithQueryString(
|
||||
@RequestParam(value = "page", required = false,defaultValue = "1") Integer page,
|
||||
@RequestParam(value = "limit", required = false,defaultValue = "30") Integer limit,
|
||||
@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
|
||||
@RequestParam(value = "limit", required = false, defaultValue = "30") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@RequestParam(value = "noCm", required = false) String noCm,
|
||||
@ -176,138 +56,100 @@ public class PasienController extends LocaleController<PasienVO> implements
|
||||
@RequestParam(value = "dateStart", required = false) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = false) String dateEnd,
|
||||
@RequestParam(value = "namaAyah", required = false) String namaAyah) {
|
||||
if(tanggalLahir.equals("Invalid date"))
|
||||
tanggalLahir=null;
|
||||
if(dateStart.equals("Invalid date"))
|
||||
dateStart=null;
|
||||
if(dateEnd.equals("Invalid date"))
|
||||
dateEnd=null;
|
||||
System.out.println(namaAyah);
|
||||
Map<String, Object> resultPageMap = pasienService.findByNoCmAndTglLahir(page, limit, sort, dir, noCm, dateStart, dateEnd,tanggalLahir,namaAyah);
|
||||
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK);
|
||||
/*return constructListPageResult(resultPageMap);*/
|
||||
if (tanggalLahir.equals("Invalid date"))
|
||||
tanggalLahir = null;
|
||||
if (dateStart.equals("Invalid date"))
|
||||
dateStart = null;
|
||||
if (dateEnd.equals("Invalid date"))
|
||||
dateEnd = null;
|
||||
Map<String, Object> resultPageMap = pasienService.findByNoCmAndTglLahir(page, limit, sort, dir, noCm, dateStart,
|
||||
dateEnd, tanggalLahir, namaAyah);
|
||||
return getJsonResponse(resultPageMap, OK);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private PapInformasiIbuService servicePap;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/get/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getByNoCM(
|
||||
@RequestParam(value = "noCm", required = false) String noCm,
|
||||
@RequestMapping(value = "/get/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getByNoCM(@RequestParam(value = "noCm", required = false) String noCm,
|
||||
@RequestParam(value = "limit", required = false, defaultValue = "1000") Integer limit) {
|
||||
|
||||
PasienVO resultPageMap = pasienService.findByNoCm(noCm);
|
||||
try {
|
||||
if(resultPageMap==null)
|
||||
return RestUtil.getJsonResponse(null, HttpStatus.NOT_FOUND);
|
||||
Map<String,Object> map = resultPageMap.ToMap();
|
||||
PasienDaftar pasienDaftar = (PasienDaftar) pasienDaftarService.findbyNoCmLast(resultPageMap.getNoCm());
|
||||
if (resultPageMap == null)
|
||||
return getJsonResponse(null, NOT_FOUND);
|
||||
Map<String, Object> map = resultPageMap.ToMap();
|
||||
PasienDaftar pasienDaftar = pasienDaftarService.findbyNoCmLast(resultPageMap.getNoCm());
|
||||
map.put("kebangsaan", resultPageMap.getKebangsaan());
|
||||
if(CommonUtil.isNotNullOrEmpty(pasienDaftar)) {
|
||||
if (isNotNullOrEmpty(pasienDaftar)) {
|
||||
map.put("pasienDaftar", pasienDaftar.ToMap());
|
||||
|
||||
List<String> mapAntrian = new ArrayList<>();
|
||||
for(AntrianPasienDiPeriksa antrian : pasienDaftar.getAntrianPasienDiPeriksaSet()) {
|
||||
for (AntrianPasienDiPeriksa antrian : pasienDaftar.getAntrianPasienDiPeriksaSet())
|
||||
mapAntrian.add(antrian.getNoRec());
|
||||
}
|
||||
if(CommonUtil.isNotNullOrEmpty(mapAntrian)) {
|
||||
map.put("noRecAntrianPasien", (String)mapAntrian.get(0));
|
||||
}
|
||||
if (isNotNullOrEmpty(mapAntrian))
|
||||
map.put("noRecAntrianPasien", mapAntrian.get(0));
|
||||
}
|
||||
if(resultPageMap.getAlamats().iterator().hasNext()){
|
||||
map.put("alamat",resultPageMap.getAlamats().iterator().next());
|
||||
}
|
||||
return RestUtil.getJsonResponse(map, HttpStatus.OK);
|
||||
if (resultPageMap.getAlamats().iterator().hasNext())
|
||||
map.put("alamat", resultPageMap.getAlamats().iterator().next());
|
||||
return getJsonResponse(map, OK);
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceVOException(e.getMessage());
|
||||
}
|
||||
return RestUtil.getJsonResponse(null, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/CheckKajianAwal/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> CheckKajianAwal(@RequestParam(value = "noCm", required = false) String noCm,
|
||||
|
||||
@RequestMapping(value = "/CheckKajianAwal/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> CheckKajianAwal(
|
||||
@RequestParam(value = "noCm", required = false) String noCm,
|
||||
@RequestParam(value = "tanggal", required = false) String tanggal,
|
||||
@RequestParam(value = "desc", required = false) String desc) {
|
||||
PasienVO resultPageMap = pasienService.findByNoCm(noCm);
|
||||
try {
|
||||
if(resultPageMap==null)
|
||||
return RestUtil.getJsonResponse(null, HttpStatus.NOT_FOUND);
|
||||
Map<String,Object> map = resultPageMap.ToMap();
|
||||
if (resultPageMap == null)
|
||||
return getJsonResponse(null, NOT_FOUND);
|
||||
Map<String, Object> map = resultPageMap.ToMap();
|
||||
map.put("pasienDaftar", pasienDaftarService.findbyNoCmLast(resultPageMap.getNoCm()).ToMap());
|
||||
return RestUtil.getJsonResponse(map, HttpStatus.OK);
|
||||
return getJsonResponse(map, OK);
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceVOException(e.getMessage());
|
||||
}
|
||||
return RestUtil.getJsonResponse(null, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/get-by-no-bpjs/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-by-no-bpjs/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<PasienVO> getByNoBpjs(@RequestParam(value = "noBpjs", required = false) String noBpjs) {
|
||||
PasienVO resultPageMap = pasienService.findByNoBpjs(noBpjs);
|
||||
if(resultPageMap==null)
|
||||
{
|
||||
addHeaderMessage(Constants.MessageInfo.INFO_MESSAGE,
|
||||
noBpjs +" tidak terdfatar di dalam database rumah sakit");
|
||||
addHeaderMessage("StatusCode","404");
|
||||
if (resultPageMap == null) {
|
||||
addHeaderMessage(INFO_MESSAGE, noBpjs + " tidak terdfatar di dalam database rumah sakit");
|
||||
addHeaderMessage("StatusCode", "404");
|
||||
}
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK,mapHeaderMessage);
|
||||
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<PasienVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<PasienVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/get-by-noRec-antrian", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getByNoRec(
|
||||
@RequestParam(value = "noRec", required = false) String noRec,
|
||||
@RequestMapping(value = "/get-by-noRec-antrian", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getByNoRec(@RequestParam(value = "noRec", required = false) String noRec,
|
||||
@RequestParam(value = "limit", required = false, defaultValue = "1000") Integer limit) {
|
||||
|
||||
PasienVO resultPageMap = pasienService.findByNorecAntrian(noRec);
|
||||
try {
|
||||
if(resultPageMap==null)
|
||||
return RestUtil.getJsonResponse(null, HttpStatus.NOT_FOUND);
|
||||
Map<String,Object> map = resultPageMap.ToMap();
|
||||
PasienDaftar pasienDaftar = (PasienDaftar) pasienDaftarService.findbyNoCmLast(resultPageMap.getNoCm());
|
||||
if (resultPageMap == null)
|
||||
return getJsonResponse(null, NOT_FOUND);
|
||||
Map<String, Object> map = resultPageMap.ToMap();
|
||||
PasienDaftar pasienDaftar = pasienDaftarService.findbyNoCmLast(resultPageMap.getNoCm());
|
||||
map.put("kebangsaan", resultPageMap.getKebangsaan());
|
||||
if(CommonUtil.isNotNullOrEmpty(pasienDaftar)) {
|
||||
if (isNotNullOrEmpty(pasienDaftar)) {
|
||||
map.put("pasienDaftar", pasienDaftar.ToMap());
|
||||
List<RegistrasiPelayananPasien> registrasiPelayananPasiens = registrasiPelayananPasienDao.finByNoRecPasiendaftar(pasienDaftar.getNoRec());
|
||||
if(CommonUtil.isNotNullOrEmpty(registrasiPelayananPasiens))
|
||||
{
|
||||
List<RegistrasiPelayananPasien> registrasiPelayananPasiens = registrasiPelayananPasienDao
|
||||
.finByNoRecPasiendaftar(pasienDaftar.getNoRec());
|
||||
if (isNotNullOrEmpty(registrasiPelayananPasiens)) {
|
||||
RegistrasiPelayananPasien registrasiPelayananPasien = registrasiPelayananPasiens.get(0);
|
||||
map.put("noRecRegistrasiPelayananPasien", registrasiPelayananPasien.getNoRec());
|
||||
}
|
||||
List<String> mapAntrian = new ArrayList<>();
|
||||
for(AntrianPasienDiPeriksa antrian : pasienDaftar.getAntrianPasienDiPeriksaSet()) {
|
||||
for (AntrianPasienDiPeriksa antrian : pasienDaftar.getAntrianPasienDiPeriksaSet())
|
||||
mapAntrian.add(antrian.getNoRec());
|
||||
}
|
||||
if(CommonUtil.isNotNullOrEmpty(mapAntrian)) {
|
||||
map.put("noRecAntrianPasien", (String)mapAntrian.get(0));
|
||||
}
|
||||
if (isNotNullOrEmpty(mapAntrian))
|
||||
map.put("noRecAntrianPasien", mapAntrian.get(0));
|
||||
}
|
||||
if(resultPageMap.getAlamats().iterator().hasNext()){
|
||||
map.put("alamat",resultPageMap.getAlamats().iterator().next());
|
||||
}
|
||||
return RestUtil.getJsonResponse(map, HttpStatus.OK);
|
||||
if (resultPageMap.getAlamats().iterator().hasNext())
|
||||
map.put("alamat", resultPageMap.getAlamats().iterator().next());
|
||||
return getJsonResponse(map, OK);
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceVOException(e.getMessage());
|
||||
}
|
||||
return RestUtil.getJsonResponse(null, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,147 +0,0 @@
|
||||
/*package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
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 org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.entities.AgamaM;
|
||||
import com.jasamedika.medifirst2000.entities.Pasien;
|
||||
import com.jasamedika.medifirst2000.entities.PasienDaftar;
|
||||
import com.jasamedika.medifirst2000.entities.PurchasedTest;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.ModelService;
|
||||
import com.jasamedika.medifirst2000.service.PasienDaftarService;
|
||||
import com.jasamedika.medifirst2000.service.PasienService;
|
||||
import com.jasamedika.medifirst2000.service.TestService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.ModelVO;
|
||||
import com.jasamedika.medifirst2000.vo.PasienDaftarVO;
|
||||
import com.jasamedika.medifirst2000.vo.ModelVO;
|
||||
import com.jasamedika.medifirst2000.vo.PasienVO;
|
||||
|
||||
*//**
|
||||
* Controller class for Pasien Business
|
||||
*
|
||||
* @author Roberto
|
||||
*//*
|
||||
@RestController
|
||||
@RequestMapping("/pasien-daftar")
|
||||
public class PasienDaftarController extends LocaleController<PasienDaftarVO>
|
||||
implements IBaseRestController<PasienDaftarVO> {
|
||||
@Autowired
|
||||
private PasienService pasienService;
|
||||
|
||||
@Autowired
|
||||
private PasienDaftarService pasienDaftarService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PasienDaftarController.class);
|
||||
|
||||
@RequestMapping(value = "/baru-pasien-daftar", method = RequestMethod.GET)
|
||||
public ResponseEntity<PasienDaftarVO> baruPasienDaftar() {
|
||||
System.out.println("Controller : baruPasienDaftar");
|
||||
PasienDaftarVO pasienDaftarVO = pasienDaftarService.baru();
|
||||
addHeaderMessage(Constants.MessageInfo.INFO_MESSAGE, "DATA BERHASIL DISIMPAN");
|
||||
return RestUtil.getJsonResponse(pasienDaftarVO, HttpStatus.OK);
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/list-pasien-daftar", method = RequestMethod.GET)
|
||||
public ResponseEntity<List<PasienDaftarVO>> listPasienDaftar() {
|
||||
List<PasienDaftarVO> listPasienDaftarVO = pasienDaftarService.findAll();
|
||||
addHeaderMessage(Constants.MessageInfo.INFO_MESSAGE, "DATA BERHASIL DISIMPAN");
|
||||
return RestUtil.getJsonResponse(listPasienDaftarVO, HttpStatus.OK, mapHeaderMessage);
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-pasien-daftar", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> addVO(@Valid @RequestBody PasienDaftarVO vo) {
|
||||
try {
|
||||
PasienDaftarVO result = pasienDaftarService.add(vo);
|
||||
|
||||
if (null != result)
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, "");
|
||||
RestUtil.getJsonHttptatus(HttpStatus.CREATED);
|
||||
return RestUtil.getJsonResponse("SAVE SUKSESSSSSSSSSSSSSSS", 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ResponseEntity<String> editVO(@Valid @RequestBody PasienDaftarVO vo) {
|
||||
|
||||
try {
|
||||
PasienDaftarVO result = pasienDaftarService.update(vo);
|
||||
|
||||
if (null != result)
|
||||
return RestUtil.getJsonResponse(vo.getNoCM().toString(), HttpStatus.OK);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when update 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 update Pasien", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE);
|
||||
}
|
||||
|
||||
public ResponseEntity<PasienDaftarVO> getVO(@PathVariable("id") String id) {
|
||||
// PasienVO pasienVO = pasienService.findById(id);
|
||||
|
||||
// return RestUtil.getJsonResponse(pasienVO, HttpStatus.OK);
|
||||
return null;
|
||||
}
|
||||
|
||||
public ResponseEntity<Collection<PasienDaftarVO>> getAllVOWithQueryString(Integer page, Integer limit, String sort,
|
||||
String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<PasienDaftarVO> getAllVOFromService() {
|
||||
return pasienDaftarService.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<PasienDaftarVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
@ -1,29 +1,29 @@
|
||||
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.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.PasienMeninggalService;
|
||||
import com.jasamedika.medifirst2000.util.CommonUtil;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.PasienMeninggalVO;
|
||||
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_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;
|
||||
|
||||
/**
|
||||
* Controller class for Registrasi Pasien Business
|
||||
@ -32,190 +32,141 @@ import com.jasamedika.medifirst2000.vo.PasienMeninggalVO;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pasien-meninggal")
|
||||
public class PasienMeninggalController extends LocaleController<PasienMeninggalVO>{
|
||||
public class PasienMeninggalController extends LocaleController<PasienMeninggalVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(PasienMeninggalController.class);
|
||||
|
||||
@Autowired
|
||||
private PasienMeninggalService pasienMeninggalService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PasienMeninggalController.class);
|
||||
|
||||
private PasienMeninggalService pasienMeninggalService;
|
||||
|
||||
@RequestMapping(value = "/save-pasien-pulang", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> savePasienMeninggal(@Valid @RequestBody PasienMeninggalVO vo,HttpServletRequest request) {
|
||||
@RequestMapping(value = "/load-pasien-meninggal", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> loadPasienMeninggal(@RequestParam(value = "noRec") String noRec,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = pasienMeninggalService.updatePasienMeninggal(vo);
|
||||
if(CommonUtil.isNotNullOrEmpty(result)){
|
||||
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.CREATED,mapHeaderMessage);
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Pasien meninggal", 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 Meninggal", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------------------------
|
||||
@RequestMapping(value = "/load-pasien-meninggal", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> loadPasienMeninggal(@RequestParam(
|
||||
value = "noRec", required = true) String noRec, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = pasienMeninggalService.loadPasienMeninggal(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);
|
||||
Map<String, Object> result = pasienMeninggalService.loadPasienMeninggal(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 exception {} when loadPasienMeninggal", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when loadPasienMeninggal", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when loadPasienMeninggal", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when loadPasienMeninggal", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-pasien-meninggal", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> savePasienMeninggal(@Valid @RequestBody Map<String, Object> map, HttpServletRequest request) {
|
||||
@RequestMapping(value = "/load-rencana-pindah", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> loadRencanaPindah(
|
||||
@RequestParam(value = "noRec") String noRec, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = pasienMeninggalService.savePasienMeninggal(map);
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
} else{
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
|
||||
Map<String, Object> result = pasienMeninggalService.loadRencanaPindah(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 exception {} when loadPasienMeninggal", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when loadRencanaPindah", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when loadPasienMeninggal", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when loadRencanaPindah", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------------------
|
||||
@RequestMapping(value = "/load-rencana-pindah", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> loadRencanaPindah(@RequestParam(
|
||||
value = "noRec", required = true) String noRec, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = pasienMeninggalService.loadRencanaPindah(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 loadRencanaPindah", 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 loadRencanaPindah", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-kelas-rencana", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-kelas-rencana", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getkelasRencana(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = pasienMeninggalService.getKelasRencana();
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
} else{
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
|
||||
Map<String, Object> result = pasienMeninggalService.getKelasRencana();
|
||||
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 getkelas", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getKelasRencana", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getkelas", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getKelasRencana", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-ruangan-by-kelas", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-ruangan-by-kelas", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getRuanganByKelas(
|
||||
@RequestParam(value = "id", required = true) Integer id, HttpServletRequest request) {
|
||||
@RequestParam(value = "id") Integer id, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = pasienMeninggalService.getRuanganByKelas(id);
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
} else{
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
|
||||
Map<String, Object> result = pasienMeninggalService.getRuanganByKelas(id);
|
||||
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 getRuanganByKelas", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getRuanganByKelas", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getRuanganByKelas", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getRuanganByKelas", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-kamar-by-ruangan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-kamar-by-ruangan", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getKamarByRuangan(
|
||||
@RequestParam(value = "id", required = true) Integer id, HttpServletRequest request) {
|
||||
@RequestParam(value = "id") Integer id, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = pasienMeninggalService.getKamarByRuangan(id);
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
} else{
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
|
||||
Map<String, Object> result = pasienMeninggalService.getKamarByRuangan(id);
|
||||
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 getKamarByRuangan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getKamarByRuangan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getKamarByRuangan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getKamarByRuangan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-bed-by-kamar", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getBedByKamar(
|
||||
@RequestParam(value = "id", required = true) Integer id, HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/get-bed-by-kamar", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getBedByKamar(@RequestParam(value = "id") Integer id,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = pasienMeninggalService.getKasurByKamar(id);
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
} else{
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
|
||||
Map<String, Object> result = pasienMeninggalService.getKasurByKamar(id);
|
||||
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 getBedByKamar", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getKasurByKamar", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getBedByKamar", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getKasurByKamar", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,40 +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.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.entities.Pasien;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.PasienPulangService;
|
||||
import com.jasamedika.medifirst2000.vo.PasienPulangVO;
|
||||
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.AlamatService;
|
||||
import com.jasamedika.medifirst2000.service.AsalRujukanService;
|
||||
import com.jasamedika.medifirst2000.service.KelompokPasienService;
|
||||
import com.jasamedika.medifirst2000.service.PasienPulangService;
|
||||
import com.jasamedika.medifirst2000.service.PasienService;
|
||||
import com.jasamedika.medifirst2000.service.PegawaiService;
|
||||
import com.jasamedika.medifirst2000.service.RuanganService;
|
||||
import com.jasamedika.medifirst2000.util.CommonUtil;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.PasienPulangVO;
|
||||
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.CommonUtil.isNotNullOrEmpty;
|
||||
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 Registrasi Pasien Business
|
||||
@ -43,124 +36,37 @@ import com.jasamedika.medifirst2000.vo.PasienPulangVO;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pasien-pulang")
|
||||
public class PasienPulangController extends LocaleController<PasienPulangVO> implements
|
||||
IBaseRestController<PasienPulangVO> {
|
||||
public class PasienPulangController extends LocaleController<PasienPulangVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(PasienPulangController.class);
|
||||
|
||||
@Autowired
|
||||
private PasienPulangService<?> pasienPulangService;
|
||||
|
||||
@Autowired
|
||||
private PegawaiService pegawaiService;
|
||||
|
||||
@Autowired
|
||||
private AlamatService<?> alamatService;
|
||||
|
||||
@Autowired
|
||||
private AsalRujukanService<?> asalRujukanService;
|
||||
|
||||
@Autowired
|
||||
private RuanganService ruanganService;
|
||||
|
||||
@Autowired
|
||||
private PasienService pasienService;
|
||||
|
||||
@Autowired
|
||||
private KelompokPasienService<?> kelompokPasienService;
|
||||
private PasienPulangService<Pasien> pasienPulangService;
|
||||
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PasienPulangController.class);
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-pasien-pulang", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> savePasienPulang(@Valid @RequestBody PasienPulangVO vo,HttpServletRequest request) {
|
||||
@RequestMapping(value = "/save-pasien-pulang", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> savePasienPulang(@Valid @RequestBody PasienPulangVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = pasienPulangService.updatepasienPulang(vo);
|
||||
if(CommonUtil.isNotNullOrEmpty(result)){
|
||||
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 ));
|
||||
Map<String, Object> result = pasienPulangService.updatepasienPulang(vo);
|
||||
if (isNotNullOrEmpty(result)) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
SaveLog("Pasien Pulang", "Instruksi",request);
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
SaveLog("Pasien Pulang", "Instruksi", request);
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Pasien Pulang", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when updatepasienPulang", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Pasien Pulng", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when updatepasienPulang", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-cm", method = RequestMethod.GET)
|
||||
public ResponseEntity<String> getCm(HttpServletRequest request) {
|
||||
try {
|
||||
String noCm = pasienService.generatePasienCM();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(noCm, HttpStatus.OK,mapHeaderMessage);
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get Ruangan", 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 Ruangan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<PasienPulangVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(PasienPulangVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(PasienPulangVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<PasienPulangVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<PasienPulangVO>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,286 +1,270 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
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.FileUploadExcelDto;
|
||||
import com.jasamedika.medifirst2000.dto.PayRollDto;
|
||||
import com.jasamedika.medifirst2000.dto.PayRollUangMakanDto;
|
||||
import com.jasamedika.medifirst2000.service.PayRollPegawaiService;
|
||||
import com.jasamedika.medifirst2000.util.DateUtil;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.StrukHistoriVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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.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="/pay-roll")
|
||||
@RequestMapping(value = "/pay-roll")
|
||||
public class PayRollPegawaiController extends LocaleController<StrukHistoriVO> {
|
||||
|
||||
|
||||
@Autowired
|
||||
private PayRollPegawaiService payRollPegawaiService;
|
||||
|
||||
@RequestMapping(value="/get-pegawai-blu-pkwt", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/get-pegawai-blu-pkwt", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> prosesPegawaiBluPkwt(
|
||||
@RequestParam(value="idKategoryPegawai", required = true) Integer idKategoryPegawai,
|
||||
@RequestParam(value="idJenisGaji" , required = true) Integer idJenisGaji,
|
||||
@RequestParam(value="periode", required = true) String periode,
|
||||
@RequestParam(value="tglHistori", required = false) String tglHistori,
|
||||
HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = payRollPegawaiService.prosesPegawaiBluPkwt(idKategoryPegawai,idJenisGaji,periode,DateUtil.toDate(tglHistori));
|
||||
|
||||
@RequestParam(value = "idKategoryPegawai") Integer idKategoryPegawai,
|
||||
@RequestParam(value = "idJenisGaji") Integer idJenisGaji, @RequestParam(value = "periode") String periode,
|
||||
@RequestParam(value = "tglHistori", required = false) String tglHistori, HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = payRollPegawaiService.prosesPegawaiBluPkwt(idKategoryPegawai, idJenisGaji,
|
||||
periode, toDate(tglHistori));
|
||||
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="/save-pegawai-blu-pkwt", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/save-pegawai-blu-pkwt", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<PayRollDto>> savePegawaiByStatusPegawai(@RequestBody List<PayRollDto> dtos,
|
||||
HttpServletRequest request) {
|
||||
List<PayRollDto> result = payRollPegawaiService.save(dtos);
|
||||
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="/find-status-pegawai-blu-pkwt", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/find-status-pegawai-blu-pkwt", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> findPegawaiBluPkwt(HttpServletRequest request) {
|
||||
List<Integer> ids=new ArrayList<Integer>();
|
||||
List<Integer> ids = new ArrayList<>();
|
||||
ids.add(9);
|
||||
ids.add(10);
|
||||
List<Map<String, Object>> result = payRollPegawaiService.findDetailKategoryPegawaiBluPkwt(ids);
|
||||
|
||||
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="/find-jenis-gaji", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/find-jenis-gaji", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> findJenisGaji(HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = payRollPegawaiService.findAllJenisGaji();
|
||||
|
||||
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-uang-makan-pegawai", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-uang-makan-pegawai", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> prosesUangMakanPegawai(
|
||||
@RequestParam(value="idKategoryPegawai", required = true) Integer idKategoryPegawai,
|
||||
@RequestParam(value="idJenisGaji" , required = true) Integer idJenisGaji,
|
||||
@RequestParam(value="periode", required = true) String periode,
|
||||
@RequestParam(value="tglHistori", required = false) String tglHistori,
|
||||
HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = payRollPegawaiService.prosesUangMakanPegawai(idKategoryPegawai,idJenisGaji,periode,"uangmakan",DateUtil.toDate(tglHistori));
|
||||
|
||||
@RequestParam(value = "idKategoryPegawai") Integer idKategoryPegawai,
|
||||
@RequestParam(value = "idJenisGaji") Integer idJenisGaji, @RequestParam(value = "periode") String periode,
|
||||
@RequestParam(value = "tglHistori", required = false) String tglHistori, HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = payRollPegawaiService.prosesUangMakanPegawai(idKategoryPegawai, idJenisGaji,
|
||||
periode, "uangmakan", toDate(tglHistori));
|
||||
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="/find-status-pegawai-uang-makan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/find-status-pegawai-uang-makan", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> findPegawaiUangMakan(HttpServletRequest request) {
|
||||
List<Integer> ids=new ArrayList<Integer>();
|
||||
List<Integer> ids = new ArrayList<>();
|
||||
ids.add(9);
|
||||
ids.add(10);
|
||||
ids.add(18);
|
||||
ids.add(19);
|
||||
List<Map<String, Object>> result = payRollPegawaiService.findDetailKategoryPegawaiBluPkwt(ids);
|
||||
|
||||
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="/save-pegawai-uang-makan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/save-pegawai-uang-makan", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<PayRollUangMakanDto>> savePegawaiUangMakan(@RequestBody List<PayRollUangMakanDto> dtos,
|
||||
HttpServletRequest request) {
|
||||
List<PayRollUangMakanDto> result = payRollPegawaiService.saveUangMakan(dtos,"uangmakan");
|
||||
List<PayRollUangMakanDto> result = payRollPegawaiService.saveUangMakan(dtos, "uangmakan");
|
||||
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="/import-uang-makan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/import-uang-makan", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<PayRollUangMakanDto>> importUangMakan(
|
||||
@RequestParam(value="idKategoryPegawai", required = false) Integer idKategoryPegawai,
|
||||
@RequestParam(value="idJenisGaji" , required = false) Integer idJenisGaji,
|
||||
@RequestParam(value="periode", required = false) String periode,
|
||||
@RequestParam(value="file",required = false) String file,
|
||||
@RequestParam(value="tglHistori", required = false) String tglHistori,@RequestBody FileUploadExcelDto dto,
|
||||
HttpServletRequest request) {
|
||||
List<PayRollUangMakanDto> result = payRollPegawaiService.importUangMakan(idKategoryPegawai,idJenisGaji,periode,file,DateUtil.toDate(tglHistori),dto);
|
||||
@RequestParam(value = "idKategoryPegawai", required = false) Integer idKategoryPegawai,
|
||||
@RequestParam(value = "idJenisGaji", required = false) Integer idJenisGaji,
|
||||
@RequestParam(value = "periode", required = false) String periode,
|
||||
@RequestParam(value = "file", required = false) String file,
|
||||
@RequestParam(value = "tglHistori", required = false) String tglHistori,
|
||||
@RequestBody FileUploadExcelDto dto, HttpServletRequest request) {
|
||||
List<PayRollUangMakanDto> result = payRollPegawaiService.importUangMakan(idKategoryPegawai, idJenisGaji,
|
||||
periode, file, toDate(tglHistori), dto);
|
||||
if (result != null) {
|
||||
if (!result.isEmpty()) {
|
||||
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);
|
||||
} else {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR, "Processing data error returns empty data");
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_ERROR, "Processing data error returns empty data");
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
} else {
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value="/find-status-pegawai-harianLepas", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/find-status-pegawai-harianLepas", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> findPegawaiHarianLepas(HttpServletRequest request) {
|
||||
List<Integer> ids=new ArrayList<Integer>();
|
||||
List<Integer> ids = new ArrayList<>();
|
||||
ids.add(13);
|
||||
List<Map<String, Object>> result = payRollPegawaiService.findDetailKategoryPegawaiBluPkwt(ids);
|
||||
|
||||
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-harian-lepas-pegawai", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/get-harian-lepas-pegawai", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> prosesPegawaiHarianLepas(
|
||||
@RequestParam(value="idKategoryPegawai", required = true) Integer idKategoryPegawai,
|
||||
@RequestParam(value="idJenisGaji" , required = true) Integer idJenisGaji,
|
||||
@RequestParam(value="periode", required = true) String periode,
|
||||
@RequestParam(value="tglHistori", required = false) String tglHistori,
|
||||
HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = payRollPegawaiService.prosesUangMakanPegawai(idKategoryPegawai,idJenisGaji,periode,"harianlepas",DateUtil.toDate(tglHistori));
|
||||
|
||||
@RequestParam(value = "idKategoryPegawai") Integer idKategoryPegawai,
|
||||
@RequestParam(value = "idJenisGaji") Integer idJenisGaji, @RequestParam(value = "periode") String periode,
|
||||
@RequestParam(value = "tglHistori", required = false) String tglHistori, HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = payRollPegawaiService.prosesUangMakanPegawai(idKategoryPegawai, idJenisGaji,
|
||||
periode, "harianlepas", toDate(tglHistori));
|
||||
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="/save-pegawai-harian-lepas", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/save-pegawai-harian-lepas", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<PayRollUangMakanDto>> saveHarianLepas(@RequestBody List<PayRollUangMakanDto> dtos,
|
||||
HttpServletRequest request) {
|
||||
List<PayRollUangMakanDto> result = payRollPegawaiService.saveUangMakan(dtos,"harianlepas");
|
||||
List<PayRollUangMakanDto> result = payRollPegawaiService.saveUangMakan(dtos, "harianlepas");
|
||||
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="/find-status-pegawai-pkwt", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/find-status-pegawai-pkwt", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> findPegawaiDokterPsikologiPkwt(HttpServletRequest request) {
|
||||
List<Integer> ids=new ArrayList<Integer>();
|
||||
List<Integer> ids = new ArrayList<>();
|
||||
ids.add(10);
|
||||
List<Map<String, Object>> result = payRollPegawaiService.findDetailKategoryPegawaiBluPkwt(ids);
|
||||
|
||||
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-dokter-psikologi-pkwt", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/get-dokter-psikologi-pkwt", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> prosesDokterPsikologiPkwt(
|
||||
@RequestParam(value="idKategoryPegawai", required = true) Integer idKategoryPegawai,
|
||||
@RequestParam(value="idJenisGaji" , required = true) Integer idJenisGaji,
|
||||
@RequestParam(value="periode", required = true) String periode,
|
||||
@RequestParam(value="tglHistori", required = false) String tglHistori,
|
||||
HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = payRollPegawaiService.prosesDokterPsikologiPkwt(idKategoryPegawai,idJenisGaji,periode,DateUtil.toDate(tglHistori));
|
||||
|
||||
@RequestParam(value = "idKategoryPegawai") Integer idKategoryPegawai,
|
||||
@RequestParam(value = "idJenisGaji") Integer idJenisGaji, @RequestParam(value = "periode") String periode,
|
||||
@RequestParam(value = "tglHistori", required = false) String tglHistori, HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = payRollPegawaiService.prosesDokterPsikologiPkwt(idKategoryPegawai,
|
||||
idJenisGaji, periode, toDate(tglHistori));
|
||||
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="/save-dokter-psikologi-pkwt", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<PayRollUangMakanDto>> saveDokterPsikologiPkwt(@RequestBody List<PayRollUangMakanDto> dtos,
|
||||
HttpServletRequest request) {
|
||||
List<PayRollUangMakanDto> result = payRollPegawaiService.saveUangMakan(dtos,"tunjanganlayanan");
|
||||
@RequestMapping(value = "/save-dokter-psikologi-pkwt", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<PayRollUangMakanDto>> saveDokterPsikologiPkwt(
|
||||
@RequestBody List<PayRollUangMakanDto> dtos, HttpServletRequest request) {
|
||||
List<PayRollUangMakanDto> result = payRollPegawaiService.saveUangMakan(dtos, "tunjanganlayanan");
|
||||
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="/find-rekanan-penjamin-pasien", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/find-rekanan-penjamin-pasien", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> findRekananPenjaminPasien(HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = payRollPegawaiService.findRekananPenjaminPasien();
|
||||
|
||||
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="/find-umr", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findUmr(
|
||||
@RequestParam(value="periode", required = true) String periode,
|
||||
@RequestMapping(value = "/find-umr", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findUmr(@RequestParam(value = "periode") String periode,
|
||||
HttpServletRequest request) {
|
||||
Map<String, Object> result = payRollPegawaiService.findUmr(periode);
|
||||
|
||||
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-premi-asuransi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/get-premi-asuransi", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> prosesPremiAsuransi(
|
||||
@RequestParam(value="idJenisGaji" , required = true) Integer idJenisGaji,
|
||||
@RequestParam(value="periode", required = true) String periode,
|
||||
@RequestParam(value="idRekanan" , required = true) Integer idRekanan,
|
||||
@RequestParam(value="tglHistori", required = false) String tglHistori,
|
||||
HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = payRollPegawaiService.prosesPremiAsuransi(idJenisGaji,periode,idRekanan,DateUtil.toDate(tglHistori));
|
||||
|
||||
@RequestParam(value = "idJenisGaji") Integer idJenisGaji, @RequestParam(value = "periode") String periode,
|
||||
@RequestParam(value = "idRekanan") Integer idRekanan,
|
||||
@RequestParam(value = "tglHistori", required = false) String tglHistori, HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = payRollPegawaiService.prosesPremiAsuransi(idJenisGaji, periode, idRekanan,
|
||||
toDate(tglHistori));
|
||||
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="/save-premi-asuransi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/save-premi-asuransi", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<PayRollUangMakanDto>> savePremiAsuransi(@RequestBody List<PayRollUangMakanDto> dtos,
|
||||
HttpServletRequest request) {
|
||||
List<PayRollUangMakanDto> result = payRollPegawaiService.savePremiAsuransi(dtos);
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user