My hospital isn't fully electronic yet; they use a hybrid system where doctors notes and orders are written on paper, to be scanned into the electronic chart at the end of the patient's stay. Everything else (nurse's notes, labs, radiology results) are electronic. It actually works pretty well, with most of the advantages of an EMR (Electronic Medical Record) without forcing the older doctors to use the computer. That's coming, of course, but it won't be pretty.

But those of us for whom the computer is mother's milk, and whose handwriting is somewhere between chicken scratch and Linear A, we'd rather do it all online. I've been writing my admission notes for a few years with a Microsoft Word template, printing them out and putting them in the chart, with nary a problem. And the medical records department clearly used PDF's for the pages, both the blank order sheets and the preprinted, fill-in-the-blanks "standard orders" since they were available on the hospital intranet. So let's create PDF's with actual editable text boxes and check boxes (these are mockups, but they look right):

physician order sheetgastroenteritis order sheet

The response from medical records: not an option. It's too hard, inserting all those textboxes by hand on all those lines, and they don't "possess the very expensive software that makes this possible." They had to go to the graphic arts department to use their copy of Pagemaker. And any change means having to put all those controls back in the form again, by hand.

Never tell me something on the computer is impossible. I have teh l33t hax0r ski1z! The expensive software problem is easy to solve; Writer can generate PDF's, and a little experimentation shows that form elements are preserved. The "too hard" problem should be solvable, too; Writer is scriptable and I've scripted Microsoft Word with VBA often enough; how hard could it be?

Famous last words.

Scripting Microsoft Office is like pulling teeth; Basic is verbose and tedious, and the documentation for the object model is sparse. But scripting is like pulling teeth with your eyes closed. The documentation (the bane of all open source software) is virtually nonexistent; the macro recorder (so useful for Microsoft Office) records the user interface interactions, not the underlying object model; and there is no object browser to explore the methods and properties of each object (there is the xray tool to look at objects one at a time as part of a macro).

So I just went to the documentation wiki and dived in, spending a few hours browsing, trying to find a place to start. I'd recommend the BASIC guide and the Introduction to UNO, which is Sun's answer to Microsoft's COM and the basis for the document object model, then the BASIC Binding chapter to put them together. The documentation of the object model is near impossible to find but it's there.

You really need to be able to read Java to understand the rest of the documentation, since both the examples and the underlying concepts are in that language. I wouldn't use anything but Basic, though, since it abstracts away all the underlying interface querying and dispatching and type casting.

The code I developed is here; I'll blog about the things I learned as I get the time.

Leave a Reply

Warning: Undefined variable $user_ID in /home/public/blog/wp-content/themes/evanescence/comments.php on line 75