Exemple #1
0
func CopyPatient(source *models.Patient) *models.Patient {
	target := &models.Patient{}
	target.Gender = source.Gender
	name := models.HumanName{}
	name.Given = []string{source.Name[0].Given[0]}
	name.Family = []string{source.Name[0].Family[0]}
	target.Name = []models.HumanName{name}
	target.BirthDate = &models.FHIRDateTime{Time: source.BirthDate.Time, Precision: models.Date}
	target.Address = source.Address
	target.Meta = source.Meta
	return target
}
func GenerateDemographics() models.Patient {
	patient := models.Patient{}
	patient.Gender = strings.ToLower(fake.Gender())
	name := models.HumanName{}
	var firstName string
	if patient.Gender == "male" {
		firstName = fake.MaleFirstName()
	} else {
		firstName = fake.FemaleFirstName()
	}
	name.Given = []string{firstName}
	name.Family = []string{fake.LastName() + fake.DigitsN(4)}
	patient.Name = []models.HumanName{name}
	patient.BirthDate = &models.FHIRDateTime{Time: RandomBirthDate(), Precision: models.Date}
	patient.Address = []models.Address{GenerateAddress()}
	return patient
}