Health Maintenance History
Health maintenance history is a key record in Primary Care. It is the basis of HEDIS measures and is one of the most important features of a clinical patient record because it is used for preventive care.
The Health Maintenance History record as kept in the Primary Care Decision Tree is not intended to provide diagnostic results. It is used solely to log that certain items key to preventive care have been performed for the patient.
Modifying or creating a Health Maintenance History record in the Decision Tree requires full understanding of the data structures within MedInformatix, including where every clinical element is kept. It also requires very advanced SQL knowledge. If you do not have this level of expertise, use this chapter as a way of understanding how this particular feature is configured.
Although seemingly a simple task, this is actually a complex undertaking because some preventive care may have been done outside of the primary care physician’s control. It may have been done in the office of a specialist, or requested specifically by the patient from another doctor. More than likely a mix of events will have occurred where some of the primary care was done in another facility while some have been done recently by the current practice treating the patient.
Preventive care done in the office is already being tracked by existing forms and questionnaires found in the Decision Tree. However, those that are done at outside locations need to be tracked as well and will often have to be recorded manually.
A new action property called #ABSTRACT was created to handle the mixed data types being tracked. Preventive care done somewhere else needs to be tracked as a single point in time value recording the date of the care. This then has to be compared with mostly transactional data (those with historical multiple occurrences) of preventive care being tracked in the clinical information system. Only the newest date is pertinent. Thus, older information should be overridden by newer data.
The #ABSTRACT data entry screen allows a list of health maintenance items to be listed on the left hand column. Then, data entry fields are allowed on the right hand side. If the entry is blank, a user may click on it and will be given a date field. This date field is used to indicate an action that was done outside of the transactional historical data in the clinical patient information database. What it actually does is send an order to the Order Entry System using the department code “HM” (Health Maintenance). This special purpose department is used to turn the old history of preventive care into a queryable transaction.
The display of the dates on the #ABSTRACT screen is based on a series of queries defined by the tree designer. Each individual item displayed in a row has its individual query and the query first must check the CLORDER table for a matching entry with the department code of “HM”. If it finds that, it should display that order date on the row’s date column. Because it is used to summarize the occurrence of a past event, it is called an ABSTRACT.
It should then query the current database for current data kept in any of the existing clinical tables to see if preventive care was done by the current physician. If so, then that date should override the ABSTRACT date.
#ABSTRACT
Below is a view of the Health Maintenance History window in the Primary Care Decision Tree, which uses #ABSTRACT.
Action Property
#ABSTRACT:PHMAINT.QA

