Update PasienService

Pembuatan API simpan pasien baru bpjs dari mobile jkn
This commit is contained in:
salmanoe 2022-12-08 07:11:17 +07:00
parent f75d0a64ab
commit 77b1eec23b
6 changed files with 55 additions and 112 deletions

View File

@ -11,10 +11,15 @@ import java.util.List;
import java.util.Map;
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.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;
@ -38,6 +43,7 @@ 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.JadwalDokterService;
import com.jasamedika.medifirst2000.service.ModelService;
import com.jasamedika.medifirst2000.service.PasienService;
@ -72,6 +78,8 @@ 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 PasienService<Pasien> pasienService;
@ -83,7 +91,7 @@ public class BridgingDaftarOnlineController {
@Autowired
private RuanganService<RuanganVO> ruanganService;
@Autowired
private PegawaiService pegawaiService;
@ -646,10 +654,26 @@ public class BridgingDaftarOnlineController {
List<Map<String, Object>> entity = ruanganService.findRajalBPJS();
return new ResponseEntity<>(entity, HttpStatus.OK);
}
@RequestMapping(value = "/bpjs/dpjp/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> getListDpjp() {
List<Map<String, Object>> entity = pegawaiService.getDokterBpjs();
return new ResponseEntity<>(entity, HttpStatus.OK);
}
@RequestMapping(value = "/bpjs/patient/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> saveNewPatient(@Valid @RequestBody PasienVO vo) {
try {
PasienVO result = pasienService.add(vo);
if (null != result)
return new ResponseEntity<>(true, HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
return new ResponseEntity<>(false, HttpStatus.INTERNAL_SERVER_ERROR);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
return new ResponseEntity<>(false, HttpStatus.CONFLICT);
}
return new ResponseEntity<>(false, HttpStatus.NOT_ACCEPTABLE);
}
}

View File

@ -166,34 +166,39 @@ public class PasienServiceImpl extends BaseVoServiceImpl implements PasienServic
public PasienVO add(PasienVO vo) throws JpaSystemException, ServiceVOException {
Pasien pasien = new Pasien();
pasien = pasienConverter.transferVOToModel(vo, pasien);
pasien.setJenisKelamin(jenisKelaminConverter.transferVOToModel(vo.getJenisKelamin(), new JenisKelamin()));
pasien.setAgama(agamaConverter.transferVOToModel(vo.getAgama(), new Agama()));
pasien.setPendidikan(pendidikanConverter.transferVOToModel(vo.getPendidikan(), new Pendidikan()));
pasien.setPekerjaan(pekerjaanConverter.transferVOToModel(vo.getPekerjaan(), new Pekerjaan()));
pasien.setStatusPerkawinan(
statusPerkawinanConverter.transferVOToModel(vo.getStatusPerkawinan(), new StatusPerkawinan()));
if (CommonUtil.isNotNullOrEmpty(vo.getJenisKelamin()))
pasien.setJenisKelamin(jenisKelaminConverter.transferVOToModel(vo.getJenisKelamin(), new JenisKelamin()));
if (CommonUtil.isNotNullOrEmpty(vo.getAgama()))
pasien.setAgama(agamaConverter.transferVOToModel(vo.getAgama(), new Agama()));
if (CommonUtil.isNotNullOrEmpty(vo.getPendidikan()))
pasien.setPendidikan(pendidikanConverter.transferVOToModel(vo.getPendidikan(), new Pendidikan()));
if (CommonUtil.isNotNullOrEmpty(vo.getPekerjaan()))
pasien.setPekerjaan(pekerjaanConverter.transferVOToModel(vo.getPekerjaan(), new Pekerjaan()));
if (CommonUtil.isNotNullOrEmpty(vo.getStatusPerkawinan()))
pasien.setStatusPerkawinan(
statusPerkawinanConverter.transferVOToModel(vo.getStatusPerkawinan(), new StatusPerkawinan()));
List<Alamat> listAlamat = new ArrayList<Alamat>();
for (AlamatVO alamatVo : vo.getAlamats()) {
Alamat alamat = new Alamat();
alamat = alamatConverter.transferVOToModel(alamatVo, new Alamat());
alamat.setJenisAlamat(jenisAlamatConverter.transferVOToModel(alamatVo.getJenisAlamat(), new JenisAlamat()));
alamat.setPropinsi(propinsiConverter.transferVOToModel(alamatVo.getPropinsi(), new Propinsi()));
alamat.setNegara(negaraConverter.transferVOToModel(alamatVo.getNegara(), new Negara()));
alamat.setRekanan(rekananConverter.transferVOToModel(alamatVo.getRekanan(), new Rekanan()));
alamat.setPegawai(loginUserConverter.transferVOToModel(alamatVo.getPegawai(), new LoginUser()));
// alamat.setKecamatan(kecamatanConverter.transferVOToModel(alamatVo.getKecamatan(),
// new Kecamatan()));
if (CommonUtil.isNotNullOrEmpty(alamatVo.getJenisAlamat()))
alamat.setJenisAlamat(jenisAlamatConverter.transferVOToModel(alamatVo.getJenisAlamat(), new JenisAlamat()));
if (CommonUtil.isNotNullOrEmpty(alamatVo.getPropinsi()))
alamat.setPropinsi(propinsiConverter.transferVOToModel(alamatVo.getPropinsi(), new Propinsi()));
if (CommonUtil.isNotNullOrEmpty(alamatVo.getNegara()))
alamat.setNegara(negaraConverter.transferVOToModel(alamatVo.getNegara(), new Negara()));
if (CommonUtil.isNotNullOrEmpty(alamatVo.getRekanan()))
alamat.setRekanan(rekananConverter.transferVOToModel(alamatVo.getRekanan(), new Rekanan()));
if (CommonUtil.isNotNullOrEmpty(alamatVo.getPegawai()))
alamat.setPegawai(loginUserConverter.transferVOToModel(alamatVo.getPegawai(), new LoginUser()));
alamat.setPasien(pasien);
listAlamat.add(alamat);
}
pasien.getAlamats().addAll(listAlamat);
if (listAlamat.size() > 0)
pasien.getAlamats().addAll(listAlamat);
Pasien resultModel = pasienDao.save(pasien);
// return VO
PasienVO resultVo = new PasienVO();
pasienConverter.transferModelToVO(resultModel, resultVo);
return resultVo;
}

View File

@ -302,7 +302,6 @@ public class Alamat extends BaseMaster {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ObjectNegaraFk")
@NotNull(message = "Kd Negara tidak boleh kosong")
@Caption(value = "Object Negara")
private Negara negara;

View File

@ -60,7 +60,6 @@ public class Pasien extends BaseMasterPasien {
@ManyToOne
@JoinColumn(name = "ObjectJenisKelaminFk")
@NotNull(message="Kd Jenis Kelamin tidak boleh kosong")
@Caption(value="Object Jenis Kelamin")
private JenisKelamin jenisKelamin;
@ -93,7 +92,6 @@ public class Pasien extends BaseMasterPasien {
@ManyToOne
@JoinColumn(name = "ObjectPendidikanFk")
@NotNull(message="Kd Pendidikan tidak boleh kosong")
@Caption(value="Object Pendidikan")
private Pendidikan pendidikan;

View File

@ -1,10 +1,5 @@
package com.jasamedika.medifirst2000.vo;
import javax.persistence.Column;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotNull;
import com.jasamedika.medifirst2000.base.vo.BaseMasterVO;
import com.jasamedika.medifirst2000.helper.Caption;
@ -22,7 +17,6 @@ public class AlamatVO extends BaseMasterVO {
this.alamatEmail = alamatEmail;
}
@Column(name = "AlamatEmail", nullable = true , length = 50)
public String getAlamatEmail(){
return this.alamatEmail;
}
@ -34,7 +28,6 @@ public class AlamatVO extends BaseMasterVO {
this.alamatLengkap = alamatLengkap;
}
@Column(name = "AlamatLengkap", nullable = false , length = 200)
public String getAlamatLengkap(){
return this.alamatLengkap;
}
@ -46,7 +39,6 @@ public class AlamatVO extends BaseMasterVO {
this.blackBerry = blackBerry;
}
@Column(name = "BlackBerry", nullable = true , length = 10)
public String getBlackBerry(){
return this.blackBerry;
}
@ -70,7 +62,6 @@ public class AlamatVO extends BaseMasterVO {
this.facebook = facebook;
}
@Column(name = "Facebook", nullable = true , length = 50)
public String getFacebook(){
return this.facebook;
}
@ -82,7 +73,6 @@ public class AlamatVO extends BaseMasterVO {
this.faksimile1 = faksimile1;
}
@Column(name = "Faksimile1", nullable = true , length = 15)
public String getFaksimile1(){
return this.faksimile1;
}
@ -94,7 +84,6 @@ public class AlamatVO extends BaseMasterVO {
this.faksimile2 = faksimile2;
}
@Column(name = "Faksimile2", nullable = true , length = 15)
public String getFaksimile2(){
return this.faksimile2;
}
@ -106,7 +95,6 @@ public class AlamatVO extends BaseMasterVO {
this.fixedPhone1 = fixedPhone1;
}
@Column(name = "FixedPhone1", nullable = true , length = 15)
public String getFixedPhone1(){
return this.fixedPhone1;
}
@ -118,7 +106,6 @@ public class AlamatVO extends BaseMasterVO {
this.fixedPhone2 = fixedPhone2;
}
@Column(name = "FixedPhone2", nullable = true , length = 15)
public String getFixedPhone2(){
return this.fixedPhone2;
}
@ -127,7 +114,6 @@ public class AlamatVO extends BaseMasterVO {
private Byte isBillingAddress;
@Column(name = "isBillingAddress", nullable = false )
public Byte getIsBillingAddress() {
return isBillingAddress;
}
@ -140,7 +126,6 @@ public class AlamatVO extends BaseMasterVO {
private Byte isPrimaryAddress;
@Column(name = "isPrimaryAddress", nullable = false )
public Byte getIsPrimaryAddress() {
return isPrimaryAddress;
}
@ -152,7 +137,6 @@ public class AlamatVO extends BaseMasterVO {
@Caption(value="Is Shipping Address")
private Byte isShippingAddress;
@Column(name = "isShippingAddress", nullable = false )
public Byte getIsShippingAddress() {
return isShippingAddress;
}
@ -164,7 +148,6 @@ public class AlamatVO extends BaseMasterVO {
@Caption(value="Kode Alamat")
private Integer kdAlamat;
@Column(name = "KdAlamat", nullable = false )
public Integer getKdAlamat() {
return kdAlamat;
}
@ -173,8 +156,6 @@ public class AlamatVO extends BaseMasterVO {
this.kdAlamat = kdAlamat;
}
@ManyToOne
@JoinColumn(name = "ObjectDesaKelurahanFk")
@Caption(value="Object Desa Kelurahan")
private DesaKelurahanVO desaKelurahan;
@ -182,12 +163,10 @@ public class AlamatVO extends BaseMasterVO {
this.desaKelurahan = desaKelurahan;
}
@Column(name = "KdDesaKelurahan", nullable = true )
public DesaKelurahanVO getDesaKelurahan(){
return this.desaKelurahan;
}
@Column(name = "ObjectDesaKelurahanFk", insertable=false,updatable=false)
private Integer desaKelurahanId;
@ -200,8 +179,6 @@ public class AlamatVO extends BaseMasterVO {
this.desaKelurahanId = desaKelurahanId;
}
@ManyToOne
@JoinColumn(name = "ObjectHubunganKeluargaFk")
@Caption(value="Object Hubungan Keluarga")
private HubunganKeluargaVO hubunganKeluarga;
@ -209,12 +186,10 @@ public class AlamatVO extends BaseMasterVO {
this.hubunganKeluarga = hubunganKeluarga;
}
@Column(name = "KdHubunganKeluarga", nullable = true )
public HubunganKeluargaVO getHubunganKeluarga(){
return this.hubunganKeluarga;
}
@Column(name = "ObjectHubunganKeluargaFk", insertable=false,updatable=false)
private Integer hubunganKeluargaId;
@ -227,9 +202,6 @@ public class AlamatVO extends BaseMasterVO {
this.hubunganKeluargaId = hubunganKeluargaId;
}
@ManyToOne
@JoinColumn(name = "ObjectJenisAlamatFk")
@NotNull(message="Object Jenis AlamatVO Harus Diisi")
@Caption(value="Object Jenis Alamat")
private JenisAlamatVO jenisAlamat;
@ -237,12 +209,10 @@ public class AlamatVO extends BaseMasterVO {
this.jenisAlamat = jenisAlamat;
}
@Column(name = "KdJenisAlamat", nullable = false )
public JenisAlamatVO getJenisAlamat(){
return this.jenisAlamat;
}
@Column(name = "ObjectJenisAlamatFk", insertable=false,updatable=false)
private Integer jenisAlamatId;
public Integer getJenisAlamatId() {
@ -253,8 +223,6 @@ public class AlamatVO extends BaseMasterVO {
this.jenisAlamatId = jenisAlamatId;
}
@ManyToOne
@JoinColumn(name = "ObjectKecamatanFk")
@Caption(value="Object Kecamatan")
private KecamatanVO kecamatan;
@ -262,12 +230,10 @@ public class AlamatVO extends BaseMasterVO {
this.kecamatan = kecamatan;
}
@Column(name = "KdKecamatan", nullable = true )
public KecamatanVO getKecamatan(){
return this.kecamatan;
}
@Column(name = "ObjectKecamatanFk", insertable=false,updatable=false)
private Integer kecamatanId;
@ -280,8 +246,6 @@ public class AlamatVO extends BaseMasterVO {
this.kecamatanId = kecamatanId;
}
@ManyToOne
@JoinColumn(name = "ObjectKotaKabupatenFk")
@Caption(value="Object Kota Kabupaten")
private KotaKabupatenVO kotaKabupaten;
@ -289,12 +253,10 @@ public class AlamatVO extends BaseMasterVO {
this.kotaKabupaten = kotaKabupaten;
}
@Column(name = "KdKotaKabupaten", nullable = true )
public KotaKabupatenVO getKotaKabupaten(){
return this.kotaKabupaten;
}
@Column(name = "ObjectKotaKabupatenFk", insertable=false,updatable=false)
private Integer kotaKabupatenId;
@ -306,9 +268,6 @@ public class AlamatVO extends BaseMasterVO {
this.kotaKabupatenId = kotaKabupatenId;
}
@ManyToOne
@JoinColumn(name = "ObjectNegaraFk")
@NotNull(message="Object NegaraVO Harus Diisi")
@Caption(value="Object Negara")
private NegaraVO negara;
@ -316,12 +275,10 @@ public class AlamatVO extends BaseMasterVO {
this.negara = negara;
}
@Column(name = "KdNegara", nullable = false )
public NegaraVO getNegara(){
return this.negara;
}
@Column(name = "ObjectNegaraFk", insertable=false,updatable=false)
private Integer negaraId;
@ -333,8 +290,6 @@ public class AlamatVO extends BaseMasterVO {
this.negaraId = negaraId;
}
@ManyToOne
@JoinColumn(name = "ObjectPegawaiFk")
@Caption(value="Object Pegawai")
private LoginUserVO pegawai;
@ -342,12 +297,10 @@ public class AlamatVO extends BaseMasterVO {
this.pegawai = pegawai;
}
@Column(name = "KdPegawai", nullable = true , length = 5)
public LoginUserVO getPegawai(){
return this.pegawai;
}
@Column(name = "ObjectPegawaiFk", insertable=false,updatable=false)
private Integer pegawaiId;
@ -360,9 +313,6 @@ public class AlamatVO extends BaseMasterVO {
this.pegawaiId = pegawaiId;
}
@ManyToOne
@JoinColumn(name = "ObjectPropinsiFk")
@NotNull(message="Object PropinsiVO Harus Diisi")
@Caption(value="Object Propinsi")
private PropinsiVO propinsi;
@ -370,12 +320,10 @@ public class AlamatVO extends BaseMasterVO {
this.propinsi = propinsi;
}
@Column(name = "KdPropinsi", nullable = false )
public PropinsiVO getPropinsi(){
return this.propinsi;
}
@Column(name = "ObjectPropinsiFk", insertable=false,updatable=false)
private Integer propinsiId;
@ -388,8 +336,6 @@ public class AlamatVO extends BaseMasterVO {
this.propinsiId = propinsiId;
}
@ManyToOne
@JoinColumn(name = "ObjectRekananFk")
@Caption(value="Object Rekanan")
private RekananVO rekanan;
@ -397,12 +343,10 @@ public class AlamatVO extends BaseMasterVO {
this.rekanan = rekanan;
}
@Column(name = "KdRekanan", nullable = true )
public RekananVO getRekanan(){
return this.rekanan;
}
@Column(name = "ObjectRekananFk", insertable=false,updatable=false)
private Integer rekananId;
@ -417,7 +361,6 @@ public class AlamatVO extends BaseMasterVO {
@Caption(value="Kecamatan")
private String namaKecamatan;
@Column(name = "Kecamatan", nullable = true , length = 50)
public String getNamaKecamatan() {
return namaKecamatan;
}
@ -433,7 +376,6 @@ public class AlamatVO extends BaseMasterVO {
this.keteranganLainnya = keteranganLainnya;
}
@Column(name = "KeteranganLainnya", nullable = true , length = 150)
public String getKeteranganLainnya(){
return this.keteranganLainnya;
}
@ -442,7 +384,6 @@ public class AlamatVO extends BaseMasterVO {
private String kodePos;
@Column(name = "KodePos", nullable = true , length = 10)
public String getKodePos() {
return kodePos;
}
@ -454,7 +395,6 @@ public class AlamatVO extends BaseMasterVO {
@Caption(value="Kota Kabupaten")
private String namaKotaKabupaten;
@Column(name = "KotaKabupaten", nullable = true , length = 50)
public String getNamaKotaKabupaten() {
return namaKotaKabupaten;
}
@ -470,7 +410,6 @@ public class AlamatVO extends BaseMasterVO {
this.line = line;
}
@Column(name = "Line", nullable = true , length = 50)
public String getLine(){
return this.line;
}
@ -482,7 +421,6 @@ public class AlamatVO extends BaseMasterVO {
this.mobilePhone1 = mobilePhone1;
}
@Column(name = "MobilePhone1", nullable = true , length = 15)
public String getMobilePhone1(){
return this.mobilePhone1;
}
@ -494,7 +432,6 @@ public class AlamatVO extends BaseMasterVO {
this.mobilePhone2 = mobilePhone2;
}
@Column(name = "MobilePhone2", nullable = true , length = 15)
public String getMobilePhone2(){
return this.mobilePhone2;
}
@ -506,19 +443,13 @@ public class AlamatVO extends BaseMasterVO {
this.namaTempatGedung = namaTempatGedung;
}
@Column(name = "NamaTempatGedung", nullable = true , length = 150)
public String getNamaTempatGedung(){
return this.namaTempatGedung;
}
@ManyToOne
@JoinColumn(name = "NoCMFk")
@Caption(value="No C M")
//@JsonBackReference
private PasienVO pasien;
@Column(name = "NoCM", nullable = true , length = 15)
public PasienVO getPasien() {
return pasien;
}
@ -527,7 +458,6 @@ public class AlamatVO extends BaseMasterVO {
this.pasien = pasien;
}
@Column(name = "NoCMFk", insertable=false,updatable=false)
private Integer pasienId;
@ -556,7 +486,6 @@ public class AlamatVO extends BaseMasterVO {
@Caption(value="Twitter")
private String twitter;
@Column(name = "Twitter", nullable = true , length = 50)
public String getTwitter() {
return twitter;
}
@ -572,7 +501,6 @@ public class AlamatVO extends BaseMasterVO {
this.website = website;
}
@Column(name = "Website", nullable = true , length = 80)
public String getWebsite(){
return this.website;
}
@ -584,7 +512,6 @@ public class AlamatVO extends BaseMasterVO {
this.whatsApp = whatsApp;
}
@Column(name = "WhatsApp", nullable = true , length = 15)
public String getWhatsApp(){
return this.whatsApp;
}
@ -596,7 +523,6 @@ public class AlamatVO extends BaseMasterVO {
this.yahooMessenger = yahooMessenger;
}
@Column(name = "YahooMessenger", nullable = true , length = 50)
public String getYahooMessenger(){
return this.yahooMessenger;
}

View File

@ -1,22 +1,16 @@
package com.jasamedika.medifirst2000.vo;
import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.*;
import java.util.Date;
import org.hibernate.validator.constraints.NotEmpty;
import com.jasamedika.medifirst2000.base.vo.BaseMasterVO;
import com.jasamedika.medifirst2000.entities.Alamat;
import javax.persistence.CascadeType;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.internal.util.logging.Messages;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.jasamedika.medifirst2000.base.vo.BaseMasterVO;
import com.jasamedika.medifirst2000.helper.Caption;
@ -42,7 +36,6 @@ public class PasienVO extends BaseMasterVO {
private GolonganDarahVO golonganDarah;
@ManyToOne
@NotNull(message="Kd Jenis Kelamin tidak boleh kosong")
@Caption(value="Object Jenis Kelamin")
private JenisKelaminVO jenisKelamin;
@ -59,7 +52,6 @@ public class PasienVO extends BaseMasterVO {
private KebangsaanVO kebangsaan;
@ManyToOne
@NotNull(message="Kd Pendidikan tidak boleh kosong")
@Caption(value="Object Pendidikan")
private PendidikanVO pendidikan;
@ -68,7 +60,6 @@ public class PasienVO extends BaseMasterVO {
private StatusPerkawinanVO statusPerkawinan;
@ManyToOne
@NotNull(message="Object Title Harus Diisi")
@Caption(value="Object Title")
private TitlePasienVO title;