Update controller

Clean code
This commit is contained in:
Salman Manoe 2025-01-07 15:19:00 +07:00
parent 776ffe55a3
commit 711084879d
22 changed files with 2002 additions and 5236 deletions

View File

@ -1,173 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.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.service.LaundryService;
import com.jasamedika.medifirst2000.service.SaranaPrasaranaReportingService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
/**
* Controller class for Sarana Prasarana Business
*
*/
@RestController
@RequestMapping("/sarana-prasarana-reporting")
public class SaranaPrasaranaReportingController extends LocaleController<RegistrasiPelayananVO>
implements IBaseRestController<RegistrasiPelayananVO> {
@Autowired
private SaranaPrasaranaReportingService saranaPrasaranaReportingService;
@RequestMapping("/lapDaftarPengeringan")
public ModelAndView generateDaftarPengeringan(ModelAndView m,
@RequestParam(value = "startPeriode", required = true) String startPeriode,
@RequestParam(value = "endPeriode", required = true) String endPeriode,
@RequestParam(value = "format", required = false) String format) {
Map<String, Object> result = saranaPrasaranaReportingService.getDaftarPengeringan(startPeriode,endPeriode);
m.addObject("dataSource", result.get("daftarPengeringan"));
m.addObject("startPeriode", startPeriode);
m.addObject("endPeriode", endPeriode);
m.addObject("format", "pdf");
if (format != null && !format.isEmpty()) {
m.addObject("format", format);
}
return m;
}
@RequestMapping("/daftarPengambilanLinenKotor")
public ModelAndView generateDaftarPengambilanLinenKotor(ModelAndView m,
@RequestParam(value = "startPeriode", required = true) String startPeriode,
@RequestParam(value = "endPeriode", required = true) String endPeriode,
@RequestParam(value = "format", required = false) String format) {
Map<String, Object> result = saranaPrasaranaReportingService.getDaftarPengambilanLinenKotor(startPeriode,endPeriode);
m.addObject("dataSource", result.get("pengambilanLinenKotor"));
m.addObject("startPeriode", startPeriode);
m.addObject("endPeriode", endPeriode);
m.addObject("format", "pdf");
if (format != null && !format.isEmpty()) {
m.addObject("format", format);
}
return m;
}
@RequestMapping("/daftarPermintaanPerbaikanDariRuangan")
public ModelAndView generateDaftarPermintaanPerbaikanDariRuangan(ModelAndView m,
@RequestParam(value = "startPeriode", required = true) String startPeriode,
@RequestParam(value = "endPeriode", required = true) String endPeriode,
@RequestParam(value = "format", required = false) String format) {
Map<String, Object> result = saranaPrasaranaReportingService.getAllPermintaanPerbaikan(startPeriode,endPeriode);
m.addObject("dataSource", result.get("permintaanPerbaikan"));
m.addObject("startPeriode", startPeriode);
m.addObject("endPeriode", endPeriode);
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;
}
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;
}
}

View File

@ -1,194 +1,119 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.domain.Specifications;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource; import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController; import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.entities.SasaranStrategis; import com.jasamedika.medifirst2000.entities.SasaranStrategis;
import com.jasamedika.medifirst2000.exception.ServiceVOException; import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.SasaranStrategisService; import com.jasamedika.medifirst2000.service.SasaranStrategisService;
import com.jasamedika.medifirst2000.util.rest.RestUtil; import com.jasamedika.medifirst2000.vo.PasienVO;
import com.jasamedika.medifirst2000.vo.SasaranStrategisVO; import com.jasamedika.medifirst2000.vo.SasaranStrategisVO;
import net.kaczmarzyk.spring.data.jpa.domain.Equal; import net.kaczmarzyk.spring.data.jpa.domain.Equal;
import net.kaczmarzyk.spring.data.jpa.domain.GreaterThanOrEqual; import net.kaczmarzyk.spring.data.jpa.domain.GreaterThanOrEqual;
import net.kaczmarzyk.spring.data.jpa.domain.LessThanOrEqual; import net.kaczmarzyk.spring.data.jpa.domain.LessThanOrEqual;
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec; import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.domain.Specifications;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Collection;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController @RestController
@RequestMapping("/sasaran-strategis") @RequestMapping("/sasaran-strategis")
public class SasaranStrategisController extends LocaleController<SasaranStrategisVO> implements public class SasaranStrategisController extends LocaleController<SasaranStrategisVO> {
IBaseRestController<SasaranStrategisVO> {
private static final Logger LOGGER = getLogger(SasaranStrategisController.class);
@Autowired @Autowired
private SasaranStrategisService sasaranStrategisService; private SasaranStrategisService sasaranStrategisService;
private static final Logger LOGGER = LoggerFactory @RequestMapping(value = "/save-sasaran-strategis/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
.getLogger(SasaranStrategisController.class); public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody SasaranStrategisVO vo,
HttpServletRequest request) {
@RequestMapping(value = "/save-sasaran-strategis/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody SasaranStrategisVO vo, HttpServletRequest request) {
try { try {
Map<String,Object> result=sasaranStrategisService.addSasaranStrategis(vo); Map<String, Object> result = sasaranStrategisService.addSasaranStrategis(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request )); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Sasaran Strategis", e.getMessage()); LOGGER.error("Got ServiceVOException {} when addSasaranStrategis", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, e.getMessage());
e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Sasaran Strategis", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when addSasaranStrategis", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
} }
} }
@RequestMapping(value = "/update-sasaran-strategis/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/find-all-sasaran-strategis/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody SasaranStrategisVO vo, HttpServletRequest request) { public ResponseEntity<Map<String, Object>> getAllVO(HttpServletRequest request) {
try { try {
Map<String,Object> result=sasaranStrategisService.updateSasaranStrategis(vo); Map<String, Object> result = sasaranStrategisService.findAllSasaranStrategis();
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request )); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Sasaran Strategis", e.getMessage()); LOGGER.error("Got ServiceVOException {} when findAllSasaranStrategis", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, e.getMessage());
e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Sasaran Strategis", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when findAllSasaranStrategis", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
} }
} }
@RequestMapping(value = "/find-all-sasaran-strategis/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/find-all/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) { public ResponseEntity<Collection<PasienVO>> findAll(
try {
Map<String,Object> result=sasaranStrategisService.findAllSasaranStrategis();
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get all sasaran strategis", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get all sasaran strategis", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value="/find-all/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Collection<SasaranStrategis>> findAll(
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page, @RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "take", required = false, defaultValue = "100") Integer take, @RequestParam(value = "take", required = false, defaultValue = "100") Integer take,
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort, @RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir, @RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
@Spec(path = "awalPeriode", params = "awalPeriode", spec = GreaterThanOrEqual.class) Specification<SasaranStrategis> awalPeriode, @Spec(path = "awalPeriode", params = "awalPeriode", spec = GreaterThanOrEqual.class) Specification<SasaranStrategis> awalPeriode,
@Spec(path = "akhirPeriode",params="akhirPeriode", spec= LessThanOrEqual.class) Specification<SasaranStrategis> akhirPeriode, @Spec(path = "akhirPeriode", params = "akhirPeriode", spec = LessThanOrEqual.class) Specification<SasaranStrategis> akhirPeriode,
@Spec(path = "perspektifId",params="perspektifId", spec= Equal.class) Specification<SasaranStrategis> perspektifId) @Spec(path = "perspektifId", params = "perspektifId", spec = Equal.class) Specification<SasaranStrategis> perspektifId) {
{ Specification<SasaranStrategis> spec = Specifications.where(awalPeriode).and(akhirPeriode).and(perspektifId);
Specification<SasaranStrategis> spec = Specifications.where(awalPeriode).and(akhirPeriode).and(perspektifId); Map<String, Object> result = sasaranStrategisService.findAll(page, take, sort, dir, spec);
Map<String, Object> result = new HashMap<String, Object>(); return constructListPageResult(result);
result = sasaranStrategisService.findAll(page, take, sort,dir, spec);
return constructListPageResult(result);
} }
@RequestMapping(value = "/generate-kode/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/generate-kode/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> generateKode( public ResponseEntity<Map<String, Object>> generateKode(@RequestParam(value = "perspektifId") Integer perspektifId,
@RequestParam(value="perspektifId",required=true) Integer perspektifId,
HttpServletRequest request) { HttpServletRequest request) {
try { try {
Map<String,Object> result=sasaranStrategisService.generateCode(perspektifId); Map<String, Object> result = sasaranStrategisService.generateCode(perspektifId);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request )); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get all sasaran strategis", e.getMessage()); LOGGER.error("Got ServiceVOException {} when sasaranStrategisService.generateCode", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, e.getMessage());
e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get all sasaran strategis", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when sasaranStrategisService.generateCode", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
} }
} }
@Override
public ResponseEntity<Collection<SasaranStrategisVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<SasaranStrategisVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(SasaranStrategisVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(SasaranStrategisVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<SasaranStrategisVO>> getAllVO() {
return null;
}
} }

View File

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

View File

@ -1,140 +1,57 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.util.Collection; import com.jasamedika.medifirst2000.constants.MessageResource;
import java.util.List; import com.jasamedika.medifirst2000.controller.base.LocaleController;
import java.util.Map; import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.SatuanStandarService;
import javax.servlet.http.HttpServletRequest; import com.jasamedika.medifirst2000.vo.SatuanStandarVO;
import javax.validation.Valid;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; 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.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException; import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; 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.RestController;
import com.jasamedika.medifirst2000.constants.Constants; import javax.servlet.http.HttpServletRequest;
import com.jasamedika.medifirst2000.constants.MessageResource; import javax.validation.Valid;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController; import java.util.Map;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants; import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import com.jasamedika.medifirst2000.exception.ServiceVOException; import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import com.jasamedika.medifirst2000.service.SatuanStandarService; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import com.jasamedika.medifirst2000.util.rest.RestUtil; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import com.jasamedika.medifirst2000.vo.SatuanStandarVO; import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController @RestController
@RequestMapping("/satuan-standar") @RequestMapping("/satuan-standar")
public class SatuanStandarController extends LocaleController<SatuanStandarVO> implements IBaseRestController<SatuanStandarVO>{ public class SatuanStandarController extends LocaleController<SatuanStandarVO> {
private static final Logger LOGGER = getLogger(SatuanStandarController.class);
@Autowired @Autowired
private SatuanStandarService satuanStandarService; private SatuanStandarService satuanStandarService;
private static final Logger LOGGER = LoggerFactory.getLogger(SatuanStandarController.class); @RequestMapping(value = "/save-satuan-standar/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody SatuanStandarVO vo,
@RequestMapping(value = "/save-satuan-standar/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) HttpServletRequest request) {
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody SatuanStandarVO vo, HttpServletRequest request) {
try { try {
Map<String,Object> result=satuanStandarService.addSatuanStandar(vo); Map<String, Object> result = satuanStandarService.addSatuanStandar(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request )); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add SatuanStandar", e.getMessage()); LOGGER.error("Got ServiceVOException {} when addSatuanStandar", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, e.getMessage());
e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add SatuanStandar", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when addSatuanStandar", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
} }
} }
@RequestMapping(value = "/update-satuan-standar/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody SatuanStandarVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=satuanStandarService.updateSatuanStandar(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 SatuanStandar", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update SatuanStandar", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-satuan-standar/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
try {
Map<String,Object> result=satuanStandarService.findAllSatuanStandar();
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get all sasaran strategis", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get all sasaran strategis", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@Override
public ResponseEntity<Collection<SatuanStandarVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<SatuanStandarVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(SatuanStandarVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(SatuanStandarVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<SatuanStandarVO>> getAllVO() {
return null;
}
} }

View File

@ -1,30 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
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.controller.base.LocaleController;
import com.jasamedika.medifirst2000.service.SchedulerService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.AssetVO;
@RestController
@RequestMapping("/scheduler")
public class SchedulerController extends LocaleController<AssetVO>{
@Autowired
private SchedulerService schedulerService;
@RequestMapping(value = "/get-akomodasi-rawat-inap", method = RequestMethod.GET)
public ResponseEntity<Map<String,Object>> getAkomodasiRawatInap() {
Map<String,Object> result = new HashMap<String,Object>();
schedulerService.runAkomodasiRawatInap();
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
}
}

View File

@ -17,7 +17,7 @@ import java.util.List;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE; 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.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttptatus; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger; import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR; import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
@ -47,7 +47,7 @@ public class SettingDataFixedController extends LocaleController<SettingDataFixe
} catch (ServiceVOException | JpaSystemException e) { } catch (ServiceVOException | JpaSystemException e) {
LOGGER.error("Got exception {} when settingDataFixedService.getSetting", e.getMessage()); LOGGER.error("Got exception {} when settingDataFixedService.getSetting", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} }
} }

