Fix conflict pasien service

This commit is contained in:
salmanoe 2022-12-10 20:09:16 +07:00
commit 579c2d6c14
4 changed files with 28 additions and 28 deletions

View File

@ -678,11 +678,19 @@ public class BridgingDaftarOnlineController {
return new ResponseEntity<>(null, HttpStatus.NOT_ACCEPTABLE);
}
@RequestMapping(value = "/bpjs/patient/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/bpjs/medical-record-id/patient/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> getPatientMedicalRecordId(@PathVariable Integer id) {
PasienVO result = pasienService.findById(id);
if (result != null)
return new ResponseEntity<>(result.getNoCm(), HttpStatus.OK);
return new ResponseEntity<>(null, HttpStatus.OK);
}
@RequestMapping(value = "/bpjs/card-number/{noBpjs}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Boolean> checkNoBPJSPasien(@PathVariable String noBpjs) {
PasienVO result = pasienService.findByNoBpjs(noBpjs);
if (result != null)
return new ResponseEntity<>(true, HttpStatus.OK);
return new ResponseEntity<>(null, HttpStatus.OK);
}
}

View File

@ -24,25 +24,18 @@ import com.jasamedika.medifirst2000.entities.Pasien;
*/
@Repository("PasienDao")
public interface PasienDao extends PagingAndSortingRepository<Pasien, Integer> {
// custom query
@Query("select model from Pasien model where model.namaPasien=:nama")
public List<Pasien> findPasienByNama(@Param("nama") String nama);
// @Query("select model from Pasien model join fetch model.agama join fetch
// model.jenisKelamin join fetch model.pekerjaan join fetch model.pendidikan
// join fetch model.statusPerkawinan where model.noCm = :noCm")
@Query("select model from Pasien model where model.noCm = :noCm")
public List<Pasien> findPasienBynoCm(@Param("noCm") String noCm);
// custom query WITH pagination
@Query("select model from Pasien model where model.namaPasien=:nama")
public Page<Pasien> findPagePasienByNama(@Param("nama") String nama, Pageable Page);
// custom query return map example
@Query("select new map(model.id as id, model.namaPasien as nama) from Pasien model")
public List<Map<String, String>> getMapPasien();
// native query example
@Query(value = "SELECT " + "namaPasien AS NAMA " + "FROM Pasien", nativeQuery = true)
List<Object[]> getNativePasien();
@ -51,9 +44,13 @@ public interface PasienDao extends PagingAndSortingRepository<Pasien, Integer> {
@Query("select model from Pasien model,DataAsuransi ap where ap.pasien.noCm = model.noCm and ap.noKepesertaan = :noBpjs")
public List<Pasien> findPasienBynoBpjs(@Param("noBpjs") String noBpjs);
/**
* Data asuransi di laravel sepertinya sudah tidak dipakai
*/
@Query("select model from Pasien model where model.noBpjs = :noBpjs")
public List<Pasien> findPasienByNoBpjs(@Param("noBpjs") String noBpjs);
// @Query("select model from Pasien model where model.noCm =:noCm")
// public List<Pasien> findByNoCm(String noCm);
@Query("select model from Pasien model where model.id =:id")
public Pasien findById(@Param("id") Integer id);

View File

@ -25,6 +25,8 @@ public interface PasienService<T> extends BaseVoService<Pasien, PasienVO, Intege
PasienVO findById(Integer key);
PasienVO findByNoCm(String key);
PasienVO findByNoBpjs(String noBpjs);
PasienVO findByNorecAntrian(String noRec);
@ -39,8 +41,6 @@ public interface PasienService<T> extends BaseVoService<Pasien, PasienVO, Intege
Pasien findPasienById(Integer key);
PasienVO findByNoBpjs(String noBpjs);
List<Map<String, Object>> findIbuAnak(Long tglAwal, Long tglAkhir);
}

View File

@ -229,6 +229,17 @@ public class PasienServiceImpl extends BaseVoServiceImpl implements PasienServic
pasienVO = converterPasien.transferModelToVO(pasien, pasienVO);
return pasienVO;
}
@Override
public PasienVO findByNoBpjs(String noBpjs) {
List<Pasien> data = pasienDao.findPasienByNoBpjs(noBpjs);
Pasien pasien = null;
if (data.size() != 0)
pasien = data.get(0);
PasienVO pasienVO = new PasienVO();
pasienVO = converterPasien.transferModelToVO(pasien, pasienVO);
return pasienVO;
}
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
@ -543,22 +554,6 @@ public class PasienServiceImpl extends BaseVoServiceImpl implements PasienServic
return entity;
}
@Override
public PasienVO findByNoBpjs(String noBpjs) {
List<Pasien> data = pasienDao.findPasienBynoBpjs(noBpjs);
Pasien pasien = null;
if (data.size() != 0)
pasien = data.get(0);
if (pasien == null) {
return null;
}
PasienVO pasienVO = new PasienVO();
pasienVO = pasienConverter.transferModelToVO(pasien, pasienVO);
return pasienVO;
}
@Override
public void updateTanggalMeninggal(Pasien p) {
pasienDao.save(p);