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