Seleccionar idstudy segun identifierfield para redirect
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
defmodule ApiWeb.Redirect do
|
||||
use ApiWeb, :controller
|
||||
require Logger
|
||||
alias Api.Repo
|
||||
import Ecto.Query
|
||||
|
||||
def index(conn, %{"accession" => accession}) do
|
||||
Envar.load(".env")
|
||||
@ -77,16 +79,12 @@ defmodule ApiWeb.Redirect do
|
||||
query =
|
||||
if studyidentifier == "IDSTUDY" do
|
||||
from s in "study",
|
||||
join: p in "patient",
|
||||
on: p.idpatient == s.idpatient,
|
||||
where: s.accessionnumber == ^accessionnumber,
|
||||
select: %{
|
||||
idstudy: s.idstudy
|
||||
}
|
||||
else
|
||||
from s in "study",
|
||||
join: p in "patient",
|
||||
on: p.idpatient == s.idpatient,
|
||||
where: s.accessionnumber == ^accessionnumber,
|
||||
select: %{
|
||||
idstudy: s.idstudy
|
||||
|
||||
Reference in New Issue
Block a user