Get patient list in source code

167 views
Skip to first unread message

lkot...@gmail.com

unread,
Jul 31, 2018, 8:46:07 AM7/31/18
to dcm4che
Hello,

I am new to Dcm4chee-arc-light. I would like to get a list of patients in java, so i looked into dcm4chee's code and found the class PatientServiceEJB.java (in dcm4chee-arc-patient/impl). This java class have a method (findPatient) that allows to search the database for a particular patient using it's ID and Issuer. 

I wanted to use this and did in my code : 
PatientServiceEJB ps = new PatientServiceEJB();
IDWithIssuer pid = new IDWithIssuer("2000031031","DPI");
ps.findPatient(pid);

But it returns an error :  
Time elapsed: 0.024 sec  <<< ERROR!
java.lang.NullPointerException
at org.dcm4chee.arc.patient.impl.PatientServiceEJB.findPatients(PatientServiceEJB.java:75)

So I added a System.out.print(em) in the findPatient method and it turns out the em (EntityManager) is null. 

Did I miss something ? Or is there any other way to get the patient list in code ? 
ps : I don't have any dependencies problems with javax.persistance 

Thanks in advance :)

Gunter Zeilinger

unread,
Aug 1, 2018, 4:27:57 AM8/1/18
to dcm...@googlegroups.com
You cannot use managed objects (CDI Beans/EJBs) outside Java EE Containers!

dcm4che-arc-light QIDO-RS already provides the SearchForPatient  service according CP 1363. So you may send a HTTP GET request and parse returned JSON (or multipart-related/XML) by your java client.

e.g.:
$ curl -v -H "Accept: application/dicom+json" "http://localhost:8080/dcm4chee-arc/aets/DCM4CHEE/rs/patients?PatientID=3540&IssuerOfPatientID=Site%20A&includefield=all"
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /dcm4chee-arc/aets/DCM4CHEE/rs/patients?PatientID=3540&IssuerOfPatientID=Site%20A&includefield=all HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.58.0
> Accept: application/dicom+json
>
< HTTP/1.1 200 OK
< Cache-Control: no-cache
< Access-Control-Allow-Headers: origin, content-type, accept, authorization
< Date: Wed, 01 Aug 2018 08:25:48 GMT
< Connection: keep-alive
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Credentials: true
< Transfer-Encoding: chunked
< Content-Type: application/dicom+json
< Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS, HEAD
<
* Connection #0 to host localhost left intact
[{"00080005":{"vr":"CS","Value":["ISO_IR 100"]},"00081190":{"vr":"UR","Value":["http://localhost:8080/dcm4chee-arc/aets/DCM4CHEE/rs"]},"00100010":{"vr":"PN","Value":[{"Alphabetic":"PAPAYA^P"}]},"00100020":{"vr":"LO","Value":["3540"]},"00100021":{"vr":"LO","Value":["Site A"]},"00100024":{"vr":"SQ","Value":[{"00400032":{"vr":"UT","Value":["1.2.40.0.13.1.1.999.111.1111"]},"00400033":{"vr":"CS","Value":["ISO"]}}]},"00100030":{"vr":"DA","Value":["19460101"]},"00100040":{"vr":"CS","Value":["M"]},"00201200":{"vr":"IS","Value":[1]},"77770010":{"vr":"LO","Value":["DCM4CHEE Archive 5"]},"77771010":{"vr":"DT","Value":["20180731105144.372"]},"77771011":{"vr":"DT","Value":["20180731105144.378"]}}]


--
You received this message because you are subscribed to the Google Groups "dcm4che" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dcm4che+unsubscribe@googlegroups.com.
To post to this group, send email to dcm...@googlegroups.com.
Visit this group at https://groups.google.com/group/dcm4che.
For more options, visit https://groups.google.com/d/optout.

lkot...@gmail.com

unread,
Aug 2, 2018, 4:43:46 AM8/2/18
to dcm4che
Hello,

Thank you for your answer.
Alright I didn't know that (I don't have much experience with JEE). I tried the HTTP GET request way in code, it works very well, thank you for helping !
Reply all
Reply to author
Forward
0 new messages