2018-12-08 18:01:33 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"database/sql"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (doc doctors) readModels(rows *sql.Rows) iDatabaseModels {
|
|
|
|
var models iDatabaseModels
|
|
|
|
for rows.Next() {
|
|
|
|
var valueList [7]iHasValue
|
|
|
|
rows.Scan(&valueList[0], &valueList[1], &valueList[2], &valueList[3], &valueList[4],
|
|
|
|
&valueList[5], &valueList[6])
|
|
|
|
|
|
|
|
models = append(models, doctor{
|
|
|
|
valueList[0].(int64), valueList[1].(string), valueList[2].(string), academicDegree(valueList[3].(string)),
|
|
|
|
specialization(valueList[4].(string)), valueList[5].(time.Time), jobPosition(valueList[6].(string))})
|
|
|
|
}
|
|
|
|
return models
|
|
|
|
}
|
2018-12-18 22:09:23 +01:00
|
|
|
|
2018-12-08 18:01:33 +01:00
|
|
|
func (pat patients) readModels(rows *sql.Rows) iDatabaseModels {
|
|
|
|
var models iDatabaseModels
|
2018-12-18 22:09:23 +01:00
|
|
|
var pati patient
|
2018-12-08 18:01:33 +01:00
|
|
|
for rows.Next() {
|
2018-12-18 22:09:23 +01:00
|
|
|
pati = patient{}
|
|
|
|
rows.Scan(&pati.Pesel, &pati.Name, &pati.Surname, &pati.BirthDate, &pati.PatientState,
|
2019-01-12 11:27:42 +01:00
|
|
|
&pati.PatientSex, &pati.PatientEmail)
|
2018-12-18 22:09:23 +01:00
|
|
|
models = append(models, pati)
|
2018-12-08 18:01:33 +01:00
|
|
|
}
|
|
|
|
return models
|
|
|
|
}
|
|
|
|
func (dia diagnoses) readModels(rows *sql.Rows) iDatabaseModels {
|
|
|
|
var models iDatabaseModels
|
2018-12-18 22:09:23 +01:00
|
|
|
var diag diagnosis
|
2018-12-08 18:01:33 +01:00
|
|
|
for rows.Next() {
|
2018-12-18 22:09:23 +01:00
|
|
|
diag = diagnosis{}
|
|
|
|
rows.Scan(&diag.IcdSymbol, &diag.Name, &diag.FieldOfSurgery, &diag.Description)
|
|
|
|
models = append(models, diag)
|
2018-12-08 18:01:33 +01:00
|
|
|
}
|
|
|
|
return models
|
|
|
|
}
|
|
|
|
func (ope operations) readModels(rows *sql.Rows) iDatabaseModels {
|
|
|
|
var models iDatabaseModels
|
2018-12-18 22:09:23 +01:00
|
|
|
var oper operation
|
2018-12-08 18:01:33 +01:00
|
|
|
for rows.Next() {
|
2018-12-18 22:09:23 +01:00
|
|
|
oper = operation{}
|
2019-01-11 22:49:42 +01:00
|
|
|
rows.Scan(&oper.OperationID, &oper.Name, &oper.AverageTime, &oper.OperationType,
|
|
|
|
&oper.Cost, &oper.Refoundation)
|
2018-12-18 22:09:23 +01:00
|
|
|
models = append(models, oper)
|
2018-12-08 18:01:33 +01:00
|
|
|
}
|
|
|
|
return models
|
|
|
|
}
|
|
|
|
|
2018-12-18 22:09:23 +01:00
|
|
|
func (doc admissions) readModels(rows *sql.Rows) iDatabaseModels {
|
2018-12-08 18:01:33 +01:00
|
|
|
var models iDatabaseModels
|
2018-12-18 22:09:23 +01:00
|
|
|
var admiss admission
|
2018-12-08 18:01:33 +01:00
|
|
|
for rows.Next() {
|
2018-12-18 22:09:23 +01:00
|
|
|
admiss = admission{}
|
|
|
|
rows.Scan(&admiss.AdmissionID, &admiss.AdmissionDate, &admiss.EndDate,
|
2019-01-11 22:49:42 +01:00
|
|
|
&admiss.PatientPesel, &admiss.DiagnosisSymbol, &admiss.MainDoctor, &admiss.PlanedOperation,
|
2018-12-18 22:09:23 +01:00
|
|
|
&admiss.RoomNumber, &admiss.IsPlanned)
|
|
|
|
models = append(models, admiss)
|
2018-12-08 18:01:33 +01:00
|
|
|
}
|
|
|
|
return models
|
2018-12-18 22:09:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (ro rooms) readModels(rows *sql.Rows) iDatabaseModels {
|
|
|
|
var models iDatabaseModels
|
|
|
|
var rom room
|
|
|
|
for rows.Next() {
|
|
|
|
rom = room{}
|
2019-01-11 22:49:42 +01:00
|
|
|
rows.Scan(&rom.RoomNumber, &rom.NumberOfBeds, &rom.IncreasedCare)
|
2018-12-18 22:09:23 +01:00
|
|
|
models = append(models, rom)
|
|
|
|
}
|
|
|
|
return models
|
|
|
|
}
|