cambios consulta informes
This commit is contained in:
		| @ -43,26 +43,26 @@ defmodule Api.Downloadpdf do | ||||
|         patientname: fragment("replace(?, '^', ' ')", p.patientname), | ||||
|         studydate: fragment("TO_CHAR(?, 'YYYY-MM-DD')", s.studydate), | ||||
|         studytime: s.studytime, | ||||
|         studydescription: s.studydescription, | ||||
|         proceduredescription: s.proceduredescription, | ||||
|         procedurecode: s.procedurecode, | ||||
|         studydescription: fragment("COALESCE(?, '')", s.studydescription), | ||||
|         proceduredescription: fragment("COALESCE(?, '')", s.proceduredescription), | ||||
|         procedurecode: fragment("COALESCE(?, '')", s.procedurecode), | ||||
|         modality: s.modality, | ||||
|         patientid: p.patientid, | ||||
|         patientbirthdate: fragment("TO_CHAR(?, 'YYYY-MM-DD')", p.patientbirthdate), | ||||
|         fin_signature: pr.signature, | ||||
|         matricula_finalized: fragment("COALESCE(?, '')",pr.matricula), | ||||
|         fin_signature: fragment("COALESCE(?, '')", pr.signature), | ||||
|         matricula_finalized: fragment("COALESCE(?, '')", pr.matricula), | ||||
|         informantphysician: u.username, | ||||
|         insurer: fragment("COALESCE(?, '')",s.insurer), | ||||
|         institutionname: s.institutionname, | ||||
|         referringphysiciansname: fragment("COALESCE(?, '')", s.referringphysiciansname), | ||||
|         servicio: fragment("COALESCE(?, '')", s.servicio) | ||||
|         insurer: fragment("COALESCE(?, '')", s.insurer), | ||||
|         institutionname: fragment("COALESCE(?, '')", s.institutionname), | ||||
|         referringphysiciansname: fragment("COALESCE(?, '')", s.referringphysiciansname) | ||||
|         # servicio: fragment("COALESCE(?, '')", s.servicio) | ||||
|       } | ||||
|  | ||||
|  | ||||
|     result = Repo.one( | ||||
|       from q in subquery(query), | ||||
|       select: fragment("json_build_object('idstudyreport', ?, 'body', ?, 'idstudy', ?, 'accessionnumber', ?, 'patientname', ?, 'studydate', ?, 'studytime', ?, 'studydescription', ?, 'proceduredescription', ?, 'procedurecode', ?, 'modality', ?, 'patientid', ?, 'patientbirthdate', ?, 'fin_signature', ?, 'matricula_finalized', ?, 'informantphysician', ?, 'insurer', ?, 'institutionname', ?, 'referringphysiciansname', ?, 'printtemplate', ?, 'servicio', ?)", | ||||
|         q.idstudyreport, q.body, q.idstudy, q.accessionnumber, q.patientname, q.studydate, q.studytime, q.studydescription, q.proceduredescription, q.procedurecode, q.modality, q.patientid, q.patientbirthdate, q.fin_signature, q.matricula_finalized, q.informantphysician, q.insurer, q.institutionname, q.referringphysiciansname, q.printtemplate, q.servicio | ||||
|       select: fragment("json_build_object('idstudyreport', ?, 'body', ?, 'idstudy', ?, 'accessionnumber', ?, 'patientname', ?, 'studydate', ?, 'studytime', ?, 'studydescription', ?, 'proceduredescription', ?, 'procedurecode', ?, 'modality', ?, 'patientid', ?, 'patientbirthdate', ?, 'fin_signature', ?, 'matricula_finalized', ?, 'informantphysician', ?, 'insurer', ?, 'institutionname', ?, 'referringphysiciansname', ?, 'printtemplate', ?)", | ||||
|         q.idstudyreport, q.body, q.idstudy, q.accessionnumber, q.patientname, q.studydate, q.studytime, q.studydescription, q.proceduredescription, q.procedurecode, q.modality, q.patientid, q.patientbirthdate, q.fin_signature, q.matricula_finalized, q.informantphysician, q.insurer, q.institutionname, q.referringphysiciansname, q.printtemplate | ||||
|       ) | ||||
|     ) | ||||
|     Logger.info("#{inspect(result)}") | ||||
|  | ||||
		Reference in New Issue
	
	Block a user