示例#1
0
文件: main.go 项目: mitre/ptmatch
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
}
示例#2
0
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
}