Update controller

Clean code
This commit is contained in:
Salman Manoe 2025-01-06 10:39:03 +07:00
parent d2bc46ffbe
commit c36a4e2bad
27 changed files with 1008 additions and 3090 deletions

View File

@ -1,18 +1,16 @@
package com.jasamedika.medifirst2000.service;
import java.util.Date;
import com.jasamedika.medifirst2000.dto.EtiketPersetujuanUmum;
import com.jasamedika.medifirst2000.vo.PersetujuanUmumVO;
import java.util.List;
import java.util.Map;
import com.jasamedika.medifirst2000.dto.EtiketPersetujuanUmum;
import com.jasamedika.medifirst2000.entities.PersetujuanUmum;
import com.jasamedika.medifirst2000.vo.PersetujuanUmumVO;
public interface PersetujuanUmumService {
Map<String,Object> savePersetujuanUmum(PersetujuanUmumVO vo);
void updateStatusRegistrasi(PersetujuanUmumVO persetujuanUmum);
List findEtiket(String noCm,String tglRegistrasi);
List<EtiketPersetujuanUmum> findEtiket(String noCm,String tglRegistrasi);
}

View File

@ -1,22 +1,18 @@
package com.jasamedika.medifirst2000.service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.jasamedika.medifirst2000.dto.AntrianPasien;
import com.jasamedika.medifirst2000.entities.AntrianPasienRegistrasi;
import com.jasamedika.medifirst2000.entities.Pasien;
import com.jasamedika.medifirst2000.entities.PasienDaftar;
import com.jasamedika.medifirst2000.entities.RegistrasiPelayananPasien;
import com.jasamedika.medifirst2000.vo.HasilTriaseVO;
import com.jasamedika.medifirst2000.vo.MasukKamarVO;
import com.jasamedika.medifirst2000.vo.OrderPelayananCustomVO;
import com.jasamedika.medifirst2000.vo.PemeriksaanSelanjutnyaVO;
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananPasienVO;
import java.util.List;
import java.util.Map;
public interface RegistrasiPelayananPasienService <T> extends BaseVoService<RegistrasiPelayananPasien, RegistrasiPelayananPasienVO, String> {
@ -39,7 +35,7 @@ public interface RegistrasiPelayananPasienService <T> extends BaseVoService<Regi
List<Pasien> findAllPasien(String startDate, String endDate);
List findAntrian(String noRec);
List<AntrianPasien> findAntrian(String noRec);
AntrianPasien getNomorUrutPasienbyJenis(String jenis);

View File

@ -1,66 +1,25 @@
package com.jasamedika.medifirst2000.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import com.jasamedika.medifirst2000.converter.*;
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
import com.jasamedika.medifirst2000.dao.*;
import com.jasamedika.medifirst2000.dto.AntrianPasien;
import com.jasamedika.medifirst2000.entities.*;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PasienDaftarService;
import com.jasamedika.medifirst2000.service.PasienService;
import com.jasamedika.medifirst2000.service.RegistrasiPelayananPasienService;
import com.jasamedika.medifirst2000.service.SuratPermintaanMasukService;
import com.jasamedika.medifirst2000.util.CommonUtil;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import com.jasamedika.medifirst2000.converter.KamarConverter;
import com.jasamedika.medifirst2000.converter.KasusPenyakitConverter;
import com.jasamedika.medifirst2000.converter.RegistrasiPelayananPasienConverter;
import com.jasamedika.medifirst2000.converter.RuanganConverter;
import com.jasamedika.medifirst2000.converter.TempatTidurConverter;
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
import com.jasamedika.medifirst2000.dao.AntrianPasienDiPeriksaDao;
import com.jasamedika.medifirst2000.dao.AntrianPasienRegistrasiDao;
import com.jasamedika.medifirst2000.dao.OrderPelayananDao;
import com.jasamedika.medifirst2000.dao.PasienDaftarDao;
import com.jasamedika.medifirst2000.dao.RegistrasiPelayananPasienDao;
import com.jasamedika.medifirst2000.dao.StatusBedDao;
import com.jasamedika.medifirst2000.dao.TempatTidurDao;
import com.jasamedika.medifirst2000.dto.AntrianPasien;
import com.jasamedika.medifirst2000.entities.AntrianPasienDiPeriksa;
import com.jasamedika.medifirst2000.entities.AntrianPasienRegistrasi;
import com.jasamedika.medifirst2000.entities.HasilTriase;
import com.jasamedika.medifirst2000.entities.Kamar;
import com.jasamedika.medifirst2000.entities.KasusPenyakit;
import com.jasamedika.medifirst2000.entities.OrderPelayanan;
import com.jasamedika.medifirst2000.entities.PapKebutuhanEdukasi;
import com.jasamedika.medifirst2000.entities.Pasien;
import com.jasamedika.medifirst2000.entities.PasienDaftar;
import com.jasamedika.medifirst2000.entities.PersetujuanUmum;
import com.jasamedika.medifirst2000.entities.RegistrasiPelayananPasien;
import com.jasamedika.medifirst2000.entities.Ruangan;
import com.jasamedika.medifirst2000.entities.TempatTidur;
import com.jasamedika.medifirst2000.enums.StatusAntrianEnum;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PasienDaftarService;
import com.jasamedika.medifirst2000.service.PasienService;
import com.jasamedika.medifirst2000.service.PersetujuanUmumService;
import com.jasamedika.medifirst2000.service.RegistrasiPelayananPasienService;
import com.jasamedika.medifirst2000.service.SuratPermintaanMasukService;
import com.jasamedika.medifirst2000.util.CommonUtil;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.vo.HasilTriaseVO;
import com.jasamedika.medifirst2000.vo.MasukKamarVO;
import com.jasamedika.medifirst2000.vo.OrderPelayananCustomVO;
import com.jasamedika.medifirst2000.vo.PemeriksaanSelanjutnyaVO;
import com.jasamedika.medifirst2000.vo.PersetujuanUmumVO;
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananPasienVO;
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
import com.jasamedika.medifirst2000.vo.SuratPermintaanMasukVO;
import java.util.*;
/**
* Implement class for PasienService
@ -368,9 +327,9 @@ public class RegistrasiPelayananPasienServiceImpl extends BaseVoServiceImpl
}
@Override
public List findAntrian(String noRec) {
public List<AntrianPasien> findAntrian(String noRec) {
AntrianPasienRegistrasi antrianPasienRegistrasi = antrianPasienRegistrasiDao.findByNoRec(noRec);
List list = new ArrayList();
List<AntrianPasien> list = new ArrayList<>();
Long count = (long)0;
AntrianPasien antrian = new AntrianPasien();
if (antrianPasienRegistrasi != null) {

View File

@ -1,34 +1,34 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.ProdukDetailLabAnatomi;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.ProdukDetailLabAnatomiService;
import com.jasamedika.medifirst2000.vo.ProdukDetailLabAnatomiVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.ProdukDetailLabAnatomiService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.ProdukDetailLabAnatomiVO;
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.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 ProdukDetailLabAnatomiController
@ -37,76 +37,38 @@ import com.jasamedika.medifirst2000.vo.ProdukDetailLabAnatomiVO;
*/
@RestController
@RequestMapping("/laboratorium-anatomi")
@JsonIgnoreProperties(ignoreUnknown = true)
public class ProdukDetailLabAnatomiController extends LocaleController<ProdukDetailLabAnatomiVO> implements
IBaseRestController<ProdukDetailLabAnatomiVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(ProdukDetailLabAnatomiController.class);
@JsonIgnoreProperties(ignoreUnknown = true)
public class ProdukDetailLabAnatomiController extends LocaleController<ProdukDetailLabAnatomiVO> {
private static final Logger LOGGER = getLogger(ProdukDetailLabAnatomiController.class);
@Autowired
private ProdukDetailLabAnatomiService produkDetailLabAnatomiService;
private ProdukDetailLabAnatomiService<ProdukDetailLabAnatomi> produkDetailLabAnatomiService;
@RequestMapping(value = "/save-laboratorium-anatomi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody List<ProdukDetailLabAnatomiVO> vos,HttpServletRequest request) {
@RequestMapping(value = "/save-laboratorium-anatomi", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody List<ProdukDetailLabAnatomiVO> vos,
HttpServletRequest request) {
try {
Map<String,Object> result=null;
for(ProdukDetailLabAnatomiVO vo:vos){
Map<String, Object> result = null;
for (ProdukDetailLabAnatomiVO vo : vos)
result = produkDetailLabAnatomiService.addProdukDetailLabAnatomi(vo);
mapHeaderMessage.clear();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
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 ));
}
SaveLog("Laboratorium Patologi Anatomi", "Laboratorium",request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
SaveLog("Laboratorium Patologi Anatomi", "Laboratorium", 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 addProdukDetailLabAnatomi", 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 addProdukDetailLabAnatomi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@Override
public ResponseEntity<Collection<ProdukDetailLabAnatomiVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<ProdukDetailLabAnatomiVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(ProdukDetailLabAnatomiVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(ProdukDetailLabAnatomiVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<ProdukDetailLabAnatomiVO>> getAllVO() {
return null;
}
}

View File

@ -1,119 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLConnection;
import java.nio.charset.Charset;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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.util.FileCopyUtils;
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.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.entities.DokumenTemplate;
import com.jasamedika.medifirst2000.service.ProdukHukumService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.AgamaVO;
import com.jasamedika.medifirst2000.vo.DokumenTemplateVO;
@RestController
@RequestMapping("/produk-hukum")
public class ProdukHukumController extends LocaleController<AgamaVO> {
@Autowired
private ProdukHukumService produkHukumService;
private static final Logger LOGGER = LoggerFactory
.getLogger(ProdukHukumController.class);
@RequestMapping(value="/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> uploadTemplateSurat(
@RequestBody DokumenTemplateVO dokumenTemplateVO,
HttpServletRequest request) {
String result = produkHukumService.uploadDocumentTemplateSurat(dokumenTemplateVO);
if (result != null) {
if (!result.isEmpty()) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR, "Processing data error returns empty data");
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
}
} else {
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
}
}
@RequestMapping(value="/download/{id}", method = RequestMethod.GET)
public void downloadFileDokumenTemplate(HttpServletResponse response, @PathVariable("id") Integer id) throws IOException {
DokumenTemplate result= produkHukumService.findById(id);
File file = new File(result.getFileLocation());
System.out.println();
if(!file.exists()){
String errorMessage = "Sorry. The file you are looking for does not exist";
System.out.println(errorMessage);
OutputStream outputStream = response.getOutputStream();
outputStream.write(errorMessage.getBytes(Charset.forName("UTF-8")));
outputStream.close();
return;
}
String mimeType= URLConnection.guessContentTypeFromName(file.getName());
if(mimeType==null){
System.out.println("mimetype is not detectable, will take default");
mimeType = "application/octet-stream";
}
System.out.println("mimetype : "+mimeType);
response.setContentType(mimeType);
/* "Content-Disposition : inline" will show viewable types [like images/text/pdf/anything viewable by browser] right on browser
while others(zip e.g) will be directly downloaded [may provide save as popup, based on your browser setting.]*/
response.setHeader("Content-Disposition", String.format("inline; filename=\"" + result.getFileName() +"\""));
/* "Content-Disposition : attachment" will be directly download, may provide save as popup, based on your browser setting*/
//response.setHeader("Content-Disposition", String.format("attachment; filename=\"%s\"", file.getName()));
response.setContentLength((int)file.length());
InputStream inputStream = new BufferedInputStream(new FileInputStream(file));
//Copy bytes from source to destination(outputstream in this example), closes both streams.
FileCopyUtils.copy(inputStream, response.getOutputStream());
}
@RequestMapping(value = "/get-all", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public List<DokumenTemplate> getAllDokumenTemplate(
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "limit", required = false, defaultValue = "50") Integer limit,
@RequestParam(value = "sort", required = false, defaultValue = "namaSurat") String sort,
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
@RequestParam(value = "dateStart", required = false) String dateStart,
@RequestParam(value = "dateEnd", required = false) String dateEnd,
@RequestParam(value = "id", required = false) Integer suratId) {
List<DokumenTemplate> resultPageMap = produkHukumService.getAllDokumenTemplate(page, limit, sort, dir, dateStart, dateEnd, suratId);
return resultPageMap;
}
}

View File

@ -1,56 +1,56 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.ProdukKeslingNilaiNormalService;
import com.jasamedika.medifirst2000.vo.ProdukKeslingNilaiNormalVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.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.ProdukKeslingNilaiNormalService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
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.web.bind.annotation.RequestMethod.GET;
@RestController
@RequestMapping("/produk-kesling-nilai-normal")
public class ProdukKeslingNilaiNormalController extends LocaleController{
public class ProdukKeslingNilaiNormalController extends LocaleController<ProdukKeslingNilaiNormalVO> {
private static final Logger LOGGER = getLogger(ProdukKeslingNilaiNormalController.class);
@Autowired
private ProdukKeslingNilaiNormalService produkKeslingNilaiNormalService;
private static final Logger LOGGER = LoggerFactory.getLogger(ProdukKeslingNilaiNormalController.class);
@RequestMapping(value = "/get-produk-kesling-nilai-normal", method = RequestMethod.GET)
public ResponseEntity<Map<String,Object>> getJenisLimbahB3Masuk(HttpServletRequest request,@RequestParam(value = "jenisPemeriksaanId", required = true) Integer jenisPemeriksaanId) {
@RequestMapping(value = "/get-produk-kesling-nilai-normal", method = GET)
public ResponseEntity<Map<String, Object>> getJenisLimbahB3Masuk(HttpServletRequest request,
@RequestParam(value = "jenisPemeriksaanId") Integer jenisPemeriksaanId) {
try {
Map<String,Object> result = produkKeslingNilaiNormalService.getProdukKeslingNilaiNormalService(jenisPemeriksaanId);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
Map<String, Object> result = produkKeslingNilaiNormalService
.getProdukKeslingNilaiNormalService(jenisPemeriksaanId);
mapHeaderMessage.put(LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
return getJsonResponse(result, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get all pengendali", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getProdukKeslingNilaiNormalService", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get all dokter", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getProdukKeslingNilaiNormalService", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,164 +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.ProduksiNonSterilService;
import com.jasamedika.medifirst2000.util.CommonUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PelayananProduksiVO;
import com.jasamedika.medifirst2000.vo.ProduksiNonSterilVO;
@RestController
@RequestMapping("/produksi-non-steril")
public class ProduksiNonSterilController extends LocaleController<PelayananProduksiVO> implements
IBaseRestController<PelayananProduksiVO> {
@Autowired
private ProduksiNonSterilService produksiNonSterilService;
private static final Logger LOGGER = LoggerFactory
.getLogger(ProduksiNonSterilController.class);
@RequestMapping(value = "/save-produksi-non-steril/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody ProduksiNonSterilVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=produksiNonSterilService.addProduksiNonSteril(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 Pelayanan Admixture", 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 Pelayanan Admixture", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/update-produksi-non-steril/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> editVO(@Valid @RequestBody ProduksiNonSterilVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=produksiNonSterilService.updateProduksiNonSteril(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 Pelayanan Admixture", 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 Pelayanan Admixture", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
// @RequestMapping(value = "/get-barang-medis/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<Map<String,Object>> getBarangMedis(HttpServletRequest request) {
//
// try {
// Map<String,Object> result=produksiNonSterilService.getBarangMedis();
// 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 Pelayanan Admixture", 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 Pelayanan Admixture", jse.getMessage());
// addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
// jse.getMessage());
// return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
// mapHeaderMessage);
// }
// }
@RequestMapping(value = "/find-barang-medis", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findBarangMedis(HttpServletRequest request) {
Map<String,Object> result = produksiNonSterilService.getBarangMedis();
if(CommonUtil.isNotNullOrEmpty(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.OK,mapHeaderMessage);
}
@Override
public ResponseEntity<Collection<PelayananProduksiVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<PelayananProduksiVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PelayananProduksiVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PelayananProduksiVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PelayananProduksiVO>> getAllVO() {
return null;
}
}

View File

@ -1,123 +1,75 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.Program;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.ProgramService;
import com.jasamedika.medifirst2000.vo.ProgramVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.ProgramService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.ProgramVO;
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;
@RestController
@RequestMapping("/program")
public class ProgramController extends LocaleController<ProgramVO> {
private static final Logger LOGGER = getLogger(ProgramController.class);
@Autowired
private ProgramService<?> programService;
private static final Logger LOGGER = LoggerFactory
.getLogger(ProgramController.class);
@RequestMapping(value = "/save-program", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody ProgramVO vo,HttpServletRequest request) {
try{
private ProgramService<Program> programService;
@RequestMapping(value = "/save-program", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody ProgramVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = programService.addProgram(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 Program", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addProgram", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Program", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addProgram", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-program", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody ProgramVO vo,HttpServletRequest request) {
try{
Map<String, Object> result = programService.updateProgram(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 Program", 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 Program", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-program", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/find-all-program", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findAllProgram(HttpServletRequest request) {
Map<String, Object> result=null;
try {
result = programService.findAllProgram();
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
Map<String, Object> result = programService.findAllProgram();
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
}catch(Exception ex){
ex.printStackTrace();
return getJsonResponse(result, OK);
} catch (Exception ex) {
throw new ServiceVOException(ex.getMessage());
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/find-one-program", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findOneProgram(HttpServletRequest request) {
Map<String, Object> result=null;
try {
result = programService.findOneProgram();
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
}catch(Exception ex){
ex.printStackTrace();
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
}

View File

@ -1,133 +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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.ProgramDanPerencanaanPenangananService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.ProgramDanPerencanaanPenangananVO;
@RestController
@RequestMapping("/programDanPerencanaanPenanganan")
public class ProgramDanPerencanaanPenangananController extends LocaleController<ProgramDanPerencanaanPenangananVO> implements IBaseRestController<ProgramDanPerencanaanPenangananVO>{
@Autowired
private ProgramDanPerencanaanPenangananService programDanPerencanaanPenangananService;
private static final Logger LOGGER = LoggerFactory
.getLogger(ProgramDanPerencanaanPenangananController.class);
@Override
public ResponseEntity<Collection<ProgramDanPerencanaanPenangananVO>> getAllVOWithQueryString(
HttpServletRequest request, Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<ProgramDanPerencanaanPenangananVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(ProgramDanPerencanaanPenangananVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(ProgramDanPerencanaanPenangananVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<ProgramDanPerencanaanPenangananVO>> getAllVO() {
return null;
}
@RequestMapping(value = "/save-program-penanganan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody ProgramDanPerencanaanPenangananVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=programDanPerencanaanPenangananService.saveCatatanPerkembangan(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 Program dan Perencanaan Penanganan", 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 Program dan Perencanaan Penanganan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/update-program-penanganan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> editVO(@Valid @RequestBody ProgramDanPerencanaanPenangananVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=programDanPerencanaanPenangananService.updateCatatanPerkembangan(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 Program dan Perencanaan Penanganan", 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 Program dan Perencanaan Penanganan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/find-by-noCm/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(@RequestParam(value = "noCm", required = false, defaultValue = "000000000000001") String noCm,HttpServletRequest request) {
Map<String,Object> result = programDanPerencanaanPenangananService.findByNoCm(noCm);
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
}

View File

@ -1,118 +1,76 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.ProgramKerjaStrategis;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.ProgramKerjaStrategisService;
import com.jasamedika.medifirst2000.vo.PasienVO;
import com.jasamedika.medifirst2000.vo.ProgramKerjaStrategisVO;
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.entities.ProgramKerjaStrategis;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.ProgramKerjaStrategisService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.ProgramKerjaStrategisVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Collection;
import java.util.Map;
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController
@RequestMapping("/program-kerja-strategis")
public class ProgramKerjaStrategisController extends LocaleController<ProgramKerjaStrategisVO>
implements IBaseRestController<ProgramKerjaStrategisVO>{
public class ProgramKerjaStrategisController extends LocaleController<ProgramKerjaStrategisVO> {
private static final Logger LOGGER = getLogger(ProgramKerjaStrategisController.class);
@Autowired
private ProgramKerjaStrategisService programService;
private static final Logger LOGGER = LoggerFactory
.getLogger(PegawaiController.class);
@Override
public ResponseEntity<Collection<ProgramKerjaStrategisVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<ProgramKerjaStrategisVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(ProgramKerjaStrategisVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(ProgramKerjaStrategisVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<ProgramKerjaStrategisVO>> getAllVO() {
return null;
}
@RequestMapping(value="/find-all/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Collection<ProgramKerjaStrategis>> findAll(
@RequestMapping(value = "/find-all/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Collection<PasienVO>> findAll(
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "take", required = false, defaultValue = "100") Integer take,
@RequestParam(value = "sort", required = false, defaultValue = "periode") String sort,
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
@Spec(path = "id", params = "id", spec = Equal.class) Specification<ProgramKerjaStrategis> spec)
{
Map<String, Object> result = new HashMap<String, Object>();
result = programService.findAll(page, take, sort,dir, spec);
return constructListPageResult(result);
@Spec(path = "id", params = "id", spec = Equal.class) Specification<ProgramKerjaStrategis> spec) {
Map<String, Object> result = programService.findAll(page, take, sort, dir, spec);
return constructListPageResult(result);
}
@RequestMapping(value="/save/", method= RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody ProgramKerjaStrategisVO vo,HttpServletRequest request){
try{
@RequestMapping(value = "/save/", method = POST, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody ProgramKerjaStrategisVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = programService.save(vo);
if(null!= result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
if (null != result)
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add/update programKerjaStrategis", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when save", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add/update programKerjaStrategis", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when save", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,113 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PropinsiService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PropinsiVO;
/**
* Controller class for Propinsi Business
*
* @author Roberto
*/
@RestController
@RequestMapping("/propinsi")
@JsonIgnoreProperties(ignoreUnknown = true)
public class PropinsiController extends LocaleController<PropinsiVO> implements IBaseRestController<PropinsiVO> {
@Autowired
private PropinsiService propinsiService;
private static final Logger LOGGER = LoggerFactory.getLogger(PropinsiController.class);
@RequestMapping(value = "/save-propinsi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> savePropinsi(@Valid @RequestBody PropinsiVO vo) {
try {
PropinsiVO result = propinsiService.add(vo);
if (null != result)
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, "");
RestUtil.getJsonHttpStatus(HttpStatus.CREATED);
return RestUtil.getJsonResponse("", HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Propinsi", 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 Propinsi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@Override
public ResponseEntity<PropinsiVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PropinsiVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PropinsiVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PropinsiVO>> getAllVO() {
return null;
}
@Override
public ResponseEntity<Collection<PropinsiVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
Integer limit, String sort, String dir) {
return null;
}
}

View File

@ -1,101 +1,76 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.ProsesCuciService;
import com.jasamedika.medifirst2000.vo.ProsesCuciVO;
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.ProsesCuciService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.ProsesCuciVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController
@RequestMapping("/proses-cuci")
public class ProsesCuciController extends LocaleController<ProsesCuciVO> {
private static final Logger LOGGER = getLogger(ProsesCuciController.class);
@Autowired
private ProsesCuciService prosesCuciService;
private static final Logger LOGGER = LoggerFactory.getLogger(ProsesCuciController.class);
@RequestMapping(value = "/save-proses-cuci/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-proses-cuci/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveProsesCuci(@Valid @RequestBody ProsesCuciVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = prosesCuciService.saveProsesCuci(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Proses Cuci", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveProsesCuci", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Proses Cuci", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveProsesCuci", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-proses-cuci/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/find-all-proses-cuci/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findAllProsesCuci(HttpServletRequest request) {
try {
Map<String, Object> result = prosesCuciService.findAllProsesCuci();
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get All Proses Cuci", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when findAllProsesCuci", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get All Proses Cuci", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when findAllProsesCuci", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/delete-proses-cuci/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> deleteProsesCuci(@RequestParam(value = "id", required = true) Integer id) {
try {
if (prosesCuciService.deleteProsesCuci(id) == true)
return RestUtil.getJsonResponse(id + " Dihapus", HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when delete Proses Cuci", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when delete Proses Cuci", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
return RestUtil.getJsonHttpStatus(HttpStatus.NOT_ACCEPTABLE);
}
}

View File

@ -1,59 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.ProsesSterilisasiAlatService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.ProsesSterilisasiAlatVO;
@RestController
@RequestMapping("/proses-sterilisasi-alat")
public class ProsesSterilisasiAlatController extends LocaleController<ProsesSterilisasiAlatVO> {
@Autowired
private ProsesSterilisasiAlatService prosesSterilisasiAlatService;
private static final Logger LOGGER = LoggerFactory.getLogger(ProsesSterilisasiAlatController.class);
@RequestMapping(value = "/save-proses-sterilisasi-alat/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveProsesSterilisasiAlat(@Valid @RequestBody ProsesSterilisasiAlatVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = prosesSterilisasiAlatService.saveProsesSterilisasiAlat(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 save Proses Sterilisasi Alat", 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 save Proses Sterilisasi Alat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,162 +1,135 @@
package com.jasamedika.medifirst2000.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import 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.entities.Pegawai;
import com.jasamedika.medifirst2000.entities.Ruangan;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PsrsPermintaanPerbaikanService;
import com.jasamedika.medifirst2000.service.StokProdukGlobalService;
import com.jasamedika.medifirst2000.service.StrukOrderService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.AkunVO;
import com.jasamedika.medifirst2000.vo.KirimPerbaikanVO;
import com.jasamedika.medifirst2000.vo.PemeliharaanVO;
import com.jasamedika.medifirst2000.vo.PenjadwalanHeaderVO;
import com.jasamedika.medifirst2000.vo.PerbaikanVO;
import com.jasamedika.medifirst2000.vo.PermintaanPerbaikanVO;
import com.jasamedika.medifirst2000.vo.SukuCadangLuarVO;
import com.jasamedika.medifirst2000.vo.*;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController
@RequestMapping("/psrsPermintaanPerbaikan")
public class PsrsPermintaanPerbaikanController extends LocaleController<AkunVO>{
public class PsrsPermintaanPerbaikanController extends LocaleController<PermintaanPerbaikanVO> {
private static final Logger LOGGER = getLogger(PsrsPermintaanPerbaikanController.class);
@Autowired
private PsrsPermintaanPerbaikanService psrsPermintaanPerbaikanService;
@Autowired
private StrukOrderService strukOrderService;
@Autowired
private StokProdukGlobalService stokProdukGlobalService;
private static final Logger LOGGER = LoggerFactory.getLogger(PsrsPermintaanPerbaikanController.class);
@RequestMapping(value = "/save-permintaan-perbaikan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePermintaanPerbaikan(@Valid @RequestBody PermintaanPerbaikanVO vo,HttpServletRequest request,HttpServletResponse response) {
@RequestMapping(value = "/save-permintaan-perbaikan/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePermintaanPerbaikan(@Valid @RequestBody PermintaanPerbaikanVO vo,
HttpServletRequest request, HttpServletResponse response) {
try {
Map<String, Object> result = psrsPermintaanPerbaikanService.savePermintaanPerbaikan(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Permintaan Perbaikan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePermintaanPerbaikan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Permintaan Perbaikan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when savePermintaanPerbaikan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}
@RequestMapping(value = "/get-aset-by-ruangan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getAsetByRuangan() {
Map<String, Object> data = psrsPermintaanPerbaikanService.getAsetByRuangan();
return data;
}
@RequestMapping(value = "/get-ruangan-by-user-login", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-ruangan-by-user-login", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getRuanganByUserLogin() {
Ruangan r=psrsPermintaanPerbaikanService.getRuanganByUserLogin();
Map<String, Object> data = new HashMap<String,Object>();
Ruangan r = psrsPermintaanPerbaikanService.getRuanganByUserLogin();
Map<String, Object> data = new HashMap<>();
data.put("id", r.getId());
data.put("namaRuangan", r.getNamaRuangan());
return data;
}
@RequestMapping(value = "/get-ruangan-tujuan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-ruangan-tujuan", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getRuanganTujuan() {
Ruangan r=psrsPermintaanPerbaikanService.getRuanganTujuan();
Map<String, Object> data = new HashMap<String,Object>();
Ruangan r = psrsPermintaanPerbaikanService.getRuanganTujuan();
Map<String, Object> data = new HashMap<>();
data.put("id", r.getId());
data.put("namaRuangan", r.getNamaRuangan());
return data;
}
@RequestMapping(value = "/get-user-login", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-user-login", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getUserLogin() {
Pegawai p=psrsPermintaanPerbaikanService.getPegawaiByUserLogin();
Map<String, Object> data = new HashMap<String,Object>();
Pegawai p = psrsPermintaanPerbaikanService.getPegawaiByUserLogin();
Map<String, Object> data = new HashMap<>();
data.put("id", p.getId());
data.put("namaPegawai", p.getNamaLengkap());
return data;
}
@RequestMapping(value = "/get-aset-by-produk", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getAsetByProduk(@RequestParam(value = "produkId") Integer produkId) {
Map<String, Object> data = psrsPermintaanPerbaikanService.getAsetByProduk(produkId);
return data;
}
@RequestMapping(value = "/get-kontrak", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getKotrak() {
Map<String, Object> data = psrsPermintaanPerbaikanService.getKotrak();
return data;
}
@RequestMapping(value = "/get-kontrak-detail", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getKontrakDetail(@RequestParam(value = "noRec") String noRec) {
Map<String, Object> data = psrsPermintaanPerbaikanService.getKontrakDetail(noRec);
return data;
}
@RequestMapping(value = "/get-detail-permintaan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getDetailPermintaan(@RequestParam(value = "noRec") String noRec) {
Map<String, Object> data = psrsPermintaanPerbaikanService.getDetailPermintaan(noRec);
return data;
}
@RequestMapping(value = "/pre-add-perbaikan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> preAddPerbaikan(@RequestParam(value = "noRec") String noRec) {
Map<String, Object> data = psrsPermintaanPerbaikanService.preAddPerbaikan(noRec);
return data;
}
@RequestMapping(value = "/pre-add-pemeliharaan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> preAddPemeliharaan(@RequestParam(value = "noRec") String noRec) {
Map<String, Object> data = psrsPermintaanPerbaikanService.preAddPemeliharaan(noRec);
return data;
}
@RequestMapping(value = "/get-no-order-perbaikan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String,Object> getNoPemusnahan() {
Map<String, Object> result = new HashMap<String,Object>();
@RequestMapping(value = "/get-kontrak", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getKotrak() {
return psrsPermintaanPerbaikanService.getKotrak();
}
@RequestMapping(value = "/get-kontrak-detail", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getKontrakDetail(@RequestParam(value = "noRec") String noRec) {
return psrsPermintaanPerbaikanService.getKontrakDetail(noRec);
}
@RequestMapping(value = "/get-detail-permintaan", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getDetailPermintaan(@RequestParam(value = "noRec") String noRec) {
return psrsPermintaanPerbaikanService.getDetailPermintaan(noRec);
}
@RequestMapping(value = "/pre-add-perbaikan", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> preAddPerbaikan(@RequestParam(value = "noRec") String noRec) {
return psrsPermintaanPerbaikanService.preAddPerbaikan(noRec);
}
@RequestMapping(value = "/pre-add-pemeliharaan", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> preAddPemeliharaan(@RequestParam(value = "noRec") String noRec) {
return psrsPermintaanPerbaikanService.preAddPemeliharaan(noRec);
}
@RequestMapping(value = "/get-no-order-perbaikan", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getNoPemusnahan() {
Map<String, Object> result = new HashMap<>();
result.put("noOrderPerbaikan", strukOrderService.preFormatNoUrut("Order Perbaikan", "PBK"));
return result;
}
@RequestMapping(value = "/get-informasi-perbaikan-masuk", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String,Object> informasiPerbaikanMasuk(
@RequestMapping(value = "/get-informasi-perbaikan-masuk", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> informasiPerbaikanMasuk(
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "take", required = false, defaultValue = "10000") Integer limit,
@RequestParam(value = "sort", required = false) String sort,
@ -165,15 +138,13 @@ public class PsrsPermintaanPerbaikanController extends LocaleController<AkunVO>{
@RequestParam(value = "dateEnd", required = false) String dateEnd,
@RequestParam(value = "noOrder", required = false) String noOrder,
@RequestParam(value = "jenisOrder", required = false) String jenisOrder) {
Map<String, Object> resultPageMap = strukOrderService.getInformasiPerbaikanMasuk(page, limit, sort, dir, dateStart,dateEnd,noOrder,jenisOrder);
return resultPageMap;
return strukOrderService.getInformasiPerbaikanMasuk(page, limit, sort, dir, dateStart, dateEnd, noOrder,
jenisOrder);
}
@RequestMapping(value = "/get-informasi-perbaikan-keluar", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String,Object> informasiPerbaikanKeluar(
@RequestMapping(value = "/get-informasi-perbaikan-keluar", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> informasiPerbaikanKeluar(
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "take", required = false, defaultValue = "10000") Integer limit,
@RequestParam(value = "sort", required = false) String sort,
@ -182,199 +153,176 @@ public class PsrsPermintaanPerbaikanController extends LocaleController<AkunVO>{
@RequestParam(value = "dateEnd", required = false) String dateEnd,
@RequestParam(value = "noOrder", required = false) String noOrder,
@RequestParam(value = "jenisOrder", required = false) String jenisOrder) {
Map<String, Object> resultPageMap = strukOrderService.getInformasiPerbaikanKeluar(page, limit, sort, dir, dateStart,dateEnd,noOrder,jenisOrder);
return resultPageMap;
return strukOrderService.getInformasiPerbaikanKeluar(page, limit, sort, dir, dateStart, dateEnd, noOrder,
jenisOrder);
}
@RequestMapping(value = "/kirim-perbaikan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveKirimPerbaikan(@Valid @RequestBody KirimPerbaikanVO vo,HttpServletRequest request,HttpServletResponse response) {
Map<String, Object> result = psrsPermintaanPerbaikanService.kirimPerbaikan(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
@RequestMapping(value = "/kirim-perbaikan/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveKirimPerbaikan(@Valid @RequestBody KirimPerbaikanVO vo,
HttpServletRequest request, HttpServletResponse response) {
Map<String, Object> result = psrsPermintaanPerbaikanService.kirimPerbaikan(vo);
if (null != result)
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
}
@RequestMapping(value = "/save-verifikasi-perbaikan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveVerifikasiPerbaikan(@Valid @RequestBody KirimPerbaikanVO vo,HttpServletRequest request,HttpServletResponse response) {
@RequestMapping(value = "/save-verifikasi-perbaikan/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveVerifikasiPerbaikan(@Valid @RequestBody KirimPerbaikanVO vo,
HttpServletRequest request, HttpServletResponse response) {
try {
Map<String, Object> result = psrsPermintaanPerbaikanService.saveVerifikasiPerbaikan(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Penerimaan Barang", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveVerifikasiPerbaikan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Penerimaan Barang", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveVerifikasiPerbaikan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-penjadwalan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePenjadwalan(@Valid @RequestBody PenjadwalanHeaderVO vo,HttpServletRequest request,HttpServletResponse response) {
@RequestMapping(value = "/save-penjadwalan/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePenjadwalan(@Valid @RequestBody PenjadwalanHeaderVO vo,
HttpServletRequest request, HttpServletResponse response) {
try {
Map<String, Object> result = psrsPermintaanPerbaikanService.savePenjadwalan(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Penerimaan Barang", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePenjadwalan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Penerimaan Barang", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when savePenjadwalan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-ruangan-asset", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/find-ruangan-asset", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getRuanganRegistrasiAset(HttpServletRequest request) {
try {
Map<String,Object> result = psrsPermintaanPerbaikanService.getRuanganPerbaikan();
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 = psrsPermintaanPerbaikanService.getRuanganPerbaikan();
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 getRuanganRegistrasiAset", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getRuanganPerbaikan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getRuanganRegistrasiAset", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getRuanganPerbaikan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-produk-by-ruangan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAsetPerbaikan(@RequestParam(value = "id", required = true) Integer id, HttpServletRequest request){
@RequestMapping(value = "/find-produk-by-ruangan", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAsetPerbaikan(@RequestParam(value = "id") Integer id,
HttpServletRequest request) {
try {
Map<String,Object> result = psrsPermintaanPerbaikanService.getProdukPerbaikan(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 = psrsPermintaanPerbaikanService.getProdukPerbaikan(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 getAsetPerbaikan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getProdukPerbaikan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getAsetPerbaikan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getProdukPerbaikan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-aset-by-produk-and-ruangan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getAsetByProduk(@RequestParam(value = "produkId") Integer produkId,@RequestParam(value = "ruanganId") Integer ruanganId) {
Map<String, Object> data = psrsPermintaanPerbaikanService.getAsetByProdukAndRuangan(produkId,ruanganId);
return data;
@RequestMapping(value = "/get-aset-by-produk-and-ruangan", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getAsetByProduk(@RequestParam(value = "produkId") Integer produkId,
@RequestParam(value = "ruanganId") Integer ruanganId) {
return psrsPermintaanPerbaikanService.getAsetByProdukAndRuangan(produkId, ruanganId);
}
@RequestMapping(value = "/save-perbaikan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePerbaikan(@Valid @RequestBody PerbaikanVO vo,HttpServletRequest request,HttpServletResponse response) {
@RequestMapping(value = "/save-perbaikan/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePerbaikan(@Valid @RequestBody PerbaikanVO vo,
HttpServletRequest request, HttpServletResponse response) {
try {
Map<String, Object> result = psrsPermintaanPerbaikanService.savePerbaikan(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Permintaan Perbaikan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePerbaikan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Permintaan Perbaikan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when savePerbaikan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-pemeliharaan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePemeliharaan(@Valid @RequestBody PemeliharaanVO vo,HttpServletRequest request,HttpServletResponse response) {
@RequestMapping(value = "/save-pemeliharaan/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePemeliharaan(@Valid @RequestBody PemeliharaanVO vo,
HttpServletRequest request, HttpServletResponse response) {
try {
Map<String, Object> result = psrsPermintaanPerbaikanService.savePemeliharaan(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Permintaan Perbaikan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePemeliharaan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Permintaan Perbaikan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when savePemeliharaan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-suku-cadang-luar/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveSukuCadangLuar(@Valid @RequestBody List<SukuCadangLuarVO> vo,HttpServletRequest request,HttpServletResponse response) {
@RequestMapping(value = "/save-suku-cadang-luar/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveSukuCadangLuar(@Valid @RequestBody List<SukuCadangLuarVO> vo,
HttpServletRequest request, HttpServletResponse response) {
try {
Map<String, Object> result = psrsPermintaanPerbaikanService.saveSukuCadangLuar(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Permintaan Perbaikan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveSukuCadangLuar", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Permintaan Perbaikan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveSukuCadangLuar", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-stok-ruangan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String,Object> getStokRuangan() {
Map<String, Object> resultPageMap = stokProdukGlobalService.getStokRuangan();
return resultPageMap;
@RequestMapping(value = "/get-stok-ruangan", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getStokRuangan() {
return stokProdukGlobalService.getStokRuangan();
}
@RequestMapping(value = "/verifikasi-ruangan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String,Object> verifikasiRuangan(
@RequestMapping(value = "/verifikasi-ruangan", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> verifikasiRuangan(
@RequestParam(value = "noRecKirimProduk", required = false) String noRec) {
Map<String, Object> resultPageMap = strukOrderService.verifikasiRuangan(noRec);
return resultPageMap;
return strukOrderService.verifikasiRuangan(noRec);
}
@RequestMapping(value = "/monitoring", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String,Object> monitoring(
@RequestMapping(value = "/monitoring", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> monitoring(
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "take", required = false, defaultValue = "10000") Integer limit,
@RequestParam(value = "sort", required = false) String sort,
@ -384,127 +332,71 @@ public class PsrsPermintaanPerbaikanController extends LocaleController<AkunVO>{
@RequestParam(value = "ruanganId", required = false) Integer ruanganId,
@RequestParam(value = "noAset", required = false) String noAset,
@RequestParam(value = "produkId", required = false) Integer produkId) {
Map<String, Object> resultPageMap = strukOrderService.monitoringPerbaikan(page, limit, sort, dir, dateStart,dateEnd,ruanganId,noAset,produkId);
return resultPageMap;
return strukOrderService.monitoringPerbaikan(page, limit, sort, dir, dateStart, dateEnd, ruanganId, noAset,
produkId);
}
@RequestMapping(value = "/detail-monitoring", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String,Object> detailMonitoring(
@RequestMapping(value = "/detail-monitoring", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> detailMonitoring(
@RequestParam(value = "strukOrderId", required = false) String strukOrderId,
@RequestParam(value = "noRegistrasiAset", required = false) String noRegistrasiAset) {
return strukOrderService.detailMonitoring(strukOrderId, noRegistrasiAset);
}
Map<String, Object> resultPageMap = strukOrderService.detailMonitoring(strukOrderId,noRegistrasiAset);
return resultPageMap;
@RequestMapping(value = "/get-lap-permintaan-perbaikan", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getLapPermintaanPerbaikan() {
return psrsPermintaanPerbaikanService.getLapPermintaanPerbaikan();
}
//add by iwankasan
//12.12.2017
@RequestMapping(value = "/get-lap-permintaan-perbaikan",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getLapPermintaanPerbaikan(
) {
Map<String, Object> data = psrsPermintaanPerbaikanService.getLapPermintaanPerbaikan();
return data;
}
@RequestMapping(value = "/get-lap-permintaan-perbaikan-by-date",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-lap-permintaan-perbaikan-by-date", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getLapPermintaanPerbaikanByDate(
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate
) {
Map<String, Object> data = psrsPermintaanPerbaikanService.getLapPermintaanPerbaikanByDate(startDate, endDate);
return data;
@RequestParam(value = "endDate", required = false) String endDate) {
return psrsPermintaanPerbaikanService.getLapPermintaanPerbaikanByDate(startDate, endDate);
}
@RequestMapping(value = "/get-lap-permintaan-perbaikan-by-noorder",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-lap-permintaan-perbaikan-by-noorder", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getLapPermintaanPerbaikanByNoTrans(
@RequestParam(value = "noOrder", required = false) String noOrder
) {
Map<String, Object> data = psrsPermintaanPerbaikanService.getLapPermintaanPerbaikanByNoOrder(noOrder);
return data;
@RequestParam(value = "noOrder", required = false) String noOrder) {
return psrsPermintaanPerbaikanService.getLapPermintaanPerbaikanByNoOrder(noOrder);
}
@RequestMapping(value = "/get-lap-permintaan-perbaikan-by-jenis-order",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-lap-permintaan-perbaikan-by-jenis-order", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getLapPermintaanPerbaikanByJenisOrder(
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate,
@RequestParam(value = "jenisOrder", required = false) String jenisOrder
) {
Map<String, Object> data = psrsPermintaanPerbaikanService.getLapPermintaanPerbaikanByJenisOrder(jenisOrder, startDate, endDate);
return data;
@RequestParam(value = "jenisOrder", required = false) String jenisOrder) {
return psrsPermintaanPerbaikanService.getLapPermintaanPerbaikanByJenisOrder(jenisOrder, startDate, endDate);
}
@RequestMapping(value = "/get-suku-cadang-by-strukorder",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-suku-cadang-by-strukorder", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getOrderSukuCadangbyStrukOrder(String strukOrder) {
Map<String, Object> data = this.psrsPermintaanPerbaikanService.getOrderSukuCadangbyStrukOrder(strukOrder);
return data;
return this.psrsPermintaanPerbaikanService.getOrderSukuCadangbyStrukOrder(strukOrder);
}
@RequestMapping(value = "/get-monitoring-perbaikan",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-monitoring-perbaikan", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getMonitoringPerbaikan(
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate
) {
Map<String, Object> data = this.psrsPermintaanPerbaikanService.getMonitoringPerbaikanByDate(startDate, endDate);
return data;
@RequestParam(value = "endDate", required = false) String endDate) {
return this.psrsPermintaanPerbaikanService.getMonitoringPerbaikanByDate(startDate, endDate);
}
@RequestMapping(value = "/get-asset-gedung-by-jenis-asset",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-asset-gedung-by-jenis-asset", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getAssetGedungByJenisAsset(Integer idJenis) {
Map<String, Object> data = this.psrsPermintaanPerbaikanService.getAssetGedungByJenisAsset(idJenis);
return data;
return this.psrsPermintaanPerbaikanService.getAssetGedungByJenisAsset(idJenis);
}
@RequestMapping(value = "/get-asset-non-gedung-by-jenis-asset",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getAssetNonGedungByJenisAsset(
@RequestParam(value = "id", required = true) Integer id,
@RequestParam(value="idJenis", required=true) Integer idJenis, HttpServletRequest request) {
Map<String, Object> data = this.psrsPermintaanPerbaikanService.getAssetNonGedungByJenisAsset(id, idJenis);
return data;
@RequestMapping(value = "/get-asset-non-gedung-by-jenis-asset", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getAssetNonGedungByJenisAsset(@RequestParam(value = "id") Integer id,
@RequestParam(value = "idJenis") Integer idJenis, HttpServletRequest request) {
return this.psrsPermintaanPerbaikanService.getAssetNonGedungByJenisAsset(id, idJenis);
}
@RequestMapping(value = "/get-asset-gedung-by-order-pelayanan",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-asset-gedung-by-order-pelayanan", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getAssetGedungByOrderPelayanan(
@RequestParam(value = "noOrderPelayanan", required = false) String noOrderPelayanan, HttpServletRequest request) {
Map<String, Object> data = this.psrsPermintaanPerbaikanService.getAssetGedungByOrderPelayanan(noOrderPelayanan);
return data;
@RequestParam(value = "noOrderPelayanan", required = false) String noOrderPelayanan,
HttpServletRequest request) {
return this.psrsPermintaanPerbaikanService.getAssetGedungByOrderPelayanan(noOrderPelayanan);
}
@RequestMapping(value = "/get-asset-non-gedung-by-order-pelayanan",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getAssetNonGedungByOrderPelayanan(
@RequestParam(value = "noOrderPelayanan", required = false) String noOrderPelayanan, HttpServletRequest request) {
Map<String, Object> data = this.psrsPermintaanPerbaikanService.getAssetNonGedungByOrderPelayanan(noOrderPelayanan);
return data;
}
@RequestMapping(value = "/get-asset-by-jenis-produk",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getAssetByJenisProduk(@RequestParam(value="noRec")String noRec, HttpServletRequest request) {
Map<String, Object> data = this.psrsPermintaanPerbaikanService.getRegistrasiAssetByJenisProduk(noRec);
return data;
}
}

View File

@ -1,106 +1,106 @@
package com.jasamedika.medifirst2000.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.RIS_ReportService;
import com.jasamedika.medifirst2000.service.RadiologiService;
import com.jasamedika.medifirst2000.vo.OrderRadiologiVO;
import com.jasamedika.medifirst2000.vo.StrukOrderVO;
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.RIS_ReportService;
import com.jasamedika.medifirst2000.service.RadiologiService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.OrderRadiologiVO;
import com.jasamedika.medifirst2000.vo.StrukOrderVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController
@RequestMapping("/radiologi-ris")
public class RadiologiController extends LocaleController{
public class RadiologiController extends LocaleController<OrderRadiologiVO> {
private static final Logger LOGGER = getLogger(RadiologiController.class);
@Autowired
private RadiologiService service;
@Autowired
private RIS_ReportService rIS_ReportService;
private static final Logger LOGGER = LoggerFactory.getLogger(RadiologiController.class);
@RequestMapping(value = "/save-order-radiologi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveOrderRadiologi(@Valid @RequestBody OrderRadiologiVO vo, HttpServletRequest request) {
@RequestMapping(value = "/save-order-radiologi", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveOrderRadiologi(@Valid @RequestBody OrderRadiologiVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result = service.saveOrderRadiologi(vo);
Map<String, Object> result = service.saveOrderRadiologi(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 saveOrderRadiologi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveOrderRadiologi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveOrderRadiologi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveOrderRadiologi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-order-radiologi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateOrderRadiologi(@Valid @RequestBody StrukOrderVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = service.updateOrderRadiologi(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
@RequestMapping(value = "/update-order-radiologi", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateOrderRadiologi(@Valid @RequestBody StrukOrderVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = service.updateOrderRadiologi(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 updateOrderRadiologi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when updateOrderRadiologi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when updateOrderRadiologi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when updateOrderRadiologi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-data-report", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-data-report", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> getDataMapping(
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate, HttpServletRequest request) {
try {
List<Map<String, Object>> result = rIS_ReportService.getReportByTglCreate(startDate, endDate);
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getDataAsuransiPasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getReportByTglCreate", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getDataAsuransiPasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getReportByTglCreate", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}

View File

@ -1,120 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.RefackingService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.RefackingVO;
@RestController
@RequestMapping("/refacking")
@JsonIgnoreProperties(ignoreUnknown = true)
public class RefackingController extends LocaleController<RefackingVO> implements
IBaseRestController<RefackingVO> {
@Autowired
private RefackingService refackingService;
private static final Logger LOGGER = LoggerFactory
.getLogger(RefackingController.class);
@RequestMapping(value = "/save-refacking", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody RefackingVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=refackingService.addRefacking(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-produk", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findBarangMedis(HttpServletRequest request) {
Map<String,Object> result = refackingService.findProdukRefacking();
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<RefackingVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<RefackingVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(RefackingVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(RefackingVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<RefackingVO>> getAllVO() {
return null;
}
}

View File

@ -1,101 +1,88 @@
package com.jasamedika.medifirst2000.controller;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.RegistrasiAset;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.RegistrasiAsetService;
import com.jasamedika.medifirst2000.vo.DistribusiBarangInvestasiVO;
import com.jasamedika.medifirst2000.vo.HistoryAlatVO;
import com.jasamedika.medifirst2000.vo.RegistrasiAsetVO;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Map;
import javax.servlet.http.*;
import javax.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.RegistrasiAsetService;
import com.jasamedika.medifirst2000.service.StrukPelayananService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.DistribusiBarangInvestasiVO;
import com.jasamedika.medifirst2000.vo.HistoryAlatVO;
import com.jasamedika.medifirst2000.vo.PenerimaanBarangVO;
import com.jasamedika.medifirst2000.vo.RegistrasiAsetVO;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController
@RequestMapping("/registrasi-aset")
public class RegistrasiAsetController extends LocaleController<PenerimaanBarangVO> {
public class RegistrasiAsetController extends LocaleController<RegistrasiAsetVO> {
private static final Logger LOGGER = getLogger(RegistrasiAsetController.class);
@Autowired
private StrukPelayananService strukPelayananService;
@Autowired
private RegistrasiAsetService registrasiAsetService;
private RegistrasiAsetService<RegistrasiAset> registrasiAsetService;
private static final Logger LOGGER = LoggerFactory.getLogger(RegistrasiAsetController.class);
@RequestMapping(value = "/save-distribusi-barang/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveDistribusiBarang(@Valid @RequestBody DistribusiBarangInvestasiVO vo,HttpServletRequest request,HttpServletResponse response) {
@RequestMapping(value = "/save-distribusi-barang/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveDistribusiBarang(@Valid @RequestBody DistribusiBarangInvestasiVO vo,
HttpServletRequest request, HttpServletResponse response) {
try {
Map<String, Object> result = registrasiAsetService.saveDistribusiBarang(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Distribusi Barang", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveDistribusiBarang", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Distribusi Barang", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveDistribusiBarang", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-dokumen/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveDokumen(@Valid @RequestBody HistoryAlatVO vo,HttpServletRequest request,HttpServletResponse response) {
@RequestMapping(value = "/save-dokumen/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveDokumen(@Valid @RequestBody HistoryAlatVO vo,
HttpServletRequest request, HttpServletResponse response) {
try {
Map<String, Object> result = registrasiAsetService.saveDokumen(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save History Alat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveDokumen", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save History Alat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveDokumen", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/grid-registrasi-aset")
@ResponseBody
public Map<String,Object> gridListAset(
public Map<String, Object> gridListAset(
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "take", required = false, defaultValue = "10") Integer limit,
@RequestParam(value = "sort", required = false, defaultValue = "tglRegisterAset") String sort,
@ -103,88 +90,52 @@ public class RegistrasiAsetController extends LocaleController<PenerimaanBarangV
@RequestParam(value = "periodeAwal", required = false) String periodeAwal,
@RequestParam(value = "periodeAhir", required = false) String periodeAhir,
@RequestParam(value = "ruanganId", required = false) Integer ruanganId) {
Map<String, Object> resultPageMap = registrasiAsetService.gridListAset(page, limit, sort, dir, periodeAwal,periodeAhir,ruanganId);
return resultPageMap;
return registrasiAsetService.gridListAset(page, limit, sort, dir, periodeAwal, periodeAhir, ruanganId);
}
@RequestMapping(value = "/get-detail-aset", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> detailAset(
@RequestParam(value = "noRec", required = true) String noRec) {
Map<String, Object> kartuPengendliDetailList = registrasiAsetService.detailAset(noRec);
return kartuPengendliDetailList;
@RequestMapping(value = "/get-detail-aset", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> detailAset(@RequestParam(value = "noRec") String noRec) {
return registrasiAsetService.detailAset(noRec);
}
@RequestMapping(value = "/update-aset/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateAset(@Valid @RequestBody RegistrasiAsetVO vo,HttpServletRequest request,HttpServletResponse response) {
@RequestMapping(value = "/update-aset/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateAset(@Valid @RequestBody RegistrasiAsetVO vo,
HttpServletRequest request, HttpServletResponse response) {
try {
Map<String, Object> result = registrasiAsetService.updateAset(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Distribusi Barang", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when updateAset", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Distribusi Barang", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when updateAset", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/download", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> download(@RequestParam(value = "noRec", required = true) Integer noRec,HttpServletResponse response) throws IOException {
@RequestMapping(value = "/download", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> download(@RequestParam(value = "noRec") Integer noRec, HttpServletResponse response)
throws IOException {
Map<String, Object> detailAset = registrasiAsetService.getFormatDownload(noRec);
String fileName = (String) detailAset.get("namaFile");
String format = (String) detailAset.get("format");
String fileType = "application/"+format;
// Find this file id in database to get file name, and file type
// You must tell the browser the file type you are going to send
// for example application/pdf, text/plain, text/html, image/jpg
String fileType = "application/" + format;
response.setContentType(fileType);
// Make sure to show the download dialog
response.setHeader("Content-disposition", "attachment; filename="+fileName);
// Assume file name is retrieved from database
// For example D:\\file\\test.pdf
response.setHeader("Content-disposition", "attachment; filename=" + fileName);
File my_file = new File(fileName);
// This should send the file to browser
OutputStream out = response.getOutputStream();
FileInputStream in = new FileInputStream(my_file);
byte[] buffer = new byte[4096];
int length;
while ((length = in.read(buffer)) > 0) {
while ((length = in.read(buffer)) > 0)
out.write(buffer, 0, length);
}
in.close();
out.flush();
return null;
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/daftar-dokumen")
@ResponseBody
public Map<String,Object> gridListAset(@RequestParam(value = "noRec", required = true) String noRec,@RequestParam(value = "kategori", required = true) String kategori) {
Map<String, Object> resultPageMap = registrasiAsetService.daftarDokumen(noRec,kategori);
return resultPageMap;
}
}

View File

@ -1,110 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.RegistrasiMasukRuanganService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.RegistrasiMasukRuanganVO;
/**
* Controller class for Registrasi Pasien Business
*
* @author Askur
*/
@RestController
@RequestMapping("/registrasi-masuk-ruangan")
@JsonIgnoreProperties(ignoreUnknown = true)
public class RegistrasiMasukRuanganController extends LocaleController<RegistrasiMasukRuanganVO> implements
IBaseRestController<RegistrasiMasukRuanganVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(RegistrasiMasukRuanganController.class);
@Autowired
private RegistrasiMasukRuanganService registrasiMasukRuanganService;
@RequestMapping(value = "/list-antrian-pasien-diperiksa", method = RequestMethod.GET)
public ResponseEntity<List<RegistrasiMasukRuanganVO>> listPasienDaftar() {
List<RegistrasiMasukRuanganVO> listPasienDaftarVO = registrasiMasukRuanganService.getListAntrianPasienDiPeriksa();
addHeaderMessage(Constants.MessageInfo.INFO_MESSAGE, "DATA BERHASIL DISIMPAN");
return RestUtil.getJsonResponse(listPasienDaftarVO, HttpStatus.OK, mapHeaderMessage);
}
@RequestMapping(value = "/save-registrasi-masuk-ruangan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RegistrasiMasukRuanganVO> savePasien(@Valid @RequestBody RegistrasiMasukRuanganVO vo) {
try {
RegistrasiMasukRuanganVO result = registrasiMasukRuanganService.add(vo);
if (null != result)
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, "");
RestUtil.getJsonHttpStatus(HttpStatus.CREATED);
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);
}
}
@Override
public ResponseEntity<RegistrasiMasukRuanganVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(RegistrasiMasukRuanganVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(RegistrasiMasukRuanganVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<RegistrasiMasukRuanganVO>> getAllVO() {
return null;
}
@Override
public ResponseEntity<Collection<RegistrasiMasukRuanganVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
}

View File

@ -1,134 +1,105 @@
package com.jasamedika.medifirst2000.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import 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.entities.HasilTriase;
import com.jasamedika.medifirst2000.entities.PasienDaftar;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.DataAsuransiService;
import com.jasamedika.medifirst2000.service.HasilTriaseService;
import com.jasamedika.medifirst2000.service.RegistrasiPasienRawatInapService;
import com.jasamedika.medifirst2000.service.RegistrasiPasienService;
import com.jasamedika.medifirst2000.service.RegistrasiPelayananService;
import com.jasamedika.medifirst2000.service.ReportingPelayananRekamMedisService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.DataAsuransiVO;
import com.jasamedika.medifirst2000.vo.PasienDaftarVO;
import com.jasamedika.medifirst2000.vo.PasienVO;
import com.jasamedika.medifirst2000.vo.RegistrasiPasienPenunjangVO;
import com.jasamedika.medifirst2000.vo.RegistrasiPasienVO;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController
@RequestMapping("/registrasi-pasien")
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonIgnoreProperties(ignoreUnknown = true)
public class RegistrasiPasienController extends LocaleController<RegistrasiPasienVO> {
private static final Logger LOGGER = getLogger(RegistrasiPasienController.class);
@Autowired
private RegistrasiPasienService registrasiPasienService;
@Autowired
private ReportingPelayananRekamMedisService reportingPelayananRekamMedisService;
@Autowired
private RegistrasiPelayananService registrasiPelayananService;
private RegistrasiPelayananService<PasienDaftar> registrasiPelayananService;
@Autowired
private HasilTriaseService hasilTriaseService;
private static final Logger LOGGER = LoggerFactory
.getLogger(RegistrasiPasienController.class);
@RequestMapping(value = "/save-registrasi-pasien", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveRegistrasiPasien(@Valid @RequestBody RegistrasiPasienVO vo,HttpServletRequest request) {
try {
if(vo.getPasien().getNamaDepan()!=null)
vo.getPasien().setNamaPasien(vo.getPasien().getNamaDepan()+" "+vo.getPasien().getNamaBelakang());
Map<String,Object> result=registrasiPasienService.saveRegistrasiPasien(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 Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-registrasi-pasien-penunjang", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveRegistrasiPasienPenunjang(@Valid @RequestBody RegistrasiPasienPenunjangVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = registrasiPelayananService.savePasienDaftarPenunjang(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 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);
}
}
@Autowired
private DataAsuransiService dataAsuransiService;
@RequestMapping(value = "/save-data-asuransi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> saveDataAsuransi(@Valid @RequestBody DataAsuransiVO vo,HttpServletRequest request) {
try {
Map<String,Object> result=dataAsuransiService.saveDataAsuransi(vo);
private RegistrasiPasienRawatInapService registrasiPasienInapJalanService;
@RequestMapping(value = "/save-registrasi-pasien", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveRegistrasiPasien(@Valid @RequestBody RegistrasiPasienVO vo,
HttpServletRequest request) {
try {
if (vo.getPasien().getNamaDepan() != null)
vo.getPasien().setNamaPasien(vo.getPasien().getNamaDepan() + " " + vo.getPasien().getNamaBelakang());
Map<String, Object> result = registrasiPasienService.saveRegistrasiPasien(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveRegistrasiPasien", 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 saveRegistrasiPasien", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-registrasi-pasien-penunjang", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveRegistrasiPasienPenunjang(
@Valid @RequestBody RegistrasiPasienPenunjangVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = registrasiPelayananService.savePasienDaftarPenunjang(vo);
if (null != result)
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when savePasienDaftarPenunjang", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when savePasienDaftarPenunjang", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/antrian-pasien-gawat-darurat/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/antrian-pasien-gawat-darurat/", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getAllNewVOWithQueryString(
@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
@RequestParam(value = "limit", required = false, defaultValue = "10") Integer limit,
@ -138,127 +109,82 @@ public class RegistrasiPasienController extends LocaleController<RegistrasiPasie
@RequestParam(value = "dateStart", required = false) String dateStart,
@RequestParam(value = "dateEnd", required = false) String dateEnd,
@RequestParam(value = "namaPasien", required = false) String namaPasien) {
Map<String, Object> resultPageMap = hasilTriaseService.findHasilTriase(page, limit, sort, dir, dateStart, dateEnd);
List<HasilTriase> data=(List<HasilTriase>) resultPageMap.get("hasilTriase");
Map<String,Object>result=new HashMap<String,Object>();
Map<String, Object> resultPageMap = hasilTriaseService.findHasilTriase(page, limit, sort, dir, dateStart,
dateEnd);
List<HasilTriase> data = (List<HasilTriase>) resultPageMap.get("hasilTriase");
Map<String, Object> result = new HashMap<>();
result.put("data", data);
return result;
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/get-one-antrian-pasien-gawat-darurat/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-one-antrian-pasien-gawat-darurat/", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getOneVOWithQueryString(@RequestParam(value = "noRec", required = false) String noRec) {
Map<String, Object> resultPageMap = hasilTriaseService.findHasilTriase(noRec);
List<HasilTriase> data=(List<HasilTriase>) resultPageMap.get("hasilTriase");
Map<String,Object>result=new HashMap<String,Object>();
List<HasilTriase> data = (List<HasilTriase>) resultPageMap.get("hasilTriase");
Map<String, Object> result = new HashMap<>();
result.put("data", data);
return result;
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@Autowired
private RegistrasiPasienRawatInapService registrasiPasienInapJalanService;
@RequestMapping(value = "/save-registrasi-pasien-bayi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> registrasiPasien(@Valid @RequestBody PasienVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = registrasiPasienInapJalanService.registrasiPasien(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-registrasi-pasien-bayi", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> registrasiPasien(@Valid @RequestBody PasienVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = registrasiPasienInapJalanService.registrasiPasien(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 saveRegistrasiPasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when registrasiPasien", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveRegistrasiPasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when registrasiPasien", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-pasien-daftar-bayi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePasienDaftar(@Valid @RequestBody PasienDaftarVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = registrasiPasienInapJalanService.registrasiRekamMedisPasien(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 savePasienDaftar", 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 savePasienDaftar", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-pasien-by-nocm", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPasienByNocm(
@RequestParam(value = "noCm", required = true) String noCm, HttpServletRequest request) {
@RequestMapping(value = "/get-pasien-by-nocm", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPasienByNocm(@RequestParam(value = "noCm") String noCm,
HttpServletRequest request) {
try {
Map<String, Object> result = registrasiPelayananService.getDataPasien(noCm);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getPasienByNocm", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getDataPasien", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getPasienByNocm", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getDataPasien", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-pasien-daftar", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updatePasienDaftar(@Valid @RequestBody PasienVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = registrasiPelayananService.updatePasienDaftar(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
@RequestMapping(value = "/update-pasien-daftar", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updatePasienDaftar(@Valid @RequestBody PasienVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = registrasiPelayananService.updatePasienDaftar(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 updatePasienDaftar", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when updatePasienDaftar", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when updatePasienDaftar", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-umur", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> getUmur(
@RequestParam("tglLahir") String tglLahir,HttpServletRequest request){
try {
String result = reportingPelayananRekamMedisService.getUmur(tglLahir);
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 getUmur ", 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 getUmur", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when updatePasienDaftar", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,33 +1,31 @@
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.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.dao.HasilTriaseDao;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.RegistrasiPasienGawatDaruratService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.RegistrasiPasienGawatDaruratVO;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
/**
* Controller class for Registrasi Pasien Business
@ -36,77 +34,63 @@ import com.jasamedika.medifirst2000.vo.RegistrasiPasienGawatDaruratVO;
*/
@RestController
@RequestMapping("/registrasi-pasien-gawat-darurat")
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonIgnoreProperties(ignoreUnknown = true)
public class RegistrasiPasienGawatDaruratController extends LocaleController<RegistrasiPasienGawatDaruratVO> {
private static final Logger LOGGER = getLogger(RegistrasiPasienGawatDaruratController.class);
@Autowired
private RegistrasiPasienGawatDaruratService registrasiPasienGawatDarurat;
@Autowired
private HasilTriaseDao hasilTriaseDao;
private static final Logger LOGGER = LoggerFactory
.getLogger(RegistrasiPasienGawatDaruratController.class);
@RequestMapping(value = "/save-registrasi-pasien-gawat-darurat", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePasienFromRegistrasiPasienGawatDarurat(@Valid @RequestBody RegistrasiPasienGawatDaruratVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-registrasi-pasien-gawat-darurat", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePasienFromRegistrasiPasienGawatDarurat(
@Valid @RequestBody RegistrasiPasienGawatDaruratVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=registrasiPasienGawatDarurat.savePasienFromRegistrasiPasienGawatDarurat(vo);
Map<String, Object> result = registrasiPasienGawatDarurat.savePasienFromRegistrasiPasienGawatDarurat(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePasienFromRegistrasiPasienGawatDarurat", 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 savePasienFromRegistrasiPasienGawatDarurat", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-registrasi-pasien", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePasienFromRegistrasi(@Valid @RequestBody RegistrasiPasienGawatDaruratVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-registrasi-pasien", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePasienFromRegistrasi(
@Valid @RequestBody RegistrasiPasienGawatDaruratVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=registrasiPasienGawatDarurat.savePasien(vo);
Map<String, Object> result = registrasiPasienGawatDarurat.savePasien(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePasien", 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 savePasien", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/get-hasil-triage/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-hasil-triage/", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getAllNewVOWithQueryString(
@RequestParam(value = "noRec", required = false, defaultValue = "noRec") String noRec)
{
Map<String, Object> result=null;
try {
result = hasilTriaseDao.findOne(noRec).ToMap();
} catch (IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
}
return result;
@RequestParam(value = "noRec", required = false, defaultValue = "noRec") String noRec) {
try {
return hasilTriaseDao.findOne(noRec).ToMap();
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new ServiceVOException(e.getMessage());
}
}
}

View File

@ -1,35 +1,35 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.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.AntrianPasienRegistrasi;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.RegistrasiPasienOnlineService;
import com.jasamedika.medifirst2000.util.CommonUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.AntrianPasienRegistrasiVO;
import com.jasamedika.medifirst2000.vo.GridAntrianPasienDiPeriksaVO;
import com.jasamedika.medifirst2000.vo.PasienVO;
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.Collection;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
/**
* Controller class for Registrasi Pasien Business
@ -38,120 +38,97 @@ import com.jasamedika.medifirst2000.vo.GridAntrianPasienDiPeriksaVO;
*/
@RestController
@RequestMapping("/registrasi-pasien-online")
@JsonIgnoreProperties(ignoreUnknown = true)
public class RegistrasiPasienOnlineController extends LocaleController<AntrianPasienRegistrasiVO> implements IBaseRestController<AntrianPasienRegistrasiVO> {
@JsonIgnoreProperties(ignoreUnknown = true)
public class RegistrasiPasienOnlineController extends LocaleController<AntrianPasienRegistrasiVO> {
private static final Logger LOGGER = getLogger(RegistrasiPasienOnlineController.class);
@Autowired
private RegistrasiPasienOnlineService registrasiPasienOnlineService;
private static final Logger LOGGER = LoggerFactory
.getLogger(RegistrasiPasienOnlineController.class);
@RequestMapping(value = "/get-pasien", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> getPasien(@RequestParam(value = "id", required = false)String id) {
private RegistrasiPasienOnlineService<AntrianPasienRegistrasi> registrasiPasienOnlineService;
@RequestMapping(value = "/get-pasien", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPasien(@RequestParam(value = "id", required = false) String id) {
try {
Map<String,Object> result=registrasiPasienOnlineService.getPasienByNoRec(id);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
Map<String, Object> result = registrasiPasienOnlineService.getPasienByNoRec(id);
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 getPasienByNoRec", 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 getPasienByNoRec", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-registrasi-pasien-online", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveRegistrasiPasienOnline(
//@Valid @RequestBody AntrianPasienRegistrasiVO vo,
HttpServletRequest request) {
try {
//add by askur 04102016
//if(vo.getPasien().getNamaDepan()!=null)
// vo.getPasien().setNamaPasien(vo.getPasien().getNamaDepan());
//
AntrianPasienRegistrasiVO vo = (AntrianPasienRegistrasiVO) this.getItem2(request, new AntrianPasienRegistrasiVO());
Map<String,Object> result=registrasiPasienOnlineService.saveRegistrasiPasienOnline(vo);
if (null != result)
{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
BroadcastMessage("DaftarAntrianPerjanjian",result.get("noReservasi").toString());
}
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);
}
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/confirm-registrasi-online/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> confirmRegistrasiPelayananPasien(@RequestParam(value = "noReservasi", required = false) String noReservasi,HttpServletRequest request) {
@RequestMapping(value = "/save-registrasi-pasien-online", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveRegistrasiPasienOnline(HttpServletRequest request) {
try {
Map<String, Object> resultPageMap = registrasiPasienOnlineService.confirmRegistrasiPasienOnline(noReservasi);
if(CommonUtil.isNotNullOrEmpty(resultPageMap))
{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
BroadcastMessage("DaftarAntrian","");
AntrianPasienRegistrasiVO vo = (AntrianPasienRegistrasiVO) this.getItem2(request,
new AntrianPasienRegistrasiVO());
Map<String, Object> result = registrasiPasienOnlineService.saveRegistrasiPasienOnline(vo);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
BroadcastMessage("DaftarAntrianPerjanjian", result.get("noReservasi").toString());
}
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK,mapHeaderMessage);
return getJsonResponse(result, CREATED, 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);
LOGGER.error("Got ServiceVOException {} when saveRegistrasiPasienOnline", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(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);
LOGGER.error("Got JpaSystemException {} when saveRegistrasiPasienOnline", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/confirm-pendaftaran/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> confirmPendaftaran(@RequestParam(value = "noReservasi", required = false) String noReservasi,HttpServletRequest request) {
@RequestMapping(value = "/confirm-registrasi-online/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> confirmRegistrasiPelayananPasien(
@RequestParam(value = "noReservasi", required = false) String noReservasi, HttpServletRequest request) {
try {
Map<String, Object> resultPageMap = registrasiPasienOnlineService
.confirmRegistrasiPasienOnline(noReservasi);
if (CommonUtil.isNotNullOrEmpty(resultPageMap)) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
BroadcastMessage("DaftarAntrian", "");
}
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when confirmRegistrasiPasienOnline", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when confirmRegistrasiPasienOnline", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/confirm-pendaftaran/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> confirmPendaftaran(
@RequestParam(value = "noReservasi", required = false) String noReservasi, HttpServletRequest request) {
try {
Map<String, Object> resultPageMap = registrasiPasienOnlineService.confirmPendaftaran(noReservasi);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
BroadcastMessage("DaftarAntrian","");
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK,mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
BroadcastMessage("DaftarAntrian", "");
return getJsonResponse(resultPageMap, 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);
LOGGER.error("Got ServiceVOException {} when confirmPendaftaran", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(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);
LOGGER.error("Got JpaSystemException {} when confirmPendaftaran", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/antrian-pasien-list/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Collection<GridAntrianPasienDiPeriksaVO>> getAllVOWithQueryString(
@RequestParam(value = "page", required = false,defaultValue = "1") Integer page,
@RequestParam(value = "limit", required = false,defaultValue = "10") Integer limit,
@RequestMapping(value = "/antrian-pasien-list/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Collection<PasienVO>> getAllVOWithQueryString(
@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
@RequestParam(value = "limit", required = false, defaultValue = "10") Integer limit,
@RequestParam(value = "sort", required = false, defaultValue = "noRec") String sort,
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
@RequestParam(value = "ruanganId", required = false) Integer ruanganId,
@ -159,73 +136,9 @@ public class RegistrasiPasienOnlineController extends LocaleController<AntrianPa
@RequestParam(value = "dateEnd", required = false) String dateEnd,
@RequestParam(value = "noReservasi", required = false) String noReservasi,
@RequestParam(value = "namaPasien", required = false) String namaPasien) {
Map<String, Object> resultPageMap = registrasiPasienOnlineService.findAllAntrianPaging(page, limit, sort, dir,ruanganId,dateStart,dateEnd,namaPasien,noReservasi);
Map<String, Object> resultPageMap = registrasiPasienOnlineService.findAllAntrianPaging(page, limit, sort, dir,
ruanganId, dateStart, dateEnd, namaPasien, noReservasi);
return constructListPageResult(resultPageMap);
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/proses-antrian-ke-pasien/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> prosesAntrianToPasien(@RequestParam(value = "noReservasi", required = false) String noReservasi,HttpServletRequest request) {
try {
Map<String, Object> resultPageMap = registrasiPasienOnlineService.savePasienAndPasienDaftar(noReservasi);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(resultPageMap, 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<Collection<AntrianPasienRegistrasiVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<AntrianPasienRegistrasiVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(AntrianPasienRegistrasiVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(AntrianPasienRegistrasiVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<AntrianPasienRegistrasiVO>> getAllVO() {
return null;
}
}

View File

@ -1,256 +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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.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.RegistrasiSmsService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.AntrianPasienRegistrasiVO;
import com.jasamedika.medifirst2000.vo.RegistrasiSmsVO;
/**
* Controller class for Registrasi Pasien Business
*
* @author adik
*/
@RestController
@RequestMapping("/registrasi-pasien-sms")
@JsonIgnoreProperties(ignoreUnknown = true)
public class RegistrasiPasienSmsController extends LocaleController<AntrianPasienRegistrasiVO>
implements IBaseRestController<AntrianPasienRegistrasiVO> {
@Autowired
private RegistrasiSmsService registrasiSmsService;
private static final Logger LOGGER = LoggerFactory.getLogger(RegistrasiPasienSmsController.class);
@RequestMapping(value = "/save-registrasi-sms/", method = RequestMethod.POST)
public ResponseEntity<Map<String, Object>> saveRegistrasiSms(
@RequestParam(value = "noCm", required = true) String noCm,
@RequestParam(value = "kodeRuangan", required = true) String kodeRuangan,
@RequestParam(value = "kodeDokter", required = true) short kodeDokter,
@RequestParam(value = "kodeRegulerEkslusif", required = true) Integer kodeRegulerEkslusif,
@RequestParam(value = "tanggal", required = true) String tanggal, HttpServletRequest request) {
try {
RegistrasiSmsVO vo = new RegistrasiSmsVO();
vo.setNoCm(noCm);
vo.setKodeRuangan(kodeRuangan);
vo.setKodeDokter(kodeDokter);
vo.setKodeRegulerEkslusif(kodeRegulerEkslusif);
vo.setTanggal(DateUtil.toDate(tanggal));
Map<String, Object> result = registrasiSmsService.saveRegistrasiPasienSms(vo);
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.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 = "/sms_gateway_kemenkes/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveRegistrasiSms(
@RequestParam(value = "msisdn", required = true) String msisdns,
@RequestParam(value = "trx_id", required = true) String trx_id,
@RequestParam(value = "sms", required = true) String sms, HttpServletRequest request) {
String[] rs = sms.split("_");
// rs[0] --> "WALL+RS"
// rs[1] --> "DAFTAR"
// rs[2] --> kode rs
// rs[3] --> kode poli
// rs[4] --> kode dokter
// rs[5] --> kode cara bayar
// rs[6] --> kode no rm
// rs[7] --> kode tgl lahir
// rs[8] --> kode tgl daftar
try {
RegistrasiSmsVO vo = new RegistrasiSmsVO();
vo.setNoCm(rs[6]);
vo.setKodeRuangan(rs[3]);
String tgllahir = rs[7];
String tgldaftar = rs[8];
String kdDokter = rs[4];
Map<String, Object> result = registrasiSmsService.saveRegistrasiPasienSmsKemenkes(vo, tgllahir, tgldaftar,
kdDokter);
Integer stats = new Integer((Integer) result.get("status"));
if (stats > 0) {
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.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 = "/get-ruangan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> zzgetRuangan(HttpServletRequest request) {
try {
Map<String, Object> result = registrasiSmsService.findAllRuangan();
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.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 = "/get-dokter/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getDokter(
@RequestParam(value = "kodeRuangan", required = true) Integer kodeRuangan,
@RequestParam(value = "tanggal", required = true) String tanggal, HttpServletRequest request) {
try {
Map<String, Object> result = registrasiSmsService.findAllDokter(kodeRuangan, DateUtil.toDate(tanggal));
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.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 = "/get-all-dokter", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getDokterRuangan(HttpServletRequest request) {
try {
Map<String, Object> result = registrasiSmsService.findAllDokter();
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.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@Override
public ResponseEntity<Collection<AntrianPasienRegistrasiVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<AntrianPasienRegistrasiVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(AntrianPasienRegistrasiVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(AntrianPasienRegistrasiVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<AntrianPasienRegistrasiVO>> getAllVO() {
return null;
}
}

View File

@ -6,16 +6,13 @@ import com.jasamedika.medifirst2000.converter.BaseConverterImpl;
import com.jasamedika.medifirst2000.converter.KelompokPasienConverter;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.dao.*;
import com.jasamedika.medifirst2000.dto.Antrian;
import com.jasamedika.medifirst2000.dto.HasilLaboratoriumDto;
import com.jasamedika.medifirst2000.dto.OrderPelayananGiziDto;
import com.jasamedika.medifirst2000.dto.*;
import com.jasamedika.medifirst2000.entities.*;
import com.jasamedika.medifirst2000.enums.TipePasienEnum;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.*;
import com.jasamedika.medifirst2000.vo.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
@ -24,7 +21,6 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.net.URLDecoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@ -37,6 +33,7 @@ import static com.jasamedika.medifirst2000.util.DateUtil.toDate;
import static com.jasamedika.medifirst2000.util.JsonUtil.ToMaps;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
@ -50,7 +47,7 @@ import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RequestMapping("/registrasi-pelayanan")
public class RegistrasiPelayananController extends LocaleController<RegistrasiPelayananVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(RegistrasiPelayananController.class);
private static final Logger LOGGER = getLogger(RegistrasiPelayananController.class);
@Autowired
private KendaliDokumenRekamMedisService kendaliDokumenRekamMedisService;
@ -922,32 +919,6 @@ public class RegistrasiPelayananController extends LocaleController<RegistrasiPe
}
}
@RequestMapping(value = "/get-all-ruangan-penunjang", method = GET)
public ResponseEntity<List<RuanganVO>> getAllRuanganPenunjang(HttpServletRequest request) {
try {
List<RuanganVO> listRuanganVO = ruanganService
.findRuanganByDepartemenSettingDataFixed("KdDepartemenInstalasiLaboratorium");
List<RuanganVO> listRuanganTemp = new ArrayList<>(listRuanganVO);
listRuanganVO = ruanganService.findRuanganByDepartemenSettingDataFixed("KdDepartemenInstalasiRadiologi");
listRuanganTemp.addAll(listRuanganVO);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(listRuanganTemp, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error(
"Got ServiceVOException {} when findRuanganByDepartemenSettingDataFixed[KdDepartemenInstalasiLaboratorium,KdDepartemenInstalasiRadiologi]",
e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error(
"Got JpaSystemException {} when findRuanganByDepartemenSettingDataFixed[KdDepartemenInstalasiLaboratorium,KdDepartemenInstalasiRadiologi]",
jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/antrian-pasien-list-radiologi/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Collection<PasienVO>> getAllRadiologiVOWithQueryString(
@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
@ -1127,42 +1098,6 @@ public class RegistrasiPelayananController extends LocaleController<RegistrasiPe
return getJsonResponse(resultPageMap);
}
@RequestMapping(value = "/search-get-all-ruangan", method = GET)
public ResponseEntity<List<RuanganVO>> getSearchAllRuangan(
@RequestParam(value = "namaRuangan", required = false) String namaRuangan, HttpServletRequest request) {
try {
List<RuanganVO> listRuanganVO = ruanganService.findRuanganByDepartemenByName(namaRuangan);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(listRuanganVO, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when findRuanganByDepartemenByName", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when findRuanganByDepartemenByName", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/search-get-all-ruangan-rehab-medik", method = GET)
public ResponseEntity<List<RuanganVO>> getSearchAllRuanganRehabMedik(
@RequestParam(value = "namaRuangan", required = false) String namaRuangan, HttpServletRequest request) {
try {
List<RuanganVO> listRuanganVO = ruanganService.findRuanganRehamMedik();
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(listRuanganVO, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when findRuanganRehamMedik", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when findRuanganRehamMedik", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping("/kartuPasien")
public ModelAndView generateKartuPasien(ModelAndView m,
@RequestParam(value = "format", required = false) String format, @RequestParam(value = "id") Integer id) {
@ -1208,7 +1143,7 @@ public class RegistrasiPelayananController extends LocaleController<RegistrasiPe
public ModelAndView generateSlipAntrian(ModelAndView m,
@RequestParam(value = "format", required = false) String format,
@RequestParam(value = "noRec") String noRec) {
List list = registrasiPelayananPasienService.findAntrian(noRec);
List<AntrianPasien> list = registrasiPelayananPasienService.findAntrian(noRec);
m.addObject("dataSource", list);
m.addObject("tanggalReport", new Date());
m.addObject("title", "Slip Antrian");
@ -1222,7 +1157,7 @@ public class RegistrasiPelayananController extends LocaleController<RegistrasiPe
public ModelAndView generateEtiketPersetujuanUmum(ModelAndView m,
@RequestParam(value = "format", required = false) String format, @RequestParam(value = "noCm") String noCm,
@RequestParam(value = "tglRegistrasi") String tglRegistrasi) {
List list = persetujuanUmumService.findEtiket(noCm, tglRegistrasi);
List<EtiketPersetujuanUmum> list = persetujuanUmumService.findEtiket(noCm, tglRegistrasi);
m.addObject("dataSource", list);
m.addObject("tanggalReport", new Date());
m.addObject("title", "Etiket");
@ -1236,8 +1171,7 @@ public class RegistrasiPelayananController extends LocaleController<RegistrasiPe
public ModelAndView generateAntrianPasienDiperiksa(ModelAndView m,
@RequestParam(value = "format", required = false) String format,
@RequestParam(value = "noRec") String noRec) {
List list = antrianPasienDiperiksaService.findAntrian(noRec);
List<AntrianPasienDiperiksaDto> list = antrianPasienDiperiksaService.findAntrian(noRec);
m.addObject("dataSource", list);
m.addObject("tanggalReport", new Date());
m.addObject("title", "Antrian Pasien Diperiksa");
@ -1247,8 +1181,6 @@ public class RegistrasiPelayananController extends LocaleController<RegistrasiPe
return m;
}
// ---------------------------------add by
// Pratama-----------------------------//
@RequestMapping(value = "/report-detail-laboratorium/", method = GET, produces = APPLICATION_JSON_VALUE)
public ModelAndView reportOrderDetailLaboratorium(ModelAndView m,
@RequestParam(value = "noOrder", required = false) String noOrder,
@ -1291,7 +1223,6 @@ public class RegistrasiPelayananController extends LocaleController<RegistrasiPe
return m;
}
// add by askur 03112016
@RequestMapping(value = "/get-kelompok-pasien", method = GET)
public ResponseEntity<List<KelompokPasienVO>> getKelompokPasien(HttpServletRequest request) {
try {
@ -1310,7 +1241,6 @@ public class RegistrasiPelayananController extends LocaleController<RegistrasiPe
}
}
// add by askur 16122016
@RequestMapping(value = "/antrian-pasien-pulang-list/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Collection<PasienVO>> getAllAntrianPasienPulangList(
@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
@ -1588,28 +1518,6 @@ public class RegistrasiPelayananController extends LocaleController<RegistrasiPe
}
}
@RequestMapping(value = "/get-order-pelayanan-gizi/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getOrderPelayananGizi(
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate,
@RequestParam(value = "ruanganId", required = false) Integer ruanganId, HttpServletRequest request) {
try {
Map<String, Object> result = orderProdukService.getOrderPelayananGizi();
if (null != result)
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
SaveLog("Order Farmasi", "Permintaan", request);
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getOrderPelayananGizi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getOrderPelayananGizi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-order-pelayanan-gizi-minuman/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getOrderPelayananGiziMinuman(
@RequestParam(value = "startDate", required = false) String startDate,
@ -2279,22 +2187,9 @@ public class RegistrasiPelayananController extends LocaleController<RegistrasiPe
}
}
@SuppressWarnings("deprecation")
@RequestMapping(value = "/find-obat", method = GET)
public ResponseEntity<List<DiagnosaVO>> findObatProduk(
@RequestParam(value = "kodeDiagnosa", required = false) String kodeDiagnosa, HttpServletRequest request) {
String data = request.getQueryString();
data = URLDecoder.decode(data);
StringBuilder criteria = new StringBuilder();
StringBuilder values = new StringBuilder();
String[] arrQueries = data.split("&");
for (String query : arrQueries) {
if (query.contains("filter[filters][0][filter][field]")) {
criteria.append(query.replace("filter[filters][0][filter][field]=", ""));
} else if (query.contains("filter[filters][0][value]")) {
values.append(query.replace("filter[filters][0][value]=", ""));
}
}
List<DiagnosaVO> resultPageMap = registrasiPelayananService.findDiagnosaByKode(kodeDiagnosa);
return getJsonResponse(resultPageMap, OK);
}
@ -2422,29 +2317,4 @@ public class RegistrasiPelayananController extends LocaleController<RegistrasiPe
}
}
@RequestMapping(value = "/save-akomodasi", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveAkomodasi(
@RequestParam(value = "noRecPasienDaftar", required = false) String noRecPasienDaftar,
HttpServletRequest request) {
try {
Map<String, Object> result = registrasiPelayananService.trigerringSaveAkomodasi(noRecPasienDaftar);
if (isNotNullOrEmpty(result.get("norec"))) {
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", result.get("statusPasien").toString());
return getJsonResponse(result, CREATED, headerMessageCustom);
}
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when trigerringSaveAkomodasi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when trigerringSaveAkomodasi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,133 +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.RegistrasiPelayananPasienService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PemeriksaanSelanjutnyaVO;
import com.jasamedika.medifirst2000.vo.RegPelayananPasienVO;
/**
* Controller class for Registrasi Pasien Business
*
* @author Askur
*/
@RestController
@RequestMapping("/registrasi-pelayanan-pasien")
public class RegistrasiPelayananPasienController extends LocaleController<PemeriksaanSelanjutnyaVO> implements IBaseRestController<PemeriksaanSelanjutnyaVO> {
@Autowired
private RegistrasiPelayananPasienService registrasiPelayananPasienService;
private static final Logger LOGGER = LoggerFactory.getLogger(RegistrasiPelayananPasienController.class);
@RequestMapping(value = "/save-pemeriksaan-selanjutnya", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> saveRegistrasiPelayananPasien(@Valid @RequestBody RegPelayananPasienVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = registrasiPelayananPasienService.createRegistrasiPelayananPasien(vo.getNoRegistrasi(), null);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when 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 = "/update-pemeriksaan-selanjutnya", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> updateRegistrasiPelayananPasien(@Valid @RequestBody PemeriksaanSelanjutnyaVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = registrasiPelayananPasienService.updateRegistrasiPelayananPasien(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 Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@Override
public ResponseEntity<PemeriksaanSelanjutnyaVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(PemeriksaanSelanjutnyaVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(PemeriksaanSelanjutnyaVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<PemeriksaanSelanjutnyaVO>> getAllVO() {
return null;
}
@Override
public ResponseEntity<Collection<PemeriksaanSelanjutnyaVO>> getAllVOWithQueryString(HttpServletRequest request,Integer page, Integer limit, String sort, String dir) {
return null;
}
}

View File

@ -1,116 +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.RegistrasiPelayananRawatInapService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananRawatInapVO;
/**
* Controller class for Registrasi Pasien Business
*
* @author Askur
*/
@RestController
@RequestMapping("/registrasi-pelayanan-rawat-inap")
public class RegistrasiPelayananRawatInapController extends LocaleController<RegistrasiPelayananRawatInapVO> implements
IBaseRestController<RegistrasiPelayananRawatInapVO> {
@Autowired
private RegistrasiPelayananRawatInapService registrasiPasienService;
private static final Logger LOGGER = LoggerFactory.getLogger(RegistrasiPelayananRawatInapController.class);
@RequestMapping(value = "/save-registrasi-pelayanan-rawat-inap", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> saveRegistrasiPelayananRawatInapRawatInap(@Valid @RequestBody RegistrasiPelayananRawatInapVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = registrasiPasienService.saveRegistrasiPelayananRawatInapRawatInap(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 Registrasi Pelayanan Rawat Inap", 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 Registrasi Pelayanan Rawat Inap", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@Override
public ResponseEntity<RegistrasiPelayananRawatInapVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(RegistrasiPelayananRawatInapVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(RegistrasiPelayananRawatInapVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<RegistrasiPelayananRawatInapVO>> getAllVO() {
return null;
}
@Override
public ResponseEntity<Collection<RegistrasiPelayananRawatInapVO>> getAllVOWithQueryString(
HttpServletRequest request, Integer page, Integer limit, String sort, String dir) {
return null;
}
}

View File

@ -1,179 +1,129 @@
package com.jasamedika.medifirst2000.controller;
import java.text.ParseException;
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.RehabilitasiAsesmenService;
import com.jasamedika.medifirst2000.service.RehabilitasiKlaimFormulirService;
import com.jasamedika.medifirst2000.vo.RehabilitasiAsesmenVO;
import com.jasamedika.medifirst2000.vo.RehabilitasiFormulirKlaimVO;
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.RehabilitasiAsesmenService;
import com.jasamedika.medifirst2000.service.RehabilitasiKlaimFormulirService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.RehabilitasiAsesmenVO;
import com.jasamedika.medifirst2000.vo.RehabilitasiFormulirKlaimVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController
@RequestMapping("/rehabilitasi-asesmen")
public class RehabilitasiAsesmenController extends LocaleController {
private static final Logger LOGGER = LoggerFactory.getLogger(RehabilitasiAsesmenController.class);
public class RehabilitasiAsesmenController extends LocaleController<RehabilitasiAsesmenVO> {
private static final Logger LOGGER = getLogger(RehabilitasiAsesmenController.class);
@Autowired
RehabilitasiAsesmenService rehabilitasiAsesmenService;
@Autowired
RehabilitasiKlaimFormulirService rehabilitasiKlaimFormulirService;
@RequestMapping(value = "/save-rehabilitasi-asesmen", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveRehabilitasiAsesmen(@Valid @RequestBody RehabilitasiAsesmenVO vo,
HttpServletRequest request) throws ParseException {
try {
@RequestMapping(value = "/save-rehabilitasi-asesmen", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveRehabilitasiAsesmen(@Valid @RequestBody RehabilitasiAsesmenVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = rehabilitasiAsesmenService.saveRehabilitasiAsesmen(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
BroadcastMessage("DaftarAntrianLaboratorium", "noRec");
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when saveRehabilitasiAsesmen", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when saveRehabilitasiAsesmen", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, 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 = "/get-rehabilitasi-asesmen", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getRehabilitasiAsesmen(
@RequestParam(value = "norec", required = true) String norec, HttpServletRequest request) {
@RequestMapping(value = "/get-list-rehabilitasi-asesmen", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> getListRehabilitasiAsesmen(
@RequestParam(value = "norec") String norec, HttpServletRequest request) {
try {
Map<String,Object> result = rehabilitasiAsesmenService.getRehabilitasiAsesmen(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);
List<Map<String, Object>> result = rehabilitasiAsesmenService.getListRehabilitasiAsesmen(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 getKalkulasiDataRemunerasi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getListRehabilitasiAsesmen", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getKalkulasiDataRemunerasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getListRehabilitasiAsesmen", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-list-rehabilitasi-asesmen", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getListRehabilitasiAsesmen(
@RequestParam(value = "norec", required = true) String norec, HttpServletRequest request) {
try {
List<Map<String,Object>> result = rehabilitasiAsesmenService.getListRehabilitasiAsesmen(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 getKalkulasiDataRemunerasi", 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 getKalkulasiDataRemunerasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-rehabilitasi-formulir-klaim", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-rehabilitasi-formulir-klaim", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveFormulirKlaim(@Valid @RequestBody RehabilitasiFormulirKlaimVO vo,
HttpServletRequest request) throws ParseException {
HttpServletRequest request) {
try {
Map<String, Object> result = rehabilitasiKlaimFormulirService.saveRehabilitasiKlaimFormulir(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
BroadcastMessage("DaftarAntrianLaboratorium", "noRec");
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when saveRehabilitasiKlaimFormulir", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when saveRehabilitasiKlaimFormulir", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, 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 = "/get-rehabilitasi-formulir-klaim", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getRehabilitasiFormulirKlaim(
@RequestParam(value = "norec", required = true) String norec, HttpServletRequest request) {
@RequestMapping(value = "/get-list-rehabilitasi-formulir-klaim", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> getListRehabilitasiFormulirKlaim(
@RequestParam(value = "norec") String norec, HttpServletRequest request) {
try {
Map<String,Object> result = rehabilitasiKlaimFormulirService.getRehabilitasiKlaimFormulir(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);
List<Map<String, Object>> result = rehabilitasiKlaimFormulirService.getListRehabilitasiKlaimFormulir(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 getKalkulasiDataRemunerasi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getListRehabilitasiKlaimFormulir", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getKalkulasiDataRemunerasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-list-rehabilitasi-formulir-klaim", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getListRehabilitasiFormulirKlaim(
@RequestParam(value = "norec", required = true) String norec, HttpServletRequest request) {
try {
List<Map<String,Object>> result = rehabilitasiKlaimFormulirService.getListRehabilitasiKlaimFormulir(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 getKalkulasiDataRemunerasi", 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 getKalkulasiDataRemunerasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getListRehabilitasiKlaimFormulir", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}

View File

@ -1,94 +1,49 @@
package com.jasamedika.medifirst2000.controller;
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.service.StrukHistoriService;
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.RestController;
import javax.servlet.http.HttpServletRequest;
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.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.CREATED;
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController
@RequestMapping(value="/struk-histori")
@RequestMapping(value = "/struk-histori")
public class RekapGajiPegawaiController extends LocaleController<StrukHistoriVO> {
@Autowired
private StrukHistoriService strukHistoriService;
@RequestMapping(value="/import-gaji-pns", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> importFileGaji(@RequestBody StrukHistoriVO vo, HttpServletRequest request) {
@RequestMapping(value = "/import-gaji-pns", method = POST, consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> importFileGaji(@RequestBody StrukHistoriVO vo,
HttpServletRequest request) {
Map<String, Object> result = strukHistoriService.save(vo);
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);
}
}
@RequestMapping(value="/gaji-pegawai", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> gajiPegawai(@RequestParam("idKategoryPegawai") Integer idKategoryPegawai,
HttpServletRequest request) {
List<Map<String, Object>> result = strukHistoriService.findPegawaiGajiSK(idKategoryPegawai);
if (!result.isEmpty()) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
}
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
}
@RequestMapping(value="/gaji-pegawai", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveGajiPegawai(@RequestBody StrukHistoriVO vo, HttpServletRequest request) {
Map<String, Object> result = strukHistoriService.saveGajiPegawai(vo);
if (result != null) {
if (!result.isEmpty()) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} else {
if (!result.get("StrukHistori.ErrorMessage").toString().isEmpty()) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR, "StrukHistory is not created");
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR, "Processing data error returns empty data");
}
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
}
} else {
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
}
}
@RequestMapping(value="/uang-makan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> hitungUangMakanPegawai(HttpServletRequest request) {
Map<String, Object> result = strukHistoriService.findUangMakan();
if (!result.isEmpty()) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
}
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
}
}