Advertisement
Guest User

Untitled

a guest
Oct 12th, 2023
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. #set($patientClass = "org.openmrs.Patient")
  2. #set($personNameClass = "org.openmrs.PersonName")
  3. #set($patientIdentifierClass = "org.openmrs.PatientIdentifier")
  4. #set($personAttributeClass = "org.openmrs.PersonAttribute")
  5. #set($calendarClass = $util.loadClass("java.util.Calendar"))
  6. #set($personAddressClass = "org.openmrs.PersonAddress")
  7. #set($personPhoneAttributeTypeName = "Telephone Number")
  8. #set($personLanguageAttributeTypeName = "personLanguage")
  9. #set($patientIdentifierTypeClass = "org.openmrs.PatientIdentifierType")
  10. #set($locationClass = "org.openmrs.Location")
  11. #foreach( $row in $outs )
  12. #set($patient = $util.newObject($patientClass))
  13. #set($uuid = $util.generateUuid())
  14. #set($patient.uuid = $row.PatientId)
  15. #set($patient.gender = $row.Gender)
  16. #set($sourceKey = "PatientID");
  17. #set($sourceValue = $row.PatientID);
  18. #set($patient.birthdateEstimated = true)
  19. #set($patient.birthdate = $row.BirthDate)
  20. #set($identifierTypeUuid = " 05a29f94-c0ed-11e2-94be-8c13b969e334 ")
  21. #set($locationUuid = " 3b7617c9-778f-4f48-83e7-5514eb6ed946 ")
  22. #set($identifierType = $patientService.getPatientIdentifierTypeByUuid($identifierTypeUuid))
  23. #set($location = $locationService.getLocationByUuid($locationUuid))
  24. #set($patientIdentifier = $util.newObject($patientIdentifierClass))
  25. #set($patientIdentifier.identifier = "$row.PatientID")
  26. #set($patientIdentifier.identifierType = $identifierType)
  27. #set($patientIdentifier.location = $location)
  28. $patient.addIdentifier($patientIdentifier)
  29. #set($patientName = $util.newObject($personNameClass))
  30. #set($patientName.preferred = true)
  31. #set($patientName.lastName = $row.LastName)
  32. #set($patientName.firstName = $row.firstName)
  33. $patient.addName($patientName)
  34. #set($personAddress = $util.newObject($personAddressClass))
  35. #set($personAddress.preferred = true)
  36. #set($personAddress.address1 = "Kampala Najjera")
  37. $patient.addAddress($personAddress)
  38. #set($errorLog = $util.newObject("org.openmrs.module.etllite.api.domain.ErrorLog"))
  39. #set($errorLog.sourceKey = $sourceKey)
  40. #set($errorLog.sourceValue = $sourceValue)
  41. $PatientService.savePatient($patient)
  42. #end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement