Skip to content

Instantly share code, notes, and snippets.

@sdumitriu
Last active August 29, 2015 14:18
Show Gist options
  • Save sdumitriu/f55c7225091fb5dee3d4 to your computer and use it in GitHub Desktop.
Save sdumitriu/f55c7225091fb5dee3d4 to your computer and use it in GitHub Desktop.
Patient records created each months
{{velocity}}
##set ($format = $services.jodatime.getISODateFormatter())
#set ($format = $services.jodatime.getDateTimeFormatterForPattern('yyyy-MM'))
#set($q = $services.query.hql("select doc.creationDate from XWikiDocument doc, BaseObject as obj, DBStringListProperty phenotype, LongProperty iid where obj.name=doc.fullName and obj.className = ? and doc.fullName not in (?, ?) and obj.id=phenotype.id.id and phenotype.id.name = ? and (? in elements(phenotype.list)) and iid.id.id = obj.id and iid.id.name = 'identifier' and iid.value >= 0 order by doc.creationDate asc").bindValues(["PhenoTips.PatientClass", "PhenoTips.PatientClassTemplate", "PhenoTips.PatientTemplate", "extended_phenotype", "HP:0000118"]))
|=Month|=Patient records created
#foreach ($i in $q.execute())
#set ($date = $format.print($i))
#if ($prevDate != $date)
#if($prevDate)
|$prevDate|$count
#end
#set ($prevDate = $date)
#set ($count = 0)
#end
#set ($count = $count + 1)
#end
|$prevDate|$count
|=Total|=$services.query.hql(", BaseObject as obj, DBStringListProperty phenotype, LongProperty iid where obj.name=doc.fullName and obj.className = ? and doc.fullName not in (?, ?) and obj.id=phenotype.id.id and phenotype.id.name = ? and (? in elements(phenotype.list)) and iid.id.id = obj.id and iid.id.name = 'identifier' and iid.value >= 0").bindValues(["PhenoTips.PatientClass", "PhenoTips.PatientClassTemplate", "PhenoTips.PatientTemplate", "extended_phenotype", "HP:0000118"]).count()
{{/velocity}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment