Update BridgingDaftarOnlineController.java

Pembuatan service pengecekan antrian existing untuk pasien lama
This commit is contained in:
salmanoe 2023-01-14 08:37:38 +07:00
parent 755cf98031
commit 5937b90f04

View File

@ -14,14 +14,11 @@ import java.util.UUID;
import javax.validation.Valid; 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.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.PathVariable; 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;
@ -47,7 +44,6 @@ import com.jasamedika.medifirst2000.entities.Pegawai;
import com.jasamedika.medifirst2000.entities.Pendidikan; import com.jasamedika.medifirst2000.entities.Pendidikan;
import com.jasamedika.medifirst2000.entities.Ruangan; import com.jasamedika.medifirst2000.entities.Ruangan;
import com.jasamedika.medifirst2000.enums.TipePasienEnum; import com.jasamedika.medifirst2000.enums.TipePasienEnum;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.AntrianPasienDiPeriksaService; import com.jasamedika.medifirst2000.service.AntrianPasienDiPeriksaService;
import com.jasamedika.medifirst2000.service.JadwalDokterService; import com.jasamedika.medifirst2000.service.JadwalDokterService;
import com.jasamedika.medifirst2000.service.ModelService; import com.jasamedika.medifirst2000.service.ModelService;
@ -85,8 +81,6 @@ import com.jasamedika.medifirst2000.vo.custom.BridgeDaftarVerifikasiPasienNotFou
@RestController @RestController
@RequestMapping("/daftar-ol") @RequestMapping("/daftar-ol")
public class BridgingDaftarOnlineController { public class BridgingDaftarOnlineController {
private static final Logger LOGGER = LoggerFactory.getLogger(BridgingDaftarOnlineController.class);
@Autowired @Autowired
private AntrianPasienRegistrasiDao antrianPasienRegistrasiDao; private AntrianPasienRegistrasiDao antrianPasienRegistrasiDao;
@ -126,15 +120,15 @@ public class BridgingDaftarOnlineController {
@Autowired @Autowired
private PegawaiService pegawaiService; private PegawaiService pegawaiService;
@Autowired
private AntrianPasienDiPeriksaService antrianService;
@Autowired @Autowired
private RegistrasiPasienService registrasiPasienService; private RegistrasiPasienService registrasiPasienService;
@Autowired @Autowired
private PasienDaftarService pasienDaftarService; private PasienDaftarService pasienDaftarService;
@Autowired
private AntrianPasienDiPeriksaService antrianService;
@RequestMapping(value = "/klinik_rs", method = RequestMethod.GET, produces = { MediaType.APPLICATION_XML_VALUE }) @RequestMapping(value = "/klinik_rs", method = RequestMethod.GET, produces = { MediaType.APPLICATION_XML_VALUE })
public BridgeDaftarKlinikListVO daftarKlinikRs() { public BridgeDaftarKlinikListVO daftarKlinikRs() {
BridgeDaftarKlinikListVO y = new BridgeDaftarKlinikListVO(); BridgeDaftarKlinikListVO y = new BridgeDaftarKlinikListVO();
@ -684,12 +678,9 @@ public class BridgingDaftarOnlineController {
if (result != null) if (result != null)
return new ResponseEntity<>(result.getId(), HttpStatus.CREATED); return new ResponseEntity<>(result.getId(), HttpStatus.CREATED);
return new ResponseEntity<>(null, HttpStatus.NOT_ACCEPTABLE); return new ResponseEntity<>(null, HttpStatus.NOT_ACCEPTABLE);
} catch (ServiceVOException e) { } catch (Exception e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage()); e.printStackTrace();
return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR); return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
return new ResponseEntity<>(null, HttpStatus.CONFLICT);
} }
} }
@ -727,18 +718,15 @@ public class BridgingDaftarOnlineController {
try { try {
String result = registrasiPasienService.saveRegistrasiPasien(dto); String result = registrasiPasienService.saveRegistrasiPasien(dto);
return new ResponseEntity<>(result, HttpStatus.CREATED); return new ResponseEntity<>(result, HttpStatus.CREATED);
} catch (ServiceVOException e) { } catch (Exception e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage()); e.printStackTrace();
return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR); return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
return new ResponseEntity<>(null, HttpStatus.CONFLICT);
} }
} }
@RequestMapping(value = "/bpjs/patient/status/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/bpjs/antrian/status/{idPasien}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> getPatientStatus(@PathVariable Integer id) { public ResponseEntity<Boolean> getStatusAntrianPasien(@PathVariable Integer idPasien) {
Boolean exists = pasienDaftarService.checkStatusPasien(id); Boolean exists = pasienDaftarService.checkStatusPasien(idPasien);
return new ResponseEntity<>(exists, HttpStatus.OK); return new ResponseEntity<>(exists, HttpStatus.OK);
} }
} }