Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #set($patientClass = "org.openmrs.Patient")
- #set($personNameClass = "org.openmrs.PersonName")
- #set($patientIdentifierClass = "org.openmrs.PatientIdentifier")
- #set($personAttributeClass = "org.openmrs.PersonAttribute")
- #set($calendarClass = $util.loadClass("java.util.Calendar"))
- #set($personAddressClass = "org.openmrs.PersonAddress")
- #set($personPhoneAttributeTypeName = "Telephone Number")
- #set($personLanguageAttributeTypeName = "personLanguage")
- #set($patientIdentifierTypeClass = "org.openmrs.PatientIdentifierType")
- #set($locationClass = "org.openmrs.Location")
- #foreach( $row in $outs )
- #set($patient = $util.newObject($patientClass))
- #set($uuid = $util.generateUuid())
- #set($patient.uuid = $row.PatientId)
- #set($patient.gender = $row.Gender)
- #set($sourceKey = "PatientID");
- #set($sourceValue = $row.PatientID);
- #set($patient.birthdateEstimated = true)
- #set($patient.birthdate = $row.BirthDate)
- #set($identifierTypeUuid = " 05a29f94-c0ed-11e2-94be-8c13b969e334 ")
- #set($locationUuid = " 3b7617c9-778f-4f48-83e7-5514eb6ed946 ")
- #set($identifierType = $patientService.getPatientIdentifierTypeByUuid($identifierTypeUuid))
- #set($location = $locationService.getLocationByUuid($locationUuid))
- #set($patientIdentifier = $util.newObject($patientIdentifierClass))
- #set($patientIdentifier.identifier = "$row.PatientID")
- #set($patientIdentifier.identifierType = $identifierType)
- #set($patientIdentifier.location = $location)
- $patient.addIdentifier($patientIdentifier)
- #set($patientName = $util.newObject($personNameClass))
- #set($patientName.preferred = true)
- #set($patientName.lastName = $row.LastName)
- #set($patientName.firstName = $row.firstName)
- $patient.addName($patientName)
- #set($personAddress = $util.newObject($personAddressClass))
- #set($personAddress.preferred = true)
- #set($personAddress.address1 = "Kampala Najjera")
- $patient.addAddress($personAddress)
- #set($errorLog = $util.newObject("org.openmrs.module.etllite.api.domain.ErrorLog"))
- #set($errorLog.sourceKey = $sourceKey)
- #set($errorLog.sourceValue = $sourceValue)
- $PatientService.savePatient($patient)
- #end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement