Attaching wrong eform in Consult request

Preconditions

Deb install properties or similar with consult fax enabled property set
eforms in the database
completed eforms in the database with fdid's > the number of eforms

Steps to Reproduce

Write a consult
attach or not a lab or eform
Fax it

Expected Result

Only selected results for the patient gets faxed and it is reflected in the print preview

Observed Result

Print preview is as expected
Rather unpredictably old eforms with small number fdid get attached that are from other patients files
In the case of one referral of a patient to an agency with attached eform specific to that agency (fid of 214)
In this case the appropriate referral eform to be attached was fid 241 but the eform fdid 214 was also attached from another patient

Another patient refered to a consultant without an attachment had an attachment of fdid=84

Additional Comments

I suppose the work around is to print to paper and fax that, which seems a step backwards

Activity

Show:
Peter H-C
August 21, 2019, 5:26 PM

The error is persistent and renumbering the offending fdid (s) does not solve the problem as that then gives an NPE

2019-08-21 13:15:41,327 ERROR [WKHtmlToPdfUtils:168] Error running command : [wkhtmltopdf, -s, Letter, -T, 10mm, -L, 8mm, -R, 8mm, --print-media-type, --javascript-delay, 3000, https://127.0.0.1:8443/oscar/EFormViewForPdfGenerationServlet?parentAjaxId=eforms&providerId=null&fdid=214&blankForm=true, /tmp/tomcat7-tomcat7-tmp/wkhtmltopdf.3823160654005998264.pdf]
2019-08-21 13:15:41,333 ERROR [EctConsultationFormFaxAction:385] IOException occurred inside ConsultationFormFaxAction
java.io.IOException: Cannot convert html file to pdf

Raymond Rusk
August 21, 2019, 10:04 PM

Accepting without independent verification.

Marc Dumontier
November 15, 2019, 3:35 PM

Peter,

The eforms that get attached are selected by querying consult docs table

 

String sql = "SELECT * FROM eform_data e where e.patient_independent = false " +
"AND e.fdid IN (SELECT cd.document_no FROM consultdocs cd WHERE cd.requestId = '" + consultationId + "' AND cd.docType = 'E' AND cd.deleted IS NULL) " +
"ORDER BY e.form_date DESC, e.form_time DESC";

can you check if those old eforms are associated with your consult or not?

 

I followed the code through, and don’t see any way else it would grab any other eform during the faxing action

 

 

Marc Dumontier
November 15, 2019, 3:41 PM

Actually,

 

The following code looks suspicious to what you are experiencing. Does you consult have an eform associated with them?

if(reqId!=null && !reqId.trim().equals("") && consultationRequestDao.getConsultation(Integer.parseInt(reqId))!=null){
ProfessionalSpecialist professionalSpecialist = consultationRequestDao.getConsultation(Integer.parseInt(reqId)).getProfessionalSpecialist();
if (professionalSpecialist!=null && professionalSpecialist.getEformId()!=null && professionalSpecialist.getEformId()!=0){
String localUri = PrintAction.getEformRequestUrl(request);
buffer = WKHtmlToPdfUtils.convertToPdf(localUri + professionalSpecialist.getEformId() + "&blankForm=true");
bis = new ByteInputStream(buffer, buffer.length);
streams.add(bis);
alist.add(bis);

 

 

Marc Dumontier
November 15, 2019, 6:59 PM

fixed so that if you have an eform set for your professional specialist, the latest one for that patient, if found, will be send along.

 

Assignee

Marc Dumontier

Reporter

Peter H-C

Labels

OSCAR Build Date

2019/07/26

OSCAR Build Tag

1000

Client Browser

Firefox

Client OS

Ubuntu

Are you or your organization planning on submitting a fix for this bug in the next 30 days?

No

Validated by Reporter

No

SourceForge Link

None

SourceForge Reporter

None

SourceForge Assigned To

None

SourceForge Date Created

None

SourceForge ID

None

Affects versions

Priority

6
Configure