Update controller
Clean code
This commit is contained in:
parent
4c71f90382
commit
758429d815
@ -1,15 +1,15 @@
|
||||
package com.jasamedika.medifirst2000.service;
|
||||
|
||||
import com.jasamedika.medifirst2000.dto.SuratEligibilitasAsuransi;
|
||||
import com.jasamedika.medifirst2000.vo.PemakaianAsuransiVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.jasamedika.medifirst2000.entities.PemakaianAsuransi;
|
||||
import com.jasamedika.medifirst2000.vo.PemakaianAsuransiVO;
|
||||
|
||||
public interface PemakaianAsuransiService {
|
||||
|
||||
Map<String,Object> savePemakaianAsuransi(PemakaianAsuransiVO vo);
|
||||
List findByNoSep(String noSep);
|
||||
|
||||
|
||||
Map<String, Object> savePemakaianAsuransi(PemakaianAsuransiVO vo);
|
||||
|
||||
List<SuratEligibilitasAsuransi> findByNoSep(String noSep);
|
||||
|
||||
}
|
||||
|
||||
@ -1,92 +1,66 @@
|
||||
package com.jasamedika.medifirst2000.service.impl;
|
||||
|
||||
import com.jasamedika.medifirst2000.converter.BaseConverterImpl;
|
||||
import com.jasamedika.medifirst2000.dao.*;
|
||||
import com.jasamedika.medifirst2000.dto.SuratEligibilitasAsuransi;
|
||||
import com.jasamedika.medifirst2000.entities.*;
|
||||
import com.jasamedika.medifirst2000.service.PemakaianAsuransiService;
|
||||
import com.jasamedika.medifirst2000.util.CommonUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DiagnosaVO;
|
||||
import com.jasamedika.medifirst2000.vo.PemakaianAsuransiVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jasamedika.medifirst2000.vo.DataAsuransiVO;
|
||||
import com.jasamedika.medifirst2000.vo.DiagnosaVO;
|
||||
|
||||
import com.jasamedika.medifirst2000.entities.DataAsuransi;
|
||||
import com.jasamedika.medifirst2000.entities.Departemen;
|
||||
import com.jasamedika.medifirst2000.entities.DetailKamar;
|
||||
import com.jasamedika.medifirst2000.entities.Diagnosa;
|
||||
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.PemakaianAsuransiService;
|
||||
import com.jasamedika.medifirst2000.service.RegistrasiPelayananPasienService;
|
||||
import com.jasamedika.medifirst2000.util.CommonUtil;
|
||||
import com.jasamedika.medifirst2000.entities.PemakaianAsuransi;
|
||||
import com.jasamedika.medifirst2000.entities.RegistrasiPelayananPasien;
|
||||
import com.jasamedika.medifirst2000.vo.PemakaianAsuransiVO;
|
||||
import com.jasamedika.medifirst2000.converter.BaseConverterImpl;
|
||||
import com.jasamedika.medifirst2000.dao.AntrianPasienDiPeriksaDao;
|
||||
import com.jasamedika.medifirst2000.dao.DepartemenDao;
|
||||
import com.jasamedika.medifirst2000.dao.DetailKamarDao;
|
||||
import com.jasamedika.medifirst2000.dao.PasienDaftarDao;
|
||||
import com.jasamedika.medifirst2000.dao.PemakaianAsuransiDao;
|
||||
import com.jasamedika.medifirst2000.dao.RegistrasiPelayananPasienDao;
|
||||
import com.jasamedika.medifirst2000.dto.SuratEligibilitasAsuransi;
|
||||
|
||||
/**
|
||||
* Implement class for PemakaianAsuransiService
|
||||
*
|
||||
* @author Generator
|
||||
* @param <T>
|
||||
*/
|
||||
@Service("pemakaianAsuransiService")
|
||||
public class PemakaianAsuransiServiceImpl extends BaseVoServiceImpl implements PemakaianAsuransiService {
|
||||
|
||||
@Autowired
|
||||
private BaseConverterImpl<PemakaianAsuransiVO, PemakaianAsuransi> pemakaianAsuransiConverter;
|
||||
@Autowired
|
||||
private BaseConverterImpl<DataAsuransiVO, DataAsuransi> dataAsuransiConverter;
|
||||
|
||||
@Autowired
|
||||
private BaseConverterImpl<DiagnosaVO, Diagnosa> diagnosaConverter;
|
||||
|
||||
@Autowired
|
||||
private PemakaianAsuransiDao pemakaianAsuransiDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
private DetailKamarDao detailKamarDao;
|
||||
|
||||
@Autowired
|
||||
private DepartemenDao departemenDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
private PasienDaftarDao pasienDaftarDao;
|
||||
@Autowired
|
||||
private com.jasamedika.medifirst2000.dao.DataAsuransiDao dataAsuransiDao;
|
||||
private DataAsuransiDao dataAsuransiDao;
|
||||
|
||||
@Autowired
|
||||
private AntrianPasienDiPeriksaDao antrianPasienDiPeriksaDao;
|
||||
@Autowired
|
||||
private RegistrasiPelayananPasienService registrasiPelayananPasienService;
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> savePemakaianAsuransi(PemakaianAsuransiVO vo) {
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
PemakaianAsuransi model = new PemakaianAsuransi();
|
||||
model = pemakaianAsuransiConverter.transferVOToModel(vo, model);
|
||||
model.setPasienDaftar(antrianPasienDiPeriksaDao.finByNoIdAndTglRegistrasi(Short.parseShort("0"), vo.getPasienDaftar().getPasien().getId(),
|
||||
vo.getPasienDaftar().getTglRegistrasi()).getPasienDaftar());
|
||||
model.setPasienDaftar(antrianPasienDiPeriksaDao.finByNoIdAndTglRegistrasi((short) 0,
|
||||
vo.getPasienDaftar().getPasien().getId(), vo.getPasienDaftar().getTglRegistrasi()).getPasienDaftar());
|
||||
if (CommonUtil.isNotNullOrEmpty(vo.getAsuransi())) {
|
||||
List<DataAsuransi> list=dataAsuransiDao.findByNoKepesertaan(vo.getNoKepesertaan());
|
||||
|
||||
List<DataAsuransi> list = dataAsuransiDao.findByNoKepesertaan(vo.getNoKepesertaan());
|
||||
|
||||
DataAsuransi dataAsuransi = new DataAsuransi();
|
||||
if(list.size()!=0)
|
||||
dataAsuransi=list.get(0);
|
||||
if (!list.isEmpty())
|
||||
dataAsuransi = list.get(0);
|
||||
dataAsuransi.setNoKepesertaan(vo.getNoKepesertaan());
|
||||
dataAsuransi.setPasien(model.getPasienDaftar().getPasien());
|
||||
dataAsuransi = dataAsuransiDao.save(dataAsuransi);
|
||||
//model.setAsuransi(dataAsuransi);
|
||||
dataAsuransiDao.save(dataAsuransi);
|
||||
}
|
||||
if (CommonUtil.isNotNullOrEmpty(vo.getDiagnosis())) {
|
||||
model.setDiagnosis(diagnosaConverter.transferVOToModel(vo.getDiagnosis(), new Diagnosa()));
|
||||
@ -99,10 +73,9 @@ public class PemakaianAsuransiServiceImpl extends BaseVoServiceImpl implements P
|
||||
|
||||
return result;
|
||||
}
|
||||
@Autowired
|
||||
private RegistrasiPelayananPasienDao registrasiPelayananPasienDao;
|
||||
|
||||
@Override
|
||||
public List findByNoSep(String noSep) {
|
||||
public List<SuratEligibilitasAsuransi> findByNoSep(String noSep) {
|
||||
SuratEligibilitasAsuransi suratEligibilitasAsuransi = new SuratEligibilitasAsuransi();
|
||||
PemakaianAsuransi pemakaianAsuransi = pemakaianAsuransiDao.finByNoSep(noSep);
|
||||
RegistrasiPelayananPasien registrasiPelayananPasien = new RegistrasiPelayananPasien();
|
||||
@ -110,13 +83,11 @@ public class PemakaianAsuransiServiceImpl extends BaseVoServiceImpl implements P
|
||||
DetailKamar detailKamar = new DetailKamar();
|
||||
if (CommonUtil.isNotNullOrEmpty(pemakaianAsuransi)) {
|
||||
suratEligibilitasAsuransi.setPemakaianAsuransi(pemakaianAsuransi);
|
||||
// registrasiPelayananPasien = registrasiPelayananPasienService
|
||||
// .find(pemakaianAsuransi.getPasien().getPasienDaftar().getPasien().getNoCm());
|
||||
departemen = departemenDao.findById(pemakaianAsuransi.getPasienDaftar().getRuangan().getDepartemen().getId());
|
||||
departemen = departemenDao
|
||||
.findById(pemakaianAsuransi.getPasienDaftar().getRuangan().getDepartemen().getId());
|
||||
}
|
||||
if (CommonUtil.isNotNullOrEmpty(pemakaianAsuransi.getPasienDaftar())) {
|
||||
detailKamar = detailKamarDao.findById(pemakaianAsuransi.getPasienDaftar().getKelas().getId());
|
||||
//registrasiPelayananPasien=registrasiPelayananPasienDao.finByNoRecs(pemakaianAsuransi.getPasien().getPasienDaftar().getNoRec()).get(0);
|
||||
registrasiPelayananPasien.setPasien(pemakaianAsuransi.getPasienDaftar().getPasien());
|
||||
suratEligibilitasAsuransi.setRegistrasiPelayananPasien(registrasiPelayananPasien);
|
||||
}
|
||||
@ -126,8 +97,9 @@ public class PemakaianAsuransiServiceImpl extends BaseVoServiceImpl implements P
|
||||
if (CommonUtil.isNotNullOrEmpty(departemen)) {
|
||||
suratEligibilitasAsuransi.setDetailKamar(detailKamar);
|
||||
}
|
||||
List list = new ArrayList();
|
||||
List<SuratEligibilitasAsuransi> list = new ArrayList<>();
|
||||
list.add(suratEligibilitasAsuransi);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,126 +1,106 @@
|
||||
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.AdmisiRencanaPindahRuanganService;
|
||||
import com.jasamedika.medifirst2000.vo.AdmisiRencanaPindahRuanganVO;
|
||||
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.AdmisiRencanaPindahRuangan;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.AdmisiRencanaPindahRuanganService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.AdmisiRencanaPindahRuanganVO;
|
||||
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.getJsonHttptatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/admisi-rencana-pasien")
|
||||
public class AdmisiRencanaPindahRuanganController extends LocaleController<AdmisiRencanaPindahRuanganVO>{
|
||||
public class AdmisiRencanaPindahRuanganController extends LocaleController<AdmisiRencanaPindahRuanganVO> {
|
||||
|
||||
@Autowired
|
||||
private AdmisiRencanaPindahRuanganService service;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AdmisiRencanaPindahRuanganController.class);
|
||||
|
||||
@RequestMapping(value = "/save-admisi-rencana", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> saveAdmisiRencana(@Valid @RequestBody AdmisiRencanaPindahRuanganVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.save(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
private AdmisiRencanaPindahRuanganService service;
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when saveB3RuanganInputData", 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 saveB3RuanganInputData", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-admisi-rencana", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getDataGrid(
|
||||
@RequestParam(value = "startDate", required = false) String startDate,
|
||||
@RequestParam(value = "endDate", required = false) String endDate,
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AdmisiRencanaPindahRuanganController.class);
|
||||
|
||||
@RequestMapping(value = "/save-admisi-rencana", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveAdmisiRencana(@Valid @RequestBody AdmisiRencanaPindahRuanganVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.getDataGrid(startDate,endDate);
|
||||
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 = service.save(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 save", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when save", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-admisi-rencana", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getDataGrid(
|
||||
@RequestParam(value = "startDate", required = false) String startDate,
|
||||
@RequestParam(value = "endDate", required = false) String endDate, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.getDataGrid(startDate, endDate);
|
||||
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 getDataGrid", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getDataGrid", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getDataGrid", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getDataGrid", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/get-one-admisi-rencana")
|
||||
public Map<String,Object> getOneDataGrid(
|
||||
@RequestParam(value = "noRec", required = false) String noRec) {
|
||||
|
||||
Map<String,Object> result = service.getOneDataGrid(noRec);
|
||||
|
||||
return result;
|
||||
public Map<String, Object> getOneDataGrid(@RequestParam(value = "noRec", required = false) String noRec) {
|
||||
return service.getOneDataGrid(noRec);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-admisi-rencana", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> updateAdmisiRencana(@Valid @RequestBody AdmisiRencanaPindahRuanganVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.update(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
@RequestMapping(value = "/update-admisi-rencana", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> updateAdmisiRencana(@Valid @RequestBody AdmisiRencanaPindahRuanganVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.update(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 saveB3RuanganInputData", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when update", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when saveB3RuanganInputData", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got exception {} when update", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/find-admisi-rencana")
|
||||
public Map<String,Object> findAdmisiRencana(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "100") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "noRec") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@RequestParam(value = "tanggalAwal", required = false) String tanggalAwal,
|
||||
@RequestParam(value = "tanggalAhir", required = false) String tanggalAhir) {
|
||||
|
||||
Map<String, Object> resultPageMap = service.findAdmisiRencana(page, limit, sort, dir, tanggalAwal, tanggalAhir);
|
||||
|
||||
return resultPageMap;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,179 +1,148 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.AdvokasiHukumMedicolegalService;
|
||||
import com.jasamedika.medifirst2000.vo.UsulanEvaluasiVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.AdvokasiHukumMedicolegalService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.UsulanEvaluasiVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
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.getJsonHttptatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/advokasi-hukum-medicolegal")
|
||||
public class AdvokasiHukumMedicolegalController extends LocaleController<UsulanEvaluasiVO>
|
||||
{
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AdvokasiHukumMedicolegalController.class);
|
||||
|
||||
public class AdvokasiHukumMedicolegalController extends LocaleController<UsulanEvaluasiVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AdvokasiHukumMedicolegalController.class);
|
||||
|
||||
@Autowired
|
||||
private AdvokasiHukumMedicolegalService advokasiHukumMedicolegalService;
|
||||
|
||||
@RequestMapping( value = "/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> saveEvaluasiRekanan(
|
||||
@RequestBody UsulanEvaluasiVO vo, HttpServletRequest request) {
|
||||
|
||||
|
||||
@RequestMapping(value = "/save", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> saveEvaluasiRekanan(@RequestBody UsulanEvaluasiVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
String result = advokasiHukumMedicolegalService.saveEvaluasiRekanan(vo);
|
||||
|
||||
if (result != null)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
|
||||
LOGGER.error("Got exception {} when savePlanningDHM", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when saveEvaluasiRekanan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
|
||||
LOGGER.error("Got exception {} when savePlanningDHM", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
LOGGER.error("Got JpaSystemException {} when saveEvaluasiRekanan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
@RequestMapping(value = "/get-no-evaluasi", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String,Object>> getNoEvaluasi(HttpServletRequest request) {
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-no-evaluasi", method = GET)
|
||||
public ResponseEntity<Map<String, Object>> getNoEvaluasi(HttpServletRequest request) {
|
||||
try {
|
||||
String noSurat= advokasiHukumMedicolegalService.noAdvokasiHukumMedicolegal();
|
||||
Map<String,Object> result=new HashMap<String,Object>();
|
||||
String noSurat = advokasiHukumMedicolegalService.noAdvokasiHukumMedicolegal();
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("noSurat", noSurat);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add nota-dinas", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when noAdvokasiHukumMedicolegal", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add nota-dinas", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got exception {} when noAdvokasiHukumMedicolegal", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-list-evaluasi-by-ruangan-tujuan", method = RequestMethod.GET)
|
||||
public ResponseEntity<List<Map<String,Object>>> getListUsulanEvaluasiByRuanganTujuan(
|
||||
|
||||
@RequestMapping(value = "/get-list-evaluasi-by-ruangan-tujuan", method = GET)
|
||||
public ResponseEntity<List<Map<String, Object>>> getListUsulanEvaluasiByRuanganTujuan(
|
||||
@RequestParam(value = "noUsulan", required = false) String noUsulan,
|
||||
@RequestParam(value = "tglAwal", required = true)String tglAwal,
|
||||
@RequestParam(value = "tglAkhir", required = true)String tglAkhir,
|
||||
@RequestParam(value = "ruanganId", required = true)Integer ruanganId,
|
||||
HttpServletRequest request) {
|
||||
|
||||
@RequestParam(value = "tglAwal") String tglAwal, @RequestParam(value = "tglAkhir") String tglAkhir,
|
||||
@RequestParam(value = "ruanganId") Integer ruanganId, HttpServletRequest request) {
|
||||
try {
|
||||
List<Map<String,Object>> noSurat= advokasiHukumMedicolegalService.listAdvokasiHukumMedicolegalByRuanganTujuan(tglAwal, tglAkhir,noUsulan,ruanganId);
|
||||
|
||||
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(noSurat, HttpStatus.OK,mapHeaderMessage);
|
||||
List<Map<String, Object>> noSurat = advokasiHukumMedicolegalService
|
||||
.listAdvokasiHukumMedicolegalByRuanganTujuan(tglAwal, tglAkhir, noUsulan, ruanganId);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(noSurat, OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add nota-dinas", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when listAdvokasiHukumMedicolegalByRuanganTujuan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add nota-dinas", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
LOGGER.error("Got JpaSystemException {} when listAdvokasiHukumMedicolegalByRuanganTujuan",
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
@RequestMapping(value = "/get-list-evaluasi-by-ruangan-pembuat", method = RequestMethod.GET)
|
||||
public ResponseEntity<List<Map<String,Object>>> getListUsulanEvaluasiByRuanganPembuat(
|
||||
|
||||
@RequestMapping(value = "/get-list-evaluasi-by-ruangan-pembuat", method = GET)
|
||||
public ResponseEntity<List<Map<String, Object>>> getListUsulanEvaluasiByRuanganPembuat(
|
||||
@RequestParam(value = "noUsulan", required = false) String noUsulan,
|
||||
@RequestParam(value = "tglAwal", required = true)String tglAwal,
|
||||
@RequestParam(value = "tglAkhir", required = true)String tglAkhir,
|
||||
@RequestParam(value = "ruanganId", required = true)Integer ruanganId,
|
||||
HttpServletRequest request) {
|
||||
|
||||
@RequestParam(value = "tglAwal") String tglAwal, @RequestParam(value = "tglAkhir") String tglAkhir,
|
||||
@RequestParam(value = "ruanganId") Integer ruanganId, HttpServletRequest request) {
|
||||
try {
|
||||
List<Map<String,Object>> noSurat= advokasiHukumMedicolegalService.listAdvokasiHukumMedicolegalByRuanganPembuat(tglAwal, tglAkhir, noUsulan, ruanganId);
|
||||
|
||||
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(noSurat, HttpStatus.OK,mapHeaderMessage);
|
||||
List<Map<String, Object>> noSurat = advokasiHukumMedicolegalService
|
||||
.listAdvokasiHukumMedicolegalByRuanganPembuat(tglAwal, tglAkhir, noUsulan, ruanganId);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(noSurat, OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add nota-dinas", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when listAdvokasiHukumMedicolegalByRuanganPembuat", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add nota-dinas", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got exception {} when listAdvokasiHukumMedicolegalByRuanganPembuat", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
@RequestMapping(value = "/get-by-nousulan/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getUsulanEvaluasiByNoUsulan(
|
||||
@RequestParam(value = "noUsulan", required = true) String noUsulan) {
|
||||
Map<String,Object> resultPageMap = advokasiHukumMedicolegalService.advokasiHukumMedicolegalByNoUsulan(noUsulan);
|
||||
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK, mapHeaderMessage);
|
||||
|
||||
@RequestMapping(value = "/get-by-nousulan/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getUsulanEvaluasiByNoUsulan(
|
||||
@RequestParam(value = "noUsulan") String noUsulan) {
|
||||
Map<String, Object> resultPageMap = advokasiHukumMedicolegalService
|
||||
.advokasiHukumMedicolegalByNoUsulan(noUsulan);
|
||||
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
|
||||
}
|
||||
@RequestMapping( value = "/save-rekomendasi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> saveRekomendasi(
|
||||
@RequestBody UsulanEvaluasiVO vo, HttpServletRequest request) {
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-rekomendasi", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveRekomendasi(@RequestBody UsulanEvaluasiVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = advokasiHukumMedicolegalService.saveRekomendasiEvaluasiRekanan(vo);
|
||||
|
||||
Map<String, Object> result = advokasiHukumMedicolegalService.saveRekomendasiEvaluasiRekanan(vo);
|
||||
if (result != null)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
|
||||
LOGGER.error("Got exception {} when savePlanningDHM", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when saveRekomendasiEvaluasiRekanan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
|
||||
LOGGER.error("Got exception {} when savePlanningDHM", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
LOGGER.error("Got JpaSystemException {} when saveRekomendasiEvaluasiRekanan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,124 +1,99 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.entities.Agama;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.AgamaService;
|
||||
import com.jasamedika.medifirst2000.vo.AgamaVO;
|
||||
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.entities.Agama;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.AgamaService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.AgamaVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
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.getJsonHttptatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/agama")
|
||||
public class AgamaController extends LocaleController<AgamaVO> implements IBaseRestController<AgamaVO> {
|
||||
public class AgamaController extends LocaleController<AgamaVO> {
|
||||
|
||||
@Autowired
|
||||
private AgamaService agamaService;
|
||||
private AgamaService<Agama> agamaService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AgamaController.class);
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<AgamaVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<AgamaVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-agama/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/save-agama/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> addVO(@Valid @RequestBody AgamaVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
AgamaVO result = (AgamaVO) agamaService.add(vo);
|
||||
|
||||
AgamaVO result = agamaService.add(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse("", HttpStatus.CREATED, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse("", CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Agama", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when add", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Agama", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when add", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-agama/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/update-agama/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> editVO(@Valid @RequestBody AgamaVO vo) {
|
||||
try {
|
||||
AgamaVO result = (AgamaVO) agamaService.update(vo);
|
||||
|
||||
AgamaVO result = agamaService.update(vo);
|
||||
if (null != result)
|
||||
return RestUtil.getJsonResponse("", HttpStatus.OK);
|
||||
return getJsonResponse("", OK);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when update Agama", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when update", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when update Agama", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when update", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE);
|
||||
return getJsonHttptatus(NOT_ACCEPTABLE);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/delete-agama/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/delete-agama/", method = GET, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
try {
|
||||
if (agamaService.delete(id) == true)
|
||||
return RestUtil.getJsonResponse("", HttpStatus.CREATED);
|
||||
|
||||
if (agamaService.delete(id))
|
||||
return getJsonResponse("", CREATED);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when delete Agama", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when delete", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when delete Agama", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when delete", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<AgamaVO>> getAllVO() {
|
||||
List<AgamaVO> agamaList = agamaService.findAll();
|
||||
return RestUtil.getJsonResponse(agamaList, HttpStatus.OK);
|
||||
return getJsonHttptatus(NOT_ACCEPTABLE);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/search-agama", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/search-agama", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Collection<AgamaVO>> getAllVOWithQueryString(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "limit", required = false, defaultValue = "10") Integer limit,
|
||||
@ -126,21 +101,7 @@ public class AgamaController extends LocaleController<AgamaVO> implements IBaseR
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir) {
|
||||
Map<String, Object> resultPageMap = agamaService.findAllWithPageAndLimitAndSortByAndDirectionParameter(page,
|
||||
limit, sort, dir);
|
||||
|
||||
return constructListPageResult(resultPageMap);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/find-agama", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> getAllVOWithQueryString(@RequestParam(value = "id", required = true) Integer id) {
|
||||
Agama agama = agamaService.findByIdAgama(id);
|
||||
|
||||
return RestUtil.getJsonResponse(agama.getAgama(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(AgamaVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,77 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.AkunService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.AkunVO;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/akun")
|
||||
public class AkunController extends LocaleController<AkunVO>{
|
||||
|
||||
@Autowired
|
||||
private AkunService akunService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(AkunController.class);
|
||||
|
||||
@RequestMapping(value = "/save-akun",
|
||||
method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveAkun(@Valid @RequestBody AkunVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = akunService.saveAkun(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 saveAkun", 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 saveAkun", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-all-akun", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findAllAkun(HttpServletRequest request) {
|
||||
Map<String, Object> result=null;
|
||||
try {
|
||||
result = akunService.findAllAkun();
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,43 +1,19 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
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.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.entities.AgamaM;
|
||||
import com.jasamedika.medifirst2000.entities.Pasien;
|
||||
import com.jasamedika.medifirst2000.entities.PurchasedTest;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.entities.Alamat;
|
||||
import com.jasamedika.medifirst2000.service.AlamatService;
|
||||
import com.jasamedika.medifirst2000.service.ModelService;
|
||||
import com.jasamedika.medifirst2000.service.PasienService;
|
||||
//import com.jasamedika.medifirst2000.service.TestService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.AlamatVO;
|
||||
import com.jasamedika.medifirst2000.vo.ModelVO;
|
||||
import com.jasamedika.medifirst2000.vo.ModelVO;
|
||||
import com.jasamedika.medifirst2000.vo.PasienVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
|
||||
/**
|
||||
* Controller class for Pasien Business
|
||||
@ -46,52 +22,21 @@ import com.jasamedika.medifirst2000.vo.PasienVO;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/alamat")
|
||||
public class AlamatController extends LocaleController<PasienVO> implements IBaseRestController<AlamatVO> {
|
||||
|
||||
public class AlamatController extends LocaleController<PasienVO> {
|
||||
|
||||
@Autowired
|
||||
private AlamatService alamatService;
|
||||
private AlamatService<Alamat> alamatService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(AlamatVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(AlamatVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<AlamatVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/cari-alamat-id/{id}", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/cari-alamat-id/{id}", method = GET)
|
||||
public ResponseEntity<AlamatVO> getVO(@PathVariable("id") Integer id) {
|
||||
AlamatVO alamatVO = alamatService.findById(id);
|
||||
|
||||
return RestUtil.getJsonResponse(alamatVO, HttpStatus.OK);
|
||||
return getJsonResponse(alamatVO, OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/cari-alamat-by-pasien-id/{id}", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/cari-alamat-by-pasien-id/{id}", method = GET)
|
||||
public ResponseEntity<AlamatVO> getByPasienVO(@PathVariable("id") Integer id) {
|
||||
AlamatVO alamatVO = alamatService.findByPasienId(id);
|
||||
|
||||
return RestUtil.getJsonResponse(alamatVO, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<AlamatVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
return getJsonResponse(alamatVO, OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,227 +1,142 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.dto.AlatDto;
|
||||
import com.jasamedika.medifirst2000.entities.Alat;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.AlatService;
|
||||
import com.jasamedika.medifirst2000.vo.AlatVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.dto.AlatDto;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.AlatService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.AlatVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttptatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/alat")
|
||||
public class AlatController extends LocaleController<AlatVO> {
|
||||
|
||||
|
||||
@Autowired
|
||||
private AlatService alatService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(AlatController.class);
|
||||
|
||||
@RequestMapping(value = "/save-alat/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody AlatVO vo,HttpServletRequest request) {
|
||||
|
||||
try{
|
||||
Map<String, Object> result = alatService.addAlat(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 Alat", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Alat", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-alat/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody AlatVO vo,HttpServletRequest request) {
|
||||
|
||||
try{
|
||||
Map<String, Object> result = alatService.addAlat(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 Alat", 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 Alat", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-all-alat/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=alatService.findAllAlat();
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get all alat", 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 get all alat", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
private AlatService<Alat> alatService;
|
||||
|
||||
@RequestMapping(value="/save-mesin-cuci", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> saveMesinCuci(@RequestBody AlatDto dto,
|
||||
HttpServletRequest request) {
|
||||
Map<String,Object> result = alatService.saveAlat(dto);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AlatController.class);
|
||||
|
||||
@RequestMapping(value = "/find-all-alat/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllVO(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = alatService.findAllAlat();
|
||||
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 findAllAlat", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when findAllAlat", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-mesin-cuci", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveMesinCuci(@RequestBody AlatDto dto, HttpServletRequest request) {
|
||||
Map<String, Object> result = alatService.saveAlat(dto);
|
||||
if (!result.isEmpty()) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-mesin-cuci", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> get(
|
||||
@RequestParam(value="alatId", required = true) Integer alatId,
|
||||
HttpServletRequest request) {
|
||||
Map<String, Object> result = alatService.getByAlatId(alatId);
|
||||
|
||||
if (result!=null) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-all-mesin-cuci", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getAll(
|
||||
HttpServletRequest request) {
|
||||
@RequestMapping(value = "/get-all-mesin-cuci", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getAll(HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = alatService.getAllAlat();
|
||||
|
||||
if (result!=null) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
if (result != null) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-mesin-aset", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getAllRuangan(
|
||||
HttpServletRequest request) {
|
||||
@RequestMapping(value = "/get-mesin-aset", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getAllRuangan(HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = alatService.getAllProdukAset();
|
||||
|
||||
if (result!=null) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
if (result != null) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-satuan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getSatuan(
|
||||
HttpServletRequest request) {
|
||||
@RequestMapping(value = "/get-satuan", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getSatuan(HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = alatService.getAllSatuanStandar();
|
||||
|
||||
if (result!=null) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
if (result != null) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-departemen-laundry", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getDepartemenLaundry(
|
||||
HttpServletRequest request) {
|
||||
@RequestMapping(value = "/get-departemen-laundry", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getDepartemenLaundry(HttpServletRequest request) {
|
||||
Map<String, Object> result = alatService.getDepartemenLaundry();
|
||||
|
||||
if (result!=null) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
if (result != null) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-max-no-mesin", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getMaxId(
|
||||
HttpServletRequest request) {
|
||||
@RequestMapping(value = "/get-max-no-mesin", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getMaxId(HttpServletRequest request) {
|
||||
Map<String, Object> result = alatService.getMaxId();
|
||||
|
||||
if (result!=null) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
if (result != null) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-produkasetid-alatid", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/get-produkasetid-alatid", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getProdukAsetAlat(
|
||||
@RequestParam(value="produkAsetId", required = true) Integer produkAsetId,
|
||||
@RequestParam(value="alatId", required = true) Integer alatId,
|
||||
@RequestParam(value = "produkAsetId") Integer produkAsetId, @RequestParam(value = "alatId") Integer alatId,
|
||||
HttpServletRequest request) {
|
||||
Map<String, Object> result = alatService.cekMesiId(produkAsetId, alatId);
|
||||
|
||||
if (result!=null) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
if (result != null) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-asset-laundry",
|
||||
method=RequestMethod.GET,
|
||||
produces=MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> gerAssetLaundry(HttpServletRequest request){
|
||||
Map<String, Object> result = this.alatService.findAssetLaundry();
|
||||
return result;
|
||||
|
||||
@RequestMapping(value = "/get-asset-laundry", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> gerAssetLaundry(HttpServletRequest request) {
|
||||
return this.alatService.findAssetLaundry();
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-mesin-laundry",
|
||||
method=RequestMethod.GET,
|
||||
produces=MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> gerMesinLaundry(HttpServletRequest request){
|
||||
Map<String, Object> result = this.alatService.getMesinLaundry();
|
||||
return result;
|
||||
|
||||
@RequestMapping(value = "/get-mesin-laundry", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> gerMesinLaundry(HttpServletRequest request) {
|
||||
return this.alatService.getMesinLaundry();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,35 +1,32 @@
|
||||
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.AnamnesisService;
|
||||
import com.jasamedika.medifirst2000.vo.AnamnesisVO;
|
||||
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
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.AnamnesisService;
|
||||
import com.jasamedika.medifirst2000.service.AnamnesisService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.AnamnesisVO;
|
||||
import com.jasamedika.medifirst2000.vo.AnamnesisVO;
|
||||
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
|
||||
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.getJsonHttptatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
/**
|
||||
* Controller class for Registrasi Pasien Business
|
||||
@ -38,62 +35,43 @@ import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/anamnesis")
|
||||
public class AnamnesisController extends LocaleController<RegistrasiPelayananVO>{
|
||||
public class AnamnesisController extends LocaleController<RegistrasiPelayananVO> {
|
||||
|
||||
@Autowired
|
||||
private AnamnesisService service;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AnamnesisController.class);
|
||||
|
||||
@RequestMapping(value = "/save-anamnesis", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> saveAnamnesis(@Valid @RequestBody AnamnesisVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.saveAnamnesis(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
private AnamnesisService service;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AnamnesisController.class);
|
||||
|
||||
@RequestMapping(value = "/save-anamnesis", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveAnamnesis(@Valid @RequestBody AnamnesisVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.saveAnamnesis(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 saveAnamnesis", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveAnamnesis", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when saveAnamnesis", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveAnamnesis", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-anamnesis/{noCm}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-anamnesis/{noCm}", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getTindakanByIdUserAndPeriod(@PathVariable("noCm") String noCm,
|
||||
HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = null;
|
||||
List<Map<String, Object>> result;
|
||||
try {
|
||||
|
||||
result = service.getAnamnesis(noCm);
|
||||
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceVOException(e.getMessage());
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
return getJsonResponse(result, OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-anamnesis1/{noCm}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getAnamnesis(@PathVariable("noCm") String noCm,
|
||||
HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = null;
|
||||
try {
|
||||
|
||||
result = service.getAnamnesis(noCm);
|
||||
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,37 +1,33 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.entities.Pengendali;
|
||||
import com.jasamedika.medifirst2000.entities.Ruangan;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.AnggaranService;
|
||||
import com.jasamedika.medifirst2000.service.DetailAnggaranService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.HeadAnggaranVO;
|
||||
import com.jasamedika.medifirst2000.vo.VerifikasiSpekAnggaranVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
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.getJsonHttptatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/anggaran")
|
||||
@ -55,201 +51,139 @@ public class AnggaranController extends LocaleController<HeadAnggaranVO> {
|
||||
@RequestParam(value = "dateStart", required = false) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = false) String dateEnd,
|
||||
@RequestParam(value = "tahun", required = false) Integer tahun,
|
||||
@RequestParam(value = "gridFor", required = true) String gridFor,
|
||||
@RequestParam(value = "gridFor") String gridFor,
|
||||
@RequestParam(value = "pengendaliId", required = false) Integer pengendaliId) {
|
||||
|
||||
Map<String, Object> resultPageMap = service.detailSpekAnggaran(page, limit, sort, dir, dateStart, dateEnd,
|
||||
tahun, gridFor, pengendaliId);
|
||||
|
||||
return resultPageMap;
|
||||
return service.detailSpekAnggaran(page, limit, sort, dir, dateStart, dateEnd, tahun, gridFor, pengendaliId);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-pengajuan-usulan-anggaran-baru", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/save-pengajuan-usulan-anggaran-baru", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> savePengajuanUsulanAnggaranBaru(@Valid @RequestBody HeadAnggaranVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.savePengajuanUsulanAnggaranBaru(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 savePengajuanUsulanAnggaran", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when savePengajuanUsulanAnggaranBaru", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when savePengajuanUsulanAnggaran", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when savePengajuanUsulanAnggaranBaru", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-detail-anggaran/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> findDetailSpekAnggaranByParent(
|
||||
@RequestParam(value = "noRec", required = true) String noRec,
|
||||
@RequestMapping(value = "/get-detail-anggaran/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> findDetailSpekAnggaranByParent(@RequestParam(value = "noRec") String noRec,
|
||||
@RequestParam(value = "parameter", required = false) String parameter,
|
||||
@RequestParam(value = "asalProdukId", required = false) Integer asalProdukId,
|
||||
@RequestParam(value = "mataAnggaranId", required = false) Integer mataAnggaranId) {
|
||||
Map<String, Object> detailAnggaran = detailAnggaranService.findDetailSpekAnggaranByParent(noRec, parameter,
|
||||
asalProdukId, mataAnggaranId);
|
||||
|
||||
return detailAnggaran;
|
||||
return detailAnggaranService.findDetailSpekAnggaranByParent(noRec, parameter, asalProdukId, mataAnggaranId);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-verifikasi-spek-anggaran", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/save-verifikasi-spek-anggaran", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveVerifikasiSpekAnggaran(
|
||||
@Valid @RequestBody VerifikasiSpekAnggaranVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.saveVerifikasiSpekAnggaran(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 savePengajuanUsulanAnggaran", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveVerifikasiSpekAnggaran", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when savePengajuanUsulanAnggaran", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveVerifikasiSpekAnggaran", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-un-verifikasi-spek-anggaran", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/save-un-verifikasi-spek-anggaran", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveUnVerifikasiSpekAnggaran(
|
||||
@Valid @RequestBody VerifikasiSpekAnggaranVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.saveUnVerifikasiSpekAnggaran(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 savePengajuanUsulanAnggaran", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveUnVerifikasiSpekAnggaran", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when savePengajuanUsulanAnggaran", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveUnVerifikasiSpekAnggaran", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-kode-produk", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> gedProdukByNama(
|
||||
@RequestParam(value = "namaProduk", required = true) String namaProduk) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
ResponseEntity<Map<String, Object>> restUtil = null;
|
||||
try {
|
||||
result = service.gedProdukByNama(namaProduk);
|
||||
if (null != result) {
|
||||
restUtil = RestUtil.getJsonResponse(result, HttpStatus.FOUND, mapHeaderMessage);
|
||||
} else {
|
||||
restUtil = RestUtil.getJsonResponse(null, HttpStatus.NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
restUtil = RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
return restUtil;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-pengendali", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/get-pengendali", method = GET)
|
||||
public ResponseEntity<Pengendali> getPengendali(HttpServletRequest request) {
|
||||
try {
|
||||
Pengendali pengendali = service.getPengendaliByUserLogin();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(pengendali, HttpStatus.OK, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(pengendali, OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get all pengendali", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getPengendaliByUserLogin", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(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.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getPengendaliByUserLogin", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-ruangan", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/get-ruangan", method = GET)
|
||||
public ResponseEntity<Ruangan> getRuangan(HttpServletRequest request) {
|
||||
try {
|
||||
Ruangan ruangan = service.getRuanganByUserLogin();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(ruangan, HttpStatus.OK, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(ruangan, OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get all dokter", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getRuanganByUserLogin", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(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.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getRuanganByUserLogin", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-all-dokter", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String, Object>> getJenisProduk(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> listJenisProduk = service.getJenisProduk();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(listJenisProduk, HttpStatus.OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get all dokter", 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 get all dokter", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// add by Arya 2017-01-19
|
||||
@RequestMapping(value = "/edit-pengajuan-usulan-anggaran", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/edit-pengajuan-usulan-anggaran", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> editPengajuanUsulanAnggaran(@Valid @RequestBody HeadAnggaranVO vo,
|
||||
@RequestParam(value = "noRec", required = false) String noRec, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.editPengajuanUsulanAnggaran(vo, noRec);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when editPengajuanUsulanAnggaran", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when editPengajuanUsulanAnggaran", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when editPengajuanUsulanAnggaran", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when editPengajuanUsulanAnggaran", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
// end add by Arya 2017-01-19
|
||||
|
||||
// add by Arya 2017-01-30
|
||||
@RequestMapping(value = "/get-pengajuan-usulan-anggaran-by-norec/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> findPengajuanUsulanAnggaranByNoRec(
|
||||
@RequestParam(value = "noRec", required = true) String noRec) {
|
||||
Map<String, Object> detailAnggaran = service.findPengajuanUsulanAnggaranByNoRec(noRec);
|
||||
|
||||
return detailAnggaran;
|
||||
@RequestMapping(value = "/get-pengajuan-usulan-anggaran-by-norec/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> findPengajuanUsulanAnggaranByNoRec(@RequestParam(value = "noRec") String noRec) {
|
||||
return service.findPengajuanUsulanAnggaranByNoRec(noRec);
|
||||
}
|
||||
// end add by Arya 2017-01-30
|
||||
|
||||
//add by Arya 2017-02-02
|
||||
|
||||
// add by Arya 2017-02-02
|
||||
@RequestMapping(value = "/daftar-detail-anggaran")
|
||||
@ResponseBody
|
||||
public Map<String, Object> getDetailAnggaran(
|
||||
@ -261,12 +195,8 @@ public class AnggaranController extends LocaleController<HeadAnggaranVO> {
|
||||
@RequestParam(value = "dateEnd", required = false) String dateEnd,
|
||||
@RequestParam(value = "tahun", required = false) Integer tahun,
|
||||
@RequestParam(value = "pengendaliId", required = false) Integer pengendaliId) {
|
||||
|
||||
Map<String, Object> resultPageMap = service.getDetailAnggaran(page, limit, sort, dir, dateStart, dateEnd,
|
||||
tahun, pengendaliId);
|
||||
|
||||
return resultPageMap;
|
||||
return service.getDetailAnggaran(page, limit, sort, dir, dateStart, dateEnd, tahun, pengendaliId);
|
||||
}
|
||||
//end add by Arya 2017-02-02
|
||||
// end add by Arya 2017-02-02
|
||||
|
||||
}
|
||||
|
||||
@ -1,64 +1,60 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ApiError {
|
||||
|
||||
private HttpStatus status;
|
||||
private String message;
|
||||
private List<String> errors;
|
||||
private HttpStatus status;
|
||||
private String message;
|
||||
private List<String> errors;
|
||||
|
||||
//
|
||||
public ApiError() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ApiError() {
|
||||
super();
|
||||
}
|
||||
public ApiError(final HttpStatus status, final String message, final List<String> errors) {
|
||||
super();
|
||||
this.status = status;
|
||||
this.message = message;
|
||||
this.errors = errors;
|
||||
}
|
||||
|
||||
public ApiError(final HttpStatus status, final String message, final List<String> errors) {
|
||||
super();
|
||||
this.status = status;
|
||||
this.message = message;
|
||||
this.errors = errors;
|
||||
}
|
||||
public ApiError(final HttpStatus status, final String message, final String error) {
|
||||
super();
|
||||
this.status = status;
|
||||
this.message = message;
|
||||
errors = Collections.singletonList(error);
|
||||
}
|
||||
|
||||
public ApiError(final HttpStatus status, final String message, final String error) {
|
||||
super();
|
||||
this.status = status;
|
||||
this.message = message;
|
||||
errors = Arrays.asList(error);
|
||||
}
|
||||
public HttpStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
//
|
||||
public void setStatus(final HttpStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public HttpStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setStatus(final HttpStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
public void setMessage(final String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
public List<String> getErrors() {
|
||||
return errors;
|
||||
}
|
||||
|
||||
public void setMessage(final String message) {
|
||||
this.message = message;
|
||||
}
|
||||
public void setErrors(final List<String> errors) {
|
||||
this.errors = errors;
|
||||
}
|
||||
|
||||
public List<String> getErrors() {
|
||||
return errors;
|
||||
}
|
||||
|
||||
public void setErrors(final List<String> errors) {
|
||||
this.errors = errors;
|
||||
}
|
||||
|
||||
public void setError(final String error) {
|
||||
errors = Arrays.asList(error);
|
||||
}
|
||||
public void setError(final String error) {
|
||||
errors = Collections.singletonList(error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,133 +1,79 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Date;
|
||||
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.ApresiasiAtasLayananService;
|
||||
import com.jasamedika.medifirst2000.vo.ApresiasiAtasLayananVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.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.ApresiasiAtasLayananService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.ApresiasiAtasLayananVO;
|
||||
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.getJsonHttptatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/apresiasi-atas-layanan")
|
||||
public class ApresiasiAtasLayananController extends LocaleController<ApresiasiAtasLayananVO>{
|
||||
|
||||
public class ApresiasiAtasLayananController extends LocaleController<ApresiasiAtasLayananVO> {
|
||||
|
||||
@Autowired
|
||||
private ApresiasiAtasLayananService apresiasiAtasLayananService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(ApresiasiAtasLayananController.class);
|
||||
|
||||
@RequestMapping(value = "/save-apresiasi-atas-layanan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody ApresiasiAtasLayananVO vo, HttpServletRequest request) {
|
||||
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ApresiasiAtasLayananController.class);
|
||||
|
||||
@RequestMapping(value = "/save-apresiasi-atas-layanan/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody ApresiasiAtasLayananVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=apresiasiAtasLayananService.addApresiasiAtasLayanan(vo);
|
||||
Map<String, Object> result = apresiasiAtasLayananService.addApresiasiAtasLayanan(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 Apresiasi Atas Layanan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when addApresiasiAtasLayanan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Apresiasi Atas Layanan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when addApresiasiAtasLayanan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-apresiasi-atas-layanan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody ApresiasiAtasLayananVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=apresiasiAtasLayananService.updateApresiasiAtasLayanan(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 Apresiasi Atas Layanan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Apresiasi Atas Layanan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-all-apresiasi-atas-layanan/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=apresiasiAtasLayananService.findAllApresiasiAtasLayanan();
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get all sasaran strategis", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get all sasaran strategis", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/rekap-apresiasi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/rekap-apresiasi", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getKelasByRuangan(
|
||||
@RequestParam(value = "from", required = false) String from,
|
||||
@RequestParam(value = "to", required = false) String to,
|
||||
HttpServletRequest request) {
|
||||
Map<String, Object> result = null;
|
||||
try{
|
||||
result =apresiasiAtasLayananService.rekapApresiasi(from, to);
|
||||
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
|
||||
|
||||
if(dataFound){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
@RequestParam(value = "to", required = false) String to, HttpServletRequest request) {
|
||||
Map<String, Object> result;
|
||||
try {
|
||||
result = apresiasiAtasLayananService.rekapApresiasi(from, to);
|
||||
boolean dataFound = (boolean) result.get("dataFound");
|
||||
if (dataFound) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} else {
|
||||
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
|
||||
}
|
||||
else{
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
throw new ServiceVOException(e.getMessage());
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
return getJsonResponse(result, OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,66 +1,64 @@
|
||||
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.AsesmenGiziAwalService;
|
||||
import com.jasamedika.medifirst2000.vo.AsesmenGiziAwalVO;
|
||||
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
|
||||
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.AsesmenGiziAwalService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.AsesmenGiziAwalVO;
|
||||
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
|
||||
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.getJsonHttptatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
/**
|
||||
* Controller class for Registrasi Pasien Business
|
||||
* Controller class for Asesmen Gizi Awal Service
|
||||
*
|
||||
* @author Adik
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/asesmen-gizi-awal")
|
||||
public class AsesmenGiziAwalController extends LocaleController<RegistrasiPelayananVO>{
|
||||
public class AsesmenGiziAwalController extends LocaleController<RegistrasiPelayananVO> {
|
||||
|
||||
@Autowired
|
||||
private AsesmenGiziAwalService asesmenGiziAwalService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(AsesmenGiziAwalController.class);
|
||||
|
||||
@RequestMapping(value = "/save-asesmen-gizi-awal", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveAsesmenGiziAwal(@Valid @RequestBody AsesmenGiziAwalVO vo,HttpServletRequest request) {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AsesmenGiziAwalController.class);
|
||||
|
||||
@RequestMapping(value = "/save-asesmen-gizi-awal", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveAsesmenGiziAwal(@Valid @RequestBody AsesmenGiziAwalVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=asesmenGiziAwalService.saveAsesmenGiziAwal(vo);
|
||||
Map<String, Object> result = asesmenGiziAwalService.saveAsesmenGiziAwal(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
SaveLog("Assesment Gizi Awal", "Pemeriksaan",request);
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
SaveLog("Assesment Gizi Awal", "Pemeriksaan", request);
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when saveAsesmenGiziAwal", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveAsesmenGiziAwal", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when saveAsesmenGiziAwal", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveAsesmenGiziAwal", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,32 +1,31 @@
|
||||
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.AsesmenGiziLanjutService;
|
||||
import com.jasamedika.medifirst2000.vo.AsesmenGiziLanjutVO;
|
||||
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
|
||||
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.AsesmenGiziLanjutService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.AsesmenGiziLanjutVO;
|
||||
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
|
||||
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.getJsonHttptatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/asesmen-gizi-lanjut")
|
||||
@ -37,65 +36,24 @@ public class AsesmenGiziLanjutController extends LocaleController<RegistrasiPela
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AsesmenGiziLanjutController.class);
|
||||
|
||||
@RequestMapping(value = "/save-asesmen-gizi-lanjut", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/save-asesmen-gizi-lanjut", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveAsesmenGiziLanjut(@Valid @RequestBody AsesmenGiziLanjutVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = asesmenGiziLanjutService.saveAsesmenGiziLanjut(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
SaveLog("Assesment Gizi Lanjut", "Pemeriksaan Khusus",request);
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
SaveLog("Assesment Gizi Lanjut", "Pemeriksaan Khusus", request);
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when save Asesmen Gizi Lanjut", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveAsesmenGiziLanjut", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when save Asesmen Gizi Lanjut", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveAsesmenGiziLanjut", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-asesmen-gizi-lanjut", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> updateAsesmenGiziLanjut(@Valid @RequestBody AsesmenGiziLanjutVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = asesmenGiziLanjutService.updateAsesmenGiziLanjut(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 Asesmen Gizi Lanjut", 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 Asesmen Gizi Lanjut", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-by-noRegistrasi/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findByNoRegistrasi(
|
||||
@RequestParam(value = "noRegistrasi", required = false) String noRegistrasi, HttpServletRequest request) {
|
||||
|
||||
Map<String, Object> result = asesmenGiziLanjutService.findByNoRegistrasi(noRegistrasi);
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,58 +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.AssetService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.AssetVO;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/asset")
|
||||
public class AssetController extends LocaleController<AssetVO> {
|
||||
|
||||
@Autowired
|
||||
private AssetService assetService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AssetController.class);
|
||||
|
||||
@RequestMapping(value = "/save-asset", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveAsset(@Valid @RequestBody AssetVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = assetService.saveAsset(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 saveAsset", 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 saveAsset", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,249 +1,162 @@
|
||||
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.AsuhanKeperawatanPeriOperatifService;
|
||||
import com.jasamedika.medifirst2000.vo.AsuhanKeperawatanPeriOperatifVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.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.AsuhanKeperawatanPeriOperatifService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.AsuhanKeperawatanPeriOperatifVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttptatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/asuhan-keperawatan-master")
|
||||
public class AsuhanKeperawatanPeriOperasiController extends LocaleController<AsuhanKeperawatanPeriOperatifVO>{
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AsuhanKeperawatanPeriOperasiController.class);
|
||||
|
||||
public class AsuhanKeperawatanPeriOperasiController extends LocaleController<AsuhanKeperawatanPeriOperatifVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AsuhanKeperawatanPeriOperasiController.class);
|
||||
|
||||
@Autowired
|
||||
private AsuhanKeperawatanPeriOperatifService asuhanKeperawatanPeriOperatifService;
|
||||
|
||||
@RequestMapping(
|
||||
value = "/save-asuhan-keperawatan-master",
|
||||
method = RequestMethod.POST,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveAsuhanPerawat(
|
||||
@Valid @RequestBody AsuhanKeperawatanPeriOperatifVO vo,
|
||||
HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String, Object> result = this.asuhanKeperawatanPeriOperatifService.saveAsuhan(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 saveAsuhanPerawat", 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 saveAsuhanPerawat", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
value = "/get-list-data",
|
||||
method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/get-list-data", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getLoadData(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String, Object> result = this.asuhanKeperawatanPeriOperatifService.getAllAsuhan();
|
||||
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} else {
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
|
||||
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when getLoadData", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when getAllAsuhan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getLoadData", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got JpaSystemException {} when getAllAsuhan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
value = "/get-list-data-intra-operasi",
|
||||
method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getLoadDataIntraOperasi(HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/get-list-data-intra-operasi", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getLoadDataIntraOperasi(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = this.asuhanKeperawatanPeriOperatifService.getAllIntraOperasiPerawatBedah();
|
||||
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(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 getLoadDataIntraOperasi", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when getAllIntraOperasiPerawatBedah", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getLoadDataIntraOperasi", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got JpaSystemException {} when getAllIntraOperasiPerawatBedah", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
value = "/get-list-data-post-operasi",
|
||||
method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getLoadDataPostOperasi(HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/get-list-data-post-operasi", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getLoadDataPostOperasi(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = this.asuhanKeperawatanPeriOperatifService.getAllPostOperasiPerawatBedah();
|
||||
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(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 getLoadDataPostOperasi", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when getAllPostOperasiPerawatBedah", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getLoadDataPostOperasi", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got JpaSystemException {} when getAllPostOperasiPerawatBedah", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
value = "/get-list-data-intra-operasi-anestesi",
|
||||
method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-list-data-intra-operasi-anestesi", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getLoadDataIntraOperasiAnestesi(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String, Object> result = this.asuhanKeperawatanPeriOperatifService.getAllIntraOperasiAnestesi();
|
||||
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
//return result;
|
||||
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 getLoadDataIntraOperasiAnestesi", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when getAllIntraOperasiAnestesi", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getLoadDataIntraOperasiAnestesi", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got JpaSystemException {} when getAllIntraOperasiAnestesi", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
value = "/get-list-data-post-operasi-anestesi",
|
||||
method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getLoadDataPostOperasiAnestesi(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String, Object> result = this.asuhanKeperawatanPeriOperatifService.getAllPostOperasiAnestesi();
|
||||
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
//return result;
|
||||
} else {
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when getLoadDataPostOperasiAnestesi", 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 getLoadDataPostOperasiAnestesi", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
|
||||
@RequestMapping(value = "/get-list-data-post-operasi-anestesi", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getLoadDataPostOperasiAnestesi(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = this.asuhanKeperawatanPeriOperatifService.getAllPostOperasiAnestesi();
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} else {
|
||||
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got ServiceVOException {} when getAllPostOperasiAnestesi", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when getAllPostOperasiAnestesi", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
value = "/get-list-data-intra-operasi-perawat-bedah-v1",
|
||||
method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getLoadDataIntraOperasiPerawatBedahV1(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String, Object> result = this.asuhanKeperawatanPeriOperatifService.getAllIntraOperasiPerawatBedahV1();
|
||||
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
//return result;
|
||||
} else {
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when getLoadDataIntraOperasiAnestesi", 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 getLoadDataIntraOperasiAnestesi", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-list-data-intra-operasi-perawat-bedah-v1", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getLoadDataIntraOperasiPerawatBedahV1(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = this.asuhanKeperawatanPeriOperatifService.getAllIntraOperasiPerawatBedahV1();
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} else {
|
||||
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got ServiceVOException {} when getAllIntraOperasiPerawatBedahV1", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when getAllIntraOperasiPerawatBedahV1", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,128 +1,104 @@
|
||||
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.AsuhanKeperawatanPeriOperasiHeaderService;
|
||||
import com.jasamedika.medifirst2000.vo.AsuhanKeperawatanPeriOperasiHeaderVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
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.AsuhanKeperawatanPeriOperasiHeaderService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.AsuhanKeperawatanPeriOperasiHeaderVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttptatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/asuhan-keperawatan-peri-operasi")
|
||||
public class AsuhanKeperawatanPeriOperasiHeaderController extends LocaleController<AsuhanKeperawatanPeriOperasiHeaderVO>{
|
||||
public class AsuhanKeperawatanPeriOperasiHeaderController
|
||||
extends LocaleController<AsuhanKeperawatanPeriOperasiHeaderVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AsuhanKeperawatanPeriOperasiHeaderController.class);
|
||||
|
||||
|
||||
@Autowired
|
||||
private AsuhanKeperawatanPeriOperasiHeaderService asuhanKeperawatanPeriOperasiHeaderService;
|
||||
|
||||
@RequestMapping(
|
||||
value = "/save-asuhan-perawat",
|
||||
method = RequestMethod.POST,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/save-asuhan-perawat", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveAsuhanKeperawatan(
|
||||
@Valid @RequestBody AsuhanKeperawatanPeriOperasiHeaderVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String, Object> result = this.asuhanKeperawatanPeriOperasiHeaderService.saveAsuhanHeader(vo);
|
||||
|
||||
if (result != null)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
|
||||
LOGGER.error("Got exception {} when saveAsuhanKeperawatan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when saveAsuhanHeader", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
|
||||
LOGGER.error("Got exception {} when saveAsuhanKeperawatan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
LOGGER.error("Got JpaSystemException {} when saveAsuhanHeader", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
value = "/get-list-by-notrans",
|
||||
method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getLoadDataByNoTrans(
|
||||
@RequestParam(value = "notrans", required = true) String notrans, HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/get-list-by-notrans", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getLoadDataByNoTrans(@RequestParam(value = "notrans") String notrans,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = this.asuhanKeperawatanPeriOperasiHeaderService.getListAsuhanByNoTrans(notrans);
|
||||
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} else {
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
|
||||
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when getLoadDataByNoTrans", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when getListAsuhanByNoTrans", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getLoadDataByNoTrans", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got JpaSystemException {} when getListAsuhanByNoTrans", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
value = "get-pasien-operasi",
|
||||
method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getPasienDaftarOperasi(
|
||||
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "get-pasien-operasi", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getPasienDaftarOperasi(@RequestParam(value = "noRec") String noRec,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = this.asuhanKeperawatanPeriOperasiHeaderService.getPasienDaftarOperasi(noRec);
|
||||
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} else {
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
|
||||
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when getPasienDaftarOperasi", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when getPasienDaftarOperasi", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getPasienDaftarOperasi", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got JpaSystemException {} when getPasienDaftarOperasi", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,302 +1,197 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.dto.SuratEligibilitasAsuransi;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.BridgingBpjs;
|
||||
import com.jasamedika.medifirst2000.service.PemakaianAsuransiService;
|
||||
import com.jasamedika.medifirst2000.vo.PemakaianAsuransiVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.jasamedika.medifirst2000.base.vo.BaseModelVO;
|
||||
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.DepartemenDao;
|
||||
import com.jasamedika.medifirst2000.dao.DetailKamarDao;
|
||||
import com.jasamedika.medifirst2000.dao.PemakaianAsuransiDao;
|
||||
import com.jasamedika.medifirst2000.dto.SuratEligibilitasAsuransi;
|
||||
import com.jasamedika.medifirst2000.entities.Departemen;
|
||||
import com.jasamedika.medifirst2000.entities.DetailKamar;
|
||||
import com.jasamedika.medifirst2000.entities.PemakaianAsuransi;
|
||||
import com.jasamedika.medifirst2000.entities.RegistrasiPelayananPasien;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.AlamatService;
|
||||
import com.jasamedika.medifirst2000.service.BridgingBpjs;
|
||||
import com.jasamedika.medifirst2000.service.PemakaianAsuransiService;
|
||||
import com.jasamedika.medifirst2000.service.RegistrasiPelayananPasienService;
|
||||
import com.jasamedika.medifirst2000.service.RegistrasiPelayananService;
|
||||
import com.jasamedika.medifirst2000.util.CommonUtil;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.AlamatVO;
|
||||
import com.jasamedika.medifirst2000.vo.PemakaianAsuransiVO;
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttptatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/asuransi")
|
||||
public class AsuransiController extends LocaleController<PemakaianAsuransiVO> {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BridgingBpjs bridgingBpjs;
|
||||
|
||||
@Autowired
|
||||
private PemakaianAsuransiDao pemakaianAsuransiDao;
|
||||
|
||||
private BridgingBpjs bridgingBpjs;
|
||||
|
||||
@Autowired
|
||||
private PemakaianAsuransiService pemakaianAsuransiService;
|
||||
|
||||
@Autowired
|
||||
private RegistrasiPelayananPasienService registrasiPelayananPasienService;
|
||||
|
||||
@Autowired
|
||||
private RegistrasiPelayananService registrasiPelayananService;
|
||||
|
||||
public AsuransiController() {
|
||||
public AsuransiController() {
|
||||
}
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RegistrasiPelayananController.class);
|
||||
|
||||
@RequestMapping(value = "/save-pemakaian-asuransi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AsuransiController.class);
|
||||
|
||||
@RequestMapping(value = "/save-pemakaian-asuransi", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> savePemakaianAsuransi(@Valid @RequestBody PemakaianAsuransiVO vo,
|
||||
HttpServletRequest request) throws ParseException {
|
||||
try {
|
||||
Map<String, String> mapHeaderMessage = new HashMap<String, String>();
|
||||
Map<String, String> mapHeaderMessage = new HashMap<>();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||
vo.setTglRegistrasi(format.parse(vo.getTanggalPendaftaran()));
|
||||
Map<String, Object> result = pemakaianAsuransiService.savePemakaianAsuransi(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.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when savePemakaianAsuransi", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when savePemakaianAsuransi", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/check-kepesertaan/{id}", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/check-kepesertaan/{id}", method = GET)
|
||||
public ResponseEntity<Object> checkKepesertaaan(@RequestParam(value = "id", required = false) String id) {
|
||||
Object peserta = bridgingBpjs.CekKepesertaan(id);
|
||||
|
||||
return RestUtil.getJsonResponse(peserta, HttpStatus.OK);
|
||||
return getJsonResponse(peserta, OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/detail-sep-peserta/", method = RequestMethod.GET)
|
||||
public ResponseEntity<Object> getDetailSEPPeserta(@RequestParam(value = "noSep", required = true) String noSep) {
|
||||
|
||||
@RequestMapping(value = "/detail-sep-peserta/", method = GET)
|
||||
public ResponseEntity<Object> getDetailSEPPeserta(@RequestParam(value = "noSep") String noSep) {
|
||||
Object peserta = bridgingBpjs.getDetailSEP(noSep);
|
||||
|
||||
return RestUtil.getJsonResponse(peserta, HttpStatus.OK);
|
||||
return getJsonResponse(peserta, OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/data-kunjungan-peserta/", method = RequestMethod.GET)
|
||||
public ResponseEntity<Object> getDataKunjunganPeserta(@RequestParam(value = "noSep", required = true) String noSep) {
|
||||
|
||||
@RequestMapping(value = "/data-kunjungan-peserta/", method = GET)
|
||||
public ResponseEntity<Object> getDataKunjunganPeserta(@RequestParam(value = "noSep") String noSep) {
|
||||
Object peserta = bridgingBpjs.getDataKunjunganPeserta(noSep);
|
||||
|
||||
return RestUtil.getJsonResponse(peserta, HttpStatus.OK);
|
||||
return getJsonResponse(peserta, OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/data-riwayat-pelayanan-peserta/", method = RequestMethod.GET)
|
||||
public ResponseEntity<Object> getDataRiwayatPelayananPeserta(@RequestParam(value = "noKartu", required = true) String noKartu) {
|
||||
|
||||
@RequestMapping(value = "/data-riwayat-pelayanan-peserta/", method = GET)
|
||||
public ResponseEntity<Object> getDataRiwayatPelayananPeserta(@RequestParam(value = "noKartu") String noKartu) {
|
||||
Object peserta = bridgingBpjs.getDataRiwayatPelayananPeserta(noKartu);
|
||||
|
||||
return RestUtil.getJsonResponse(peserta, HttpStatus.OK);
|
||||
return getJsonResponse(peserta, OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/check-rujukan/{id}", method = RequestMethod.GET)
|
||||
public ResponseEntity<Object> cekRujukan(@RequestParam(value = "noRujukan", required = false) String noRujukan) {
|
||||
Object rujukan = bridgingBpjs.CekNoRujukan(noRujukan);
|
||||
|
||||
return RestUtil.getJsonResponse(rujukan, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/generate-sep", method = RequestMethod.GET)
|
||||
public ResponseEntity<Object> generateSep(
|
||||
|
||||
@RequestParam(value = "noBpjs", required = false) String noBpjs,
|
||||
@RequestParam(value = "tanggalRujukan", required = false) String tanggalRujuakn,
|
||||
@RequestParam(value = "tanggalSep", required = false) String tanggalSep,
|
||||
@RequestParam(value = "noRujukan", required = false) String noRujukan,
|
||||
@RequestMapping(value = "/generate-sep", method = GET)
|
||||
public ResponseEntity<Object> generateSep(@RequestParam(value = "noBpjs", required = false) String noBpjs,
|
||||
@RequestParam(value = "tanggalRujukan", required = false) String tanggalRujuakn,
|
||||
@RequestParam(value = "tanggalSep", required = false) String tanggalSep,
|
||||
@RequestParam(value = "noRujukan", required = false) String noRujukan,
|
||||
@RequestParam(value = "ppkRujukan", required = false) String ppkRujukan,
|
||||
@RequestParam(value = "isRawatJalan", required = false) String isRawatJalan,
|
||||
@RequestParam(value = "catatan", required = false) String catatan,
|
||||
@RequestParam(value = "kodeDiagnosa", required = false) String kodeDiagnosa,
|
||||
@RequestParam(value = "poliTujuan", required = false) String poliTujuan,
|
||||
@RequestParam(value = "isRawatJalan", required = false) String isRawatJalan,
|
||||
@RequestParam(value = "catatan", required = false) String catatan,
|
||||
@RequestParam(value = "kodeDiagnosa", required = false) String kodeDiagnosa,
|
||||
@RequestParam(value = "poliTujuan", required = false) String poliTujuan,
|
||||
@RequestParam(value = "kelasRawat", required = false) String kelasRawat,
|
||||
@RequestParam(value = "lakaLantas", required = false) String lakaLantas,
|
||||
@RequestParam(value = "lokasiLaka", required = false) String lokasiLaka,
|
||||
@RequestParam(value = "lakaLantas", required = false) String lakaLantas,
|
||||
@RequestParam(value = "lokasiLaka", required = false) String lokasiLaka,
|
||||
@RequestParam(value = "noCm", required = false) String noCm) {
|
||||
Object rujukan = bridgingBpjs.GenerateSep(noBpjs, tanggalRujuakn, tanggalSep,noRujukan, ppkRujukan, isRawatJalan.equals("T"), catatan, kodeDiagnosa, poliTujuan, kelasRawat, lakaLantas,lokasiLaka, noCm);
|
||||
|
||||
return RestUtil.getJsonResponse(rujukan, HttpStatus.OK);
|
||||
Object rujukan = bridgingBpjs.GenerateSep(noBpjs, tanggalRujuakn, tanggalSep, noRujukan, ppkRujukan,
|
||||
isRawatJalan.equals("T"), catatan, kodeDiagnosa, poliTujuan, kelasRawat, lakaLantas, lokasiLaka, noCm);
|
||||
return getJsonResponse(rujukan, OK);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/asuransiBPJS")
|
||||
public ModelAndView generateAsuransiBPJS(ModelAndView m,
|
||||
@RequestParam(value = "format", required = false) String format,
|
||||
@RequestParam(value = "noSep", required = true) String noSep) {
|
||||
|
||||
List list = pemakaianAsuransiService.findByNoSep(noSep);
|
||||
@RequestParam(value = "noSep") String noSep) {
|
||||
List<SuratEligibilitasAsuransi> list = pemakaianAsuransiService.findByNoSep(noSep);
|
||||
m.addObject("dataSource", list);
|
||||
m.addObject("tanggalReport", new Date());
|
||||
m.addObject("title", "SURAT ELIGIBILITAS PESERTA");
|
||||
m.addObject("format", "pdf");
|
||||
|
||||
if (format != null && !format.isEmpty()) {
|
||||
if (format != null && !format.isEmpty())
|
||||
m.addObject("format", format);
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-tanggal-pulang-sep", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> generateSep(@Valid @RequestBody Map<String, Object> vo, HttpServletRequest request){
|
||||
Map<String, Object> result = bridgingBpjs.UpdateTanggalPulang(
|
||||
(String)vo.get("noSep"), (String)vo.get("tglPlg"), (String)vo.get("ppkPelayanan"));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/mapping-sep", method = RequestMethod.GET)
|
||||
public ResponseEntity<Object> mappingSep(
|
||||
|
||||
@RequestParam(value = "noSep", required = false) String noSep,
|
||||
@RequestParam(value = "noTrans", required = false) String noTrans) {
|
||||
Object rujukan = bridgingBpjs.mappingTransaksiSep(noSep, noTrans);
|
||||
|
||||
return RestUtil.getJsonResponse(rujukan, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-tglPulang", method = RequestMethod.GET)
|
||||
public ResponseEntity<Object> updateTglPulang(
|
||||
|
||||
@RequestParam(value = "noSep", required = false) String noSep,
|
||||
@RequestMapping(value = "/update-tglPulang", method = GET)
|
||||
public ResponseEntity<Object> updateTglPulang(@RequestParam(value = "noSep", required = false) String noSep,
|
||||
@RequestParam(value = "tglPulang", required = false) String tglPulang) {
|
||||
Object rujukan = bridgingBpjs.updateTglPulang(noSep, tglPulang);
|
||||
|
||||
return RestUtil.getJsonResponse(rujukan, HttpStatus.OK);
|
||||
return getJsonResponse(rujukan, OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-sep", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String,Object>> generateSep(
|
||||
@RequestParam(value = "noSep", required = false) String noSep,
|
||||
@RequestParam(value = "noBpjs", required = false) String noBpjs,
|
||||
@RequestParam(value = "tanggalRujukan", required = false) String tanggalRujukan,
|
||||
@RequestParam(value = "tanggalSep", required = false) String tanggalSep,
|
||||
@RequestParam(value = "noRujukan", required = false) String noRujukan,
|
||||
|
||||
@RequestMapping(value = "/update-sep", method = GET)
|
||||
public ResponseEntity<Map<String, Object>> generateSep(
|
||||
@RequestParam(value = "noSep", required = false) String noSep,
|
||||
@RequestParam(value = "noBpjs", required = false) String noBpjs,
|
||||
@RequestParam(value = "tanggalRujukan", required = false) String tanggalRujukan,
|
||||
@RequestParam(value = "tanggalSep", required = false) String tanggalSep,
|
||||
@RequestParam(value = "noRujukan", required = false) String noRujukan,
|
||||
@RequestParam(value = "ppkRujukan", required = false) String ppkRujukan,
|
||||
@RequestParam(value = "isRawatJalan", required = false) String isRawatJalan,
|
||||
@RequestParam(value = "catatan", required = false) String catatan,
|
||||
@RequestParam(value = "kodeDiagnosa", required = false) String kodeDiagnosa,
|
||||
@RequestParam(value = "poliTujuan", required = false) String poliTujuan,
|
||||
@RequestParam(value = "isRawatJalan", required = false) String isRawatJalan,
|
||||
@RequestParam(value = "catatan", required = false) String catatan,
|
||||
@RequestParam(value = "kodeDiagnosa", required = false) String kodeDiagnosa,
|
||||
@RequestParam(value = "poliTujuan", required = false) String poliTujuan,
|
||||
@RequestParam(value = "kelasRawat", required = false) String kelasRawat,
|
||||
@RequestParam(value = "lakaLantas", required = false) String lakaLantas,
|
||||
@RequestParam(value = "lokasiLaka", required = false) String lokasiLaka,
|
||||
@RequestParam(value = "lakaLantas", required = false) String lakaLantas,
|
||||
@RequestParam(value = "lokasiLaka", required = false) String lokasiLaka,
|
||||
@RequestParam(value = "noCm", required = false) String noCm) {
|
||||
|
||||
Map<String,Object> updateSep = bridgingBpjs.updateSep(noSep, noBpjs, tanggalRujukan, tanggalSep, noRujukan, ppkRujukan, isRawatJalan.equals("T"), catatan, kodeDiagnosa, poliTujuan, kelasRawat, lakaLantas, lokasiLaka, noCm);
|
||||
return RestUtil.getJsonResponse(updateSep, HttpStatus.OK);
|
||||
Map<String, Object> updateSep = bridgingBpjs.updateSep(noSep, noBpjs, tanggalRujukan, tanggalSep, noRujukan,
|
||||
ppkRujukan, isRawatJalan.equals("T"), catatan, kodeDiagnosa, poliTujuan, kelasRawat, lakaLantas,
|
||||
lokasiLaka, noCm);
|
||||
return getJsonResponse(updateSep, OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/data-rujukan-rs/", method = RequestMethod.GET)
|
||||
public ResponseEntity<Object> getDataRujukanRS(@RequestParam(value = "noRujukan", required = true) String noRujukan) {
|
||||
|
||||
@RequestMapping(value = "/data-rujukan-rs/", method = GET)
|
||||
public ResponseEntity<Object> getDataRujukanRS(@RequestParam(value = "noRujukan") String noRujukan) {
|
||||
Object peserta = bridgingBpjs.getDataRujukanByNoRujukanRS(noRujukan);
|
||||
|
||||
return RestUtil.getJsonResponse(peserta, HttpStatus.OK);
|
||||
return getJsonResponse(peserta, OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/data-rujukan-pcare/", method = RequestMethod.GET)
|
||||
public ResponseEntity<Object> getDataRujukanPCare(@RequestParam(value = "noRujukan", required = true) String noRujukan) {
|
||||
Object peserta = bridgingBpjs.getDataRujukanByNoRujukanPcare(noRujukan);
|
||||
|
||||
return RestUtil.getJsonResponse(peserta, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/data-rujukan-byNoKartu-rs/", method = RequestMethod.GET)
|
||||
public ResponseEntity<Object> getDataRujukanByNoKartuRS(@RequestParam(value = "noKartu", required = true) String noKartu) {
|
||||
@RequestMapping(value = "/data-rujukan-byNoKartu-rs/", method = GET)
|
||||
public ResponseEntity<Object> getDataRujukanByNoKartuRS(@RequestParam(value = "noKartu") String noKartu) {
|
||||
Object peserta = bridgingBpjs.getDataRujukanByNoKartuRS(noKartu);
|
||||
return getJsonResponse(peserta, OK);
|
||||
}
|
||||
|
||||
return RestUtil.getJsonResponse(peserta, HttpStatus.OK);
|
||||
@RequestMapping(value = "/check-kepesertaan-by-nik/", method = GET)
|
||||
public ResponseEntity<Map<String, Object>> checkKepesertaanByNIK(@RequestParam(value = "nik") String nik) {
|
||||
Map<String, Object> peserta = bridgingBpjs.checkKepesertaanByNIK(nik);
|
||||
return getJsonResponse(peserta, OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/data-rujukan-byNoKartu-pcare/", method = RequestMethod.GET)
|
||||
public ResponseEntity<Object> getDataRujukanByNoKartuPCare(@RequestParam(value = "noKartu", required = true) String noKartu) {
|
||||
Object peserta = bridgingBpjs.getDataRujukanByKartuPcare(noKartu);
|
||||
|
||||
return RestUtil.getJsonResponse(peserta, HttpStatus.OK);
|
||||
@RequestMapping(value = "/get-monitor-klaim/", method = GET)
|
||||
public ResponseEntity<Map<String, Object>> getMonitorKlaim(@RequestParam(value = "tglMasuk") String tglMasuk,
|
||||
@RequestParam(value = "tglKeluar") String tglKeluar, @RequestParam(value = "kelasRawat") String kelasRawat,
|
||||
@RequestParam(value = "jnsPelayanan") String jnsPelayanan, @RequestParam(value = "cari") String cari,
|
||||
@RequestParam(value = "status") String status) {
|
||||
Map<String, Object> peserta = bridgingBpjs.getMonitoringVerifikasiKlaim(tglMasuk, tglKeluar, kelasRawat,
|
||||
jnsPelayanan, cari, status);
|
||||
return getJsonResponse(peserta, OK);
|
||||
}
|
||||
@RequestMapping(value = "/check-kepesertaan-by-nik/", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String,Object>> checkKepesertaanByNIK(@RequestParam(value = "nik", required = true) String nik) {
|
||||
Map<String,Object> peserta = bridgingBpjs.checkKepesertaanByNIK(nik);
|
||||
|
||||
return RestUtil.getJsonResponse(peserta, HttpStatus.OK);
|
||||
@RequestMapping(value = "/delete-sep/", method = GET)
|
||||
public ResponseEntity<Map<String, Object>> deleteSep(@RequestParam(value = "noSep") String noSep) {
|
||||
Map<String, Object> dataIntegrasi = bridgingBpjs.deleteSep(noSep);
|
||||
return getJsonResponse(dataIntegrasi, OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-referensi-diagnosa/", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String,Object>> getReferensiDiagnosa(@RequestParam(value = "nama", required = true) String nama) {
|
||||
Map<String,Object> peserta = bridgingBpjs.getReferensiDiagnosa(nama);
|
||||
|
||||
return RestUtil.getJsonResponse(peserta, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-referensi-faskes/", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String,Object>> getReferensiFaskes(@RequestParam(value = "nama", required = true) String nama,
|
||||
@RequestParam(value = "start", required = true) Integer start,
|
||||
@RequestParam(value = "limit", required = true) Integer limit) {
|
||||
Map<String,Object> peserta = bridgingBpjs.getReferensiFaskes(nama, start, limit);
|
||||
|
||||
return RestUtil.getJsonResponse(peserta, HttpStatus.OK);
|
||||
}
|
||||
@RequestMapping(value = "/get-monitor-klaim/", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String,Object>> getMonitorKlaim(@RequestParam(value = "tglMasuk", required = true) String tglMasuk,
|
||||
@RequestParam(value = "tglKeluar", required = true) String tglKeluar,
|
||||
@RequestParam(value = "kelasRawat", required = true) String kelasRawat,
|
||||
@RequestParam(value = "jnsPelayanan", required = true) String jnsPelayanan,
|
||||
@RequestParam(value = "cari", required = true) String cari,
|
||||
@RequestParam(value = "status", required = true) String status) {
|
||||
Map<String,Object> peserta = bridgingBpjs.getMonitoringVerifikasiKlaim(tglMasuk, tglKeluar, kelasRawat, jnsPelayanan, cari, status);
|
||||
|
||||
return RestUtil.getJsonResponse(peserta, HttpStatus.OK);
|
||||
}
|
||||
@RequestMapping(value = "/get-integrasi-inacbg/", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String,Object>> getIntegrasiSepInacbg(@RequestParam(value = "noSep", required = true) String noSep) {
|
||||
Map<String,Object> dataIntegrasi = bridgingBpjs.getDataIntegrasiSepInacbg(noSep);
|
||||
|
||||
return RestUtil.getJsonResponse(dataIntegrasi, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/delete-sep/", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String,Object>> deleteSep(@RequestParam(value = "noSep", required = true) String noSep) {
|
||||
Map<String,Object> dataIntegrasi = bridgingBpjs.deleteSep(noSep);
|
||||
|
||||
return RestUtil.getJsonResponse(dataIntegrasi, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-poli", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String,Object>> getPoli() {
|
||||
Map<String,Object> dataIntegrasi = bridgingBpjs.pencarianDataPoli();
|
||||
return RestUtil.getJsonResponse(dataIntegrasi, HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,14 +7,12 @@ import com.jasamedika.medifirst2000.notification.MessagePublisher;
|
||||
import com.jasamedika.medifirst2000.security.model.UserAuthentication;
|
||||
import com.jasamedika.medifirst2000.security.service.TokenAuthenticationService;
|
||||
import com.jasamedika.medifirst2000.service.ActivityPegawaiService;
|
||||
import com.jasamedika.medifirst2000.service.AgamaService;
|
||||
import com.jasamedika.medifirst2000.service.JadwalDokterService;
|
||||
import com.jasamedika.medifirst2000.service.LoginUserService;
|
||||
import com.jasamedika.medifirst2000.util.CommonUtil;
|
||||
import com.jasamedika.medifirst2000.util.DateUtil;
|
||||
import com.jasamedika.medifirst2000.util.JsonUtil;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.AgamaVO;
|
||||
import com.jasamedika.medifirst2000.vo.LoginUserVO;
|
||||
import com.jasamedika.medifirst2000.vo.custom.AuthVO;
|
||||
import org.slf4j.Logger;
|
||||
@ -29,7 +27,10 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Controller class for Authenticate Business
|
||||
@ -39,6 +40,7 @@ import java.util.*;
|
||||
@RestController
|
||||
@RequestMapping("/auth")
|
||||
public class AuthenticateController {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AuthenticateController.class);
|
||||
|
||||
protected Map<String, String> mapHeaderMessage = new HashMap<>();
|
||||
@ -52,9 +54,6 @@ public class AuthenticateController {
|
||||
@Autowired
|
||||
private LoginUserService loginUserService;
|
||||
|
||||
@Autowired
|
||||
public AgamaService<AgamaVO> agamaService;
|
||||
|
||||
@Autowired
|
||||
private ActivityPegawaiService activityPegawaiService;
|
||||
|
||||
@ -91,7 +90,7 @@ public class AuthenticateController {
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.BAD_REQUEST, mapHeaderMessage);
|
||||
}
|
||||
|
||||
LOGGER.info("starting logging {}", vo.getNamaUser() + " at " + DateUtil.getIndonesianStringDate(new Date()));
|
||||
LOGGER.info("starting sign-in {}", vo.getNamaUser() + " at " + DateUtil.getIndonesianStringDate(new Date()));
|
||||
|
||||
try {
|
||||
mapHeaderMessage = new HashMap<>();
|
||||
@ -104,7 +103,6 @@ public class AuthenticateController {
|
||||
String token = tokenAuthenticationService.addAuthentication(httpResponse,
|
||||
new UserAuthentication(new User(loginUserVo.getNamaUser(), loginUserVo.getKataSandi(),
|
||||
Collections.singletonList(authority))));
|
||||
|
||||
boolean isSupervising = request.getHeader(Constants.HttpHeader.SUPERVISING) != null;
|
||||
if (isSupervising) { // supervising login
|
||||
mapHeaderMessage.put("X-AUTH-SUPERVISOR-TOKEN", token);
|
||||
@ -139,7 +137,7 @@ public class AuthenticateController {
|
||||
public ResponseEntity<AuthVO> signOut(@RequestBody AuthVO vo, HttpServletResponse httpResponse) {
|
||||
LoginUserVO loginUserVO = loginUserService.findById(vo.getId());
|
||||
|
||||
LOGGER.info("starting logout {}",
|
||||
LOGGER.info("starting sign-out {}",
|
||||
loginUserVO.getNamaUser() + " at " + DateUtil.getIndonesianStringDate(new Date()));
|
||||
|
||||
Integer idPegawai = 0;
|
||||
@ -158,7 +156,8 @@ public class AuthenticateController {
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.BAD_REQUEST, mapHeaderMessage);
|
||||
}
|
||||
|
||||
LOGGER.info("starting logging {}", vo.getNamaUser() + " at " + DateUtil.getIndonesianStringDate(new Date()));
|
||||
LOGGER.info("starting sign-in-mobile {}",
|
||||
vo.getNamaUser() + " at " + DateUtil.getIndonesianStringDate(new Date()));
|
||||
|
||||
try {
|
||||
mapHeaderMessage = new HashMap<>();
|
||||
@ -201,7 +200,7 @@ public class AuthenticateController {
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOGGER.error("Signing-in error {}", ex.getMessage());
|
||||
LOGGER.error("Signing-in-mobile error {}", ex.getMessage());
|
||||
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
@ -212,7 +211,7 @@ public class AuthenticateController {
|
||||
public ResponseEntity<AuthVO> signOutMobile(@RequestBody AuthVO vo, HttpServletResponse httpResponse) {
|
||||
LoginUserVO loginUserVO = loginUserService.findById(vo.getId());
|
||||
|
||||
LOGGER.info("starting logout {}",
|
||||
LOGGER.info("starting sign-out-mobile {}",
|
||||
loginUserVO.getNamaUser() + " at " + DateUtil.getIndonesianStringDate(new Date()));
|
||||
|
||||
Integer idPegawai = 0;
|
||||
@ -221,4 +220,5 @@ public class AuthenticateController {
|
||||
loggingSystemAsynchronous.saveSignOutLog(loginUserVO.getNamaUser(), idPegawai);
|
||||
return RestUtil.getJsonResponse(vo, HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,182 +1,163 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.B3RuanganInputDataService;
|
||||
import com.jasamedika.medifirst2000.vo.B3RuanganInputDataVO;
|
||||
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.B3RuanganInputDataService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.B3DaftarBahanBerbahayaVO;
|
||||
import com.jasamedika.medifirst2000.vo.B3RuanganInputDataVO;
|
||||
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.getJsonHttptatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/b3-Ruangan-Input-Data")
|
||||
public class B3RuanganInputDataController extends LocaleController<B3RuanganInputDataVO>{
|
||||
public class B3RuanganInputDataController extends LocaleController<B3RuanganInputDataVO> {
|
||||
|
||||
@Autowired
|
||||
private B3RuanganInputDataService service;
|
||||
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(B3RuanganInputDataController.class);
|
||||
|
||||
@RequestMapping(value = "/get-login-petugas", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-login-petugas", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getLoginUser(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.getUserLogin();
|
||||
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 = service.getUserLogin();
|
||||
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 getLoginUser", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getUserLogin", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getLoginUser", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getUserLogin", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-ruangan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-ruangan", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getRuangan(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.getRuangan();
|
||||
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 = service.getRuangan();
|
||||
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 getRuangan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getRuangan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getRuangan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getRuangan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-stok-global", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-stok-global", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getB3StokGlobal(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.getB3StokGlobal();
|
||||
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 = service.getB3StokGlobal();
|
||||
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 getB3StokGlobal", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getB3StokGlobal", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getB3StokGlobal", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getB3StokGlobal", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-bahan-b3", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveB3RuanganInputData(@Valid @RequestBody B3RuanganInputDataVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.saveB3RuanganInputData(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-bahan-b3", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveB3RuanganInputData(@Valid @RequestBody B3RuanganInputDataVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.saveB3RuanganInputData(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 saveB3RuanganInputData", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveB3RuanganInputData", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when saveB3RuanganInputData", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveB3RuanganInputData", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-bahan-b3", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-bahan-b3", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getB3RuanganInputDataByRuangan(
|
||||
@RequestParam(value = "ruanganId", required = true) Integer ruanganId, HttpServletRequest request) {
|
||||
@RequestParam(value = "ruanganId") Integer ruanganId, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.getB3RuanganInput(ruanganId);
|
||||
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 = service.getB3RuanganInput(ruanganId);
|
||||
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 getB3RuanganInputDataByRuangan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getB3RuanganInput", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getB3RuanganInputDataByRuangan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getB3RuanganInput", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-bahan-b3", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> updateB3DaftarBahanBerbahaya(@Valid @RequestBody B3DaftarBahanBerbahayaVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Integer result = service.updateB3DaftarBahanBerbahaya(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(vo.getNoRec(), HttpStatus.OK,mapHeaderMessage);
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when updateB3DaftarBahanBerbahaya", 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 updateB3DaftarBahanBerbahaya", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/delete-bahan-b3", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Boolean> deleteB3DaftarBahanBerbahaya(
|
||||
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
|
||||
@RequestMapping(value = "/delete-bahan-b3", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Boolean> deleteB3DaftarBahanBerbahaya(@RequestParam(value = "noRec") String noRec,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Boolean result = service.deleteB3DaftarBahanBerbahaya(noRec);
|
||||
if (result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when deleteB3DaftarBahanBerbahaya", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when deleteB3DaftarBahanBerbahaya", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when deleteB3DaftarBahanBerbahaya", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when deleteB3DaftarBahanBerbahaya", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,193 +1,129 @@
|
||||
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.BakuMutu;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.BakuMutuService;
|
||||
import com.jasamedika.medifirst2000.vo.BakuMutuVO;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
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.BakuMutuService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.BakuMutuVO;
|
||||
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.getJsonHttptatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/baku-mutu")
|
||||
public class BakuMutuController extends LocaleController<BakuMutuVO> {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BakuMutuService bakuMutuService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(BakuMutuController.class);
|
||||
|
||||
@RequestMapping(value = "/save-baku-mutu/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody BakuMutuVO vo,HttpServletRequest request) {
|
||||
|
||||
try{
|
||||
private BakuMutuService<BakuMutu> bakuMutuService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(BakuMutuController.class);
|
||||
|
||||
@RequestMapping(value = "/save-baku-mutu/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody BakuMutuVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = bakuMutuService.addBakuMutu(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 Baku Mutu", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when add Baku Mutu", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Baku Mutu", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when add Baku Mutu", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-baku-mutu/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody BakuMutuVO vo,HttpServletRequest request) {
|
||||
|
||||
try{
|
||||
Map<String, Object> result = bakuMutuService.addBakuMutu(vo);
|
||||
|
||||
@RequestMapping(value = "/find-all-baku-mutu/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllVO(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = bakuMutuService.findAllBakuMutu();
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when update Baku Mutu", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when get all baku mutu", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when update Baku Mutu", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when get all baku mutu", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-all-baku-mutu/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=bakuMutuService.findAllBakuMutu();
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get all baku mutu", 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 get all baku mutu", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/delete-baku-mutu", method = RequestMethod.GET)
|
||||
public ResponseEntity<String> deleteBakuMutu(@RequestParam(value = "id", required = true) Integer id) {
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-baku-mutu-parent", method = GET)
|
||||
public ResponseEntity<Map<String, Object>> getBakuMutuParent(HttpServletRequest request) {
|
||||
try {
|
||||
if (bakuMutuService.deleteBakuMutu(id) == true)
|
||||
return RestUtil.getJsonResponse(id +" Dihapus", HttpStatus.CREATED);
|
||||
|
||||
Map<String, Object> bakuMutu = bakuMutuService.getBakuMutuParent();
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(bakuMutu, OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when delete BakuMutu", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when get Baku Mutu parent", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when delete BakuMutu", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when get Baku Mutu parent", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-baku-mutu-parent", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String,Object>> getBakuMutuParent(HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/get-baku-mutu-child", method = GET)
|
||||
public ResponseEntity<Map<String, Object>> getBakuMutuChild(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> bakuMutu = bakuMutuService.getBakuMutuParent();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(bakuMutu, HttpStatus.OK, mapHeaderMessage);
|
||||
Map<String, Object> bakuMutu = bakuMutuService.getBakuMutuChild();
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(bakuMutu, HttpStatus.OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get Baku Mutu", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when get Baku Mutu child", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get Baku Mutu", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when get Baku Mutu child", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-baku-mutu-child", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String,Object>> getBakuMutuChild(HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/get-baku-mutu-by-id", method = GET)
|
||||
public ResponseEntity<Map<String, Object>> bakuMutuById(HttpServletRequest request,
|
||||
@RequestParam(value = "id") Integer id) {
|
||||
try {
|
||||
Map<String,Object> bakuMutu = bakuMutuService.getBakuMutuChild();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(bakuMutu, HttpStatus.OK, mapHeaderMessage);
|
||||
Map<String, Object> bakuMutu = bakuMutuService.bakuMutuById(id);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(bakuMutu, HttpStatus.OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get Baku Mutu", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when get Baku Mutu", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get Baku Mutu", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when get Baku Mutu", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-baku-mutu-by-id", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String,Object>> bakuMutuById(HttpServletRequest request,@RequestParam(value = "id", required = true) Integer id) {
|
||||
try {
|
||||
Map<String,Object> bakuMutu = bakuMutuService.bakuMutuById(id);
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(bakuMutu, HttpStatus.OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get Baku Mutu", 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 get Baku Mutu", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,189 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.dao.KelasDao;
|
||||
import com.jasamedika.medifirst2000.dao.RuanganDao;
|
||||
import com.jasamedika.medifirst2000.dto.BukuRegisterMasukDto;
|
||||
import com.jasamedika.medifirst2000.service.ReportingPelayananRekamMedisService;
|
||||
import com.jasamedika.medifirst2000.util.DateUtil;
|
||||
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
|
||||
|
||||
/**
|
||||
* Controller class for Registrasi Pasien Business
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cetakan")
|
||||
public class CetakanController extends LocaleController<RegistrasiPelayananVO>
|
||||
implements IBaseRestController<RegistrasiPelayananVO> {
|
||||
@Autowired
|
||||
private ReportingPelayananRekamMedisService reportingPelayananRekamMedisService;
|
||||
|
||||
@Autowired
|
||||
private RuanganDao ruanganDao;
|
||||
|
||||
@Autowired
|
||||
private KelasDao kelasDao;
|
||||
|
||||
private String formatBulan(Integer bulan){
|
||||
String bulanString="";
|
||||
switch(bulan){
|
||||
case 1 :
|
||||
bulanString="januari";
|
||||
break;
|
||||
case 2 :
|
||||
bulanString="februari";
|
||||
break;
|
||||
case 3 :
|
||||
bulanString="maret";
|
||||
break;
|
||||
case 4 :
|
||||
bulanString="april";
|
||||
break;
|
||||
case 5 :
|
||||
bulanString="mei";
|
||||
break;
|
||||
case 6 :
|
||||
bulanString="juni";
|
||||
break;
|
||||
case 7 :
|
||||
bulanString="juli";
|
||||
break;
|
||||
case 8 :
|
||||
bulanString="agustus";
|
||||
break;
|
||||
case 9 :
|
||||
bulanString="september";
|
||||
break;
|
||||
case 10 :
|
||||
bulanString="oktober";
|
||||
break;
|
||||
case 11 :
|
||||
bulanString="november";
|
||||
break;
|
||||
case 12 :
|
||||
bulanString="desember";
|
||||
break;
|
||||
}
|
||||
return bulanString;
|
||||
}
|
||||
|
||||
@RequestMapping("/lapBukuRegisterMasukRi")
|
||||
public ModelAndView generateLapBukuRegisterMasukRi(ModelAndView m,
|
||||
@RequestParam(value = "format", required = false) String format,
|
||||
@RequestParam(value = "startDate", required = true) String startDate,
|
||||
@RequestParam(value = "endDate", required = true) String endDate,
|
||||
@RequestParam(value = "ruangan", required = true) Integer ruangan) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
String month=(formatBulan(Integer.valueOf(new SimpleDateFormat("MM").format(new Date()))));
|
||||
String monthFirstCaplock=Character.toString(month.charAt(0)).toUpperCase()+month.substring(1);
|
||||
String monthAllCaplock=month.toUpperCase();
|
||||
List<BukuRegisterMasukDto> bukuRegisterMasukList = new ArrayList<BukuRegisterMasukDto>();
|
||||
|
||||
List<Object[]> list = reportingPelayananRekamMedisService.findAntrianPasienDiPeriksaByRuanganPeriode(ruangan,startDate,endDate);
|
||||
for (Object[] data : list) {
|
||||
String noPendaftaran=(String) data[0];
|
||||
Date tglPendaftaran=(Date) data[1];
|
||||
String noCm=(String) data[2];
|
||||
String namaPasien=(String) data[3];
|
||||
String jenisKelamin=(String) data[4];
|
||||
String jenisPasien=(String) data[5];
|
||||
String statusPasienRs=(String) data[6];
|
||||
String statusPasien=(String) data[7];
|
||||
String caraMasuk=(String) data[8];
|
||||
String ruanganPerujuk=(String) data[9];
|
||||
String statusKeluar=(String) data[10];
|
||||
String statusPulang=(String) data[11];
|
||||
String kondisiPulang=(String) data[12];
|
||||
Date tglKeluar=(Date) data[13];
|
||||
String noKamar=(String) data[14];
|
||||
String noBed=(String) data[15];
|
||||
String kelasPelayanan=(String) data[16];
|
||||
String kasusPenyakit=(String) data[17];
|
||||
BukuRegisterMasukDto dto = new BukuRegisterMasukDto();
|
||||
dto.setCaraMasuk(caraMasuk);
|
||||
dto.setJenisKelamin(jenisKelamin);
|
||||
dto.setJenisPasien(jenisPasien);
|
||||
dto.setKasusPenyakit(kasusPenyakit);
|
||||
dto.setKelasPelayanan(kelasPelayanan);
|
||||
dto.setKondisiPulang(kondisiPulang);
|
||||
dto.setNoKamar(noKamar);
|
||||
dto.setNamaPasien(namaPasien);
|
||||
dto.setNoBed(noBed);
|
||||
dto.setNoCm(noCm);
|
||||
dto.setNoPendaftaran(noPendaftaran);
|
||||
dto.setRuanganPerujuk(ruanganPerujuk);
|
||||
dto.setStatusKeluar(statusKeluar);
|
||||
dto.setStatusPasien(statusPasien);
|
||||
dto.setStatusPasienRs(statusPasienRs);
|
||||
dto.setStatusPulang(statusPulang);
|
||||
dto.setTglKeluar(DateUtil.formatDate(tglKeluar));
|
||||
dto.setTglPendaftaran(DateUtil.formatDate(tglPendaftaran));
|
||||
bukuRegisterMasukList.add(dto);
|
||||
}
|
||||
|
||||
m.addObject("dataSource", bukuRegisterMasukList);
|
||||
m.addObject("startDate", startDate);
|
||||
m.addObject("endDate", endDate);
|
||||
m.addObject("tanggalReport", (new SimpleDateFormat("dd").format(new Date()))+" "+
|
||||
monthFirstCaplock+" " + (new SimpleDateFormat("YYYY").format(new Date())));
|
||||
m.addObject("ruangan", ruanganDao.findOne(ruangan).getNamaRuangan());
|
||||
m.addObject("format", "pdf");
|
||||
|
||||
if (format != null && !format.isEmpty()) {
|
||||
m.addObject("format", format);
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<RegistrasiPelayananVO>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<RegistrasiPelayananVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(RegistrasiPelayananVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(RegistrasiPelayananVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<RegistrasiPelayananVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,188 +1,108 @@
|
||||
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.CheckIn;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.CheckInService;
|
||||
import com.jasamedika.medifirst2000.vo.CheckInVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.CheckInService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.CheckInVO;
|
||||
import com.jasamedika.medifirst2000.vo.PapKebutuhanEdukasiVO;
|
||||
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.getJsonHttptatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/check-in")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class CheckInController extends LocaleController<CheckInVO> implements IBaseRestController<CheckInVO> {
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class CheckInController extends LocaleController<CheckInVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CheckInController.class);
|
||||
|
||||
@Autowired
|
||||
private CheckInService checkInService;
|
||||
private CheckInService<CheckIn> checkInService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<CheckInVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<CheckInVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(CheckInVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(CheckInVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<CheckInVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-check-in/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody CheckInVO vo, HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/save-check-in/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody CheckInVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=checkInService.addCheckIn(vo);
|
||||
Map<String, Object> result = checkInService.addCheckIn(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 CheckIn", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when save check in", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add CheckIn", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when save check in", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-check-in/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody CheckInVO vo,HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/get-check-in-by-norec", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getCheckInByNoRec(@RequestParam(value = "noRec") String noRec,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = checkInService.updateCheckIn(vo);
|
||||
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
result.put("message", "Berhasil");
|
||||
}else{
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
result.put("message", "Gagal");
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED);
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add CheckIn", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add CheckIn", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
value = "/get-check-in-by-norec",
|
||||
method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getCheckInByNoRec(
|
||||
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request){
|
||||
|
||||
try {
|
||||
Map<String,Object> result = this.checkInService.findByNoRec(noRec);
|
||||
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
|
||||
} else{
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
|
||||
|
||||
Map<String, Object> result = this.checkInService.findByNoRec(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 getCheckInByNoRec", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when get check in by norec", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getCheckInByNoRec", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
value = "/get-check-in-by-norec-antrian",
|
||||
method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getCheckInByNoRecAntrian(
|
||||
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request){
|
||||
|
||||
try {
|
||||
Map<String,Object> result = this.checkInService.getCheckInByNoRecAntrian(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 getCheckInByNoRecAntrian", 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 getCheckInByNoRecAntrian", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got JpaSystemException {} when get check in by norec", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-check-in-by-norec-antrian", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getCheckInByNoRecAntrian(@RequestParam(value = "noRec") String noRec,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = this.checkInService.getCheckInByNoRecAntrian(noRec);
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
|
||||
} else {
|
||||
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
|
||||
|
||||
}
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got ServiceVOException {} when get check in by norec antrian", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get check in by norec antrian", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,311 +1,176 @@
|
||||
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.ItPerbaikanService;
|
||||
import com.jasamedika.medifirst2000.vo.ItPelaksanaanPerbaikanVO;
|
||||
import com.jasamedika.medifirst2000.vo.ItPerbaikanVO;
|
||||
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.ItPerbaikanService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.ItPelaksanaanPerbaikanVO;
|
||||
import com.jasamedika.medifirst2000.vo.ItPerbaikanVO;
|
||||
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.getJsonHttptatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/it-perbaikan")
|
||||
public class ItPerbaikanController extends LocaleController<ItPerbaikanVO>{
|
||||
|
||||
public class ItPerbaikanController extends LocaleController<ItPerbaikanVO> {
|
||||
|
||||
@Autowired
|
||||
private ItPerbaikanService service;
|
||||
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ItPerbaikanController.class);
|
||||
|
||||
@RequestMapping(value = "/get-no-order", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-no-order", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getNoOrder(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.getNoOrderTable();
|
||||
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 getJadwalPemeliharaan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when get no order", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getJadwalPemeliharaan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when get no order", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@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 ItPerbaikanVO vo, HttpServletRequest request) {
|
||||
@RequestMapping(value = "/save-permintaan-perbaikan", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> savePermintaanPerbaikan(@Valid @RequestBody ItPerbaikanVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.savePermintaanPerbaikan(vo);
|
||||
try{
|
||||
Map<String, Object> result = service.savePermintaanPerbaikan(vo);
|
||||
try {
|
||||
BroadcastMessageOther("PermintaanPerbaikan", result);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
} catch (Exception ex) {
|
||||
throw new ServiceVOException(ex.getMessage());
|
||||
}
|
||||
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 savePermintaanPerbaikan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when save permintaan perbaikan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when savePermintaanPerbaikan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when save permintaan perbaikan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(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 = service.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 = service.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.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when find ruangan asset", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getRuanganRegistrasiAset", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when find ruangan asset", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-asset-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){
|
||||
try {
|
||||
Map<String,Object> result = service.getAsetPerbaikan(id);
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
} else{
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
|
||||
}
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when getAsetPerbaikan", 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 getAsetPerbaikan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
// @RequestMapping(value = "/get-all-permintaan-perbaikan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
// public ResponseEntity<Map<String, Object>> getAllPermintaanPerbaikan(
|
||||
// @RequestParam(value = "tanggalAwal", required = false) String tanggalAwal,
|
||||
// @RequestParam(value = "tanggalAkhir", required = false) String tanggalAkhir,
|
||||
// HttpServletRequest request) {
|
||||
// try {
|
||||
// Map<String,Object> result = service.getAllPermintaanPerbaikan(tanggalAwal,tanggalAkhir);
|
||||
// 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 getAllPermintaanPerbaikan", 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 getAllPermintaanPerbaikan", jse.getMessage());
|
||||
// addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
// return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
// }
|
||||
// }
|
||||
|
||||
@RequestMapping(value = "/get-one-permintaan-perbaikan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getOnePermintaanPerbaikan(
|
||||
@RequestParam(value = "noRec", required = true) String noRec,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.getOnePermintaanPerbaikan(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 getOnePermintaanPerbaikan", 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 getOnePermintaanPerbaikan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-pelaksanaan-perbaikan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> savePelaksanaanPerbaikan(@Valid @RequestBody ItPelaksanaanPerbaikanVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
//Map<String,Object> result = service.savePelaksanaanPerbaikan(vo);
|
||||
Map<String,Object> result = this.service.savePelaksanaanPerbaikanRev1(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 savePelaksanaanPerbaikan", 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 savePelaksanaanPerbaikan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-all-It-perbaikan-by-norec", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllItPerbaikanByNoRec(
|
||||
@RequestParam(value = "noRec", required = true) String noRec,
|
||||
@RequestMapping(value = "/find-asset-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 = service.getAllItPerbaikanByNoRec(noRec);
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
} else{
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
|
||||
Map<String, Object> result = service.getAsetPerbaikan(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 getAllItPerbaikanByNoRec", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when find asset by ruangan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getAllItPerbaikanByNoRec", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when find asset by ruangan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/delete-list-perbaikan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> deleteListPerbaikann(
|
||||
@RequestParam(value = "noRec", required = true) String noRec,
|
||||
|
||||
@RequestMapping(value = "/save-pelaksanaan-perbaikan", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> savePelaksanaanPerbaikan(@Valid @RequestBody ItPelaksanaanPerbaikanVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = this.service.savePelaksanaanPerbaikanRev1(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 save pelaksanaan perbaikan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when save pelaksanaan perbaikan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/delete-list-perbaikan", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> deleteListPerbaikann(@RequestParam(value = "noRec") String noRec,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Boolean status = service.deleteItPerbaikan(noRec);
|
||||
if (status){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse("noRec : "+noRec, HttpStatus.OK);
|
||||
} else{
|
||||
return RestUtil.getJsonResponse("noRec : null", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when deleteListPerbaikann", 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 deleteListPerbaikann", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-data-perbaikan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> updateDataPerbaikan(@Valid @RequestBody ItPerbaikanVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.updatePermintaanPerbaikan(vo);
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
}
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when updateJadwalPerbaikanDariRuangan", 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 getJadwalPerbaikanDariRuangan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-pelaksanaan-perbaikan-all",
|
||||
method=RequestMethod.GET,
|
||||
produces=MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getPelaksanaanPerbaikanAll(
|
||||
@RequestParam("startDate")String startDate, @RequestParam("endDate")String endDate, HttpServletRequest request) {
|
||||
Map<String, Object> result = this.service.getPelaksanaanPerbaikIt(startDate, endDate);
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-pelaksanaan-perbaikan-by-noRec",
|
||||
method=RequestMethod.GET,
|
||||
produces=MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getPelaksanaanPerbaikanbyNoRec(
|
||||
@RequestParam("noRec")String noRec, HttpServletRequest request) {
|
||||
Map<String, Object> result = this.service.getPelaksanaanPerbaikItByNoRec(noRec);
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-kategori-kerusakan-iti",
|
||||
method=RequestMethod.GET,
|
||||
produces=MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getKategoriKerusakan(HttpServletRequest request) {
|
||||
Map<String, Object> result = this.service.getKategoriKerusakan();
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-asset-by-kelompok-produk",
|
||||
method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAssetByKelompokProduk(
|
||||
@RequestParam(value = "id", required = true) Integer id,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.getAssetByKelompokProduk(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);
|
||||
if (status) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse("noRec : " + noRec, OK);
|
||||
} else {
|
||||
return getJsonResponse("noRec : null", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get-asset-by-kelompok-produk", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when delete list perbaikan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get-asset-by-kelompok-produk", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when delete list perbaikan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-kategori-kerusakan-iti", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getKategoriKerusakan(HttpServletRequest request) {
|
||||
return this.service.getKategoriKerusakan();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,42 +1,38 @@
|
||||
package com.jasamedika.medifirst2000.controller.base;
|
||||
|
||||
import com.jasamedika.medifirst2000.base.vo.BaseModelVO;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
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.ResponseBody;
|
||||
|
||||
import com.jasamedika.medifirst2000.base.vo.BaseModelVO;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.*;
|
||||
|
||||
/**
|
||||
* Base Rest Operation for Controller Class
|
||||
*
|
||||
* @author Roberto
|
||||
*/
|
||||
public interface IBaseRestController<V extends BaseModelVO> extends
|
||||
IRestPageController<V> {
|
||||
public interface IBaseRestController<V extends BaseModelVO> extends IRestPageController<V> {
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/{id}", method = GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<V> getVO(@PathVariable("id") Integer id);
|
||||
ResponseEntity<V> getVO(@PathVariable("id") Integer id);
|
||||
|
||||
@RequestMapping(value = "/", method = RequestMethod.PUT, consumes = { "application/json" })
|
||||
@RequestMapping(value = "/", method = PUT, consumes = { "application/json" })
|
||||
@ResponseBody
|
||||
public ResponseEntity<String> addVO(@RequestBody V vo);
|
||||
ResponseEntity<String> addVO(@RequestBody V vo);
|
||||
|
||||
@RequestMapping(value = "/", method = RequestMethod.POST, consumes = { "application/json" })
|
||||
@RequestMapping(value = "/", method = POST, consumes = { "application/json" })
|
||||
@ResponseBody
|
||||
public ResponseEntity<String> editVO(@RequestBody V vo);
|
||||
ResponseEntity<String> editVO(@RequestBody V vo);
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
|
||||
@RequestMapping(value = "/{id}", method = DELETE)
|
||||
@ResponseBody
|
||||
public ResponseEntity<String> deleteVO(@PathVariable("id") Integer id);
|
||||
ResponseEntity<String> deleteVO(@PathVariable("id") Integer id);
|
||||
|
||||
@RequestMapping(value = "/", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/", method = GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<List<V>> getAllVO();
|
||||
ResponseEntity<List<V>> getAllVO();
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user