From b01c88e7f53911e46dd9c7a1876a6a82e5d5bdcb Mon Sep 17 00:00:00 2001 From: ahdan15 Date: Tue, 1 Jul 2025 12:42:28 +0700 Subject: [PATCH] update terbaru --- docker-compose.yml | 18 +- internal/database/database.go | 11 +- internal/server/routes.go | 22 +- pkg/database/mongo/account.go | 26 ++ pkg/database/mongo/condition.go | 26 ++ pkg/database/mongo/coverage.go | 26 ++ pkg/database/mongo/location.go | 85 ++++++ pkg/database/mongo/patient.go | 25 +- pkg/database/mongo/practitioner.go | 27 ++ pkg/database/satu_data/location.go | 7 +- pkg/handlers/MongoHandler/Patient/patient.go | 28 ++ pkg/handlers/MongoHandler/account/account.go | 26 ++ .../MongoHandler/condition/condition.go | 26 ++ .../MongoHandler/coverage/coverage.go | 26 ++ .../MongoHandler/practitioner/practitioner.go | 28 ++ pkg/handlers/Practitioner/Practitioner.go | 77 ++--- pkg/handlers/location/location.go | 26 ++ pkg/handlers/migrasi/location/location.go | 14 +- pkg/models/mongo/account/account.go | 29 ++ pkg/models/mongo/condition/condition.go | 23 ++ pkg/models/mongo/coverage/coverage.go | 30 ++ .../insertpatient/insertPatientRelated.go | 22 +- pkg/models/simrs/location.go | 2 + pkg/models/struct/fhir.go | 263 +++++++++++++----- 24 files changed, 759 insertions(+), 134 deletions(-) create mode 100644 pkg/database/mongo/account.go create mode 100644 pkg/database/mongo/condition.go create mode 100644 pkg/database/mongo/coverage.go create mode 100644 pkg/handlers/MongoHandler/account/account.go create mode 100644 pkg/handlers/MongoHandler/condition/condition.go create mode 100644 pkg/handlers/MongoHandler/coverage/coverage.go create mode 100644 pkg/models/mongo/account/account.go create mode 100644 pkg/models/mongo/condition/condition.go create mode 100644 pkg/models/mongo/coverage/coverage.go diff --git a/docker-compose.yml b/docker-compose.yml index f8837d5..06c413d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,7 +17,7 @@ services: # DATABASE SIMRS V3.0 - SIMRS_STAG_HOST=10.10.123.223 - SIMRS_STAG_PORT=5432 - - SIMRS_STAG_NAME=simrsbackup + - SIMRS_STAG_NAME=simrs-stag - SIMRS_STAG_USER=simtest - SIMRS_STAG_PASS=12345 # DATABASE SATU DATA @@ -26,22 +26,6 @@ services: - SATUDATA_PASS=stim*RS54 - SATUDATA_NAME=satu_db - SATUDATA_PORT=5000 - # BPJS - - BASEURL_BPJS=https://apijkn.bpjs-kesehatan.go.id/ - - CONS_ID=5257 - - USER_KEY=4cf1cbef8c008440bbe9ef9ba789e482 - - SECRET_KEY=1bV363512D - # SERVICE ANTROL - - ANTREAN_RS=antreanrs - # BPJS VCLAIM - - VCALIM_RS=vclaim-rest - # BPJS PCARE - - PCARE_RS=pcare-rest - # BPJS ICARE - - PCARE_APLICARE=ihs - # LIS MIKROBIOLOGI - - LIS_MIKROBIOLOGI_URL=http://10.10.123.218/ - - LIS_REGISTERPA # MONGODB DEV - MONGODB_DEV_HOST=10.10.123.206 - MONGODB_DEV_PORT=27017 diff --git a/internal/database/database.go b/internal/database/database.go index 0afe5e1..582ef6b 100644 --- a/internal/database/database.go +++ b/internal/database/database.go @@ -33,11 +33,12 @@ type service struct { } var ( - hostSimrs = os.Getenv("SIMRS_STAG_HOST") - userNameSimrs = os.Getenv("SIMRS_STAG_USER") - passwordSimrs = os.Getenv("SIMRS_STAG_PASS") - dbNameSimrs = os.Getenv("SIMRS_STAG_NAME") - portSimrs = os.Getenv("SIMRS_STAG_PORT") + hostSimrs = os.Getenv("SIMRS_STAG_HOST") + userNameSimrs = os.Getenv("SIMRS_STAG_USER") + passwordSimrs = os.Getenv("SIMRS_STAG_PASS") + dbNameSimrs = os.Getenv("SIMRS_STAG_NAME") + portSimrs = os.Getenv("SIMRS_STAG_PORT") + hostSatudata = os.Getenv("SATUDATA_HOST") userNameSatudata = os.Getenv("SATUDATA_USER") passwordSatudata = os.Getenv("SATUDATA_PASS") diff --git a/internal/server/routes.go b/internal/server/routes.go index 5ebc08e..ae433b0 100644 --- a/internal/server/routes.go +++ b/internal/server/routes.go @@ -4,6 +4,9 @@ import ( MasterHandler "api-poliklinik/pkg/handlers/Master" patientHandler "api-poliklinik/pkg/handlers/MongoHandler/Patient" patientRelatedHandler "api-poliklinik/pkg/handlers/MongoHandler/PatientRelated" + AccountHandler "api-poliklinik/pkg/handlers/MongoHandler/account" + ConditionHandler "api-poliklinik/pkg/handlers/MongoHandler/condition" + CoverageHandler "api-poliklinik/pkg/handlers/MongoHandler/coverage" "api-poliklinik/pkg/handlers/MongoHandler/encounter" EpisodeHandler "api-poliklinik/pkg/handlers/MongoHandler/episodeofcare" personHandler "api-poliklinik/pkg/handlers/MongoHandler/person" @@ -28,7 +31,7 @@ func (s *Server) RegisterRoutes() http.Handler { r := gin.Default() r.Use(cors.New(cors.Config{ AllowOrigins: []string{"*"}, // or specific domains like "http://example.com" - AllowMethods: []string{"GET", "POST", "PUT", "DELETE"}, + AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"}, AllowHeaders: []string{"Origin", "Content-Type"}, AllowCredentials: true, })) @@ -78,6 +81,20 @@ func (s *Server) RegisterRoutes() http.Handler { Relasi.GET("/getdatapatientrelated", patientRelatedHandler.GetAllPatientdanRelated) } + condition := v1.Group("/condition") + { + condition.GET("/get", ConditionHandler.GetCondition) + } + + account := v1.Group("/account") + { + account.GET("/get", AccountHandler.GetAccount) + } + + cover := v1.Group("/coverage") + { + cover.GET("/get", CoverageHandler.GetCover) + } patient := v1.Group("/patient") { patient.POST("/insertpatient", patientHandler.InsertPatient) @@ -85,6 +102,7 @@ func (s *Server) RegisterRoutes() http.Handler { patient.PUT("/updatepatient", patientHandler.UpdatePatient) patient.POST("/deletepatient", patientHandler.DeletePatient) patient.GET("/getdata/display/:display/value/:value", patientHandler.GetDataBY) + patient.GET("id/:id", patientHandler.GetpasienByID) //patient.POST("/getdataby", patientHandler.GetDataIdentifier) } @@ -106,6 +124,7 @@ func (s *Server) RegisterRoutes() http.Handler { Practitionermongo := v1.Group("/practitioner") { Practitionermongo.GET("/getdatapractitioner", practitionerHandler.GetDataPractitioner) + Practitionermongo.GET("/id/:id", practitionerHandler.GetPractitionerbyID) Practitionermongo.GET("/getdata/display/:display/value/:value", practitionerHandler.Getdatadokter) //Practitionermongo.POST("/insertpractitioner", personHandler.InsertPerson) //Practitionermongo.POST("/deletepractitioner", personHandler.DeletePersonHand) @@ -121,6 +140,7 @@ func (s *Server) RegisterRoutes() http.Handler { Location := v1.Group("/location") { Location.GET("/getdatalocation", LocationHandler.Getlocation) + Location.GET("/subsistem/:subsistem", LocationHandler.Getlocationbysubs) //Location.POST("/insertlocation", personHandler.Inse rtPerson) //Location.POST("/deletelocation", personHandler.DeletePersonHand) } diff --git a/pkg/database/mongo/account.go b/pkg/database/mongo/account.go new file mode 100644 index 0000000..851e81e --- /dev/null +++ b/pkg/database/mongo/account.go @@ -0,0 +1,26 @@ +package mongo + +import ( + "api-poliklinik/pkg/models/mongo/account" + "context" + "go.mongodb.org/mongo-driver/bson" + "log" + "time" +) + +func (s *DatabaseService) Getaccount() ([]*account.Account, error) { + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + + dataaccount, err := s.DBMongo.Collection("account").Find(ctx, bson.D{}) + if err != nil { + log.Println(err) + } + var Account []*account.Account + err = dataaccount.All(ctx, &Account) + if err != nil { + log.Println(err) + return nil, err + } + return Account, nil +} diff --git a/pkg/database/mongo/condition.go b/pkg/database/mongo/condition.go new file mode 100644 index 0000000..4165abc --- /dev/null +++ b/pkg/database/mongo/condition.go @@ -0,0 +1,26 @@ +package mongo + +import ( + "api-poliklinik/pkg/models/mongo/condition" + "context" + "go.mongodb.org/mongo-driver/bson" + "log" + "time" +) + +func (s *DatabaseService) Getcondition() ([]*condition.Condition, error) { + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + + datacondition, err := s.DBMongo.Collection("condition").Find(ctx, bson.D{}) + if err != nil { + log.Println(err) + } + var Condition []*condition.Condition + err = datacondition.All(ctx, &Condition) + if err != nil { + log.Println(err) + return nil, err + } + return Condition, nil +} diff --git a/pkg/database/mongo/coverage.go b/pkg/database/mongo/coverage.go new file mode 100644 index 0000000..00e5676 --- /dev/null +++ b/pkg/database/mongo/coverage.go @@ -0,0 +1,26 @@ +package mongo + +import ( + "api-poliklinik/pkg/models/mongo/coverage" + "context" + "go.mongodb.org/mongo-driver/bson" + "log" + "time" +) + +func (s *DatabaseService) Getcoverage() ([]*coverage.Coverage, error) { + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + + datacover, err := s.DBMongo.Collection("coverage").Find(ctx, bson.D{}) + if err != nil { + log.Println(err) + } + var cover []*coverage.Coverage + err = datacover.All(ctx, &cover) + if err != nil { + log.Println(err) + return nil, err + } + return cover, nil +} diff --git a/pkg/database/mongo/location.go b/pkg/database/mongo/location.go index cb5c046..76279bd 100644 --- a/pkg/database/mongo/location.go +++ b/pkg/database/mongo/location.go @@ -34,3 +34,88 @@ func (s *DatabaseService) Getlocation() ([]*location.Location, error) { } return location, nil } + +func (s *DatabaseService) Getlocationbysubs(subsistem string) ([]*location.Location, error) { + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + + filter := bson.M{ + "$and": []bson.M{ + { + "$or": []bson.M{ + { + "type.coding": bson.M{ + "$elemMatch": bson.M{ + "code": "SUBSISTEM", + "display": bson.M{"$regex": subsistem, "$options": "i"}, + }, + }, + }, + + { + "type.text": bson.M{"$regex": subsistem, "$options": "i"}, + }, + }, + }, + { + "type.coding": bson.M{ + "$elemMatch": bson.M{ + "code": "SMF", + "display": bson.M{"$exists": true, "$regex": ".+"}, + }, + }, + }, + }, + } + + datalocation, err := s.DBMongo.Collection("location").Find(ctx, filter) + if err != nil { + log.Println(err) + } + var location []*location.Location + err = datalocation.All(ctx, &location) + if err != nil { + log.Println(err) + return nil, err + } + return location, nil +} + +//func (s *DatabaseService) Getlocationbysubs(subsistem string) ([]*location.Location, error) { +// ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) +// defer cancel() +// +// filter := bson.M{ +// "$and": []bson.M{ +// // Filter 1: Cari yang subsistem-nya cocok +// { +// "type": bson.M{ +// "$elemMatch": bson.M{ +// "coding": bson.M{ +// "$elemMatch": bson.M{ +// "code": "SUBSISTEM", +// "display": bson.M{"$regex": subsistem, "$options": "i"}, +// }, +// }, +// }, +// }, +// }, +// }, +// } +// +// cursor, err := s.DBMongo.Collection("location").Find(ctx, filter) +// if err != nil { +// log.Printf("Error finding locations: %v", err) +// return nil, err +// } +// defer cursor.Close(ctx) +// +// var locations []*location.Location +// if err = cursor.All(ctx, &locations); err != nil { +// log.Printf("Error decoding locations: %v", err) +// return nil, err +// } +// +// log.Printf("Found %d locations for subsistem '%s' with SMF", len(locations), subsistem) +// return locations, nil +//} diff --git a/pkg/database/mongo/patient.go b/pkg/database/mongo/patient.go index 0567933..6293038 100644 --- a/pkg/database/mongo/patient.go +++ b/pkg/database/mongo/patient.go @@ -2,7 +2,6 @@ package mongo import ( patient "api-poliklinik/pkg/models/mongo/insertpatient" - "context" "fmt" "go.mongodb.org/mongo-driver/bson" @@ -110,6 +109,7 @@ func (s *DatabaseService) GetAllDataPatient(limit int64, skip int64) ([]*patient findOptions := options.Find() findOptions.SetLimit(limit) findOptions.SetSkip(skip) + findOptions.SetSort(bson.D{{"_id", -1}}) filter := bson.M{ "active": true, @@ -184,3 +184,26 @@ func (s *DatabaseService) DeletePatient(id string, req *patient.DeletePatient) e return nil } + +func (s *DatabaseService) GetPasienByid(id string) ([]*patient.Patient, error) { + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + + objectID, err := primitive.ObjectIDFromHex(id) + filter := bson.M{ + "_id": objectID, + } + + cursor, err := s.DBMongo.Collection("patient").Find(ctx, filter) + if err != nil { + log.Println(err) + return nil, err + } + defer cursor.Close(ctx) + var results []*patient.Patient + if err = cursor.All(ctx, &results); err != nil { + log.Println(err) + return nil, err + } + return results, nil +} diff --git a/pkg/database/mongo/practitioner.go b/pkg/database/mongo/practitioner.go index 8091e39..aab16d9 100644 --- a/pkg/database/mongo/practitioner.go +++ b/pkg/database/mongo/practitioner.go @@ -3,7 +3,10 @@ package mongo import ( "api-poliklinik/pkg/models/mongo/practitioner" "context" + "fmt" "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/bson/primitive" + "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" "log" "time" @@ -55,3 +58,27 @@ func (s *DatabaseService) GetDokterBySMF(display string, value string) ([]*pract } return results, nil } + +func (s *DatabaseService) GetDokterByid(id string) (*practitioner.Practitioner, error) { + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + + objectID, err := primitive.ObjectIDFromHex(id) + if err != nil { + return nil, fmt.Errorf("invalid ID format: %v", err) + } + filter := bson.M{ + "_id": objectID, + } + + var result practitioner.Practitioner + err = s.DBMongo.Collection("practitioner").FindOne(ctx, filter).Decode(&result) + if err != nil { + if err == mongo.ErrNoDocuments { + return nil, fmt.Errorf("dokter dengan ID %s tidak ditemukan", id) + } + return nil, err + } + + return &result, nil +} diff --git a/pkg/database/satu_data/location.go b/pkg/database/satu_data/location.go index 14928c2..82f78f7 100644 --- a/pkg/database/satu_data/location.go +++ b/pkg/database/satu_data/location.go @@ -14,8 +14,11 @@ func (s *DatabaseService) Getruang() []*simrs.Location { mr.st_aktif as st_status, mr.nama as nm_namaruang, mr.keterangan as des_keterangan, - mr.kelas as tp_kelas, mr.kelompok as tp_kelompokruang, mr.ruang as tp_typeruang, mr.subsistem as tp_subsistem, mr.is_partial as tp_partial -from m_ruang mr` + mr.kelas as tp_kelas, mr.kelompok as tp_kelompokruang, mr.ruang as tp_typeruang, mr.subsistem as tp_subsistem, mr.is_partial as tp_partial, + ms.kdsmf as id_kdsmf, ms.namasmf as nm_namasmf +from m_ruang mr +left join m_unit mu on mu.kode_unit = mr.kdunit +left join m_smf ms on ms.kdsmf = mu.smf` errQuery := s.DB.Debug().Raw(query).Scan(&dataruang).Error if errQuery != nil { if errors.Is(errQuery, gorm.ErrRecordNotFound) { diff --git a/pkg/handlers/MongoHandler/Patient/patient.go b/pkg/handlers/MongoHandler/Patient/patient.go index 5374406..f975946 100644 --- a/pkg/handlers/MongoHandler/Patient/patient.go +++ b/pkg/handlers/MongoHandler/Patient/patient.go @@ -249,3 +249,31 @@ func DeletePatient(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"message": "Pasien Sukses Ter-hapus"}) } + +func GetpasienByID(c *gin.Context) { + local := os.Getenv("MONGODB_DEV_LOCAL") + db := database.New(local).GetMongoDB() + if db == nil { + c.JSON(http.StatusInternalServerError, gin.H{"message": "Database connection failed"}) + return + } + + id := c.Param("id") + + if id == "" { + c.JSON(http.StatusBadRequest, gin.H{"message": "Parameter 'id' dibutuhkan"}) + return + } + + mongoDB := mongo.NewDatabaseServiceMongo(db) + dataID, err := mongoDB.GetPasienByid(id) + if err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"message": err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{ + "data": dataID, + "message": "pasien Dengan ID berhasil di cari", + }) +} diff --git a/pkg/handlers/MongoHandler/account/account.go b/pkg/handlers/MongoHandler/account/account.go new file mode 100644 index 0000000..56d5667 --- /dev/null +++ b/pkg/handlers/MongoHandler/account/account.go @@ -0,0 +1,26 @@ +package account + +import ( + "api-poliklinik/internal/database" + "api-poliklinik/pkg/database/mongo" + "github.com/gin-gonic/gin" + "net/http" + "os" +) + +func GetAccount(c *gin.Context) { + local := os.Getenv("MONGODB_DEV_LOCAL") + db := database.New(local).GetMongoDB() + if db == nil { + c.JSON(http.StatusInternalServerError, gin.H{"message": "Database connection failed"}) + return + } + + mongoDB := mongo.NewDatabaseServiceMongo(db) + dataAccount, errSelect := mongoDB.Getaccount() + if errSelect != nil { + c.JSON(http.StatusInternalServerError, gin.H{"message": errSelect.Error()}) + return + } + c.JSON(http.StatusOK, dataAccount) +} diff --git a/pkg/handlers/MongoHandler/condition/condition.go b/pkg/handlers/MongoHandler/condition/condition.go new file mode 100644 index 0000000..f071d67 --- /dev/null +++ b/pkg/handlers/MongoHandler/condition/condition.go @@ -0,0 +1,26 @@ +package condition + +import ( + "api-poliklinik/internal/database" + "api-poliklinik/pkg/database/mongo" + "github.com/gin-gonic/gin" + "net/http" + "os" +) + +func GetCondition(c *gin.Context) { + local := os.Getenv("MONGODB_DEV_LOCAL") + db := database.New(local).GetMongoDB() + if db == nil { + c.JSON(http.StatusInternalServerError, gin.H{"message": "Database connection failed"}) + return + } + + mongoDB := mongo.NewDatabaseServiceMongo(db) + dataAccount, errSelect := mongoDB.Getcondition() + if errSelect != nil { + c.JSON(http.StatusInternalServerError, gin.H{"message": errSelect.Error()}) + return + } + c.JSON(http.StatusOK, dataAccount) +} diff --git a/pkg/handlers/MongoHandler/coverage/coverage.go b/pkg/handlers/MongoHandler/coverage/coverage.go new file mode 100644 index 0000000..ae50b60 --- /dev/null +++ b/pkg/handlers/MongoHandler/coverage/coverage.go @@ -0,0 +1,26 @@ +package coverage + +import ( + "api-poliklinik/internal/database" + "api-poliklinik/pkg/database/mongo" + "github.com/gin-gonic/gin" + "net/http" + "os" +) + +func GetCover(c *gin.Context) { + local := os.Getenv("MONGODB_DEV_LOCAL") + db := database.New(local).GetMongoDB() + if db == nil { + c.JSON(http.StatusInternalServerError, gin.H{"message": "Database connection failed"}) + return + } + + mongoDB := mongo.NewDatabaseServiceMongo(db) + dataCover, errSelect := mongoDB.Getcoverage() + if errSelect != nil { + c.JSON(http.StatusInternalServerError, gin.H{"message": errSelect.Error()}) + return + } + c.JSON(http.StatusOK, dataCover) +} diff --git a/pkg/handlers/MongoHandler/practitioner/practitioner.go b/pkg/handlers/MongoHandler/practitioner/practitioner.go index 71aa4b8..f668e56 100644 --- a/pkg/handlers/MongoHandler/practitioner/practitioner.go +++ b/pkg/handlers/MongoHandler/practitioner/practitioner.go @@ -72,3 +72,31 @@ func Getdatadokter(c *gin.Context) { "message": "Practitioner Dengan SMF berhasil di cari", }) } + +func GetPractitionerbyID(c *gin.Context) { + local := os.Getenv("MONGODB_DEV_LOCAL") + db := database.New(local).GetMongoDB() + if db == nil { + c.JSON(http.StatusInternalServerError, gin.H{"message": "Database connection failed"}) + return + } + + id := c.Param("id") + + if id == "" { + c.JSON(http.StatusBadRequest, gin.H{"message": "Parameter 'id' dibutuhkan"}) + return + } + + mongoDB := mongo.NewDatabaseServiceMongo(db) + dataID, err := mongoDB.GetDokterByid(id) + if err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"message": err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{ + "data": dataID, + "message": "Practitioner Dengan ID berhasil di cari", + }) +} diff --git a/pkg/handlers/Practitioner/Practitioner.go b/pkg/handlers/Practitioner/Practitioner.go index 03d40df..e9358b9 100644 --- a/pkg/handlers/Practitioner/Practitioner.go +++ b/pkg/handlers/Practitioner/Practitioner.go @@ -1,35 +1,46 @@ package Practitioner -//func GetDataPractitioner(c *gin.Context) { -// db := database.New().GetDB("satudata") -// satudata := connDatabase.NewDatabaseService(db) -// -// log.Println("REQUEST") -// dataPractitioner := satudata.PractitionerGetData() -// var responsePractitioner []satu_data.DataResponse -// for _, k := range dataPractitioner { -// gelarDepan := utils.ReplaceGelar(k.GelarDepan) -// gelarBelakang := utils.ReplaceGelar(k.GelarBelakang) -// namaLengkap := gelarDepan + " " + k.NamaLengkap + " " + gelarBelakang -// namaLengkap = strings.TrimPrefix(namaLengkap, " ") -// namaLengkap = strings.TrimSuffix(namaLengkap, " ") -// -// responsePractitioner = append(responsePractitioner, satu_data.DataResponse{ -// ID: k.ID, -// NIP: k.NIP, -// JenisKelamin: k.JenisKelamin, -// NamaLengkapFull: namaLengkap, -// }) -// } -// -// c.JSON(http.StatusOK, responsePractitioner) -//} -// -//func GetDataMPasien(c *gin.Context) { -// db := database.New().GetDB("simrs") -// simrs := connDatabase.NewDatabaseService(db) -// -// dataMPasien := simrs.GetPasien() -// c.JSON(http.StatusOK, dataMPasien) -// -//} +import ( + "api-poliklinik/internal/database" + connDatabase "api-poliklinik/pkg/database/satu_data" + "api-poliklinik/pkg/models/satu_data" + "api-poliklinik/utils" + "github.com/gin-gonic/gin" + "log" + "net/http" + "strings" +) + +func GetDataPractitioner(c *gin.Context) { + db := database.New().GetDB("satudata") + satudata := connDatabase.NewDatabaseService(db) + + log.Println("REQUEST") + dataPractitioner := satudata.PractitionerGetData() + var responsePractitioner []satu_data.DataResponse + for _, k := range dataPractitioner { + gelarDepan := utils.ReplaceGelar(k.GelarDepan) + gelarBelakang := utils.ReplaceGelar(k.GelarBelakang) + namaLengkap := gelarDepan + " " + k.NamaLengkap + " " + gelarBelakang + namaLengkap = strings.TrimPrefix(namaLengkap, " ") + namaLengkap = strings.TrimSuffix(namaLengkap, " ") + + responsePractitioner = append(responsePractitioner, satu_data.DataResponse{ + ID: k.ID, + NIP: k.NIP, + JenisKelamin: k.JenisKelamin, + NamaLengkapFull: namaLengkap, + }) + } + + c.JSON(http.StatusOK, responsePractitioner) +} + +func GetDataMPasien(c *gin.Context) { + db := database.New().GetDB("simrs") + simrs := connDatabase.NewDatabaseService(db) + + dataMPasien := simrs.GetPasien() + c.JSON(http.StatusOK, dataMPasien) + +} diff --git a/pkg/handlers/location/location.go b/pkg/handlers/location/location.go index ec72b71..ca8843b 100644 --- a/pkg/handlers/location/location.go +++ b/pkg/handlers/location/location.go @@ -27,3 +27,29 @@ func Getlocation(c *gin.Context) { "message": "location Sukses Ter-ambil ", }) } + +func Getlocationbysubs(c *gin.Context) { + local := os.Getenv("MONGODB_DEV_LOCAL") + db := database.New(local).GetMongoDB() + if db == nil { + c.JSON(http.StatusInternalServerError, gin.H{"message": "Database connection failed"}) + return + } + subsistem := c.Param("subsistem") + + if subsistem == "" { + c.JSON(http.StatusBadRequest, gin.H{"message": "Parameter 'subs' dibutuhkan"}) + return + } + mongoDB := mongo.NewDatabaseServiceMongo(db) + locationsmf, errSelect := mongoDB.Getlocationbysubs(subsistem) + if errSelect != nil { + c.JSON(http.StatusInternalServerError, gin.H{"message": errSelect.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{ + "data": locationsmf, + "count": len(locationsmf), + "message": "location Sukses Ter-ambil ", + }) +} diff --git a/pkg/handlers/migrasi/location/location.go b/pkg/handlers/migrasi/location/location.go index 215f6a5..7e91546 100644 --- a/pkg/handlers/migrasi/location/location.go +++ b/pkg/handlers/migrasi/location/location.go @@ -202,6 +202,18 @@ func Migrasilokasi(c *gin.Context) { }, Text: lokasi.Partial, }, + { + Coding: []_struct.Coding{ + { + System: "", + Version: "", + Code: "SMF", + Display: lokasi.KodeSMF, + UserSelected: true, + }, + }, + Text: lokasi.NamaSMF, + }, } fhirLokasi.Contact = _struct.ExtendedContactDetail{ @@ -480,7 +492,7 @@ func Migrasilokasi(c *gin.Context) { err := mongoDB.Insertlokasi(fhirLokasi) if err != nil { - log.Printf("Gagal migrasi data praktisi %s: %v", lokasi.IDRuang, err) + log.Printf("Gagal migrasi data lokasi %s: %v", lokasi.IDRuang, err) failedCount++ continue } diff --git a/pkg/models/mongo/account/account.go b/pkg/models/mongo/account/account.go new file mode 100644 index 0000000..ba72cf1 --- /dev/null +++ b/pkg/models/mongo/account/account.go @@ -0,0 +1,29 @@ +package account + +import ( + _struct "api-poliklinik/pkg/models/struct" + "go.mongodb.org/mongo-driver/bson/primitive" +) + +type Account struct { + ResourceType string `json:"resourceType" bson:"resourceType"` + ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` + Identifier []_struct.Identifier `json:"identifier" bson:"identifier"` + Status string `json:"status" bson:"status"` + BillingStatus _struct.CodeableConcept `json:"billingStatus" bson:"billingStatus"` + Type _struct.CodeableConcept `json:"type" bson:"type"` + Name string `json:"name" bson:"name"` + Subject _struct.Reference `json:"subject" bson:"subject"` + ServicePeriod _struct.Period `json:"servicePeriod" bson:"servicePeriod"` + Coverage []_struct.Coverage `json:"coverage" bson:"coverage"` + Owner _struct.Reference `json:"owner" bson:"owner"` + Description string `json:"description" bson:"description"` + Guarantor []_struct.Guarantor `json:"guarantor" bson:"guarantor"` + Diagnosis []_struct.DiagnosisAccount `json:"diagnosis" bson:"diagnosis"` + RelatedAccount _struct.RelatedAccount `json:"relatedAccount" bson:"relatedAccount"` + Currency _struct.CodeableConcept `json:"currency" bson:"currency"` + Balance []_struct.Balance `json:"balance" bson:"balance"` + CalculatedAt string `json:"calculatedAt" bson:"calculatedAt"` + CreatedAt string `json:"createdAt" bson:"createdAt"` + UpdatedAt string `json:"updatedAt" bson:"updatedAt"` +} diff --git a/pkg/models/mongo/condition/condition.go b/pkg/models/mongo/condition/condition.go new file mode 100644 index 0000000..40c36d6 --- /dev/null +++ b/pkg/models/mongo/condition/condition.go @@ -0,0 +1,23 @@ +package condition + +import _struct "api-poliklinik/pkg/models/struct" + +type Condition struct { + ResourceType string `json:"resourceType" bson:"resourceType"` + ID string `json:"id" bson:"id"` + ClinicalStatus _struct.CodeableConcept `json:"clinicalStatus" bson:"clinicalStatus"` + VerificationStatus _struct.CodeableConcept `json:"verificationStatus" bson:"verificationStatus"` + Category []_struct.CodeableConcept `json:"category" bson:"category"` + Severity _struct.CodeableConcept `json:"severity" bson:"severity"` + Code _struct.CodeableConcept `json:"code" bson:"code"` + BodySite []_struct.CodeableConcept `json:"bodySite" bson:"bodySite"` + Subject _struct.Reference `json:"subject" bson:"subject"` + Encounter _struct.Reference `json:"encounter" bson:"encounter"` + Onset _struct.Onset `json:"onset" bson:"onset"` + Abatement _struct.Abatement `json:"abatement" bson:"abatement"` + RecordedDate string `json:"recordedDate" bson:"recordedDate"` + Participant []_struct.ConditionParticipant `json:"participant" bson:"participant"` + Stage []_struct.ConditionStage `json:"stage" bson:"stage"` + Evidence []_struct.ConditionEvidence `json:"evidence" bson:"evidence"` + Note []_struct.Note `json:"note" bson:"note"` +} diff --git a/pkg/models/mongo/coverage/coverage.go b/pkg/models/mongo/coverage/coverage.go new file mode 100644 index 0000000..6e912f3 --- /dev/null +++ b/pkg/models/mongo/coverage/coverage.go @@ -0,0 +1,30 @@ +package coverage + +import ( + _struct "api-poliklinik/pkg/models/struct" +) + +type Coverage struct { + ResourceType string `json:"resourceType" bson:"resourceType"` + ID string `json:"id" bson:"id"` + Identifier []_struct.Identifier `json:"identifier" bson:"identifier"` + Status string `json:"status" bson:"status"` + Kind string `json:"kind" bson:"kind"` + PaymentBy []_struct.CoveragePayment `json:"paymentBy" bson:"paymentBy"` + Type _struct.CodeableConcept `json:"type" bson:"type"` + PolicyHolder _struct.Reference `json:"policyHolder" bson:"policyHolder"` + Subscriber _struct.Reference `json:"subscriber" bson:"subscriber"` + SubscriberId []_struct.CodeableConcept `json:"subscriberId" bson:"subscriberId"` + Beneficiary _struct.Reference `json:"beneficiary" bson:"beneficiary"` + Dependent string `json:"dependent" bson:"dependent"` + Relationship _struct.CodeableConcept `json:"relationship" bson:"relationship"` + Period _struct.Period `json:"period" bson:"period"` + Insurer _struct.Reference `json:"insurer" bson:"insurer"` + Class []_struct.CoverageClass `json:"class" bson:"class"` + Order int `json:"order" bson:"order"` + Network string `json:"network" bson:"network"` + CostToBeneficiary []_struct.CostToBeneficiary `json:"costToBeneficiary" bson:"costToBeneficiary"` + Subrogation int `json:"subrogation" bson:"subrogation"` + Contact _struct.Reference `json:"contact" bson:"contact"` + InsurancePlan _struct.Reference `json:"insurancePlan" bson:"insurancePlan"` +} diff --git a/pkg/models/mongo/insertpatient/insertPatientRelated.go b/pkg/models/mongo/insertpatient/insertPatientRelated.go index 04f50d2..892a3ca 100644 --- a/pkg/models/mongo/insertpatient/insertPatientRelated.go +++ b/pkg/models/mongo/insertpatient/insertPatientRelated.go @@ -10,7 +10,7 @@ type Patient struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id" ` Identifier []_struct.Identifier `json:"identifier" bson:"identifier,omitempty" ` Active bool `json:"active" bson:"active,omitempty"` - Name []_struct.HumanName `json:"name" bson:"name,omitempty" ` + Name []_struct.HumanName `json:"name" bson:"name,omitempty" ` Telecom []_struct.ContactPoint `json:"telecom" bson:"telecom,omitempty" ` Gender string `json:"gender" bson:"gender,omitempty" ` BirthDate string `json:"birthDate" bson:"birthDate,omitempty" ` @@ -31,20 +31,20 @@ type Patient struct { } type GetBY struct { - Identifier []_struct.Identifier `json:"identifier,omitempty" bson:"identifier,omitempty" ` + Identifier []_struct.Identifier `json:"identifier" bson:"identifier,omitempty" ` } type UpdatePatient struct { - ResourceType string `json:"resourceType,omitempty" bson:"resourceType,omitempty"` + ResourceType string `json:"resourceType" bson:"resourceType,omitempty"` ID string `bson:"-"` - Identifier []_struct.Identifier `json:"identifier,omitempty" bson:"identifier,omitempty"` - Active bool `json:"active,omitempty" bson:"active,omitempty"` - Name []_struct.HumanName `json:"name,omitempty" bson:"name,omitempty"` - Telecom []_struct.ContactPoint `json:"telecom,omitempty" bson:"telecom,omitempty"` - Gender string `json:"gender,omitempty" bson:"gender,omitempty"` - BirthDate string `json:"birthDate,omitempty" bson:"birthDate,omitempty"` - DeceasedBoolean bool `json:"deceasedBoolean,omitempty" bson:"deceasedBoolean,omitempty"` - DeceasedDateTime string `json:"deceasedDateTime,omitempty" bson:"deceasedDateTime,omitempty"` + Identifier []_struct.Identifier `json:"identifier" bson:"identifier,omitempty"` + Active bool `json:"active" bson:"active,omitempty"` + Name []_struct.HumanName `json:"name" bson:"name,omitempty"` + Telecom []_struct.ContactPoint `json:"telecom" bson:"telecom,omitempty"` + Gender string `json:"gender" bson:"gender,omitempty"` + BirthDate string `json:"birthDate" bson:"birthDate,omitempty"` + DeceasedBoolean bool `json:"deceasedBoolean" bson:"deceasedBoolean,omitempty"` + DeceasedDateTime string `json:"deceasedDateTime" bson:"deceasedDateTime,omitempty"` Address []_struct.Address `json:"address,omitempty" bson:"address,omitempty"` MaritalStatus _struct.CodeableConcept `json:"maritalStatus,omitempty" bson:"maritalStatus,omitempty"` MultipleBirthBoolean bool `json:"multipleBirthBoolean,omitempty" bson:"multipleBirthBoolean,omitempty"` diff --git a/pkg/models/simrs/location.go b/pkg/models/simrs/location.go index 33e3286..81816e7 100644 --- a/pkg/models/simrs/location.go +++ b/pkg/models/simrs/location.go @@ -12,4 +12,6 @@ type Location struct { Typeruang string `gorm:"column:tp_typeruang" json:"typeruang"` Subsistem string `gorm:"column:tp_subsistem" json:"subsistem"` Partial string `gorm:"column:tp_partial" json:"partial"` + KodeSMF string `gorm:"column:id_kdsmf" json:"kode_smf"` + NamaSMF string `gorm:"column:nm_namasmf" json:"id_smf"` } diff --git a/pkg/models/struct/fhir.go b/pkg/models/struct/fhir.go index c720a6e..ade3a36 100644 --- a/pkg/models/struct/fhir.go +++ b/pkg/models/struct/fhir.go @@ -5,80 +5,80 @@ type StatusHistrory struct { Period Period `json:"period" ,bson:"period"` } type Identifier struct { - Use string `json:"use" bson:"use"` - Type CodeableConcept `json:"type" bson:"type"` - System string `json:"system" bson:"system"` - Value string `json:"value" bson:"value"` - Period Period `json:"period" bson:"period"` - Assigner Reference `json:"assigner" bson:"assigner"` - Coding Coding `json:"coding" bson:"coding"` + Use string `json:"use" bson:"use,omitempty"` + Type CodeableConcept `json:"type" bson:"type,omitempty"` + System string `json:"system" bson:"system,omitempty"` + Value string `json:"value" bson:"value,omitempty"` + Period Period `json:"period" bson:"period,omitempty"` + Assigner Reference `json:"assigner" bson:"assigner,omitempty"` + Coding Coding `json:"coding" bson:"coding,omitempty"` } type CodeableConcept struct { - Coding []Coding `json:"coding" bson:"coding"` - Text string `json:"text" bson:"text"` + Coding []Coding `json:"coding" bson:"coding,omitempty"` + Text string `json:"text" bson:"text,omitempty"` } type Coding struct { - System string `json:"system" bson:"system"` - Version string `json:"version" bson:"version"` - Code string `json:"code" bson:"code"` - Display string `json:"display" bson:"display"` - UserSelected bool `json:"userSelected" bson:"userSelected"` + System string `json:"system" bson:"system,omitempty"` + Version string `json:"version" bson:"version,omitempty"` + Code string `json:"code" bson:"code,omitempty"` + Display string `json:"display" bson:"display,omitempty"` + UserSelected bool `json:"userSelected" bson:"userSelected,omitempty"` } type Period struct { - Start string `json:"start,omitempty" bson:"start"` - End string `json:"end,omitempty" bson:"end"` + Start string `json:"start,omitempty" bson:"start,omitempty"` + End string `json:"end,omitempty" bson:"end,omitempty"` } type Reference struct { - Reference string `json:"reference" bson:"reference"` - Display string `json:"display" bson:"display"` + Reference string `json:"reference" bson:"reference,omitempty"` + Display string `json:"display" bson:"display,omitempty"` } type HumanName struct { - Use string `json:"use" bson:"use"` - Text string `json:"text" bson:"text"` - Family string `json:"family" bson:"family"` - Given []string `json:"given" bson:"given"` - Prefix []string `json:"prefix" bson:"prefix"` - Suffix []string `json:"suffix" bson:"suffix"` - Period Period `json:"period" bson:"period"` + Use string `json:"use" bson:"use,omitempty"` + Text string `json:"text" bson:"text,omitempty"` + Family string `json:"family" bson:"family,omitempty"` + Given []string `json:"given" bson:"given,omitempty"` + Prefix []string `json:"prefix" bson:"prefix,omitempty"` + Suffix []string `json:"suffix" bson:"suffix,omitempty"` + Period Period `json:"period" bson:"period,omitempty"` } type ContactPoint struct { - System string `bson:"system" json:"system"` - Value string `bson:"value" json:"value"` - Use string `bson:"use" json:"use"` - Rank string `bson:"rank" json:"rank"` - Period Period `bson:"period" json:"period"` + System string `bson:"system" json:"system,omitempty"` + Value string `bson:"value" json:"value,omitempty"` + Use string `bson:"use" json:"use,omitempty"` + Rank string `bson:"rank" json:"rank,omitempty"` + Period Period `bson:"period" json:"period,omitempty"` } type Address struct { - Use string `json:"use" bson:"use"` - Type string `json:"type" bson:"type"` - Text string `json:"text" bson:"text"` - Line []string `json:"line" bson:"line"` - Village string `json:"village" bson:"village"` - District string `json:"district" bson:"district"` - City string `json:"city" bson:"city"` - State string `json:"state" bson:"state"` - PostalCode string `json:"postalCode" bson:"postalCode"` - Country string `json:"country" bson:"country"` - Period Period `json:"period" bson:"period"` - Extension []Extension `json:"extension" bson:"extension"` + Use string `json:"use" bson:"use,omitempty"` + Type string `json:"type" bson:"type,omitempty"` + Text string `json:"text" bson:"text,omitempty"` + Line []string `json:"line" bson:"line,omitempty"` + Village string `json:"village" bson:"village,omitempty"` + District string `json:"district" bson:"district,omitempty"` + City string `json:"city" bson:"city,omitempty"` + State string `json:"state" bson:"state,omitempty"` + PostalCode string `json:"postalCode" bson:"postalCode,omitempty"` + Country string `json:"country" bson:"country,omitempty"` + Period Period `json:"period" bson:"period,omitempty"` + Extension []Extension `json:"extension" bson:"extension,omitempty"` } type Extension struct { - URL string `json:"url" bson:"url"` - Extension []ExtensionDetail `json:"extension" bson:"extension"` + URL string `json:"url" bson:"url,omitempty"` + Extension []ExtensionDetail `json:"extension" bson:"extension,omitempty"` } type ExtensionDetail struct { - URL string `json:"url" bson:"url"` - ValueDisplay string `json:"valueDisplay" bson:"valueDisplay"` - ValueCode string `json:"valueCode" bson:"valueCode"` + URL string `json:"url" bson:"url,omitempty"` + ValueDisplay string `json:"valueDisplay" bson:"valueDisplay,omitempty"` + ValueCode string `json:"valueCode" bson:"valueCode,omitempty"` } type Photo struct { @@ -98,22 +98,22 @@ type Photo struct { } type Contact struct { - Relationship []CodeableConcept `json:"relationship" bson:"relationship"` - Name HumanName `json:"name" bson:"name"` - Telecom []ContactPoint `json:"telecom" bson:"telecom"` - Address Address `json:"address" bson:"address"` - Gender string `json:"gender" bson:"gender"` - Organization Reference `json:"organization" bson:"organization"` - Period Period `json:"period" bson:"period"` + Relationship []CodeableConcept `json:"relationship" bson:"relationship,omitempty"` + Name HumanName `json:"name" bson:"name,omitempty"` + Telecom []ContactPoint `json:"telecom" bson:"telecom,omitempty"` + Address Address `json:"address" bson:"address,omitempty"` + Gender string `json:"gender" bson:"gender,omitempty"` + Organization Reference `json:"organization" bson:"organization,omitempty"` + Period Period `json:"period" bson:"period,omitempty"` } type Communication struct { - Language CodeableConcept `json:"language" bson:"language"` + Language CodeableConcept `json:"language" bson:"language,omitempty"` } type Link struct { - Other Reference `json:"other" bson:"other"` - Type string `json:"type" bson:"type"` + Other Reference `json:"other" bson:"other,omitempty"` + Type string `json:"type" bson:"type,omitempty"` } type LinkTarget struct { @@ -122,12 +122,12 @@ type LinkTarget struct { } type ExtendedContactDetail struct { - Purpose CodeableConcept `json:"purpose" bson:"purpose"` - Name []HumanName `json:"name" bson:"name"` - Telecom []ContactPoint `json:"telecom" bson:"telecom"` - Address []Address `json:"address" bson:"address"` - Organization Reference `json:"organization" bson:"organization"` - Period Period `json:"period" bson:"period"` + Purpose CodeableConcept `json:"purpose" bson:"purpose,omitempty"` + Name []HumanName `json:"name" bson:"name,omitempty"` + Telecom []ContactPoint `json:"telecom" bson:"telecom,omitempty"` + Address []Address `json:"address" bson:"address,omitempty"` + Organization Reference `json:"organization" bson:"organization,omitempty"` + Period Period `json:"period" bson:"period,omitempty"` } type Reason struct { @@ -314,3 +314,140 @@ type MonthlyTemple struct { type YearlyTemple struct { YearInterval int `json:"yearInterval" bson:"yearInterval"` } + +type Coverage struct { + Coverage Reference `json:"coverage" bson:"coverage"` + Priority int `json:"priority" bson:"priority"` +} + +type Guarantor struct { + Party Reference `json:"party" bson:"party"` + OnHold bool `json:"onHold" bson:"onHold"` + Period Period `json:"period" bson:"period"` +} + +type DiagnosisAccount struct { + Sequence int `json:"sequence" bson:"sequence"` + Condition DiagnosisCondition `json:"condition" bson:"condition"` + DateOfDiagnosis string `json:"dateOfDiagnosis" bson:"dateOfDiagnosis"` + Type []CodeableConcept `json:"type" bson:"type"` + OnAdmission string `json:"onAdmission" bson:"onAdmission"` + PackageCode []CodeableConcept `json:"packageCode" bson:"packageCode"` + Device Reference `json:"device" bson:"device"` +} + +type DiagnosisCondition struct { + Concept CodeableConcept `json:"concept" bson:"concept"` + Reference Reference `json:"reference" bson:"reference"` +} + +type RelatedAccount struct { + Relationship CodeableConcept `json:"relationship" bson:"relationship"` + Account Reference `json:"account" bson:"account"` +} + +type Balance struct { + Aggregate CodeableConcept `json:"aggregate" bson:"aggregate"` + Term CodeableConcept `json:"term" bson:"term"` + Estimate bool `json:"estimate" bson:"estimate"` + Amount Amount `json:"amount" bson:"amount"` +} + +type Amount struct { + Value float64 `json:"value" bson:"value"` + Currency string `json:"currency" bson:"currency"` +} + +type Onset struct { + OnsetDateTime string `json:"onsetDateTime" bson:"onsetDateTime"` + OnsetAge string `json:"onsetAge" bson:"onsetAge"` + OnsetPeriod Period `json:"onsetPeriod" bson:"onsetPeriod"` + OnsetRange Range `json:"onsetRange" bson:"onsetRange"` + OnsetString string `json:"onsetString" bson:"onsetString"` +} + +type Abatement struct { + AbatementDateTime string `json:"abatementDateTime" bson:"abatementDateTime"` + AbatementAge string `json:"abatementAge" bson:"abatementAge"` + AbatementPeriod Period `json:"abatementPeriod" bson:"abatementPeriod"` + AbatementRange Range `json:"abatementRange" bson:"abatementRange"` + AbatementString string `json:"abatementString" bson:"abatementString"` +} + +type Range struct { + Low string `json:"low" bson:"low"` + High string `json:"high" bson:"high"` +} + +type ConditionParticipant struct { + Function CodeableConcept `json:"function" bson:"function"` + Actor Reference `json:"actor" bson:"actor"` +} + +type ConditionStage struct { + Summary CodeableConcept `json:"summary" bson:"summary"` + Assessment []Reference `json:"assessment" bson:"assessment"` + Type CodeableConcept `json:"type" bson:"type"` +} + +type ConditionEvidence struct { + Concept CodeableConcept `json:"concept" bson:"concept"` + Reference Reference `json:"reference" bson:"reference"` +} + +type Stage struct { + Summary CodeableConcept `json:"summary" bson:"summary"` + Assessment []Reference `json:"assessment" bson:"assessment"` + Type CodeableConcept `json:"type" bson:"type"` +} + +type Evidence struct { + Concept CodeableConcept `json:"concept" bson:"concept"` + Reference Reference `json:"reference" bson:"reference"` +} + +type CoveragePayment struct { + Party Reference `json:"party" bson:"party"` + Responsibility string `json:"responsibility" bson:"responsibility"` +} + +type CoverageClass struct { + Type CodeableConcept `json:"type" bson:"type"` + Value CoverageClassValue `json:"value" bson:"value"` + Name string `json:"name" bson:"name"` +} + +type CoverageClassValue struct { + Use string `json:"use" bson:"use"` + Type CodeableConcept `json:"type" bson:"type"` + System string `json:"system" bson:"system"` + Value string `json:"value" bson:"value"` + Period Period `json:"period" bson:"period"` + Assigner Reference `json:"assigner" bson:"assigner"` + Name string `json:"name" bson:"name"` +} + +type CostToBeneficiary struct { + Type CodeableConcept `json:"type" bson:"type"` + Category CodeableConcept `json:"category" bson:"category"` + Network CodeableConcept `json:"network" bson:"network"` + Unit CodeableConcept `json:"unit" bson:"unit"` + Term CodeableConcept `json:"term" bson:"term"` + Value CostToBeneficiaryValue `json:"value" bson:"value"` + Exception []CostToBeneficiaryException `json:"exception" bson:"exception"` +} + +type CostToBeneficiaryValue struct { + ValueQuantity string `json:"valueQuantity" bson:"valueQuantity"` + ValueMoney Money `json:"valueMoney" bson:"valueMoney"` +} + +type CostToBeneficiaryException struct { + Type CodeableConcept `json:"type" bson:"type"` + Period Period `json:"period" bson:"period"` +} + +type Money struct { + Value float64 `json:"value" bson:"value"` + Currency string `json:"currency" bson:"currency"` +}