PHMAINT.QA
The Health Maintenance History is defined in PHMAINT.QA.
Contents of \DIM\OUTLINE\PHMAINT.QA
[%GENERAL]
Section=HM
Title=Health Maintenance History
Edit Title=Health Maintenance History
Historical Data=0
Text=PHHMAINT.TXT
The items shown above are fixed and should not be changed.
Message=&Plname, &Pfname
This is used to control the text area below the exit button and its contents are processed by the Document Interpreter.
[%QUESTION]
Vision Test=VISION
Influenza Virus Vaccine=FLU
Pneumovax=PNEUMOVAX
TB Test=TBTEST
Cholesterol Test=CHOLESTEROL
Pap Smear=PAP
Mammogram=MAMMOGRAM
PSA=PROSTATE
Tetanus Vaccine=TETANUS
--------------=DUMMY
Physical Exam=PHYSICAL
Female Pelvic Exam=PELVIC
Male Testicular Exam=TESTICLES
Hearing Test=HEARING
Breast Self-Exam=BREASTEXAM
Taught to do breast Self-Exam=TAUGHTBREAST
Urinalysis=UA
Stool Occult blood test=OCCULTBLOOD
ECG (Baseline)=ECG
Chest X-Ray (Optional)=CHESTXRAY
Sigmoidoscopy=SIGMOIDOSCOPY
Seat Belts=SEATBELT
Stop Smoking=SMOKING
The items above are the clinical data being tracked. The long description of the clinical data acts as the entry and the value after the equal sign as the variable identifier that is used to define the queries. Assign a unique one to each data item. Note the special use of the variable name “DUMMY”. This is reserved as a non-functioning variable and is used to improve the appearance of the screen by allowing separators to be inserted.
[Query]
VISION-1=SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
VISION-2=AND (ODESC='Vision Test' OR ODESC='Vision Screen')
VISION-3=AND DEPT!='REFUS' AND DEPT!='EDU' ORDER BY ORDERDATE DESC
FLU-1=SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
FLU-2=AND (ODESC='Flu Vaccination' OR ODESC='Influenza Virus Vaccine')
FLU-3=AND DEPT!='REFUS' AND DEPT!='EDU'
FLU-4=ORDER BY ORDERDATE DESC
PNEUMOVAX-1=SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY'
PNEUMOVAX-2=AND STATUS='Y' AND DEPT!='REFUS' AND DEPT!='EDU'
PNEUMOVAX-3=AND (ODESC='Pneumovax' ) ORDER BY ORDERDATE DESC
TBTEST-1=SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
TBTEST-2=AND ( ODESC='TB Test' OR ODESC='TB Tine Test' OR ODESC='TB PPD #1'
TBTEST-3=OR ODESC='TB Tine Test' OR ODESC='TB/PPD' )
TBTEST-4=AND DEPT!='REFUS' AND DEPT!='EDU'
TBTEST-5=ORDER BY ORDERDATE DESC
CHOLESTEROL-1=SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
CHOLESTEROL-2=AND (ODESC='Cholesterol' OR ODESC='Panel - Cholesterol' OR ODESC='Cholesterol Test' OR
CHOLESTEROL-3=ODESC='Lipid Profile' OR ODESC='Panel-Lipid' OR ODESC='Cholesterol, HDL')
CHOLESTEROL-4=AND DEPT!='REFUS' AND DEPT!='EDU'
CHOLESTEROL-5=ORDER BY ORDERDATE DESC
PAP-1=SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
PAP-2=AND ODESC='Pap Smear'
PAP-3=AND DEPT!='REFUS' AND DEPT!='EDU'
PAP-4=ORDER BY ORDERDATE DESC
MAMMOGRAM-1=SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
MAMMOGRAM-2=AND (ODESC='X-Ray Mammogram' OR ODESC='Mammogram')
MAMMOGRAM-3=AND DEPT!='REFUS' AND DEPT!='EDU'
MAMMOGRAM-4=ORDER BY ORDERDATE DESC
PROSTATE-1=SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
PROSTATE-2=AND (ODESC='PSA' OR ODESC='Prostate Panel')
PROSTATE-3=AND DEPT!='REFUS' AND DEPT!='EDU'
PROSTATE-4=ORDER BY ORDERDATE DESC
TETANUS-1=SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
TETANUS-2=AND (ODESC='Tetanus Vaccine' OR ODESC='Tetanus Shot' OR ODESC='Tetanus Toxoid')
TETANUS-3=AND DEPT!='REFUS' AND DEPT!='EDU'
TETANUS-4=ORDER BY ORDERDATE DESC
PHYSICAL-1=if exists (select * from CLDICTIONARY WHERE SECTION LIKE 'EX%' AND SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y' )
PHYSICAL-2=BEGIN
PHYSICAL-3= SELECT REPORTED FROM CLDICTIONARY WHERE SECTION LIKE 'EX%' AND SSNO='&MRNO' AND COMPANY='&COMPANY' ORDER BY REPORTED DESC
PHYSICAL-4=END
PHYSICAL-5=ELSE
PHYSICAL-6=BEGIN
PHYSICAL-7= SELECT ORDERDATE FROM CLORDER WHERE ODESC='Physical Exam' AND SSNO='&MRNO' AND COMPANY='&COMPANY'
PHYSICAL-8= AND DEPT='HM' AND STATUS='Y' ORDER BY ORDERDATE DESC
PHYSICAL-9=END
PELVIC-1=if exists (select * from CLDICTIONARY WHERE (SECTION ='EXGF' OR (SECTION LIKE 'EX%' AND VARCODE='GENITALIAF' AND VARTEXT!='deferred') ) AND SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y' )
PELVIC-2=BEGIN
PELVIC-3= select REPORTED from CLDICTIONARY WHERE (SECTION ='EXGF' OR (SECTION LIKE 'EX%' AND VARCODE='GENITALIAF' AND VARTEXT!='deferred') ) AND SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y' ORDER BY REPORTED DESC
PELVIC-4=END
PELVIC-5=ELSE
PELVIC-6=BEGIN
PELVIC-7= SELECT ORDERDATE FROM CLORDER WHERE ODESC='Pelvic Exam' AND SSNO='&MRNO' AND COMPANY='&COMPANY'
PELVIC-8= AND DEPT='HM' AND STATUS='Y' ORDER BY ORDERDATE DESC
PELVIC-9=END
TESTICLES-1=if exists (select * from CLDICTIONARY WHERE (SECTION ='EXGM' OR (SECTION LIKE 'EX%' AND VARCODE='GENITALIAM' AND VARTEXT!='deferred') ) AND SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y' )
TESTICLES-2=BEGIN
TESTICLES-3= select REPORTED from CLDICTIONARY WHERE (SECTION ='EXGM' OR (SECTION LIKE 'EX%' AND VARCODE='GENITALIAM' AND VARTEXT!='deferred' ) ) AND SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y' ORDER BY REPORTED DESC
TESTICLES-4=END
TESTICLES-5=ELSE
TESTICLES-6=BEGIN
TESTICLES-7= SELECT ORDERDATE FROM CLORDER WHERE ODESC='Testicular Exam' AND SSNO='&MRNO' AND COMPANY='&COMPANY'
TESTICLES-8= AND STATUS='Y' AND DEPT='HM' ORDER BY ORDERDATE DESC
TESTICLES-9=END
HEARING-1=SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
HEARING-2=AND (ODESC='Hearing Test' OR ODESC='Audiometry')
HEARING-3=AND DEPT!='EDU' AND DEPT!='REFUS'
HEARING-4=ORDER BY ORDERDATE DESC
BREASTEXAM-1=SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY'
BREASTEXAM-2=AND (ODESC='Breast Self Exam' OR ODESC='Breast Self-Exam')
BREASTEXAM-3=AND (DEPT='HM' OR DEPT='EDU')
BREASTEXAM-4=ORDER BY ORDERDATE DESC
TAUGHTBREAST-1=SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY'
TAUGHTBREAST-2=AND (ODESC='Taught Breast Self Exam' OR ODESC='Taught Breast Self-Exam')
TAUGHTBREAST-3=AND DEPT!='REFUS'
TAUGHTBREAST-4=ORDER BY ORDERDATE DESC
UA-1=SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
UA-2=AND (ODESC='Urinalysis' OR ODESC='Urinalysis w/Microscopy' OR ODESC='Urinalysis with Microscopy'
UA-3=OR ODESC='Urine Dip Stick')
UA-4=AND DEPT!='EDU' AND DEPT!='REFUS' ORDER BY ORDERDATE DESC
OCCULTBLOOD-1=SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
OCCULTBLOOD-2=AND (ODESC='Stool Occult Blood' OR ODESC='Hemoccult' OR ODESC='Stool Occult Blood Test')
OCCULTBLOOD-3=AND DEPT!='EDU' AND DEPT!='REFUS' ORDER BY ORDERDATE DESC
ECG-1=SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
ECG-2=AND ( ODESC='ECG (Baseline)' OR ODESC='ECG' OR ODESC='EKG' OR ODESC='EKG w/Interpretation')
ECG-3=AND DEPT!='EDU' AND DEPT!='REFUS' ORDER BY ORDERDATE DESC
CHESTXRAY-1=SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
CHESTXRAY-2=AND (ODESC='Chest X-Ray' OR ODESC='X-Ray Chest (1V)' OR ODESC='X-Ray Chest (2V)' OR ODESC='X-Ray Chest 2V' OR ODESC='Chest X-Ray (Optional)')
CHESTXRAY-3=AND DEPT!='EDU' AND DEPT!='REFUS' ORDER BY ORDERDATE DESC
SIGMOIDOSCOPY-1=SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
SIGMOIDOSCOPY-2=AND ODESC='Sigmoidoscopy'
SIGMOIDOSCOPY-3=AND DEPT!='EDU' AND DEPT!='REFUS' ORDER BY ORDERDATE DESC
SEATBELT-1=SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY'
SEATBELT-2=AND (DEPT='EDU' OR DEPT='HM') AND ODESC='Seat Belts'
SEATBELT-3=ORDER BY ORDERDATE DESC
SMOKING-1=SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY'
SMOKING-2=AND (DEPT='EDU' OR DEPT='HM') AND (ODESC='Stop Smoking' OR ODESC='Smoking Cessation') ORDER BY ORDERDATE DESC
The Query section is the key element of the Health Maintenance History. The above queries use complex conditionals that allow checking of dates in multiple tables.
Observe the Query for PHYSICAL above. It first performs a query on CLDICTIONARY, which checks if the physician has previously entered QA information about the patient related to an exam. If so, it will use that date (the latest one). If on the other hand that date does not exist (meaning no previous exam was found), then an ABSTRACT entry is queried from the CLORDERS table. The abstract entry will always have the description as it appears on the #ABSTRACT as the order description and it will also have a department code of “HM”.
Notice too that many of the other queries are not as complex if they are searching only in the CLORDER table. This is because the abstracted data and the transactional (Orders Data) are kept in the same place so querying is simplified. Wild cards are used extensively in the query in order for it to accurately search for all occurrences of an event that may have been described differently.
In order for Health Maintenance History to work properly, you must stick to the standard names of all orders in the Decision Tree used in Primary Care. Otherwise, much rework of the Health Maintenance History will need to be done. This requires a lot of testing to ensure accuracy.
The Health Maintenance History entry screen is used to record abstracted dates as well as to display the record. When placing the Health Maintenance History into a document, a matching boilerplate must also be supplied. Below is the boilerplate HPMAINT.TXT which serves this purpose:
Health Maintenance History
Flu Vaccine:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
AND (ODESC='Flu Vaccination' OR ODESC='Influenza Virus Vaccine')
AND DEPT!='REFUS' AND DEPT!='EDU'
ORDER BY ORDERDATE DESC
}
Tetanus Shot:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
AND (ODESC='Tetanus Vaccine' OR ODESC='Tetanus Shot' OR ODESC='Tetanus Toxoid')
AND DEPT!='REFUS' AND DEPT!='EDU'
ORDER BY ORDERDATE DESC
}
Pneumovax:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY'
AND STATUS='Y' AND DEPT!='REFUS' AND DEPT!='EDU'
AND (ODESC='Pneumovax' ) ORDER BY ORDERDATE DESC
}
TB Test:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
AND ( ODESC='TB Test' OR ODESC='TB Tine Test' OR ODESC='TB PPD #1'
OR ODESC='TB Tine Test' OR ODESC='TB/PPD' )
AND DEPT!='REFUS' AND DEPT!='EDU'
ORDER BY ORDERDATE DESC
}
Cholesterol:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{ SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
AND (ODESC LIKE '%Cholesterol%' OR ODESC LIKE '%Lipid%')
AND DEPT!='REFUS' AND DEPT!='EDU'
ORDER BY ORDERDATE DESC
}
Urinalysis:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
AND (ODESC LIKE '%Urinalysis%'
OR ODESC='Urine Dip Stick')
AND DEPT!='EDU' AND DEPT!='REFUS' ORDER BY ORDERDATE DESC
}
Hemoccult:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{ SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
AND (ODESC='Stool Occult Blood' OR ODESC='Hemoccult' OR ODESC='Stool Occult Blood Test')
AND DEPT!='EDU' AND DEPT!='REFUS' ORDER BY ORDERDATE DESC
}
ECG:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
AND (ODESC LIKE '%ECG%' OR ODESC LIKE '%EKG%')
AND DEPT!='EDU' AND DEPT!='REFUS' ORDER BY ORDERDATE DESC
}
Chest X-Ray:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
AND (ODESC LIKE '%Chest%' AND ODESC LIKE '%X-Ray%')
AND DEPT!='EDU' AND DEPT!='REFUS' ORDER BY ORDERDATE DESC
}
Sigmoidoscopy:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
AND ODESC='Sigmoidoscopy'
AND DEPT!='EDU' AND DEPT!='REFUS' ORDER BY ORDERDATE DESC
}
Colonoscopy:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
AND ODESC='Colonoscopy'
AND DEPT!='EDU' AND DEPT!='REFUS' ORDER BY ORDERDATE DESC
}
Pap Smear:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
AND ODESC='Pap Smear'
AND DEPT!='REFUS' AND DEPT!='EDU'
ORDER BY ORDERDATE DESC
}
Mammogram:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
AND (ODESC LIKE '%Mammogram%')
AND DEPT!='REFUS' AND DEPT!='EDU'
ORDER BY ORDERDATE DESC
}
PSA Test:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
AND (ODESC='PSA' OR ODESC='Prostate Panel')
AND DEPT!='REFUS' AND DEPT!='EDU'
ORDER BY ORDERDATE DESC
}
Physical Exam:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{ if (SELECT MAX(XACDATE2) FROM CLCHARGE WHERE ACCOUNT='&ACCOUNT' AND COMPANY='&COMPANY' AND ( CPT LIKE '9938%' OR CPT LIKE '9939%' OR CPT='99205' OR CPT='99215') ) IS NOT NULL
BEGIN
SELECT CONVERT(varchar, MAX(XACDATE2),1) FROM CLCHARGE WHERE ACCOUNT='&ACCOUNT' AND COMPANY='&COMPANY' AND ( CPT LIKE '9938%' OR CPT LIKE '9939%' OR CPT='99205' OR CPT='99215' )
END
ELSE
BEGIN
SELECT CONVERT(varchar, ORDERDATE,1) FROM CLORDER WHERE ODESC='Physical Exam' AND SSNO='&MRNO' AND COMPANY='&COMPANY'
AND DEPT='HM' AND STATUS='Y' ORDER BY ORDERDATE DESC
END
}
Pelvic Exam:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{ if exists (select * from CLDICTIONARY WHERE (SECTION ='EXGF' OR (SECTION LIKE 'EX%' AND VARCODE='GENITALIAF' AND VARTEXT!='deferred') ) AND SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y' )
BEGIN
select REPORTED from CLDICTIONARY WHERE (SECTION ='EXGF' OR (SECTION LIKE 'EX%' AND VARCODE='GENITALIAF' AND VARTEXT!='deferred') ) AND SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y' ORDER BY REPORTED DESC
END
ELSE
BEGIN
SELECT ORDERDATE FROM CLORDER WHERE ODESC='Female Pelvic Exam' AND SSNO='&MRNO' AND COMPANY='&COMPANY'
;{S
AND DEPT='HM' AND STATUS='Y' ORDER BY ORDERDATE DESC
END
}
Testicular Exam:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{ if exists (select * from CLDICTIONARY WHERE (SECTION ='EXGM' OR (SECTION LIKE 'EX%' AND VARCODE='GENITALIAM' AND VARTEXT!='deferred') ) AND SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y' )
BEGIN
select REPORTED from CLDICTIONARY WHERE (SECTION ='EXGM' OR (SECTION LIKE 'EX%' AND VARCODE='GENITALIAM' AND VARTEXT!='deferred' ) ) AND SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y' ORDER BY REPORTED DESC
END
ELSE
BEGIN
SELECT ORDERDATE FROM CLORDER WHERE ODESC='Male Testicular Exam' AND SSNO='&MRNO' AND COMPANY='&COMPANY'
AND STATUS='Y' AND DEPT='HM' ORDER BY ORDERDATE DESC
END
}
Dilated Fundus Exam:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{ SELECT ORDERDATE FROM CLORDER WHERE (ODESC='Dilated Fundus Exam') AND SSNO='&MRNO' AND COMPANY='&COMPANY'
AND DEPT='HM' AND STATUS='Y' ORDER BY ORDERDATE DESC
}
Hearing Test:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{if exists (select * from CLDICTIONARY WHERE ((SECTION ='EXEN' AND VARCODE IN ('EARS_RINNE','EARS_WEBER','EARS_AUDIOMETRY')) OR (SECTION LIKE 'EX%' AND VARCODE='ENT' AND VARTEXT LIKE '%Rinne%') ) AND SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y' )
BEGIN
SELECT REPORTED FROM CLDICTIONARY WHERE ((SECTION ='EXEN' AND VARCODE IN ('EARS_RINNE','EARS_WEBER','EARS_AUDIOMETRY')) OR (SECTION LIKE 'EX%' AND VARCODE='ENT' AND VARTEXT LIKE '%Rinne%') ) AND SSNO='&MRNO' AND COMPANY='&COMPANY' AND STATUS='Y'
END
ELSE
BEGIN
SELECT ORDERDATE FROM CLORDER WHERE (ODESC='Hearing Test' OR ODESC='Audiometry') AND SSNO='&MRNO' AND COMPANY='&COMPANY'
AND STATUS='Y' AND (DEPT!='EDU' AND DEPT!='REFUS') ORDER BY ORDERDATE DESC
END
}
Breast Self-Exam:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY'
AND (ODESC='Breast Self Exam' OR ODESC='Breast Self-Exam')
AND (DEPT='HM' OR DEPT='EDU')
ORDER BY ORDERDATE DESC
}
Taught to do Breast Self-Exam:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY'
AND (ODESC='Taught Breast Self Exam' OR ODESC='Taught to do Breast Self-Exam')
AND DEPT!='REFUS'
ORDER BY ORDERDATE DESC
}
Seatbelt Education:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY'
AND (DEPT='EDU' OR DEPT='HM') AND ODESC='Seat Belts'
ORDER BY ORDERDATE DESC
}
Smoking Cessation:
&SQLNOCR&SQLTRIM&SQLCOMMA&SQL1RESULT&{SELECT ORDERDATE FROM CLORDER WHERE SSNO='&MRNO' AND COMPANY='&COMPANY'
AND (DEPT='EDU' OR DEPT='HM') AND (ODESC='Stop Smoking' OR ODESC='Smoking Cessation') ORDER BY ORDERDATE DESC
}