View File

@ -1,118 +1,96 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.util.Map; import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import javax.servlet.http.HttpServletRequest; import com.jasamedika.medifirst2000.exception.ServiceVOException;
import javax.validation.Valid; import com.jasamedika.medifirst2000.service.SewaAsramaService;
import com.jasamedika.medifirst2000.vo.SewaAsramaVO;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; 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.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException; import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; 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.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants; import javax.servlet.http.HttpServletRequest;
import com.jasamedika.medifirst2000.constants.MessageResource; import javax.validation.Valid;
import com.jasamedika.medifirst2000.controller.base.LocaleController; import java.util.Map;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException; import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import com.jasamedika.medifirst2000.service.SewaAsramaService; import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import com.jasamedika.medifirst2000.util.rest.RestUtil; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import com.jasamedika.medifirst2000.vo.SewaAsramaVO; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController @RestController
@RequestMapping("/sewa-asrama") @RequestMapping("/sewa-asrama")
public class SewaAsramaController extends LocaleController<SewaAsramaVO> { public class SewaAsramaController extends LocaleController<SewaAsramaVO> {
private static final Logger LOGGER = getLogger(SewaAsramaController.class);
@Autowired @Autowired
private SewaAsramaService sewaAsramaService; private SewaAsramaService sewaAsramaService;
private static final Logger LOGGER = LoggerFactory.getLogger(SewaAsramaController.class); @RequestMapping(value = "/save-sewa-asrama/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-sewa-asrama/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveSewaAsrama(@Valid @RequestBody SewaAsramaVO vo, public ResponseEntity<Map<String, Object>> saveSewaAsrama(@Valid @RequestBody SewaAsramaVO vo,
HttpServletRequest request) { HttpServletRequest request) {
try { try {
Map<String, Object> result = sewaAsramaService.saveSewaAsrama(vo); Map<String, Object> result = sewaAsramaService.saveSewaAsrama(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, CREATED, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Sewa Asrama", e.getMessage()); LOGGER.error("Got ServiceVOException {} when saveSewaAsrama", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Sewa Asrama", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when saveSewaAsrama", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@RequestMapping(value = "/find-by-no-order/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/find-status-kamar/", method = GET)
public ResponseEntity<Map<String, Object>> findByNoOrder( public ResponseEntity<Map<String, Object>> findStatusKamar(@RequestParam(value = "periodeAwal") String periodeAwal,
@RequestParam(value = "noOrder", required = false) String noOrder, HttpServletRequest request) { @RequestParam(value = "periodeAkhir") String periodeAkhir, @RequestParam(value = "idKamar") Integer idKamar,
Map<String, Object> result = sewaAsramaService.findByNoOrder(noOrder); HttpServletRequest request) {
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
getMessage(MessageResource.LABEL_ERROR, request));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/find-status-kamar/", method = RequestMethod.GET)
public ResponseEntity<Map<String, Object>> findStatusKamar(
@RequestParam(value = "periodeAwal", required = true) String periodeAwal,
@RequestParam(value = "periodeAkhir", required = true) String periodeAkhir,
@RequestParam(value = "idKamar", required = true) Integer idKamar, HttpServletRequest request) {
try { try {
Map<String, Object> listKamarVO = sewaAsramaService.findStatusKamar(periodeAwal, periodeAkhir, idKamar); Map<String, Object> listKamarVO = sewaAsramaService.findStatusKamar(periodeAwal, periodeAkhir, idKamar);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(listKamarVO, OK, mapHeaderMessage);
return RestUtil.getJsonResponse(listKamarVO, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when Find Kamar Asrama", e.getMessage()); LOGGER.error("Got ServiceVOException {} when findStatusKamar", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when Find Kamar Asrama", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when findStatusKamar", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@RequestMapping(value = "/find-kamar/", method = RequestMethod.GET) @RequestMapping(value = "/find-kamar/", method = GET)
public ResponseEntity<Map<String, Object>> findKamar( public ResponseEntity<Map<String, Object>> findKamar(@RequestParam(value = "namaRuangan") String namaRuangan,
@RequestParam(value = "namaRuangan", required = true) String namaRuangan, HttpServletRequest request) { HttpServletRequest request) {
try { try {
Map<String, Object> listKamarVO = sewaAsramaService.findKamar(namaRuangan); Map<String, Object> listKamarVO = sewaAsramaService.findKamar(namaRuangan);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(listKamarVO, OK, mapHeaderMessage);
return RestUtil.getJsonResponse(listKamarVO, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when Find Kamar Asrama", e.getMessage()); LOGGER.error("Got ServiceVOException {} when findKamar", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when Find Kamar Asrama", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when findKamar", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
} }

View File

@ -1,119 +1,77 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.util.List; import com.jasamedika.medifirst2000.constants.MessageResource;
import java.util.Map; import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.dto.SewaLahanDto;
import javax.servlet.http.HttpServletRequest; import com.jasamedika.medifirst2000.exception.ServiceVOException;
import javax.validation.Valid; import com.jasamedika.medifirst2000.service.SewaLahanService;
import com.jasamedika.medifirst2000.vo.SewaLahanVO;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; 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.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException; import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; 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.RestController;
import com.jasamedika.medifirst2000.constants.Constants; import javax.servlet.http.HttpServletRequest;
import com.jasamedika.medifirst2000.constants.MessageResource; import javax.validation.Valid;
import com.jasamedika.medifirst2000.controller.base.LocaleController; import java.util.List;
import com.jasamedika.medifirst2000.core.web.WebConstants; import java.util.Map;
import com.jasamedika.medifirst2000.dto.SewaLahanDto;
import com.jasamedika.medifirst2000.exception.ServiceVOException; import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import com.jasamedika.medifirst2000.service.SewaLahanService; import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import com.jasamedika.medifirst2000.util.rest.RestUtil; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import com.jasamedika.medifirst2000.vo.SewaLahanVO; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController @RestController
@RequestMapping("/sewa-lahan") @RequestMapping("/sewa-lahan")
public class SewaLahanController extends LocaleController<SewaLahanVO> { public class SewaLahanController extends LocaleController<SewaLahanVO> {
private static final Logger LOGGER = getLogger(SewaLahanController.class);
@Autowired @Autowired
private SewaLahanService sewaLahanService; private SewaLahanService sewaLahanService;
private static final Logger LOGGER = LoggerFactory.getLogger(SewaLahanController.class); @RequestMapping(value = "/save-sewa-lahan/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-sewa-lahan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveSewaLahan(@Valid @RequestBody SewaLahanVO vo, public ResponseEntity<Map<String, Object>> saveSewaLahan(@Valid @RequestBody SewaLahanVO vo,
HttpServletRequest request) { HttpServletRequest request) {
try { try {
Map<String, Object> result = sewaLahanService.saveSewaLahan(vo); Map<String, Object> result = sewaLahanService.saveSewaLahan(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, CREATED, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Sewa Lahan", e.getMessage()); LOGGER.error("Got ServiceVOException {} when saveSewaLahan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Sewa Lahan", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when saveSewaLahan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
}
@RequestMapping(value = "/find-by-no-order/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoOrder(
@RequestParam(value = "noOrder", required = false) String noOrder, HttpServletRequest request) {
Map<String, Object> result = sewaLahanService.findByNoOrder(noOrder);
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
getMessage(MessageResource.LABEL_ERROR, request));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
} }
@RequestMapping(value = "/find-sewa-lahan/", method = RequestMethod.GET) @RequestMapping(value = "/find-sewa-lahan/", method = RequestMethod.GET)
public ResponseEntity<List<SewaLahanDto>> findProdukSewaLahan(HttpServletRequest request) { public ResponseEntity<List<SewaLahanDto>> findProdukSewaLahan(HttpServletRequest request) {
try { try {
List<SewaLahanDto> listSewaLahaVO = sewaLahanService.findProdukSewaLahan(); List<SewaLahanDto> listSewaLahaVO = sewaLahanService.findProdukSewaLahan();
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(listSewaLahaVO, OK, mapHeaderMessage);
return RestUtil.getJsonResponse(listSewaLahaVO, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when Find Sewa Lahan", e.getMessage()); LOGGER.error("Got ServiceVOException {} when findProdukSewaLahan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when Find Sewa Lahan", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when findProdukSewaLahan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
}
@RequestMapping(value = "/find-status-lahan/", method = RequestMethod.GET)
public ResponseEntity<Map<String, Object>> findStatusLahan(
@RequestParam(value = "periodeAwal", required = true) String periodeAwal,
@RequestParam(value = "periodeAkhir", required = true) String periodeAkhir,
@RequestParam(value = "idProduk", required = true) Integer idProduk, HttpServletRequest request) {
try {
Map<String, Object> listLahanVO = sewaLahanService.findStatusLahan(periodeAwal, periodeAkhir, idProduk);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(listLahanVO, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when Find Status Lahan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when Find Status Lahan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
} }
} }

View File

@ -1,33 +1,34 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.util.Map; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import javax.servlet.http.HttpServletRequest; import com.jasamedika.medifirst2000.controller.base.LocaleController;
import javax.validation.Valid; import com.jasamedika.medifirst2000.entities.SignInOperation;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.SignInOperationService;
import com.jasamedika.medifirst2000.vo.SignInOperationVO;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; 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.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException; import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; 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.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import javax.servlet.http.HttpServletRequest;
import com.jasamedika.medifirst2000.constants.Constants; import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource; import java.util.Map;
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.SignInOperationService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.SignInOperationVO;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
/****************** /******************
* @author Shakato * @author Shakato
@ -35,96 +36,74 @@ import com.jasamedika.medifirst2000.vo.SignInOperationVO;
@RestController @RestController
@RequestMapping("/signin-operation") @RequestMapping("/signin-operation")
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
public class SignInOperationController extends LocaleController<SignInOperationVO> public class SignInOperationController extends LocaleController<SignInOperationVO> {
{
private static final Logger LOGGER = getLogger(SignInOperationController.class);
@Autowired @Autowired
private SignInOperationService signInOperationService; private SignInOperationService<SignInOperation> signInOperationService;
private static final Logger LOGGER = LoggerFactory.getLogger(SignInOperationController.class); @RequestMapping(value = "/save-signin-operation/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<String> saveSignInOperation(@Valid @RequestBody SignInOperationVO vo,
HttpServletRequest request) {
@RequestMapping(value = "/save-signin-operation/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> saveSignInOperation(@Valid @RequestBody SignInOperationVO vo, HttpServletRequest request) {
try { try {
Map<String,Object> result = signInOperationService.saveSignInOperationService(vo); Map<String, Object> result = signInOperationService.saveSignInOperationService(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request )); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
RestUtil.getJsonHttpStatus(HttpStatus.CREATED); return getJsonResponse("Status Sukses", CREATED, mapHeaderMessage);
return RestUtil.getJsonResponse("Status Sukses", HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save SignInOperation", e.getMessage()); LOGGER.error("Got ServiceVOException {} when saveSignInOperationService", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update SignInOperation", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when saveSignInOperationService", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@RequestMapping(value = "/get-sign-in-by-norec", method = GET, produces = APPLICATION_JSON_VALUE)
@RequestMapping( public ResponseEntity<Map<String, Object>> getSingInByNoRec(@RequestParam(value = "noRec") String noRec,
value = "/get-sign-in-by-norec", HttpServletRequest request) {
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getSingInByNoRec(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request){
try { try {
Map<String,Object> result = this.signInOperationService.getSingInByNoRec(noRec); Map<String, Object> result = this.signInOperationService.getSingInByNoRec(noRec);
if (null != result) {
if (null != result){ mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request)); return getJsonResponse(result, OK, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage); } else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
} }
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getSingInByNoRec", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getSingInByNoRec", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getSingInByNoRec", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getSingInByNoRec", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@RequestMapping( @RequestMapping(value = "/get-sign-in-by-norec-antrian", method = GET, produces = APPLICATION_JSON_VALUE)
value = "/get-sign-in-by-norec-antrian", public ResponseEntity<Map<String, Object>> getSignInByNoRecAntrian(@RequestParam(value = "noRec") String noRec,
method = RequestMethod.GET, HttpServletRequest request) {
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getSignInByNoRecAntrian(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request){
try { try {
Map<String,Object> result = this.signInOperationService.getSingInByNoRecAntrian(noRec); Map<String, Object> result = this.signInOperationService.getSingInByNoRecAntrian(noRec);
if (null != result) {
if (null != result){ mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request)); return getJsonResponse(result, OK, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage); } else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
} }
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getSignInByNoRecAntrian", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getSingInByNoRecAntrian", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getSignInByNoRecAntrian", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getSingInByNoRecAntrian", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
} }

View File

@ -1,33 +1,33 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.util.Map; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.MessageResource;
import javax.servlet.http.HttpServletRequest; import com.jasamedika.medifirst2000.controller.base.LocaleController;
import javax.validation.Valid; import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.SignOutOperationService;
import com.jasamedika.medifirst2000.vo.SignOutOperationVO;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; 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.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException; import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; 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.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import javax.servlet.http.HttpServletRequest;
import com.jasamedika.medifirst2000.constants.Constants; import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource; import java.util.Map;
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.SignOutOperationService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.SignOutOperationVO;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
/****************** /******************
* @author Shakato * @author Shakato
@ -35,93 +35,73 @@ import com.jasamedika.medifirst2000.vo.SignOutOperationVO;
@RestController @RestController
@RequestMapping("/signout-operation") @RequestMapping("/signout-operation")
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
public class SignOutOperationController extends LocaleController<SignOutOperationVO> public class SignOutOperationController extends LocaleController<SignOutOperationVO> {
{
private static final Logger LOGGER = getLogger(SignOutOperationController.class);
@Autowired @Autowired
private SignOutOperationService signOutOperationService; private SignOutOperationService signOutOperationService;
private static final Logger LOGGER = LoggerFactory.getLogger(SignOutOperationController.class); @RequestMapping(value = "/save-signout-operation", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<String> saveSignInOperation(@Valid @RequestBody SignOutOperationVO vo,
HttpServletRequest request) {
@RequestMapping(value = "/save-signout-operation", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> saveSignInOperation(@Valid @RequestBody SignOutOperationVO vo, HttpServletRequest request) {
try { try {
Map<String,Object> result = signOutOperationService.saveSignOutOperationService(vo); Map<String, Object> result = signOutOperationService.saveSignOutOperationService(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request )); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
RestUtil.getJsonHttpStatus(HttpStatus.CREATED); return getJsonResponse("Status Sukses", CREATED, mapHeaderMessage);
return RestUtil.getJsonResponse("Status Sukses", HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save SignOutOperation1", e.getMessage()); LOGGER.error("Got ServiceVOException {} when saveSignOutOperationService", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update SignOutOperation2", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when saveSignOutOperationService", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@RequestMapping( @RequestMapping(value = "/get-sign-out-by-norec", method = GET, produces = APPLICATION_JSON_VALUE)
value = "/get-sign-out-by-norec", public ResponseEntity<Map<String, Object>> getSingOutByNoRec(@RequestParam(value = "noRec") String noRec,
method = RequestMethod.GET, HttpServletRequest request) {
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getSingOutByNoRec(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request){
try { try {
Map<String,Object> result = this.signOutOperationService.getSignOutByNoRec(noRec); Map<String, Object> result = this.signOutOperationService.getSignOutByNoRec(noRec);
if (null != result) {
if (null != result){ mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request)); return getJsonResponse(result, OK, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage); } else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
} }
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getSingOutByNoRec", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getSignOutByNoRec", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getSingOutByNoRec", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getSignOutByNoRec", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@RequestMapping( @RequestMapping(value = "/get-sign-out-by-norec-antrian", method = GET, produces = APPLICATION_JSON_VALUE)
value = "/get-sign-out-by-norec-antrian", public ResponseEntity<Map<String, Object>> getSingOutByNoRecAntrian(@RequestParam(value = "noRec") String noRec,
method = RequestMethod.GET, HttpServletRequest request) {
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getSingOutByNoRecAntrian(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request){
try { try {
Map<String,Object> result = this.signOutOperationService.getSignOutByNoRecAntrian(noRec); Map<String, Object> result = this.signOutOperationService.getSignOutByNoRecAntrian(noRec);
if (null != result) {
if (null != result){ mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request)); return getJsonResponse(result, OK, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage); } else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
} }
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getSingOutByNoRecAntrian", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getSignOutByNoRecAntrian", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getSingOutByNoRecAntrian", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getSignOutByNoRecAntrian", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }

View File

@ -1,149 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.SiklusGiziService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.SiklusGiziVO;
@RestController
@RequestMapping(value="/siklus-gizi")
public class SiklusGiziController extends LocaleController<SiklusGiziVO>
implements IBaseRestController<SiklusGiziVO>{
@Autowired
private SiklusGiziService siklusService;
private static final Logger LOGGER = LoggerFactory
.getLogger(IndikatorRensarController.class);
@Override
public ResponseEntity<Collection<SiklusGiziVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<SiklusGiziVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(SiklusGiziVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(SiklusGiziVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<SiklusGiziVO>> getAllVO() {
return null;
}
//Created by Pratama
//Error karna column siklusKe yang ada di database masih varchar sedangkan di java integer
@RequestMapping(value="/find-all/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<Collection<SiklusGizi>> findAll(
// @RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
// @RequestParam(value = "take", required = false, defaultValue = "100") Integer take,
// @RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
// @RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
// @Spec(path = "siklusKe", params = "siklusKe", spec = Equal.class) Specification<SiklusGizi> siklusKe,
// @Spec(path = "jenisWaktu.id", params = "jenisWaktuId", spec = Equal.class) Specification<SiklusGizi> jenisWaktu,
// @Spec(path = "kelas.id", params = "kelasId", spec = Equal.class) Specification<SiklusGizi> kelas)
// {
// Map<String, Object> result = new HashMap<String, Object>();
// Specification<SiklusGizi> spec = Specifications.where(siklusKe).and(jenisWaktu).and(kelas);
// result = siklusService.findAll(page, take, sort,dir, spec);
// return constructListPageResult(result);
// }
public ResponseEntity<Map<String,Object>> findAll(
@RequestParam(value = "jenisWaktuId", required=false) Integer jenisWaktuId,
@RequestParam(value = "siklusKe", required=false) Integer siklusKe,
@RequestParam(value = "kelasId", required=false) Integer kelasId,
@RequestParam(value = "jenisDietId", required=false) Integer jenisDietId,
@RequestParam(value = "kategoryProdukId", required=false) Integer kategoryProdukId,
@RequestParam(value = "bentukProdukId", required=false) Integer bentukProdukId,
HttpServletRequest request
){
try{
Map<String, Object> result = siklusService.findAll(jenisWaktuId, siklusKe, kelasId, jenisDietId, kategoryProdukId, bentukProdukId);
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 Siklus Gizi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get Siklus Gizi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
// Created by Pratama
// Belum di tes
@RequestMapping(value="/save/", method= RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody List<SiklusGiziVO> vos,HttpServletRequest request){
try{
Map<String, Object> result = siklusService.save(vos);
if(null!= result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add/update Siklus Gizi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add/update Siklus Gizi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
}

View File

@ -1,86 +1,23 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.util.HashMap; import com.jasamedika.medifirst2000.controller.base.LocaleController;
import java.util.List; import com.jasamedika.medifirst2000.service.SlowFastMovingService;
import java.util.Map; import com.jasamedika.medifirst2000.vo.StrukPelayananDetailVO;
import javax.servlet.http.*;
import javax.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants; import java.util.Map;
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.DetailSpekAnggaran;
import com.jasamedika.medifirst2000.entities.StrukOrder;
import com.jasamedika.medifirst2000.entities.StrukPelayananDetail;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.security.model.AppPermission;
import com.jasamedika.medifirst2000.service.PemusnahanBarangService;
import com.jasamedika.medifirst2000.service.SlowFastMovingService;
import com.jasamedika.medifirst2000.service.StrukOrderService;
import com.jasamedika.medifirst2000.service.StrukPelayananDetailService;
import com.jasamedika.medifirst2000.service.StrukPelayananService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.DetailAnggaranVO;
import com.jasamedika.medifirst2000.vo.DistribusiBarangInvestasiVO;
import com.jasamedika.medifirst2000.vo.PenerimaanBarangDetailVO;
import com.jasamedika.medifirst2000.vo.PenerimaanBarangVO;
import com.jasamedika.medifirst2000.vo.RequestBarangDariRuanganVO;
import com.jasamedika.medifirst2000.vo.StrukHistoriVO;
import com.jasamedika.medifirst2000.vo.StrukKirimVO;
import com.jasamedika.medifirst2000.vo.StrukOrderVO;
import net.kaczmarzyk.spring.data.jpa.domain.DateBetween;
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
import net.kaczmarzyk.spring.data.jpa.domain.Like;
import net.kaczmarzyk.spring.data.jpa.domain.Null;
import net.kaczmarzyk.spring.data.jpa.web.annotation.And;
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
@RestController @RestController
@RequestMapping("/slow-fast-moving") @RequestMapping("/slow-fast-moving")
public class SlowFastMovingController extends LocaleController{ public class SlowFastMovingController extends LocaleController<StrukPelayananDetailVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(SlowFastMovingController.class);
@Autowired @Autowired
private SlowFastMovingService slowFastMovingService; private SlowFastMovingService slowFastMovingService;
@SuppressWarnings("unchecked")
@RequestMapping(value = "/slow-moving")
@ResponseBody
public Map<String, Object> slowMoving(
@RequestParam(value = "kelompokProdukId", required = false) Integer kelompokProdukId,
@RequestParam(value = "jenisProdukId", required = false) Integer jenisProdukId,
@RequestParam(value = "produkId", required = false) Integer produkId,
@RequestParam(value = "dateStart", required = false) String dateStart,
@RequestParam(value = "dateEnd", required = false) String dateEnd) {
Map<String, Object> resultPageMap = slowFastMovingService.slowMoving(dateStart,dateEnd, kelompokProdukId, jenisProdukId, produkId);
return resultPageMap;
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/fast-moving") @RequestMapping(value = "/fast-moving")
@ResponseBody @ResponseBody
public Map<String, Object> fastMoving( public Map<String, Object> fastMoving(
@ -89,10 +26,7 @@ public class SlowFastMovingController extends LocaleController{
@RequestParam(value = "produkId", required = false) Integer produkId, @RequestParam(value = "produkId", required = false) Integer produkId,
@RequestParam(value = "dateStart", required = false) String dateStart, @RequestParam(value = "dateStart", required = false) String dateStart,
@RequestParam(value = "dateEnd", required = false) String dateEnd) { @RequestParam(value = "dateEnd", required = false) String dateEnd) {
return slowFastMovingService.fastMoving(dateStart,dateEnd, kelompokProdukId, jenisProdukId, produkId);
Map<String, Object> resultPageMap = slowFastMovingService.fastMoving(dateStart,dateEnd, kelompokProdukId, jenisProdukId, produkId);
return resultPageMap;
} }
} }

View File

@ -1,77 +1,37 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.util.Collection; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.HashMap; import com.jasamedika.medifirst2000.constants.MessageResource;
import java.util.List; import com.jasamedika.medifirst2000.controller.base.LocaleController;
import java.util.Map; import com.jasamedika.medifirst2000.entities.*;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import javax.servlet.http.HttpServletRequest; import com.jasamedika.medifirst2000.service.*;
import javax.validation.Valid; import com.jasamedika.medifirst2000.vo.SoapVO;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; 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.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException; 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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; 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.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import javax.servlet.http.HttpServletRequest;
import com.jasamedika.medifirst2000.constants.Constants; import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource; import java.util.HashMap;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController; import java.util.Map;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants; import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import com.jasamedika.medifirst2000.entities.Anamnesis; import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
import com.jasamedika.medifirst2000.entities.DetailDiagnosaPasien; import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import com.jasamedika.medifirst2000.entities.DetailDiagnosaTindakanPasien; import static com.jasamedika.medifirst2000.util.DateUtil.toDate;
import com.jasamedika.medifirst2000.entities.DiagnosaPasien; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import com.jasamedika.medifirst2000.entities.DiagnosaTindakanPasien; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import com.jasamedika.medifirst2000.entities.LembarKonsultasi; import static org.slf4j.LoggerFactory.getLogger;
import com.jasamedika.medifirst2000.entities.PapAnamesis; import static org.springframework.http.HttpStatus.*;
import com.jasamedika.medifirst2000.entities.PapEliminasi; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import com.jasamedika.medifirst2000.entities.PapGastrointestinal; import static org.springframework.web.bind.annotation.RequestMethod.GET;
import com.jasamedika.medifirst2000.entities.PapGenatalia; import static org.springframework.web.bind.annotation.RequestMethod.POST;
import com.jasamedika.medifirst2000.entities.PapGigiMulut;
import com.jasamedika.medifirst2000.entities.PapGinekologi;
import com.jasamedika.medifirst2000.entities.PapIntegumen;
import com.jasamedika.medifirst2000.entities.PapKeluhanUtama;
import com.jasamedika.medifirst2000.entities.PapMuskuloskeletal;
import com.jasamedika.medifirst2000.entities.PapNeurologi;
import com.jasamedika.medifirst2000.entities.PapPernapasan;
import com.jasamedika.medifirst2000.entities.PapRehabilitasi;
import com.jasamedika.medifirst2000.entities.PapSirkulasi;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.AnamnesisService;
import com.jasamedika.medifirst2000.service.DiagnosaPasienService;
import com.jasamedika.medifirst2000.service.DiagnosaTindakanPasienService;
import com.jasamedika.medifirst2000.service.LembarKonsultasiService;
import com.jasamedika.medifirst2000.service.PapAnamesisService;
import com.jasamedika.medifirst2000.service.PapBedahService;
import com.jasamedika.medifirst2000.service.PapEliminasiService;
import com.jasamedika.medifirst2000.service.PapGastrointestinalService;
import com.jasamedika.medifirst2000.service.PapGenataliaService;
import com.jasamedika.medifirst2000.service.PapGigiMulutService;
import com.jasamedika.medifirst2000.service.PapGinekologiService;
import com.jasamedika.medifirst2000.service.PapIntegumenService;
import com.jasamedika.medifirst2000.service.PapKeluhanUtamaService;
import com.jasamedika.medifirst2000.service.PapMataService;
import com.jasamedika.medifirst2000.service.PapMuskuloskeletalService;
import com.jasamedika.medifirst2000.service.PapNeurologiService;
import com.jasamedika.medifirst2000.service.PapPernapasanService;
import com.jasamedika.medifirst2000.service.PapRehabilitasiService;
import com.jasamedika.medifirst2000.service.PapSirkulasiService;
import com.jasamedika.medifirst2000.service.PapThtService;
import com.jasamedika.medifirst2000.service.SoapService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.SoapVO;
/** /**
* Controller class for Pengakjian Awal Gawat Darurat Business * Controller class for Pengakjian Awal Gawat Darurat Business
@ -81,547 +41,327 @@ import com.jasamedika.medifirst2000.vo.SoapVO;
@RestController @RestController
@RequestMapping("/soap") @RequestMapping("/soap")
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
public class SoapController extends LocaleController<SoapVO> implements public class SoapController extends LocaleController<SoapVO> {
IBaseRestController<SoapVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(SoapController.class); private static final Logger LOGGER = getLogger(SoapController.class);
@Autowired @Autowired
private SoapService soapService; private SoapService<Soap> soapService;
@Autowired @Autowired
private PapKeluhanUtamaService papkeluhanUtamaService; private PapKeluhanUtamaService<PapKeluhanUtama> papkeluhanUtamaService;
@Autowired @Autowired
private AnamnesisService anamansisService; private AnamnesisService anamansisService;
@Autowired
private PapAnamesisService papAnamesisService;
@Autowired @Autowired
private PapPernapasanService papPernapasanService; private PapAnamesisService<PapAnamesis> papAnamesisService;
@Autowired
private PapSirkulasiService papSirkulasiService;
@Autowired
private PapNeurologiService papNeurologiService;
@Autowired
private PapGastrointestinalService papGastrointestinalService;
@Autowired
private PapEliminasiService papEliminasiService;
@Autowired
private PapIntegumenService papIntegumenService;
@Autowired
private PapMuskuloskeletalService papMuskuloskeletalService;
@Autowired
private PapGenataliaService papGenataliaService;
@Autowired @Autowired
private PapGinekologiService papGinekologiService; private PapPernapasanService<PapPernapasan> papPernapasanService;
@Autowired @Autowired
private PapRehabilitasiService papRehabilitasiService; private PapSirkulasiService<PapSirkulasi> papSirkulasiService;
@Autowired @Autowired
private PapBedahService papBedahService; private PapNeurologiService<PapNeurologi> papNeurologiService;
@Autowired @Autowired
private PapGigiMulutService papGigiMulutService; private PapGastrointestinalService<PapGastrointestinal> papGastrointestinalService;
@Autowired @Autowired
private PapMataService papMataService; private PapEliminasiService<PapEliminasi> papEliminasiService;
@Autowired @Autowired
private PapThtService papThtService; private PapIntegumenService<PapIntegumen> papIntegumenService;
@Autowired
private PapMuskuloskeletalService<PapMuskuloskeletal> papMuskuloskeletalService;
@Autowired
private PapGenataliaService<PapGenatalia> papGenataliaService;
@Autowired
private PapGinekologiService<PapGinekologi> papGinekologiService;
@Autowired
private PapRehabilitasiService<PapRehabilitasi> papRehabilitasiService;
@Autowired
private PapBedahService<PapBedah> papBedahService;
@Autowired
private PapGigiMulutService<PapGigiMulut> papGigiMulutService;
@Autowired
private PapMataService<PapMata> papMataService;
@Autowired @Autowired
private DiagnosaPasienService diagnosaPasienService; private DiagnosaPasienService diagnosaPasienService;
@Autowired @Autowired
private DiagnosaTindakanPasienService diagnosaTindakanPasienService; private DiagnosaTindakanPasienService diagnosaTindakanPasienService;
@Autowired @Autowired
private LembarKonsultasiService lembarKonsultasiService; private LembarKonsultasiService<LembarKonsultasi> lembarKonsultasiService;
@RequestMapping(value = "/save-soap", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/save-soap", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody SoapVO vo,HttpServletRequest request) { public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody SoapVO vo, HttpServletRequest request) {
try { try {
Map<String,Object> result = soapService.addSoap(vo); Map<String, Object> result = soapService.addSoap(vo);
if (null != result) {
if (null != result){ mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil"); result.put("message", "Berhasil");
}else{ return getJsonResponse(result, CREATED, mapHeaderMessage);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request )); } else {
result.put("message", "Gagal"); mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
return getJsonHttpStatus(ACCEPTED, mapHeaderMessage);
} }
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage()); LOGGER.error("Got ServiceVOException {} when addSoap", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when addSoap", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@RequestMapping(value = "/edit-soap", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/select-for-soap/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> edit(@Valid @RequestBody SoapVO vo,HttpServletRequest request) { public ResponseEntity<Map<String, Object>> selectForSOAP(
try { @RequestParam(value = "noCm", required = false) String noCm,
Map<String,Object> result = soapService.updateSoap(vo); @RequestParam(value = "tglInput", required = false) String tglInput, HttpServletRequest request) {
Map<String, Object> result = new HashMap<>();
if (null != result){ String s = selectSInSOAP(noCm, tglInput);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request )); String o = selectOInSOAP(noCm, tglInput);
result.put("message", "Berhasil"); String a = selectAInSOAP(noCm, tglInput);
}else{ String p = selectPInSOAP(noCm, tglInput);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request )); boolean dataFoundS;
result.put("message", "Gagal"); boolean dataFoundO;
} boolean dataFoundA;
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage); boolean dataFoundP;
if (s.equals("dataFound : false")) {
} catch (ServiceVOException e) { dataFoundS = false;
LOGGER.error("Got exception {} when add Pasien", e.getMessage()); s = "";
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); } else {
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); dataFoundS = true;
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
} }
if (o.equals("dataFound : false")) {
} dataFoundO = false;
o = "";
@RequestMapping(value = "/find-by-noCm-and-tglInput/{noCm}/{tglInput}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) } else {
public ResponseEntity<Map<String,Object>> findByNoCm(@PathVariable("noCm") String noCm,@PathVariable("tglInput") String tglInput,HttpServletRequest request) { dataFoundO = true;
Map<String,Object> result = soapService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
} }
if (a.equals("dataFound : false")) {
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage); dataFoundA = false;
} a = "";
} else {
@RequestMapping(value = "/select-for-soap/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) dataFoundA = true;
public ResponseEntity<Map<String,Object>> selectForSOAP(@RequestParam(value = "noCm", required = false) String noCm,
@RequestParam(value = "tglInput", required = false) String tglInput,HttpServletRequest request) {
Map<String,Object> result = new HashMap<String,Object>();
String s=selectSInSOAP(noCm,tglInput);
String o=selectOInSOAP(noCm,tglInput);
String a=selectAInSOAP(noCm,tglInput);
String p=selectPInSOAP(noCm,tglInput);
Boolean dataFoundS;
Boolean dataFoundO;
Boolean dataFoundA;
Boolean dataFoundP;
if(s.equals("dataFound : false")){
dataFoundS=false;
s="";
}else{
dataFoundS=true;
} }
if(o.equals("dataFound : false")){ if (p.equals("dataFound : false")) {
dataFoundO=false; dataFoundP = false;
o=""; p = "";
}else{ } else {
dataFoundO=true; dataFoundP = true;
}
if(a.equals("dataFound : false")){
dataFoundA=false;
a="";
}else{
dataFoundA=true;
}
if(p.equals("dataFound : false")){
dataFoundP=false;
p="";
}else{
dataFoundP=true;
} }
result.put("s", s); result.put("s", s);
result.put("o", o); result.put("o", o);
result.put("a", a); result.put("a", a);
result.put("p", p); result.put("p", p);
Boolean dataFound=dataFoundS || dataFoundO || dataFoundA || dataFoundP; boolean dataFound = dataFoundS || dataFoundO || dataFoundA || dataFoundP;
if(dataFound){ if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request )); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
}else{ } else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request )); mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
} }
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage); return getJsonResponse(result, OK, mapHeaderMessage);
} }
@RequestMapping(value = "/select-for-s/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) private String selectSInSOAP(String noCm, String tglInput) {
public ResponseEntity<String> selectForSInSOAP(@RequestParam(value = "noCm", required = false) String noCm, Map<String, Object> keluhanUtama = papkeluhanUtamaService.findByNoCmAndTglInput(noCm, toDate(tglInput));
@RequestParam(value = "tglInput", required = false) String tglInput,HttpServletRequest request) { Map<String, Object> resultUmum = anamansisService.findByNoCmAndTglInput(noCm, toDate(tglInput));
Map<String,Object> resultUmum=anamansisService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); Map<String, Object> resultKhusus = papAnamesisService.findByNoCmAndTglInput(noCm, toDate(tglInput));
Map<String,Object> resultKhusus=papAnamesisService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); StringBuilder s = new StringBuilder();
StringBuffer s=new StringBuffer(); Boolean dataKeluhanUtama = (boolean) keluhanUtama.get("dataFound");
Boolean dataFoundUmum = (boolean) resultUmum.get("dataFound");
Boolean dataFoundUmum=new Boolean((boolean) resultUmum.get("dataFound")); Boolean dataFoundKhusus = (boolean) resultKhusus.get("dataFound");
Boolean dataFoundKhusus=new Boolean((boolean) resultKhusus.get("dataFound")); boolean dataFound = dataFoundUmum || dataFoundKhusus || dataKeluhanUtama;
Boolean dataFound=dataFoundUmum || dataFoundKhusus; if (dataFound) {
if(dataFound){ if (dataKeluhanUtama)
if(dataFoundUmum){ s.append("Keluhan Utama : ")
s.append("Umum [ "); .append(((PapKeluhanUtama) keluhanUtama.get("papKeluhanUtama")).getKeluhanUtama()).append(", ");
s.append("Anamnesis (Suster) : "+((Anamnesis)resultUmum.get("anamansis")).getAnamnesisSuster()+", "); if (dataFoundUmum) {
s.append("Anamnesis (Dokter) : "+((Anamnesis)resultUmum.get("anamansis")).getAnamnesisDokter()+"."); s.append("Umum [ ");
s.append(" ] "); s.append("Anamnesis (Suster) : ").append(((Anamnesis) resultUmum.get("anamansis")).getAnamnesisSuster())
.append(", ");
s.append("Anamnesis (Dokter) : ").append(((Anamnesis) resultUmum.get("anamansis")).getAnamnesisDokter())
.append(".");
s.append(" ] ");
} }
if(dataFoundKhusus){ if (dataFoundKhusus) {
s.append("Khusus [ "); s.append("Khusus [ ");
s.append("Anamnesis : "+((PapAnamesis)resultKhusus.get("papAnamesis")).getKeluhan()+". "); s.append("Anamnesis : ").append(((PapAnamesis) resultKhusus.get("papAnamesis")).getKeluhan())
s.append(" ] "); .append(". ");
s.append(" ] ");
} }
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request )); } else {
}else{ s.append("dataFound : ").append(false);
s.append("dataFound : "+dataFound);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
} }
return RestUtil.getJsonResponse(s.toString(), HttpStatus.OK,mapHeaderMessage); return s.toString();
} }
@RequestMapping(value = "/select-for-o/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) private String selectOInSOAP(String noCm, String tglInput) {
public ResponseEntity<String> selectForOInSOAP(@RequestParam(value = "noCm", required = false) String noCm, Map<String, Object> result1 = papPernapasanService.findByNoCmAndTglInput(noCm, toDate(tglInput));
@RequestParam(value = "tglInput", required = false) String tglInput,HttpServletRequest request) { Map<String, Object> result2 = papSirkulasiService.findByNoCmAndTglInput(noCm, toDate(tglInput));
Map<String,Object> result1=papPernapasanService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); Map<String, Object> result3 = papNeurologiService.findByNoCmAndTglInput(noCm, toDate(tglInput));
Map<String,Object> result2=papSirkulasiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); Map<String, Object> result4 = papGastrointestinalService.findByNoCmAndTglInput(noCm, toDate(tglInput));
Map<String,Object> result3=papNeurologiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); Map<String, Object> result5 = papEliminasiService.findByNoCmAndTglInput(noCm, toDate(tglInput));
Map<String,Object> result4=papGastrointestinalService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); Map<String, Object> result6 = papIntegumenService.findByNoCmAndTglInput(noCm, toDate(tglInput));
Map<String,Object> result5=papEliminasiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); Map<String, Object> result7 = papMuskuloskeletalService.findByNoCmAndTglInput(noCm, toDate(tglInput));
Map<String,Object> result6=papIntegumenService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); Map<String, Object> result8 = papGenataliaService.findByNoCmAndTglInput(noCm, toDate(tglInput));
Map<String,Object> result7=papMuskuloskeletalService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); Map<String, Object> result9 = papGinekologiService.findByNoCmAndTglInput(noCm, toDate(tglInput));
Map<String,Object> result8=papGenataliaService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); Map<String, Object> result10 = papRehabilitasiService.findByNoCmAndTglInput(noCm, toDate(tglInput));
Map<String, Object> result11 = papBedahService.findByNoCmAndTglInput(noCm, toDate(tglInput));
Map<String,Object> result9=papGinekologiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); Map<String, Object> result12 = papGigiMulutService.findByNoCmAndTglInput(noCm, toDate(tglInput));
Map<String,Object> result10=papRehabilitasiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); Map<String, Object> result13 = papMataService.findByNoCmAndTglInput(noCm, toDate(tglInput));
Map<String,Object> result11=papBedahService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); Boolean dataFound1 = (boolean) result1.get("dataFound");
Map<String,Object> result12=papGigiMulutService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); Boolean dataFound2 = (boolean) result2.get("dataFound");
Map<String,Object> result13=papMataService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); Boolean dataFound3 = (boolean) result3.get("dataFound");
Map<String,Object> result14=papThtService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); Boolean dataFound4 = (boolean) result4.get("dataFound");
Boolean dataFound5 = (boolean) result5.get("dataFound");
Boolean dataFound1=new Boolean((boolean) result1.get("dataFound")); Boolean dataFound6 = (boolean) result6.get("dataFound");
Boolean dataFound2=new Boolean((boolean) result2.get("dataFound")); Boolean dataFound7 = (boolean) result7.get("dataFound");
Boolean dataFound3=new Boolean((boolean) result3.get("dataFound")); Boolean dataFound8 = (boolean) result8.get("dataFound");
Boolean dataFound4=new Boolean((boolean) result4.get("dataFound")); Boolean dataFound9 = (boolean) result9.get("dataFound");
Boolean dataFound5=new Boolean((boolean) result5.get("dataFound")); Boolean dataFound10 = (boolean) result10.get("dataFound");
Boolean dataFound6=new Boolean((boolean) result6.get("dataFound")); Boolean dataFound11 = (boolean) result11.get("dataFound");
Boolean dataFound7=new Boolean((boolean) result7.get("dataFound")); Boolean dataFound12 = (boolean) result12.get("dataFound");
Boolean dataFound8=new Boolean((boolean) result8.get("dataFound")); Boolean dataFound13 = (boolean) result13.get("dataFound");
Boolean dataFoundUmum = dataFound1 || dataFound2 || dataFound3 || dataFound4 || dataFound5 || dataFound6
Boolean dataFound9=new Boolean((boolean) result9.get("dataFound")); || dataFound7 || dataFound8;
Boolean dataFound10=new Boolean((boolean) result10.get("dataFound"));
Boolean dataFound11=new Boolean((boolean) result11.get("dataFound"));
Boolean dataFound12=new Boolean((boolean) result12.get("dataFound"));
Boolean dataFound13=new Boolean((boolean) result13.get("dataFound"));
Boolean dataFoundUmum = dataFound1 || dataFound2 || dataFound3 || dataFound4
|| dataFound5 || dataFound6 || dataFound7 || dataFound8;
Boolean dataFoundKhusus = dataFound9 || dataFound10 || dataFound11 || dataFound12 || dataFound13; Boolean dataFoundKhusus = dataFound9 || dataFound10 || dataFound11 || dataFound12 || dataFound13;
Boolean dataFound = dataFoundUmum || dataFoundKhusus; boolean dataFound = dataFoundUmum || dataFoundKhusus;
StringBuffer s=new StringBuffer(); StringBuilder s = new StringBuilder();
if(dataFound){ if (dataFound) {
if(dataFoundUmum){ if (dataFoundUmum) {
s.append("Umum [ "); s.append("Umum [ ");
s.append("Pernapasan : "+(((PapPernapasan) result1.get("papPernapasan")).getIsNormal()?"Normal":"Tidak Normal")+", "); if (dataFound1)
s.append("Sirkulasi : "+(((PapSirkulasi) result2.get("papSirkulasi")).getIsNormal()?"Normal":"Tidak Normal")+", "); s.append("Pernapasan : ").append(
s.append("Neurologi : "+(((PapNeurologi) result3.get("papNeurologi")).getIsNormal()?"Normal":"Tidak Normal")+", "); ((PapPernapasan) result1.get("papPernapasan")).getIsNormal() ? "Normal" : "Tidak Normal")
s.append("Gastrointestinal : "+(((PapGastrointestinal) result4.get("papGastrointestinal")).getIsNormal()?"Normal":"Tidak Normal")+", "); .append(", ");
s.append("Eliminasi : "+(((PapEliminasi) result5.get("papEliminasi")).getIsNormal()?"Normal":"Tidak Normal")+", "); if (dataFound2)
s.append("Integumen : "+(((PapIntegumen) result6.get("papIntegumen")).getIsNormal()?"Normal":"Tidak Normal")+", "); s.append("Sirkulasi : ").append(
s.append("Muskuloskeletal : "+(((PapMuskuloskeletal) result7.get("papMuskuloskeletal")).getIsNormal()?"Normal":"Tidak Normal")+", "); ((PapSirkulasi) result2.get("papSirkulasi")).getIsNormal() ? "Normal" : "Tidak Normal")
s.append("Genatalia : "+(((PapGenatalia) result8.get("papGenatalia")).getIsNormal()?"Normal":"Tidak Normal")+"."); .append(", ");
s.append(" ] "); if (dataFound3)
s.append("Neurologi : ").append(
((PapNeurologi) result3.get("papNeurologi")).getIsNormal() ? "Normal" : "Tidak Normal")
.append(", ");
if (dataFound4)
s.append("Gastrointestinal : ")
.append(((PapGastrointestinal) result4.get("papGastrointestinal")).getIsNormal() ? "Normal"
: "Tidak Normal")
.append(", ");
if (dataFound5)
s.append("Eliminasi : ").append(
((PapEliminasi) result5.get("papEliminasi")).getIsNormal() ? "Normal" : "Tidak Normal")
.append(", ");
if (dataFound6)
s.append("Integumen : ").append(
((PapIntegumen) result6.get("papIntegumen")).getIsNormal() ? "Normal" : "Tidak Normal")
.append(", ");
if (dataFound7)
s.append("Muskuloskeletal : ")
.append(((PapMuskuloskeletal) result7.get("papMuskuloskeletal")).getIsNormal() ? "Normal"
: "Tidak Normal")
.append(", ");
if (dataFound8)
s.append("Genatalia : ").append(
((PapGenatalia) result8.get("papGenatalia")).getIsNormal() ? "Normal" : "Tidak Normal")
.append(".");
s.append(" ] ");
} }
if(dataFoundKhusus){ if (dataFoundKhusus) {
s.append("Khusus [ "); s.append("Khusus [ ");
s.append("Ginekologi : "+(((PapGinekologi) result8.get("papGinekologi")).getPengobatan())+", "); s.append("Ginekologi : ").append(((PapGinekologi) result9.get("papGinekologi")).getPengobatan())
s.append("Rehabilitasi : "+(((PapRehabilitasi) result8.get("papRehabilitasi")).getMasalahMedisDanRehabilitasi())+", "); .append(", ");
s.append("Bedah : [ "); s.append("Rehabilitasi : ")
s.append(" ]"); .append(((PapRehabilitasi) result10.get("papRehabilitasi")).getMasalahMedisDanRehabilitasi())
s.append("Gigi Mulut : "+(((PapGigiMulut) result8.get("papGigiMulut")).getPapKeadaanGigi().getName())+", "); .append(", ");
//s.append("Mata : "+(((PapMata) result8.get("papMata")).getStreak())+", "); s.append("Bedah : [ ");
s.append("Obstetri : "+""+", "); //80% s.append(" ]");
s.append("Gizi : "+""+", "); //back end belum (arya) s.append("Gigi Mulut : ")
s.append("Tumbuh Kembang Anak : "+""+", "); //back end belum .append(((PapGigiMulut) result12.get("papGigiMulut")).getPapKeadaanGigi().getName())
s.append("Psikologi : "+""+", "); //ga ada tglinput (belum integrasi) .append(", ");
s.append("THT : "+""+", "); s.append("Obstetri : " + ", ");
s.append("CLP : "+""+", "); //form belum ada s.append("Gizi : " + ", ");
s.append("Bayi Tabung : "+""+", "); //form belum ada (form di adri , backend di susi,tinggal integrasi) s.append("Tumbuh Kembang Anak : " + ", ");
s.append("Neonatus : "+""+", "); //form belum ada s.append("Psikologi : " + ", ");
s.append(" ] "); s.append("THT : " + ", ");
s.append("CLP : " + ", ");
s.append("Bayi Tabung : " + ", ");
s.append("Neonatus : " + ", ");
s.append(" ] ");
} }
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request )); } else {
}else{ s.append("dataFound : ").append(false);
s.append("dataFound : "+dataFound);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
} }
return RestUtil.getJsonResponse(s.toString(), HttpStatus.OK,mapHeaderMessage); return s.toString();
} }
@RequestMapping(value = "/select-for-a/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) private String selectAInSOAP(String noCm, String tglInput) {
public ResponseEntity<String> selectForAInSOAP(@RequestParam(value = "noCm", required = false) String noCm, Map<String, Object> result = diagnosaPasienService.findByNoCmAndTglInput(noCm, toDate(tglInput));
@RequestParam(value = "tglInput", required = false) String tglInput,HttpServletRequest request) { StringBuilder s = new StringBuilder();
Map<String,Object> result=diagnosaPasienService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); boolean dataFound = (boolean) result.get("dataFound");
StringBuffer s=new StringBuffer(); if (dataFound) {
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
s.append("Rencana Tindakan : [ "); // backend : DiagnosaPasien
for(DetailDiagnosaPasien detail:((DiagnosaPasien) result.get("diagnosaPasien")).getDiagnosis()){
s.append(detail.getDiagnosa().getNamaDiagnosa()+", ");
}
s.append(" ] ");
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}else{
s.append("dataFound : "+dataFound);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
return RestUtil.getJsonResponse(s.toString(), HttpStatus.OK,mapHeaderMessage);
}
@RequestMapping(value = "/select-for-p/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> selectForPInSOAP(@RequestParam(value = "noCm", required = false) String noCm,
@RequestParam(value = "tglInput", required = false) String tglInput,HttpServletRequest request) {
Map<String,Object> result1=lembarKonsultasiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Map<String,Object> result2=diagnosaTindakanPasienService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
StringBuffer s=new StringBuffer();
Boolean dataFound1=new Boolean((boolean) result1.get("dataFound"));
Boolean dataFound2=new Boolean((boolean) result2.get("dataFound"));
Boolean dataFound=dataFound1 || dataFound2;
if(dataFound){
s.append("Rencana Konsultasi : "+(((LembarKonsultasi) result1.get("lembarKonsultasi")).getSaran())+", ");
s.append("Rencana Tindakan : [ "); s.append("Rencana Tindakan : [ ");
for(DetailDiagnosaTindakanPasien detail:((DiagnosaTindakanPasien) result2.get("diagnosaTindakanPasien")).getDiagnosisTindakan()){ for (DetailDiagnosaPasien detail : ((DiagnosaPasien) result.get("diagnosaPasien")).getDiagnosis()) {
s.append(detail.getDiagnosaTindakan().getNamaDiagnosaTindakan()+", "); s.append(detail.getDiagnosa().getNamaDiagnosa()).append(", ");
} }
s.append(" ] "); s.append(" ] ");
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request )); } else {
}else{ s.append("dataFound : ").append(false);
s.append("dataFound : "+dataFound);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
/*
StringBuffer s=new StringBuffer();
s.append("Rencana Tindakan : "); --backend : DiagnosaTindakanPasien
s.append("Rencana Permintaan : [ ");
s.append("Laboratorium : ");
s.append("Radiologi : ");
s.append("Farmasi : ");
s.append(" ] ");
s.append("Rencana Konsultasi : "); //sudah, tapi antara form dengan domain berbeda
s.append("Instruksi Pulang : "); //back end belum
s.append("Instruksi Ranap : "); //back end belum
s.append("Instruksi Perjanjian : "); //back end belum
*/
return RestUtil.getJsonResponse(s.toString(), HttpStatus.OK,mapHeaderMessage);
}
@Override
public ResponseEntity<Collection<SoapVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<SoapVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(SoapVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(SoapVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<SoapVO>> getAllVO() {
return null;
}
private String selectSInSOAP(String noCm,String tglInput) {
Map<String,Object> keluhanUtama=papkeluhanUtamaService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Map<String,Object> resultUmum=anamansisService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Map<String,Object> resultKhusus=papAnamesisService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
StringBuffer s=new StringBuffer();
Boolean dataKeluhanUtama=new Boolean((boolean) keluhanUtama.get("dataFound"));
Boolean dataFoundUmum=new Boolean((boolean) resultUmum.get("dataFound"));
Boolean dataFoundKhusus=new Boolean((boolean) resultKhusus.get("dataFound"));
Boolean dataFound=dataFoundUmum || dataFoundKhusus || dataKeluhanUtama;
if(dataFound){
if(dataKeluhanUtama)
s.append("Keluhan Utama : "+((PapKeluhanUtama)keluhanUtama.get("papKeluhanUtama")).getKeluhanUtama()+", ");
if(dataFoundUmum){
s.append("Umum [ ");
s.append("Anamnesis (Suster) : "+((Anamnesis)resultUmum.get("anamansis")).getAnamnesisSuster()+", ");
s.append("Anamnesis (Dokter) : "+((Anamnesis)resultUmum.get("anamansis")).getAnamnesisDokter()+".");
s.append(" ] ");
}
if(dataFoundKhusus){
s.append("Khusus [ ");
s.append("Anamnesis : "+((PapAnamesis)resultKhusus.get("papAnamesis")).getKeluhan()+". ");
s.append(" ] ");
}
}else{
s.append("dataFound : "+dataFound);
} }
return s.toString(); return s.toString();
} }
private String selectOInSOAP(String noCm,String tglInput) { private String selectPInSOAP(String noCm, String tglInput) {
Map<String,Object> result1=papPernapasanService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); Map<String, Object> result1 = lembarKonsultasiService.findByNoCmAndTglInput(noCm, toDate(tglInput));
Map<String,Object> result2=papSirkulasiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); Map<String, Object> result2 = diagnosaTindakanPasienService.findByNoCmAndTglInput(noCm, toDate(tglInput));
Map<String,Object> result3=papNeurologiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); StringBuilder s = new StringBuilder();
Map<String,Object> result4=papGastrointestinalService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); Boolean dataFound1 = (boolean) result1.get("dataFound");
Map<String,Object> result5=papEliminasiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); Boolean dataFound2 = (boolean) result2.get("dataFound");
Map<String,Object> result6=papIntegumenService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); boolean dataFound = dataFound1 || dataFound2;
Map<String,Object> result7=papMuskuloskeletalService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); if (dataFound) {
Map<String,Object> result8=papGenataliaService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); if (dataFound1)
s.append("Rencana Konsultasi : ")
Map<String,Object> result9=papGinekologiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); .append(((LembarKonsultasi) result1.get("lembarKonsultasi")).getSaran()).append(", ");
Map<String,Object> result10=papRehabilitasiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); if (dataFound2) {
Map<String,Object> result11=papBedahService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); s.append("Rencana Tindakan : [ ");
Map<String,Object> result12=papGigiMulutService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); for (DetailDiagnosaTindakanPasien detail : ((DiagnosaTindakanPasien) result2
Map<String,Object> result13=papMataService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); .get("diagnosaTindakanPasien")).getDiagnosisTindakan()) {
Map<String,Object> result14=papThtService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); s.append(detail.getDiagnosaTindakan().getNamaDiagnosaTindakan()).append(", ");
}
Boolean dataFound1=new Boolean((boolean) result1.get("dataFound"));
Boolean dataFound2=new Boolean((boolean) result2.get("dataFound"));
Boolean dataFound3=new Boolean((boolean) result3.get("dataFound"));
Boolean dataFound4=new Boolean((boolean) result4.get("dataFound"));
Boolean dataFound5=new Boolean((boolean) result5.get("dataFound"));
Boolean dataFound6=new Boolean((boolean) result6.get("dataFound"));
Boolean dataFound7=new Boolean((boolean) result7.get("dataFound"));
Boolean dataFound8=new Boolean((boolean) result8.get("dataFound"));
Boolean dataFound9=new Boolean((boolean) result9.get("dataFound"));
Boolean dataFound10=new Boolean((boolean) result10.get("dataFound"));
Boolean dataFound11=new Boolean((boolean) result11.get("dataFound"));
Boolean dataFound12=new Boolean((boolean) result12.get("dataFound"));
Boolean dataFound13=new Boolean((boolean) result13.get("dataFound"));
Boolean dataFoundUmum = dataFound1 || dataFound2 || dataFound3 || dataFound4
|| dataFound5 || dataFound6 || dataFound7 || dataFound8;
Boolean dataFoundKhusus = dataFound9 || dataFound10 || dataFound11 || dataFound12 || dataFound13;
Boolean dataFound = dataFoundUmum || dataFoundKhusus;
StringBuffer s=new StringBuffer();
if(dataFound){
if(dataFoundUmum){
s.append("Umum [ ");
if(dataFound1)
s.append("Pernapasan : "+(((PapPernapasan) result1.get("papPernapasan")).getIsNormal()?"Normal":"Tidak Normal")+", ");
if(dataFound2)
s.append("Sirkulasi : "+(((PapSirkulasi) result2.get("papSirkulasi")).getIsNormal()?"Normal":"Tidak Normal")+", ");
if(dataFound3)
s.append("Neurologi : "+(((PapNeurologi) result3.get("papNeurologi")).getIsNormal()?"Normal":"Tidak Normal")+", ");
if(dataFound4)
s.append("Gastrointestinal : "+(((PapGastrointestinal) result4.get("papGastrointestinal")).getIsNormal()?"Normal":"Tidak Normal")+", ");
if(dataFound5)
s.append("Eliminasi : "+(((PapEliminasi) result5.get("papEliminasi")).getIsNormal()?"Normal":"Tidak Normal")+", ");
if(dataFound6)
s.append("Integumen : "+(((PapIntegumen) result6.get("papIntegumen")).getIsNormal()?"Normal":"Tidak Normal")+", ");
if(dataFound7)
s.append("Muskuloskeletal : "+(((PapMuskuloskeletal) result7.get("papMuskuloskeletal")).getIsNormal()?"Normal":"Tidak Normal")+", ");
if(dataFound8)
s.append("Genatalia : "+(((PapGenatalia) result8.get("papGenatalia")).getIsNormal()?"Normal":"Tidak Normal")+".");
s.append(" ] ");
} }
if(dataFoundKhusus){
s.append("Khusus [ ");
s.append("Ginekologi : "+(((PapGinekologi) result9.get("papGinekologi")).getPengobatan())+", ");
s.append("Rehabilitasi : "+(((PapRehabilitasi) result10.get("papRehabilitasi")).getMasalahMedisDanRehabilitasi())+", ");
s.append("Bedah : [ ");
s.append(" ]");
s.append("Gigi Mulut : "+(((PapGigiMulut) result12.get("papGigiMulut")).getPapKeadaanGigi().getName())+", ");
//s.append("Mata : "+(((PapMata) result13.get("papMata")).getStreak())+", ");
s.append("Obstetri : "+""+", "); //80%
s.append("Gizi : "+""+", "); //back end belum (arya)
s.append("Tumbuh Kembang Anak : "+""+", "); //back end belum
s.append("Psikologi : "+""+", "); //ga ada tglinput (belum integrasi)
s.append("THT : "+""+", ");
s.append("CLP : "+""+", "); //form belum ada
s.append("Bayi Tabung : "+""+", "); //form belum ada (form di adri , backend di susi,tinggal integrasi)
s.append("Neonatus : "+""+", "); //form belum ada
s.append(" ] "); s.append(" ] ");
} } else {
}else{ s.append("dataFound : ").append(false);
s.append("dataFound : "+dataFound);
} }
return s.toString(); return s.toString();
} }
private String selectAInSOAP(String noCm,String tglInput) { @RequestMapping(value = "/select-detail-for-soap/", method = GET, produces = APPLICATION_JSON_VALUE)
Map<String,Object> result=diagnosaPasienService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput)); public ResponseEntity<Map<String, Object>> selectDetailForSOAP(
StringBuffer s=new StringBuffer(); @RequestParam(value = "noRec", required = false) String noRec, HttpServletRequest request) {
Map<String, Object> list = soapService.findByNoRecAntrian(noRec);
Boolean dataFound=new Boolean((boolean) result.get("dataFound")); Boolean dataFound = (Boolean) list.get("dataFound");
if(dataFound){ if (dataFound) {
s.append("Rencana Tindakan : [ "); // backend : DiagnosaPasien mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
for(DetailDiagnosaPasien detail:((DiagnosaPasien) result.get("diagnosaPasien")).getDiagnosis()){ } else {
s.append(detail.getDiagnosa().getNamaDiagnosa()+", "); mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
s.append(" ] ");
}else{
s.append("dataFound : "+dataFound);
} }
return s.toString(); return getJsonResponse(list, OK, mapHeaderMessage);
}
private String selectPInSOAP(String noCm,String tglInput) {
Map<String,Object> result1=lembarKonsultasiService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
Map<String,Object> result2=diagnosaTindakanPasienService.findByNoCmAndTglInput(noCm, DateUtil.toDate(tglInput));
StringBuffer s=new StringBuffer();
Boolean dataFound1=new Boolean((boolean) result1.get("dataFound"));
Boolean dataFound2=new Boolean((boolean) result2.get("dataFound"));
Boolean dataFound=dataFound1 || dataFound2;
if(dataFound){
if(dataFound1)
s.append("Rencana Konsultasi : "+(((LembarKonsultasi) result1.get("lembarKonsultasi")).getSaran())+", ");
if(dataFound2){
s.append("Rencana Tindakan : [ ");
for(DetailDiagnosaTindakanPasien detail:((DiagnosaTindakanPasien) result2.get("diagnosaTindakanPasien")).getDiagnosisTindakan()){
s.append(detail.getDiagnosaTindakan().getNamaDiagnosaTindakan()+", ");
}}
s.append(" ] ");
}else{
s.append("dataFound : "+dataFound);
}
/*
StringBuffer s=new StringBuffer();
s.append("Rencana Tindakan : "); --backend : DiagnosaTindakanPasien
s.append("Rencana Permintaan : [ ");
s.append("Laboratorium : ");
s.append("Radiologi : ");
s.append("Farmasi : ");
s.append(" ] ");
s.append("Rencana Konsultasi : "); //sudah, tapi antara form dengan domain berbeda
s.append("Instruksi Pulang : "); //back end belum
s.append("Instruksi Ranap : "); //back end belum
s.append("Instruksi Perjanjian : "); //back end belum
*/
return s.toString();
}
@RequestMapping(value = "/select-detail-for-soap/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> selectDetailForSOAP(@RequestParam(value = "noRec", required = false) String noRec,HttpServletRequest request) {
Boolean dataFound=false;
Map<String,Object> list=soapService.findByNoRecAntrian(noRec);
dataFound=(Boolean) list.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(list, HttpStatus.OK,mapHeaderMessage);
} }
} }

View File

@ -1,56 +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.impl.SocketClientServiceImpl;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
@RestController
@RequestMapping("/client-socket")
public class SocketClientController extends LocaleController{
@Autowired
private SocketClientServiceImpl service;
private static final Logger LOGGER = LoggerFactory.getLogger(SocketClientController.class);
@RequestMapping(value = "/cetak-data", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> connectToWinSock(@Valid @RequestBody Map<String, Object> vo, HttpServletRequest request) {
try {
Map<String,Object> result = service.connectToWinSock(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 connectToWinSock", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when connectToWinSock", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,48 +1,41 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.util.Map; import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.SppbService;
import com.jasamedika.medifirst2000.vo.SppbVO;
import com.jasamedika.medifirst2000.vo.VerifikasiSppbVO;
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.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.Map;
import org.slf4j.Logger; import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import org.slf4j.LoggerFactory; import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import org.springframework.beans.factory.annotation.Autowired; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import org.springframework.http.HttpStatus; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import org.springframework.http.MediaType; import static org.springframework.http.HttpStatus.*;
import org.springframework.http.ResponseEntity; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import org.springframework.orm.jpa.JpaSystemException; import static org.springframework.web.bind.annotation.RequestMethod.GET;
import org.springframework.web.bind.annotation.RequestBody; import static org.springframework.web.bind.annotation.RequestMethod.POST;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.SppbService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
import com.jasamedika.medifirst2000.vo.SppbVO;
import com.jasamedika.medifirst2000.vo.VerifikasiSppbVO;
@RestController @RestController
@RequestMapping("/sppb") @RequestMapping("/sppb")
public class SppbController extends LocaleController<RegistrasiPelayananVO> { public class SppbController extends LocaleController<SppbVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(SppbController.class);
@Autowired @Autowired
private SppbService service; private SppbService service;
private static final Logger LOGGER = LoggerFactory.getLogger(SppbController.class);
@SuppressWarnings("unchecked")
@RequestMapping(value = "/pre-add-sppb") @RequestMapping(value = "/pre-add-sppb")
@ResponseBody @ResponseBody
public Map<String, Object> preAddSppb( public Map<String, Object> preAddSppb(
@ -53,13 +46,9 @@ public class SppbController extends LocaleController<RegistrasiPelayananVO> {
@RequestParam(value = "dateStart", required = false) String dateStart, @RequestParam(value = "dateStart", required = false) String dateStart,
@RequestParam(value = "dateEnd", required = false) String dateEnd, @RequestParam(value = "dateEnd", required = false) String dateEnd,
@RequestParam(value = "supplierId", required = false) Integer supplierId) { @RequestParam(value = "supplierId", required = false) Integer supplierId) {
return service.preAddSppb(page, limit, sort, dir, dateStart, dateEnd, supplierId);
Map<String, Object> resultPageMap = service.preAddSppb(page, limit, sort, dir, dateStart, dateEnd, supplierId);
return resultPageMap;
} }
@SuppressWarnings("unchecked")
@RequestMapping(value = "/list-sppb") @RequestMapping(value = "/list-sppb")
@ResponseBody @ResponseBody
public Map<String, Object> listSppb( public Map<String, Object> listSppb(
@ -70,108 +59,93 @@ public class SppbController extends LocaleController<RegistrasiPelayananVO> {
@RequestParam(value = "dateStart", required = false) String dateStart, @RequestParam(value = "dateStart", required = false) String dateStart,
@RequestParam(value = "dateEnd", required = false) String dateEnd, @RequestParam(value = "dateEnd", required = false) String dateEnd,
@RequestParam(value = "supplierId", required = false) Integer supplierId) { @RequestParam(value = "supplierId", required = false) Integer supplierId) {
return service.daftarSppb(page, limit, sort, dir, dateStart, dateEnd, supplierId);
Map<String, Object> resultPageMap = service.daftarSppb(page, limit, sort, dir, dateStart, dateEnd, supplierId);
return resultPageMap;
} }
@RequestMapping(value = "/detail-kontrak", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/detail-kontrak", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getKontrak( public Map<String, Object> getKontrak(@RequestParam(value = "noRec") String noRec) {
@RequestParam(value = "noRec", required = true) String noRec) { return service.detailKontrak(noRec);
Map<String, Object> kartuPengendliDetailList = service.detailKontrak(noRec);
return kartuPengendliDetailList;
} }
@RequestMapping(value = "/detail-sppb", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/detail-sppb", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getSppb(@RequestParam(value = "noRec", required = true) String noRec) { public Map<String, Object> getSppb(@RequestParam(value = "noRec") String noRec) {
Map<String, Object> sppbList = service.detailSppb(noRec); return service.detailSppb(noRec);
return sppbList;
} }
@RequestMapping(value = "/save-sppb/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/save-sppb/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveSppb(@Valid @RequestBody SppbVO vo,HttpServletRequest request,HttpServletResponse response) { public ResponseEntity<Map<String, Object>> saveSppb(@Valid @RequestBody SppbVO vo, HttpServletRequest request,
HttpServletResponse response) {
try { try {
Map<String, Object> result = service.saveSppb(vo); Map<String, Object> result = service.saveSppb(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Sppb", e.getMessage()); LOGGER.error("Got ServiceVOException {} when saveSppb", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Sppb", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when saveSppb", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
// Verifikasi by Anggaran By Header @RequestMapping(value = "/verifikasi-sppb", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
@RequestMapping(value = "/verifikasi-sppb", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Map<String, Object>> verifikasiSppb(@Valid @RequestBody VerifikasiSppbVO vo,
public ResponseEntity<Map<String, Object>> verifikasiSppb( HttpServletRequest request) {
@Valid @RequestBody VerifikasiSppbVO vo, HttpServletRequest request) {
try { try {
Map<String, Object> result = service.verifikasiSppb(vo); Map<String, Object> result = service.verifikasiSppb(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, CREATED, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when Verif Sppb", e.getMessage()); LOGGER.error("Got ServiceVOException {} when verifikasiSppb", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when Verif Sppb", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when verifikasiSppb", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
// Verifikasi by Anggaran By Header @RequestMapping(value = "/unverifikasi-sppb", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
@RequestMapping(value = "/unverifikasi-sppb", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Map<String, Object>> unverifikasiSppb(@Valid @RequestBody VerifikasiSppbVO vo,
public ResponseEntity<Map<String, Object>> unverifikasiSppb(@Valid @RequestBody VerifikasiSppbVO vo,HttpServletRequest request) { HttpServletRequest request) {
try { try {
Map<String, Object> result = service.unverifikasiSppb(vo); Map<String, Object> result = service.unverifikasiSppb(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when un Verif Sppb", e.getMessage()); LOGGER.error("Got ServiceVOException {} when unverifikasiSppb", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when un Verif Sppb", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when unverifikasiSppb", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@RequestMapping(value = "/update-sppb/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/update-sppb/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateSppb(@Valid @RequestBody SppbVO vo,HttpServletRequest request,HttpServletResponse response) { public ResponseEntity<Map<String, Object>> updateSppb(@Valid @RequestBody SppbVO vo, HttpServletRequest request,
HttpServletResponse response) {
try { try {
Map<String, Object> result = service.updateSppb(vo); Map<String, Object> result = service.updateSppb(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Sppb", e.getMessage()); LOGGER.error("Got ServiceVOException {} when updateSppb", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Sppb", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when updateSppb", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
} }

View File

@ -1,58 +1,54 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.MessageResource; import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController; import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.dto.StandarPelayananMakananDto; import com.jasamedika.medifirst2000.dto.StandarPelayananMakananDto;
import com.jasamedika.medifirst2000.service.StandarPelayananMakananService; import com.jasamedika.medifirst2000.service.StandarPelayananMakananService;
import com.jasamedika.medifirst2000.util.rest.RestUtil; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
import static org.springframework.http.HttpStatus.OK;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController @RestController
@RequestMapping("/standar-pelayanan-makanan") @RequestMapping("/standar-pelayanan-makanan")
public class StandarPelayananMakananController extends LocaleController { public class StandarPelayananMakananController extends LocaleController<StandarPelayananMakananDto> {
@Autowired @Autowired
private StandarPelayananMakananService standarPelayananMakananService; private StandarPelayananMakananService standarPelayananMakananService;
@RequestMapping(value="/save/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/save/", method = POST, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> saveData( public ResponseEntity<List<Map<String, Object>>> saveData(@RequestBody List<StandarPelayananMakananDto> dtos,
@RequestBody List<StandarPelayananMakananDto> dtos,
HttpServletRequest request) { HttpServletRequest request) {
List<Map<String, Object>> result = this.standarPelayananMakananService.save(dtos); List<Map<String, Object>> result = this.standarPelayananMakananService.save(dtos);
if (!result.isEmpty()) { if (!result.isEmpty()) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage); return getJsonResponse(result, OK, mapHeaderMessage);
} }
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} }
@RequestMapping(value="/get-all/", @RequestMapping(value = "/get-all/", method = GET, produces = APPLICATION_JSON_VALUE)
method=RequestMethod.GET,
produces=MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getDataAll(HttpServletRequest request) { public Map<String, Object> getDataAll(HttpServletRequest request) {
Map<String, Object> result = this.standarPelayananMakananService.getStandarPelayananMakanan(); return this.standarPelayananMakananService.getStandarPelayananMakanan();
return result;
} }
@RequestMapping(value="/get-ruangan/", @RequestMapping(value = "/get-ruangan/", method = GET, produces = APPLICATION_JSON_VALUE)
method=RequestMethod.GET,
produces=MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getRuangan(HttpServletRequest request) { public Map<String, Object> getRuangan(HttpServletRequest request) {
Map<String, Object> result = this.standarPelayananMakananService.getRuangan(); return this.standarPelayananMakananService.getRuangan();
return result;
} }
} }

View File

@ -1,136 +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.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.SterilisasiAlatService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.SterilisasiAlatVO;
@RestController
@RequestMapping("/sterilisasi-alat")
public class SterilisasiAlatController extends LocaleController<SterilisasiAlatVO> {
@Autowired
private SterilisasiAlatService sterilisasiAlatService;
private static final Logger LOGGER = LoggerFactory
.getLogger(SterilisasiAlatController.class);
@RequestMapping(value = "/save-sterilisasi-alat/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody SterilisasiAlatVO vo,HttpServletRequest request) {
try{
Map<String, Object> result = sterilisasiAlatService.addSterilisasiAlat(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 SterilisasiAlat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add SterilisasiAlat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/update-sterilisasi-alat/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody SterilisasiAlatVO vo,HttpServletRequest request) {
try{
Map<String, Object> result = sterilisasiAlatService.updateSterilisasiAlat(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 SterilisasiAlat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update SterilisasiAlat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-sterilisasi-alat/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
try {
Map<String,Object> result=sterilisasiAlatService.findAllSterilisasiAlat();
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 sterilisasi alat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get all sterilisasi alat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/delete-sterilisasi-alat", method = RequestMethod.GET)
public ResponseEntity<String> deleteNamaBahan(@RequestParam(value = "noRec", required = true) String noRec) {
try {
if (sterilisasiAlatService.deleteSterilisasiAlat(noRec) == true)
return RestUtil.getJsonResponse(noRec +" Dihapus", HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when delete sterilisasi alat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when delete sterilisasi alat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
return RestUtil.getJsonHttpStatus(HttpStatus.NOT_ACCEPTABLE);
}
}

View File

@ -1,109 +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.SterilisasiAlatExternalService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.SterilisasiAlatExternalVO;
@RestController
@RequestMapping("/sterilisasi-alat-external")
public class SterilisasiAlatExternalController extends LocaleController<SterilisasiAlatExternalVO> {
@Autowired
private SterilisasiAlatExternalService sterilisasiAlatExternalService;
private static final Logger LOGGER = LoggerFactory.getLogger(SterilisasiAlatExternalController.class);
@RequestMapping(value = "/save-sterilisasi-alat-external/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody SterilisasiAlatExternalVO vo,HttpServletRequest request) {
try{
Map<String, Object> result = sterilisasiAlatExternalService.addSterilisasiAlatExternal(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 Sterilisasi alat external", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Sterilisasi alat externalo", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/update-sterilisasi-alat-external/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody SterilisasiAlatExternalVO vo,HttpServletRequest request) {
try{
Map<String, Object> result = sterilisasiAlatExternalService.updateSterilisasiAlatExternal(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 Sterilisasi alat external", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update Sterilisasi alat externalo", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-sterilisasi-alat-external/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
try {
Map<String,Object> result=sterilisasiAlatExternalService.findAllSterilisasiAlatExternal();
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 SterilisasiAlatExternal", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get all SterilisasiAlatExternal", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
}

View File

@ -1,110 +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.SterilisasiAlatMesinEoService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.SterilisasiAlatMesinEoVO;
@RestController
@RequestMapping("/sterilisasi-alat-mesin-eo")
public class SterilisasiAlatMesinEoController extends LocaleController<SterilisasiAlatMesinEoVO> {
@Autowired
private SterilisasiAlatMesinEoService sterilisasiAlatMesinEoService;
private static final Logger LOGGER = LoggerFactory
.getLogger(PencatatanSuhuMesinController.class);
@RequestMapping(value = "/save-sterilisasi-alat-mesin-eo/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody SterilisasiAlatMesinEoVO vo,HttpServletRequest request) {
try{
Map<String, Object> result = sterilisasiAlatMesinEoService.addSterilisasiMesinEo(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 Sterilisasi alat menggunakan mesin eo", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Sterilisasi alat menggunakan mesin eo", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/update-sterilisasi-alat-mesin-eo/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody SterilisasiAlatMesinEoVO vo,HttpServletRequest request) {
try{
Map<String, Object> result = sterilisasiAlatMesinEoService.addSterilisasiMesinEo(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 Sterilisasi alat menggunakan mesin eo", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update Sterilisasi alat menggunakan mesin eo", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-sterilisasi-alat-mesin-eo/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
try {
Map<String,Object> result=sterilisasiAlatMesinEoService.findAllSterilisasiAlatMesinEo();
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 Sterilisasi alat menggunakan mesin eo", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get all Sterilisasi alat menggunakan mesin eo", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
}

View File

@ -1,39 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
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.controller.base.LocaleController;
import com.jasamedika.medifirst2000.service.StokMinimumPerDepoService;
import com.jasamedika.medifirst2000.vo.StokProdukGlobalVO;
/**
* Controller class for Registrasi Pasien Business
*
* @author Adik
*/
@RestController
@RequestMapping("/stok-minimum-per-depo")
public class StokMinimumPerDepoController extends LocaleController<StokProdukGlobalVO> {
@Autowired
private StokMinimumPerDepoService stokMinimumPerDepoService;
private static final Logger LOGGER = LoggerFactory.getLogger(StokMinimumPerDepoController.class);
@RequestMapping(value = "/get-all-stok-minimum-per-depo", method = RequestMethod.GET)
public Map<String, Object> findAllAntrianPaging(String dari,String kepada) {
Map<String,Object> result=stokMinimumPerDepoService.getAllStokProdukGlobal(dari, kepada);
return result;
}
}

View File

@ -1,92 +1,78 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.util.Map; import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.StokOpNameService;
import com.jasamedika.medifirst2000.vo.StokOpNameVO;
import com.jasamedika.medifirst2000.vo.StrukClosingVO;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.Map;
import org.slf4j.Logger; import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import org.slf4j.LoggerFactory; import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import org.springframework.beans.factory.annotation.Autowired; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import org.springframework.http.HttpStatus; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import org.springframework.http.MediaType; import static org.slf4j.LoggerFactory.getLogger;
import org.springframework.http.ResponseEntity; import static org.springframework.http.HttpStatus.*;
import org.springframework.orm.jpa.JpaSystemException; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import org.springframework.web.bind.annotation.RequestBody; import static org.springframework.web.bind.annotation.RequestMethod.GET;
import org.springframework.web.bind.annotation.RequestMapping; import static org.springframework.web.bind.annotation.RequestMethod.POST;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.StokOpNameService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.StokOpNameVO;
@RestController @RestController
@RequestMapping("/stok-op-name") @RequestMapping("/stok-op-name")
public class StokOpNameController extends LocaleController { public class StokOpNameController extends LocaleController<StrukClosingVO> {
private static final Logger LOGGER = getLogger(StokOpNameController.class);
@Autowired @Autowired
private StokOpNameService stokOpNameService; private StokOpNameService stokOpNameService;
private static final Logger LOGGER = LoggerFactory.getLogger(RequestPermintaanBarangController.class);
@RequestMapping(value = "/list-stok-op-name") @RequestMapping(value = "/list-stok-op-name")
@ResponseBody @ResponseBody
public Map<String, Object> getStokGlobalByProduk( public Map<String, Object> getStokGlobalByProduk(
@RequestParam(value = "kelompokProdukId", required = false) Integer kelompokProdukId, @RequestParam(value = "kelompokProdukId", required = false) Integer kelompokProdukId,
@RequestParam(value = "produkId", required = false) Integer produkId, @RequestParam(value = "produkId", required = false) Integer produkId,
@RequestParam(value = "jenisProdukId", required = false) Integer jenisProdukId) { @RequestParam(value = "jenisProdukId", required = false) Integer jenisProdukId) {
return stokOpNameService.getStokGlobalByProduk(kelompokProdukId, produkId, jenisProdukId);
Map<String, Object> resultPageMap = stokOpNameService.getStokGlobalByProduk(kelompokProdukId,produkId,jenisProdukId);
return resultPageMap;
} }
// save kartu Pengendali @RequestMapping(value = "/save-stok-op-name", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-stok-op-name", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveStokOpName(@Valid @RequestBody StokOpNameVO vo, public ResponseEntity<Map<String, Object>> saveStokOpName(@Valid @RequestBody StokOpNameVO vo,
HttpServletRequest request) { HttpServletRequest request) {
try { try {
Map<String, Object> result = stokOpNameService.saveStokOpName(vo); Map<String, Object> result = stokOpNameService.saveStokOpName(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when saveKartuPengendali", e.getMessage()); LOGGER.error("Got ServiceVOException {} when saveStokOpName", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveKartuPengendali", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when saveStokOpName", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@RequestMapping(value = "/grid-stok-op-name") @RequestMapping(value = "/grid-stok-op-name")
@ResponseBody @ResponseBody
public Map<String, Object> gridStokOpName( public Map<String, Object> gridStokOpName(@RequestParam(value = "tanggalAwal", required = false) String tanggalAwal,
@RequestParam(value = "tanggalAwal", required = false) String tanggalAwal,
@RequestParam(value = "tanggalAhir", required = false) String tanggalAhir) { @RequestParam(value = "tanggalAhir", required = false) String tanggalAhir) {
return stokOpNameService.gridStokOpName(tanggalAwal, tanggalAhir);
Map<String, Object> resultPageMap = stokOpNameService.gridStokOpName(tanggalAwal,tanggalAhir);
return resultPageMap;
} }
// Menampilkan Kartu Pengendali Berdasarkan Norec (array) @RequestMapping(value = "/get-stok-op-name-detail/", method = GET, produces = APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-stok-op-name-detail/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public Map<String, Object> kartuPengendliDetailList(@RequestParam(value = "tglClosing") String tglClosing) {
public Map<String, Object> kartuPengendliDetailList(@RequestParam(value = "tglClosing", required = true) String tglClosing) { return stokOpNameService.detailStokOpName(tglClosing);
Map<String, Object> kartuPengendliDetailList = stokOpNameService.detailStokOpName(tglClosing);
return kartuPengendliDetailList;
} }
} }