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($encounterClass = "org.openmrs.Encounter")
- #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")
- #set($encounterProviderClass = "org.openmrs.EncounterProvider")
- #set($encounterType = "org.openmrs.EncounterType")
- #set($obs = "org.openmrs.Obs")
- #foreach($row in $rows)
- #*Encounter *#
- #set($encounter = $util.newObject($encounterClass))
- #set($CONCEPT_UUIDS_FOR_PREDICTION_VALUE = [])
- $CONCEPT_UUIDS_FOR_PREDICTION_VALUE.add("1066")
- $CONCEPT_UUIDS_FOR_PREDICTION_VALUE.add("1065")
- //generate new encouter id
- #* patient *#
- #set($patient = $util.newObject($patientClass))
- //create all patient details
- #set($patientId = $row.patientId)
- //$ patient id from the db
- #set($patient = $patientService.getPatientById($patientId))
- #set($logFactory = $portal.getClass().forName('com.liferay.portal.kernel.log.LogFactoryUtil'))
- #set($log = $logFactory.getLog($patientId))
- //setting patient with only patient id
- $encounter.patient($patient)
- #*Calendar*#
- #set($calendar = $util.newObject($calendarClass))
- #set($encounter.encounterDateTime= $row.visitDate)
- #*location *#
- #set($location = $util.newObject("org.openmrs.Location"))
- #set($locationUuid = "3b7617c9-778f-4f48-83e7-5514eb6ed946")
- #set($encounter.location = $locationService.getLocationByUuid($locationUuid))
- #*encounter type *#
- #set($encounterType = $util.newObject("org.openmrs.EncounterType"))
- #set($encounterTypeUuid = "43c3630f-abfe-4fe1-8c92-b73b65199a3d")
- #set($encounter.encounterType = $encounterService.getEncounterTypeByUuid($encounterTypeUuid))
- // use set instead of arrayList
- #set($obsList = [])
- #set($obsDiarrhoea = $util.newObject("org.openmrs.Obs"))
- #set($obsDiarrhoea.concept = $ConceptService.getConceptByName("Diarrhoea"))
- #set($obsDiarrhoea.valueCoded = $CONCEPT_UUIDS_FOR_PREDICTION_VALUE)
- $obsList.add($obsDiarrhoea)
- #set($obsParaparesis = $util.newObject("org.openmrs.Obs"))
- #set($obsParaparesis.concept = $ConceptService.getConceptByName("Paraparesis"))
- #set($obsParaparesis.valueCoded = $CONCEPT_UUIDS_FOR_PREDICTION_VALUE)
- $obsList.add($obsParaparesis)
- #set($obsDiabetesMellitus = $util.newObject("org.openmrs.Obs"))
- #set($Concept = $util.newObject("org.openmrs.Concept"))
- #set($obsDiabetesMellitus.concept = $ConceptService.getConceptByName("Diabetes Mellitus"))
- #set($obsDiabetesMellitus.valueCoded = $CONCEPT_UUIDS_FOR_PREDICTION_VALUE)
- $obsList.add($obsDiabetesMellitus)
- #set($obsRash = $util.newObject("org.openmrs.Obs"))
- #set($obsRash.concept = $ConceptService.getConceptByName("Rash"))
- #set($obsRash.valueCoded = $CONCEPT_UUIDS_FOR_PREDICTION_VALUE)
- $obsList.add($obsRash)
- $encounter.setObs($obsList)
- $encounterService.saveEncounter($encounter)
- #if($encounterService == $null)
- #log("Encounter Service is null")
- #end
- #end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement