Strategy for compiling a "permanent legal document" (hot-linked .PDF) from Base records?

Premise: a “chart” database (SQLite in an EHR-wannabe), operated by users via standalone Writer form documents, consisting of patient, provider, insurance, equipment and part tables, along with billing records and a ton of scanned/externally-linked document images (for signatures, etc.).

Problem: When a patient dies or moves, and the last encounter’s claims have been paid and/or closed, and the patient’s ‘account’ must be ‘closed’ and culled from the active database after archiving all the patient’s records. Ideally, all forms and associated documents (tied to a patient’s primary key ID) would be gathered and compiled together, internally hot-linked, and exported into a single PDFa/1a archive file in a fashion that would enable a reader (e.g. an insurance auditor) to navigate the resulting document as if they were perusing the account within the database software, thus producing a “permanent legal (electronic) document” that also looks good when printed to paper.

Question: What’s the best strategy to accomplish this? I’m aware I’m going to have to go deep into the BASIC weeds, but if I’m to believe Mr. Google it doesn’t appear that anyone’s tried anything like this before.