feat(cpone): support company patient fields

This commit is contained in:
2026-08-23 19:38:46 +07:00
parent 30ddf25012
commit 4d02fc4dc9
4 changed files with 37 additions and 9 deletions

View File

@@ -26,6 +26,9 @@ type MedrecParams struct {
Village string
PostalCode string
CompanyID string
EmployeeID string
DependantID string
EmployeeName string
Channel string
}
@@ -235,10 +238,6 @@ func insertMedrec(ctx context.Context, tx *sql.Tx, medrecID string, params Medre
if mobile == "" {
mobile = params.Phone
}
var nik any
if params.IdentityType == "KTP" {
nik = params.IdentityNumber
}
firstName := params.Name
if index := strings.IndexByte(params.Name, ' '); index >= 0 {
firstName = params.Name[:index]
@@ -252,14 +251,16 @@ func insertMedrec(ctx context.Context, tx *sql.Tx, medrecID string, params Medre
_, err = tx.ExecContext(ctx, `
INSERT INTO medrec (
MEDRECID, KodeRS, Nama, Panggilan, Kelamin, TanggalLahir, TempatLahir,
JenisNomerSosial, NomerSosial, NIK, Telepon, Ponsel, Email, Alamat,
Propinsi, Kota, Kecamatan, Kelurahan, KodePos, PerusahaanID,
JenisNomerSosial, NomerSosial, NIK, DependantID, NamaKaryawan,
Telepon, Ponsel, Email, Alamat, Propinsi, Kota, Kecamatan, Kelurahan,
KodePos, PerusahaanID,
Mati, NA, LoginBuat, TanggalBuat, TanggalEdit
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'N', 'N', ?, ?, ?)`,
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'N', 'N', ?, ?, ?)`,
medrecID, params.HospitalCode, params.Name, firstName, params.Gender,
params.DateOfBirth.Format("2006-01-02"), params.PlaceOfBirth,
params.IdentityType, params.IdentityNumber, nik, phone, mobile, params.Email,
params.Address, params.Province, params.City, params.District, params.Village,
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)
if err != nil {
return MedrecPatient{}, err