On 20/06/2007, at 10:06 AM, Greg Twyford wrote:

David Guest wrote:
I think this identifies the patients we are after:-
SELECT DISTINCT CM_PATIENT.SURNAME, CM_PATIENT.FIRST_NAME, CM_PATIENT.DOB, MD_HISTORY.CONDITION, MD_HISTORY.HISTORY_CODE
FROM         CM_PATIENT INNER JOIN
MD_HISTORY ON CM_PATIENT.PATIENT_ID = MD_HISTORY.PATIENT_ID
WHERE     (MD_HISTORY.HISTORY_CODE LIKE '%diabm%' OR
                     MD_HISTORY.HISTORY_CODE LIKE 'diabf%' OR
MD_HISTORY.HISTORY_CODE LIKE 'nld%') AND (NOT (MD_HISTORY.HISTORY_CODE IN ('[EMAIL PROTECTED]', '[EMAIL PROTECTED]'))) AND (CM_PATIENT.DECEASED_DATE IS NULL) AND (CM_PATIENT.STATUS_CODE = 'A')
ORDER BY CM_PATIENT.SURNAME, CM_PATIENT.FIRST_NAME
since they don't want pre-diabetic or gestational diabetes patients. Next task is to convert a list of vertical results (HbA1c, smokes, BP, weight, feet, Urinary MA, claimed SIP and Care Plan in < 2 months, etc.) into a table by patient row.

Great SQL. I assume you're running it on MD3?

I was shocked to find that some of our secondary pathology providers are not sending us HL7 and so following up on Greg's point from this morning, if anyone is thinking of getting into Care Plans, etc. they should ensure that their pathology is coming in as HL7. Start now so you have a year's worth of data by the time you get going.

Praise the lord!

Indeed, for David Guest. In his GP hands he cradles a small SQL slingshot that has the potential to be a howitzer in GP computing.

Cheers
Kuang
2 Corinthians 3:5
_______________________________________________
Gpcg_talk mailing list
[email protected]
http://ozdocit.org/cgi-bin/mailman/listinfo/gpcg_talk

Reply via email to