Update PelayananController.java
Duplikasi controller pelayanan
This commit is contained in:
parent
92816495f6
commit
3746d5e024
@ -4,13 +4,13 @@ import com.jasamedika.medifirst2000.constants.Constants;
|
|||||||
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.core.web.WebConstants;
|
||||||
|
import com.jasamedika.medifirst2000.dto.BatalPaketProdukDto;
|
||||||
import com.jasamedika.medifirst2000.dto.TagihanPendaftaranDto;
|
import com.jasamedika.medifirst2000.dto.TagihanPendaftaranDto;
|
||||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||||
import com.jasamedika.medifirst2000.service.PasienDaftarService;
|
import com.jasamedika.medifirst2000.service.*;
|
||||||
import com.jasamedika.medifirst2000.service.PelayananPasienService;
|
|
||||||
import com.jasamedika.medifirst2000.service.ProdukService;
|
|
||||||
import com.jasamedika.medifirst2000.service.SatuanStandarService;
|
|
||||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||||
|
import com.jasamedika.medifirst2000.vo.MapProdukPaketToProdukVO;
|
||||||
|
import com.jasamedika.medifirst2000.vo.MapProdukPaketVO;
|
||||||
import com.jasamedika.medifirst2000.vo.PelayananPasienVO;
|
import com.jasamedika.medifirst2000.vo.PelayananPasienVO;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -22,7 +22,6 @@ import org.springframework.orm.jpa.JpaSystemException;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -45,6 +44,12 @@ public class PelayananController extends LocaleController<PelayananPasienVO> {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SatuanStandarService satuanStandarService;
|
private SatuanStandarService satuanStandarService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MapProdukPaketService mapProdukPaketService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MapProdukPaketToProdukService mapProdukPaketToProdukService;
|
||||||
|
|
||||||
@RequestMapping(value = "/calculate-indikator-pelayanan", method = RequestMethod.GET)
|
@RequestMapping(value = "/calculate-indikator-pelayanan", method = RequestMethod.GET)
|
||||||
public ResponseEntity<List<Map<String, Object>>> calculateIndikatorPelayanan(HttpServletRequest request,
|
public ResponseEntity<List<Map<String, Object>>> calculateIndikatorPelayanan(HttpServletRequest request,
|
||||||
@RequestParam("tahun") String tahun) {
|
@RequestParam("tahun") String tahun) {
|
||||||
@ -237,4 +242,83 @@ public class PelayananController extends LocaleController<PelayananPasienVO> {
|
|||||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/tagihan/diskon/batal-paket", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<Object> batalPaket(HttpServletRequest request, @RequestBody BatalPaketProdukDto dto) {
|
||||||
|
try {
|
||||||
|
pelayananPasienService.batalPaketProduk(dto);
|
||||||
|
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||||
|
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||||
|
return RestUtil.getJsonResponse(dto, HttpStatus.OK, mapHeaderMessage);
|
||||||
|
} catch (ServiceVOException e) {
|
||||||
|
LOGGER.error("Got exception {} when batal diskon paket", e.getMessage());
|
||||||
|
Map<String, String> error = new HashMap<>();
|
||||||
|
error.put("bad_request", e.getMessage());
|
||||||
|
return RestUtil.getJsonResponse(null, HttpStatus.BAD_REQUEST, error);
|
||||||
|
} catch (JpaSystemException jse) {
|
||||||
|
LOGGER.error("Got exception {} when batal diskon paket", jse.getMessage());
|
||||||
|
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||||
|
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/vouchers/validity", method = RequestMethod.GET)
|
||||||
|
public ResponseEntity<Object> isValidVoucher(HttpServletRequest request,
|
||||||
|
@RequestParam("kode-voucher") String kodeVoucher, @RequestParam("no-registrasi") String noRegistrasi) {
|
||||||
|
try {
|
||||||
|
boolean validVoucher = pelayananPasienService.isValidVoucher(kodeVoucher, noRegistrasi);
|
||||||
|
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||||
|
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||||
|
return RestUtil.getJsonResponse(validVoucher, HttpStatus.OK, mapHeaderMessage);
|
||||||
|
} catch (ServiceVOException e) {
|
||||||
|
LOGGER.error("Got exception {} when check voucher validity", e.getMessage());
|
||||||
|
Map<String, String> error = new HashMap<>();
|
||||||
|
error.put("bad_request", e.getMessage());
|
||||||
|
return RestUtil.getJsonResponse(false, HttpStatus.BAD_REQUEST, error);
|
||||||
|
} catch (JpaSystemException jse) {
|
||||||
|
LOGGER.error("Got exception {} when check voucher validity", jse.getMessage());
|
||||||
|
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||||
|
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/produk-paket/paket", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<Object> simpanMappingListProdukPaket(HttpServletRequest request,
|
||||||
|
@RequestBody List<MapProdukPaketVO> vos) {
|
||||||
|
try {
|
||||||
|
mapProdukPaketService.saveAll(vos);
|
||||||
|
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||||
|
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||||
|
return RestUtil.getJsonResponse(vos, HttpStatus.OK, mapHeaderMessage);
|
||||||
|
} catch (ServiceVOException e) {
|
||||||
|
LOGGER.error("Got exception {} when simpan mapping list produk paket", e.getMessage());
|
||||||
|
Map<String, String> error = new HashMap<>();
|
||||||
|
error.put("bad_request", e.getMessage());
|
||||||
|
return RestUtil.getJsonResponse(null, HttpStatus.BAD_REQUEST, error);
|
||||||
|
} catch (JpaSystemException jse) {
|
||||||
|
LOGGER.error("Got exception {} when simpan mapping list produk paket", jse.getMessage());
|
||||||
|
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||||
|
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/produk-paket/produk", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<Object> simpanMappingEntriProdukPaket(HttpServletRequest request,
|
||||||
|
@RequestBody List<MapProdukPaketToProdukVO> vos) {
|
||||||
|
try {
|
||||||
|
mapProdukPaketToProdukService.saveAll(vos);
|
||||||
|
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||||
|
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||||
|
return RestUtil.getJsonResponse(vos, HttpStatus.OK, mapHeaderMessage);
|
||||||
|
} catch (ServiceVOException e) {
|
||||||
|
LOGGER.error("Got exception {} when simpan mapping entri produk paket", e.getMessage());
|
||||||
|
Map<String, String> error = new HashMap<>();
|
||||||
|
error.put("bad_request", e.getMessage());
|
||||||
|
return RestUtil.getJsonResponse(null, HttpStatus.BAD_REQUEST, error);
|
||||||
|
} catch (JpaSystemException jse) {
|
||||||
|
LOGGER.error("Got exception {} when simpan mapping entri produk paket", jse.getMessage());
|
||||||
|
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||||
|
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user