Use CPONE user name for HIS LoginBuat

This commit is contained in:
2026-09-25 22:09:05 +07:00
parent 20ec75fbcf
commit 0d2044926e
22 changed files with 127 additions and 47 deletions

View File

@@ -16,6 +16,7 @@ type AddLabPackageParams struct {
MarkupCito float64
Notes string
Channel string
LoginBuat string
}
type labPackageHeader struct {
@@ -161,7 +162,7 @@ func addLabPackageInTransaction(ctx context.Context, tx *sql.Tx, regID string, p
return LabRegistrationOutcome{}, err
}
now := time.Now().In(jkt).Format("2006-01-02 15:04:05")
dispenserID, visitNumber, err := ensurePackageDispenser(ctx, tx, registration.Registration, packageHeader, params.Channel, now)
dispenserID, visitNumber, err := ensurePackageDispenser(ctx, tx, registration.Registration, packageHeader, params.LoginBuat, now)
if err != nil {
return LabRegistrationOutcome{}, err
}
@@ -194,7 +195,7 @@ func addLabPackageInTransaction(ctx context.Context, tx *sql.Tx, regID string, p
if err != nil {
return LabRegistrationOutcome{}, err
}
dispenserServiceID, err := insertPackageDispenserService(ctx, tx, dispenserID, registration.Registration, packageHeader.ID, packageService, operationID, params.Channel, now)
dispenserServiceID, err := insertPackageDispenserService(ctx, tx, dispenserID, registration.Registration, packageHeader.ID, packageService, operationID, params.LoginBuat, now)
if err != nil {
return LabRegistrationOutcome{}, err
}
@@ -218,19 +219,19 @@ func addLabPackageInTransaction(ctx context.Context, tx *sql.Tx, regID string, p
ShareExternal: parseNullableDecimal(packageService.ShareExternal), ShareLain: parseNullableDecimal(packageService.ShareOther),
Catatan: params.Notes,
}
trxServiceID, err := insertPackageTransactionService(ctx, tx, resolved, discountType, discount, patient, patient, guarantor, guarantor, packageHeader.ID, registration.Registration.RegID, transaction.Transaction.TrxDepartemenID, registration.Registration.MEDRECID, packageService.DepartmentID, doctorID, classID, params.Channel, now)
trxServiceID, err := insertPackageTransactionService(ctx, tx, resolved, discountType, discount, patient, patient, guarantor, guarantor, packageHeader.ID, registration.Registration.RegID, transaction.Transaction.TrxDepartemenID, registration.Registration.MEDRECID, packageService.DepartmentID, doctorID, classID, params.LoginBuat, now)
if err != nil {
return LabRegistrationOutcome{}, err
}
if _, err := tx.ExecContext(ctx, `INSERT INTO trxlayanan_detail (TrxLayananID, PaketDispenserID, PaketDispenserLayananID, LoginBuat, TanggalBuat, NA) VALUES (?, ?, ?, ?, ?, 'N')`, trxServiceID, dispenserID, dispenserServiceID, params.Channel, now); err != nil {
if _, err := tx.ExecContext(ctx, `INSERT INTO trxlayanan_detail (TrxLayananID, PaketDispenserID, PaketDispenserLayananID, LoginBuat, TanggalBuat, NA) VALUES (?, ?, ?, ?, ?, 'N')`, trxServiceID, dispenserID, dispenserServiceID, params.LoginBuat, now); err != nil {
return LabRegistrationOutcome{}, err
}
addedIDs = append(addedIDs, master.LayananID)
}
if err := insertPackageAdministration(ctx, tx, dispenserID, registration.Registration.RegID, packageHeader.ID, params.Channel, now); err != nil {
if err := insertPackageAdministration(ctx, tx, dispenserID, registration.Registration.RegID, packageHeader.ID, params.LoginBuat, now); err != nil {
return LabRegistrationOutcome{}, err
}
if err := syncLabSpecimens(ctx, tx, transaction.Transaction.TrxDepartemenID, transaction.Transaction.TrxID, params.Channel, now); err != nil {
if err := syncLabSpecimens(ctx, tx, transaction.Transaction.TrxDepartemenID, transaction.Transaction.TrxID, params.LoginBuat, now); err != nil {
return LabRegistrationOutcome{}, err
}
if err := updateLabTransactionTotal(ctx, tx, transaction.Transaction.TrxDepartemenID, registration.Registration.RegID, registration.Registration.DepartemenID); err != nil {

View File

@@ -35,6 +35,7 @@ type LabRegistrationParams struct {
WorkingDiagnosis string
Notes string
Channel string
LoginBuat string
}
type LabRegistrationOutcome struct {
@@ -290,7 +291,7 @@ func registerLabInTransaction(ctx context.Context, tx *sql.Tx, params LabRegistr
params.ClassID,
strings.TrimSpace(params.Notes),
shiftID,
params.Channel,
params.LoginBuat,
nowText,
)
if err != nil {
@@ -309,7 +310,7 @@ func registerLabInTransaction(ctx context.Context, tx *sql.Tx, params LabRegistr
senderDoctorID,
nowText,
params.ClassID,
params.Channel,
params.LoginBuat,
nowText,
)
if err != nil {
@@ -323,7 +324,7 @@ func registerLabInTransaction(ctx context.Context, tx *sql.Tx, params LabRegistr
if err := upsertLabNominals(ctx, tx, regID, trxDepartmentID, params.DepartmentID); err != nil {
return LabRegistrationOutcome{}, err
}
if err := saveLabDiagnosis(ctx, tx, regID, patient.MEDRECID, strings.TrimSpace(params.WorkingDiagnosis), params.Channel, nowText); err != nil {
if err := saveLabDiagnosis(ctx, tx, regID, patient.MEDRECID, strings.TrimSpace(params.WorkingDiagnosis), params.LoginBuat, nowText); err != nil {
return LabRegistrationOutcome{}, err
}

View File

@@ -12,8 +12,9 @@ import (
)
type AddLabServicesParams struct {
Layanan []RequestedLabService
Channel string
Layanan []RequestedLabService
Channel string
LoginBuat string
}
type RequestedLabService struct {
@@ -225,13 +226,13 @@ func addLabServicesInTransaction(ctx context.Context, tx *sql.Tx, regID string,
registration.Registration.DepartemenID,
doctorValue,
classID,
params.Channel,
params.LoginBuat,
now,
); err != nil {
return LabRegistrationOutcome{}, err
}
}
if err := syncLabSpecimens(ctx, tx, transaction.Transaction.TrxDepartemenID, transaction.Transaction.TrxID, params.Channel, now); err != nil {
if err := syncLabSpecimens(ctx, tx, transaction.Transaction.TrxDepartemenID, transaction.Transaction.TrxID, params.LoginBuat, now); err != nil {
return LabRegistrationOutcome{}, err
}
if err := updateLabTransactionTotal(

View File

@@ -30,6 +30,7 @@ type MedrecParams struct {
DependantID string
EmployeeName string
Channel string
LoginBuat string
}
type MedrecOutcome struct {
@@ -263,7 +264,7 @@ func insertMedrec(ctx context.Context, tx *sql.Tx, medrecID string, params Medre
params.IdentityType, params.IdentityNumber, params.EmployeeID, params.DependantID,
params.EmployeeName, phone, mobile, params.Email, params.Address, params.Province,
params.City, params.District, params.Village,
params.PostalCode, params.CompanyID, params.Channel, now, now)
params.PostalCode, params.CompanyID, params.LoginBuat, now, now)
if err != nil {
return MedrecPatient{}, err
}

View File

@@ -37,6 +37,7 @@ type CreatePaketParams struct {
Keterangan string
JumlahHari int64
Channel string
LoginBuat string
Layanan []CreatePaketLayananParams
}

View File

@@ -93,7 +93,7 @@ func (r MySQLLayananRepository) CreatePaket(ctx context.Context, params CreatePa
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 2, ?, ?, 'N')`,
packageID, params.Nama, params.JenisPaket, boolInt(params.RawatJalan), boolInt(params.RawatInap),
boolInt(params.MultiVisit), nullableDate(params.TanggalMulai), nullableDate(params.TanggalSelesai),
params.HeaderPaketID, params.KelasID, params.JumlahHari, "0.00", params.Keterangan, params.Channel, now)
params.HeaderPaketID, params.KelasID, params.JumlahHari, "0.00", params.Keterangan, params.LoginBuat, now)
if err != nil {
return CreatePaketResult{}, err
}
@@ -124,7 +124,7 @@ func (r MySQLLayananRepository) CreatePaket(ctx context.Context, params CreatePa
packageID, departmentID, service.DepartemenID, service.LayananID, service.Jumlah, service.JumlahHari,
decimalText(service.HargaCents), service.TipeDiskon, decimalText(service.DiskonCents), service.TipeShare,
decimalText(service.ShareRSCents), decimalText(service.ShareDokterCents), decimalText(service.ShareExternalCents),
decimalText(service.ShareLainCents), decimalText(subtotal), params.Channel, now)
decimalText(service.ShareLainCents), decimalText(subtotal), params.LoginBuat, now)
if err != nil {
return CreatePaketResult{}, err
}

View File

@@ -33,6 +33,7 @@ type RegistrationParams struct {
EmployeeID string
EmployeeName string
Channel string
LoginBuat string
PackageID string
}
@@ -129,7 +130,7 @@ func registerPatientInTransaction(ctx context.Context, tx *sql.Tx, params Regist
if found {
data := RegistrationData{Patient: patient, Registration: existing}
if strings.TrimSpace(params.PackageID) != "" {
data.Package, err = addRegistrationPackage(ctx, tx, existing, patient.MEDRECID, params.PackageID, params.Channel, params.RegistrationDate)
data.Package, err = addRegistrationPackage(ctx, tx, existing, patient.MEDRECID, params.PackageID, params.LoginBuat, params.RegistrationDate)
if err != nil {
return RegistrationOutcome{}, err
}
@@ -196,7 +197,7 @@ func registerPatientInTransaction(ctx context.Context, tx *sql.Tx, params Regist
params.ClassID,
params.Notes,
shiftID,
params.Channel,
params.LoginBuat,
nowText,
)
if err != nil {
@@ -214,7 +215,7 @@ func registerPatientInTransaction(ctx context.Context, tx *sql.Tx, params Regist
}
data := RegistrationData{Patient: patient, Registration: registration}
if strings.TrimSpace(params.PackageID) != "" {
data.Package, err = addRegistrationPackage(ctx, tx, registration, patient.MEDRECID, params.PackageID, params.Channel, params.RegistrationDate)
data.Package, err = addRegistrationPackage(ctx, tx, registration, patient.MEDRECID, params.PackageID, params.LoginBuat, params.RegistrationDate)
if err != nil {
return RegistrationOutcome{}, err
}