update docker
This commit is contained in:
18
.env
18
.env
@@ -1,18 +0,0 @@
|
||||
# POSTGRES_DSN="postgres://sa:password@localhost:5432/postgres?sslmode=disable"
|
||||
DB_HOST=localhost
|
||||
DB_USERNAME=sa
|
||||
DB_PASSWORD=password
|
||||
DB_NAME=postgres
|
||||
DB_PORT=5432
|
||||
|
||||
SATUDATA_HOST=10.10.123.165
|
||||
SATUDATA_USERNAME=stim
|
||||
SATUDATA_PASSWORD=stim*RS54
|
||||
SATUDATA_NAME=satu_db
|
||||
SATUDATA_PORT=5000
|
||||
|
||||
BASEURL_BPJS=https://apijkn.bpjs-kesehatan.go.id/
|
||||
ANTREAN_RS=antreanrs
|
||||
CONS_ID=5257
|
||||
USER_KEY=4cf1cbef8c008440bbe9ef9ba789e482
|
||||
SECRET_KEY=1bV363512D
|
||||
0
.env.exemple
Executable file
0
.env.exemple
Executable file
@@ -18,14 +18,21 @@ import (
|
||||
var DB *gorm.DB
|
||||
var localDB *gorm.DB
|
||||
var SatuDataDB *gorm.DB
|
||||
var SimrsDataDB *gorm.DB
|
||||
var err error
|
||||
|
||||
func ConnectDB() {
|
||||
hostDB := os.Getenv("DB_HOST")
|
||||
usernameDB := os.Getenv("DB_USERNAME")
|
||||
passwordDB := os.Getenv("DB_PASSWORD")
|
||||
dbName := os.Getenv("DB_NAME")
|
||||
portDB := os.Getenv("DB_PORT")
|
||||
// POSTGRE_DB_HOST=10.10.123.223
|
||||
// POSTGRE_DB_PORT=5432
|
||||
// POSTGRE_DB_NAME=simrsbackup
|
||||
// POSTGRE_DB_USER=simtest
|
||||
// POSTGRE_DB_PASS=12345
|
||||
|
||||
// hostDB := os.Getenv("DB_HOST")
|
||||
// usernameDB := os.Getenv("DB_USERNAME")
|
||||
// passwordDB := os.Getenv("DB_PASSWORD")
|
||||
// dbName := os.Getenv("DB_NAME")
|
||||
// portDB := os.Getenv("DB_PORT")
|
||||
|
||||
hostSatuData := os.Getenv("SATUDATA_HOST")
|
||||
userNameSatuData := os.Getenv("SATUDATA_USERNAME")
|
||||
@@ -33,18 +40,33 @@ func ConnectDB() {
|
||||
dbNameSatuData := os.Getenv("SATUDATA_NAME")
|
||||
portSatuData := os.Getenv("SATUDATA_PORT")
|
||||
|
||||
local := fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%s sslmode=disable TimeZone=Asia/Jakarta", hostDB, usernameDB, passwordDB, dbName, portDB)
|
||||
hostSimrsDB := os.Getenv("SIMRS_DB_HOST")
|
||||
usernameSimrsDB := os.Getenv("SIMRS_DB_USERNAME")
|
||||
passwordSimrsDB := os.Getenv("SIMRS_DB_PASSWORD")
|
||||
dbNameSimrsDB := os.Getenv("SIMRS_DB_NAME")
|
||||
portSimrsDB := os.Getenv("SIMRS_DB_PORT")
|
||||
|
||||
// local := fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%s sslmode=disable TimeZone=Asia/Jakarta", hostDB, usernameDB, passwordDB, dbName, portDB)
|
||||
|
||||
satuData := fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%s sslmode=disable TimeZone=Asia/Jakarta", hostSatuData, userNameSatuData, passwordSatuData, dbNameSatuData, portSatuData)
|
||||
|
||||
localDB, err = gorm.Open(postgres.Open(local), &gorm.Config{})
|
||||
simrsData := fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%s sslmode=disable TimeZone=Asia/Jakarta", hostSimrsDB, usernameSimrsDB, passwordSimrsDB, dbNameSimrsDB, portSimrsDB)
|
||||
|
||||
// localDB, err = gorm.Open(postgres.Open(local), &gorm.Config{})
|
||||
// if err != nil {
|
||||
// log.Fatal("Failed to connect to Satu Data database: ", err)
|
||||
// } else {
|
||||
// log.Println("Successfully connected to the database")
|
||||
// }
|
||||
|
||||
SatuDataDB, err = gorm.Open(postgres.Open(satuData), &gorm.Config{})
|
||||
if err != nil {
|
||||
log.Fatal("Failed to connect to Satu Data database: ", err)
|
||||
} else {
|
||||
log.Println("Successfully connected to the database")
|
||||
}
|
||||
|
||||
SatuDataDB, err = gorm.Open(postgres.Open(satuData), &gorm.Config{})
|
||||
SimrsDataDB, err = gorm.Open(postgres.Open(simrsData), &gorm.Config{})
|
||||
if err != nil {
|
||||
log.Fatal("Failed to connect to Satu Data database: ", err)
|
||||
} else {
|
||||
@@ -74,3 +96,26 @@ func SetHeader(cfg config.ConfigBpjs) (string, string, string, string, string) {
|
||||
return cfg.Cons_id, cfg.Secret_key, cfg.User_key, fmt.Sprint(tstamp), X_signature
|
||||
|
||||
}
|
||||
|
||||
// func SetHeaderSatusehat(cfg config.ConfigSatuSehat) (string, string, string, string, string) {
|
||||
|
||||
// timenow := time.Now().UTC()
|
||||
// time := time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
// tstamp := timenow.Unix() - time.Unix()
|
||||
|
||||
// cfg.Cons_id = os.Getenv("CONS_ID")
|
||||
// cfg.User_key = os.Getenv("USER_KEY")
|
||||
// cfg.Secret_key = os.Getenv("SECRET_KEY")
|
||||
|
||||
// secret := []byte(cfg.Secret_key)
|
||||
// message := []byte(cfg.Cons_id + "&" + fmt.Sprint(tstamp))
|
||||
// hash := hmac.New(sha256.New, secret)
|
||||
// hash.Write(message)
|
||||
// // to lowercase hexits
|
||||
// hex.EncodeToString(hash.Sum(nil))
|
||||
// // to base64
|
||||
// X_signature := base64.StdEncoding.EncodeToString(hash.Sum(nil))
|
||||
|
||||
// return cfg.Cons_id, cfg.Secret_key, cfg.User_key, fmt.Sprint(tstamp), X_signature
|
||||
|
||||
// }
|
||||
|
||||
@@ -12,11 +12,11 @@ services:
|
||||
- .:/app
|
||||
environment:
|
||||
# DATABASE SIMRS V3.0
|
||||
- POSTGRE_DB_HOST=10.10.123.223
|
||||
- POSTGRE_DB_PORT=5432
|
||||
- POSTGRE_DB_NAME=simrsbackup
|
||||
- POSTGRE_DB_USER=simtest
|
||||
- POSTGRE_DB_PASS=12345
|
||||
- SIMRS_DB_HOST=10.10.123.223
|
||||
- SIMRS_DB_NAME=simrsbackup
|
||||
- SIMRS_DB_USERNAME=simtest
|
||||
- SIMRS_DB_PASSWORD=12345
|
||||
- SIMRS_DB_PORT=5432
|
||||
# DATABASE SATU DATA
|
||||
- SATUDATA_HOST=10.10.123.165
|
||||
- SATUDATA_USERNAME=stim
|
||||
@@ -36,3 +36,6 @@ services:
|
||||
- PCARE_RS=pcare-rest
|
||||
# BPJS ICARE
|
||||
- PCARE_APLICARE=ihs
|
||||
|
||||
# SATUSEHAT
|
||||
- OR=10.10.123.165
|
||||
0
g.env.exemico
Executable file
0
g.env.exemico
Executable file
BIN
g.env.exemple
Normal file
BIN
g.env.exemple
Normal file
Binary file not shown.
@@ -5,3 +5,10 @@ type ConfigBpjs struct {
|
||||
Secret_key string
|
||||
User_key string
|
||||
}
|
||||
|
||||
type ConfigSatuSehat struct {
|
||||
Org_id string
|
||||
Client_id string
|
||||
Client_secret string
|
||||
Token string
|
||||
}
|
||||
|
||||
20
models/satusehat/prosedure.go
Normal file
20
models/satusehat/prosedure.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package satusehat
|
||||
|
||||
import (
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
type Procedure struct {
|
||||
VisitId int `db:"visit_id" json:"visit_id" validate:"required"`
|
||||
ProcedureCode string `db:"procedure_code" json:"procedure_code" validate:"required"`
|
||||
ProcedureName string `db:"procedure_name" json:"procedure_name" validate:"required"`
|
||||
}
|
||||
|
||||
func (o *Procedure) Invalid() bool {
|
||||
val := validator.New()
|
||||
err := val.Struct(o)
|
||||
if err != nil {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
109
models/satusehat/visit.go
Normal file
109
models/satusehat/visit.go
Normal file
@@ -0,0 +1,109 @@
|
||||
package satusehat
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
type Visit struct {
|
||||
VisitID string
|
||||
PatientSatusehatID string
|
||||
PatientNIK string
|
||||
PatientName string
|
||||
PatientSex string
|
||||
PatientBirthDate *time.Time
|
||||
PatientAddress string
|
||||
PractitionerNIK string
|
||||
PractitionerSatusehatID string
|
||||
PractitionerName string
|
||||
ClinicSatusehatID string
|
||||
ClinicName string
|
||||
Systole string
|
||||
Diastole string
|
||||
HeartRate string
|
||||
RespirationRate string
|
||||
OxygenSaturation string
|
||||
Temperature string
|
||||
PeriodStartDate time.Time
|
||||
PeriodEndDate time.Time
|
||||
ArrivedStartTime *time.Time
|
||||
ArrivedEndTime *time.Time
|
||||
InProgressStartTime *time.Time
|
||||
InProgressEndTime *time.Time
|
||||
FinishStartTime *time.Time
|
||||
FinishEndTime *time.Time
|
||||
}
|
||||
|
||||
type VisitDetail struct {
|
||||
VisitId string `json:"visit_id" validate:"required"`
|
||||
PatientSatusehatId string `json:"patient_satusehat_id" validate:"required"`
|
||||
PatientNik string `json:"patient_nik" `
|
||||
PatientName string `json:"patient_name" validate:"required"`
|
||||
PatientSex string `json:"patient_sex"`
|
||||
PatientBirthDate *time.Time `json:"patient_birth_date"`
|
||||
PatientAddress string `json:"patient_address"`
|
||||
PractitionerNik string `json:"practitioner_nik"`
|
||||
PractitionerId string `json:"practitioner_satusehat_id" validate:"required"`
|
||||
PractitionerName string `json:"practitioner_name" validate:"required"`
|
||||
ClinicName string `json:"clinic_name" validate:"required"`
|
||||
ClinicSatuSehatId string `json:"clinic_id" validate:"required"`
|
||||
PeriodStartDate time.Time `json:"period_start_date" validate:"required"`
|
||||
PeriodEndDate time.Time `json:"period_end_date" validate:"required"`
|
||||
ArrivedStartTime *time.Time `json:"arrived_start_time" validate:"required"`
|
||||
ArrivedEndTime *time.Time `json:"arrived_end_time" validate:"required"`
|
||||
InProgressStartTime *time.Time `json:"in_progress_start_time" validate:"required"`
|
||||
InProgressEndTime *time.Time `json:"in_progress_end_time" validate:"required"`
|
||||
FinishStartTime *time.Time `json:"finish_start_time" validate:"required"`
|
||||
FinishEndTime *time.Time `json:"finish_end_time" validate:"required"`
|
||||
}
|
||||
|
||||
func (v VisitDetail) Invalid() error {
|
||||
val := validator.New()
|
||||
return val.Struct(v)
|
||||
}
|
||||
|
||||
type VitalSign struct {
|
||||
Systole string `json:"sistole"`
|
||||
Diastole string `json:"diastole"`
|
||||
HeartRate string `json:"heart_rate"`
|
||||
RespirationRate string `json:"respiration_rate"`
|
||||
Temperature string `json:"temperature"`
|
||||
OxygenSaturation string `json:"oxygen_saturation"`
|
||||
}
|
||||
|
||||
func (v *Visit) VitalSign() VitalSign {
|
||||
return VitalSign{
|
||||
Systole: v.Systole,
|
||||
Diastole: v.Diastole,
|
||||
HeartRate: v.HeartRate,
|
||||
RespirationRate: v.RespirationRate,
|
||||
Temperature: v.Temperature,
|
||||
OxygenSaturation: v.OxygenSaturation,
|
||||
}
|
||||
}
|
||||
|
||||
func (v *Visit) VisitDetail() VisitDetail {
|
||||
return VisitDetail{
|
||||
VisitId: v.VisitID,
|
||||
PatientSatusehatId: v.PatientSatusehatID,
|
||||
PatientNik: v.PatientNIK,
|
||||
PatientName: v.PatientName,
|
||||
PatientSex: v.PatientSex,
|
||||
PatientBirthDate: v.PatientBirthDate,
|
||||
PatientAddress: v.PatientAddress,
|
||||
ClinicName: v.ClinicName,
|
||||
ClinicSatuSehatId: v.ClinicSatusehatID,
|
||||
PeriodStartDate: v.PeriodStartDate,
|
||||
PeriodEndDate: v.PeriodEndDate,
|
||||
PractitionerNik: v.PractitionerNIK,
|
||||
PractitionerId: v.PractitionerSatusehatID,
|
||||
PractitionerName: v.PractitionerName,
|
||||
ArrivedStartTime: v.ArrivedStartTime,
|
||||
ArrivedEndTime: v.ArrivedEndTime,
|
||||
InProgressStartTime: v.InProgressStartTime,
|
||||
InProgressEndTime: v.InProgressEndTime,
|
||||
FinishStartTime: v.FinishStartTime,
|
||||
FinishEndTime: v.FinishEndTime,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user