feat: add CPONE patient registration endpoint

This commit is contained in:
2026-09-07 16:25:32 +07:00
parent aae3c733ae
commit c5a959742b
11 changed files with 665 additions and 79 deletions

View File

@@ -52,6 +52,7 @@ type PossibleDuplicateData struct {
type MedrecPatient struct {
MEDRECID string `json:"MEDRECID"`
Nama *string `json:"Nama"`
Kelamin *string `json:"-"`
TanggalLahir *string `json:"TanggalLahir"`
JenisNomerSosial *string `json:"JenisNomerSosial"`
NomerSosial *string `json:"NomerSosial"`
@@ -189,7 +190,7 @@ func findPossibleMedrecDuplicates(ctx context.Context, tx *sql.Tx, name string,
}
const medrecPatientSelect = `
SELECT MEDRECID, Nama, DATE_FORMAT(TanggalLahir, '%Y-%m-%d'),
SELECT MEDRECID, Nama, DATE_FORMAT(TanggalLahir, '%Y-%m-%d'), Kelamin,
JenisNomerSosial, NomerSosial, Telepon, Ponsel
FROM medrec`
@@ -199,13 +200,14 @@ type rowScanner interface {
func scanMedrecPatient(row rowScanner) (MedrecPatient, error) {
var patient MedrecPatient
var name, birthDate, identityType, identityNumber, phone, mobile sql.NullString
err := row.Scan(&patient.MEDRECID, &name, &birthDate, &identityType, &identityNumber, &phone, &mobile)
var name, birthDate, gender, identityType, identityNumber, phone, mobile sql.NullString
err := row.Scan(&patient.MEDRECID, &name, &birthDate, &gender, &identityType, &identityNumber, &phone, &mobile)
if err != nil {
return MedrecPatient{}, err
}
patient.Nama = nullStringPtr(name)
patient.TanggalLahir = nullStringPtr(birthDate)
patient.Kelamin = nullStringPtr(gender)
patient.JenisNomerSosial = nullStringPtr(identityType)
patient.NomerSosial = nullStringPtr(identityNumber)
patient.Telepon = nullStringPtr(phone)