Longitudinal Followup it
From CaisisWiki
A.fraietta (Talk | contribs) (→B. Pazienti che richiedono una serie di 2 step per determinare se richiedono una lettera di follow-up:) |
A.fraietta (Talk | contribs) |
||
Line 2: | Line 2: | ||
[[Category:Policies and Procedures]] | [[Category:Policies and Procedures]] | ||
- | Traduzione | + | Traduzione a cura di Andrea Fraietta |
== Introduzione == | == Introduzione == | ||
Line 62: | Line 62: | ||
=== NeedLetter1, 2, or 3 === | === NeedLetter1, 2, or 3 === | ||
- | NeedLetter1- | + | NeedLetter1- I pazienti che appartengono a questa categoria sono quelli che hanno uno stato vitale controllato sul registro dei tumori e sull'SSDI negli ultimi 60 giorni e la cui ultima informazione cronologia risale a più di 14 mesi fa (ovvero non ci sono registrazioni in Caisis negli ultimi 14 mesi). Dopo che l'azione VitalStatusChecked è stata inserita nella scheda "ACtions", Caisis aggiorna automaticamente lo stato del contatto a NeedLetter1. Vengono fatti 3 tentativi di contatto del paziente. Se il paziente non risponde entro 90 giorni (indicato dal fatto che non sono state inserite azioni), e nè il registro dei tumori nè l'SSDI sono stati ancora controllati, lo stato del contatto viene automaticamente impostato a NeedVitalStatus (vedi le stesse istruzioni di cui sopra). Una volta che lo stato vitale è stato controllato, lo stato del contatto dovrebbe essere aggiornato a NeedLetter2. Gli stessi eventi avverranno se il paziente non ancora risposto dopo 90 giorni (NeedVitalStatus, quindi NeedLetter3). Si invita a non inviare lettere ai pazienti durante periodi di festività. |
==== Preparazione del materiale da inviare: ==== | ==== Preparazione del materiale da inviare: ==== | ||
- | * | + | * Stampa delle copertine delle lettere, del questionario di follow-up, delle autorizzazioni e delle etichette per ogni paziente usando Microsoft Access. Vedi wizard |
- | * | + | * La lettera di copertina dovrebbe essere con l'intestazione del medico corrente e con le corrette informazioni di contatto. |
- | * | + | * Allegare una busta per la risposta alla lettera del questionario. |
- | * | + | * Tutto il materiale dovrebbero essere raccolto in una busta con logo istituzionale. |
Revision as of 06:33, 15 September 2008
Traduzione a cura di Andrea Fraietta
Contents
|
Introduzione
Lo scopo di questo progetto è di mantenere costantemente aggiornato il nostro database con le informazioni mediche correnti e lo stato vitale di tutti i pazienti. Si tratta di un processo che sarà mantenuto aggiornato con frequenza giornaliera in modo da avare lo stato del follow-up aggiornato nel nostro sistema.
Il seguente schema riassume l'intero processo.
II. Selezionare i pazienti che necessitano di follow-up
Caisis è un database basato su web del Dipartimento di Chirurgia del Memorial Sloan Kettering Cancer Center, di New York, che memorizza le informazioni dei pazienti che vengono visitati. Ogni paziente ha uno stato del contatto che può essere visualizzato in Caisis come mostrato qui sotto. Scegliendo uno stato di contatto dalla lista verranno elencati i pazienti che appartengono a quella categoria. Lo stato di contatto del singolo paziente può essere visualizzato anche dalla scheda "Patient Info" cliccando sulla scheda "Patient Data" dopo aver selezionato il paziente.
**NOTA: QUESTI NON SONO DATI REALI
A. Pazienti che non necessitano di alcun follow-up:
• DoNotContactPerPt - Il paziente o la famiglia han richiesto di non essere contattati.
• DoNotContactPerMD - Il medico ha richiesto di non contattare il paziente (ad es: per i VIP).
• Current - Le informazioni mediche del paziente sono disponibili nel database negli ultimi 14 mesi. I pazienti deceduti rientrano comunque in questa categoria, a meno che i familiari non abbiano richiesto espressamente di non essere contattati. Ogni notte, Caisis considera i pazienti che non hanno avuto aggiornamenti negli ultimi 14 mesi, e li sposta nella categoria NeedVitalStatus, filtrando i pazienti che sono deceduti o che non hanno come reparto primario il tuo.
• LTF -Lost to Followup. Paziente che non ha risposto dopo 3 tentativi di invio di un questionario, oppure di cui non siamo in grado di aggiornare lo stato del contatto.
B. Pazienti che richiedono una serie di 2 step per determinare se richiedono una lettera di follow-up:
• NeedVitalStatus
Step 1: Pazienti che non hanno subìto aggiornamenti negli ultimi 14 mesi, che non sono deceduti, che non sono in DoNotContactPerMD o DoNotContactPerPt, con chirurgia principale presso la tua struttura, che non sono LTF, e che non hanno lo stato vitale controllato sul registro dei tumori negli ultimi 60 giorni. Il registro dei tumori istituzionale deve essere controllato per vedere se ci sono degli aggiornamenti negli ultimi 14 mesi che non siano stati recepiti in Casis.
Step 2: Controllo dell'SSDI (Social Security Death Index) per i pazienti per cui si è controllato il registro dei tumori, ma non l'SSD negli ultimi 60 giorni. L'SSDI potrebbe fornire informazioni sulla morte per i pazienti deceduti.
1. Cotrollo sul Registro dei Tumori
In molti centri di cancro, il registro dei tumori è responsabile dell'aggiornamento dello stato vitale del paziente. Questa informazione è memorizzata presso il tuo EMR (electronic medical record). Controllare il registro dei tumori implica consultare gli aggiornamenti dello stato vitale presso l'EMR e ogni altra informazione sul paziente che non sia stata recepita in Caisis. Ricerca dello stato vitale dei pazienti e di ogni recente informazione medica.
a. Inserimento di informazioni mediche in Caisis
i. Stato vitale - Se il paziente è morto, inserire la data di morte e la causa del decesso nella scheda "Patient Info", e aggiornare lo stato di contatto del paziente a “Current”. Se ci sono nuove informazioni che indicano che il paziente è ancora in vita, inserire questi dati e impostare lo stato a “ALIVE.”
ii. Informazioni mediche - Se si riscontra che alcune informaizoni mediche non sono state recepite in Caisis, inserirle nella appropriate schede del database, e rivalutare se è il caso di aggiornare o no lo stato vitale a “Current.”
2. Controllo presso l'SSDI
a. Per accedere all'SSDI, cliccare sui link del SSDI. Se non hai pratica con SSDI, puoi cliccare sui suggerimenti SSDI. Una ricerca generica richiede come chiavi di accesso il cognome, il numer o del social security e la data di nascita. Se il paziente è deceduto, inserisci in Caisis la data del decesso e la causa nella scheda "Patient Info".
b. Inserisci nella scheda "Actions", “VitalStatusChecked” dopo aver completato gli step 1 e 2.
c. Notifica il registro dei tumori se il paziente è deceduto
NeedLetter1, 2, or 3
NeedLetter1- I pazienti che appartengono a questa categoria sono quelli che hanno uno stato vitale controllato sul registro dei tumori e sull'SSDI negli ultimi 60 giorni e la cui ultima informazione cronologia risale a più di 14 mesi fa (ovvero non ci sono registrazioni in Caisis negli ultimi 14 mesi). Dopo che l'azione VitalStatusChecked è stata inserita nella scheda "ACtions", Caisis aggiorna automaticamente lo stato del contatto a NeedLetter1. Vengono fatti 3 tentativi di contatto del paziente. Se il paziente non risponde entro 90 giorni (indicato dal fatto che non sono state inserite azioni), e nè il registro dei tumori nè l'SSDI sono stati ancora controllati, lo stato del contatto viene automaticamente impostato a NeedVitalStatus (vedi le stesse istruzioni di cui sopra). Una volta che lo stato vitale è stato controllato, lo stato del contatto dovrebbe essere aggiornato a NeedLetter2. Gli stessi eventi avverranno se il paziente non ancora risposto dopo 90 giorni (NeedVitalStatus, quindi NeedLetter3). Si invita a non inviare lettere ai pazienti durante periodi di festività.
Preparazione del materiale da inviare:
- Stampa delle copertine delle lettere, del questionario di follow-up, delle autorizzazioni e delle etichette per ogni paziente usando Microsoft Access. Vedi wizard
- La lettera di copertina dovrebbe essere con l'intestazione del medico corrente e con le corrette informazioni di contatto.
- Allegare una busta per la risposta alla lettera del questionario.
- Tutto il materiale dovrebbero essere raccolto in una busta con logo istituzionale.
1. Correspondence to patients residing outside of US should be by UPS to expedite correspondence
2. Inform Physician Office Assistants which patients have been sent letters and questionnaires. Inform them who they should refer any calls to about this. In addition, give them a copy of the questionnaire and letter.
3. Any new questionnaires and cover letters must be approved by the responsible physician before being sent out.
IV. Receiving letters and questionnaires
Open LetterReceived wizard. Page 1-Lists number of letters received, returned to sender, and pending. Page 2-Instructions for processing the letters as they are received Page 3-Instructions for entering data from the questionnaire Page 4-Instructions/criteria for changing the patient’s contact status NeedMD_Contact
1) Call the physician’s office and explain that you will be sending an authorization to get medical records for a patient. Ask if they prefer to fax the authorization or send it in the mail. If they prefer sending it by mail, send cover letter to physician along with patient’s signed consent. Alternatively, if a fellow or medical student calls the doctors office, they can get the information over the phone. Copies of the medical records are still needed. 2) Once this is done, enter the action MD_Contacted in the actions tab. 3) Once the medical records are received, enter the data, or change the patient’s contact status to NeedDataEntry, if the data can’t be entered right away.
NeedMD_ToCallPt
If the patient hasn’t responded after sending three letters, change the patient’s contact status to NeedMD_ToCallPt-patients who have been in the category Letter3_Sent and have had no action entered for 6 weeks. MDs (mainly research fellows) will then call the patient to collect a history, physician contact info, and get authorization.
The following is a list of pertinent questions to ask a patient if a fellow or medical student calls the patient. These can also be used when they call a patient’s doctor for records:
- Other treatments since RP?
- Have you had any problems with urination since the surgery (difficulty passing urine; urinary retention) Have you had any treatments for urethral strictures?
- Have you had any other procedures for prostate cancer-related problems/urinary dysfunction?
- Do you wear protective pads for urine loss/incontinence? How many pads do you wear during the day? How many pads do you wear at night? Have you had any treatment for incontinence (AUS)?
- Do you have any spontaneous erections sufficient for intercourse? Are you capable of intercourse without erectile aids? If you use aids, which aids are you using? If you take Viagra, which dose are you using? Do you use injection therapy or urethral suppositories? Have you had any surgical treatment for impotence (prosthesis)?
- Follow up lab reports since last records at your site? (total PSA, testosterone, free PSA)
- Are you being followed by a physician; may we have your physician’s address and mail you a permission form to request your records from your physician?
- Would you like to be mailed a QOL questionnaire that will ask questions about your general state of health and urologic function since your surgery?
- After calling the patient, enter the action Patient_WasCalled in the actions tab.
- Enter updated information in the database.
- Change the patient’s contact status to
- Current if you do not need to contact their physician, and have up to date information.
- NeedPtAuthorization if you need to send them a Release of Information form to sign.
- NeedMD_Contact if you need to contact their physician.
NeedPtContactInfo
If a letter gets returned undeliverable, and there is no forwarding address, enter an action, ReturnedToSender. Then change the patient’s contact status to NeedPtContactInfo. The following steps can be taken to obtain their contact info. Enter an action after each step is taken.
- Call the numbers listed in the database or DMS (patient’s numbers, emergency contact numbers).
- Call information (411) to check to see if there are any listings in their area code.
- Try their physicians listed to see if they have updated contact information.
- Search the internet.
- Try your site's Tumor registry to see if they can help. They can give you the last vital status they have for a patient or the last contact information for the patient.
- If you obtain updated contact information through any of these steps, update Caisis, enter the action AddressUpdated, and then change the patient’s contact status back to NeedLetter1, 2, or 3, depending on where they are in the process.
- If no contact information is obtained after all these steps, update the patient’s contact in the database to LTF “Lost to follow-up”.
Ordering Supplies
- Order institutional letterhead and envelopes.
- Business Reply envelopes are ordered as follows:
Stato del contatto - informazione demografica in Caisis
PtContactStatus | azione/dato determinante |
---|---|
Current | CaseReviewed |
DoNotContactPerMD | |
DoNotContactPerPt | DataReceived |
Letter1_Sent | |
Letter2_Sent | Letter2_Sent |
Letter3_Sent | Letter3_Sent |
LostToFollowup | PtWebSearched |
MD_Contacted | MD_Contacted |
NeedDataEntry | DataEntered |
NeedLetter1 | Letter1_Sent |
NeedLetter2 | SentToCDB |
NeedLetter3 | SentToEMR |
NeedMD_Contact | VitalStatusChecked |
NeedMD_ToCall | PtWasCalled |
NeedPtAuthorization | |
NeedPtContactInfo | PtContactInfoUpdated |
NeedVitalStatus | LetterReturnedToSender |
Trigger sulla tabella "Actions"
Ogni volta che un utente modifica o inserisce un record nella tabella "Actions" (Risposta immediata- Dovrebbe rimanere simplice o quanto più semplice)
UPDATE Patients
SET PtContactStatus = CASE WHEN i.ActionItem = 'VitalStatusChecked' AND PtContactStatus = 'NeedVitalStatus' THEN 'Current'
WHEN i.ActionItem = 'Letter1_Sent' AND PtContactStatus = 'NeedLetter1' THEN 'Letter1_Sent'
WHEN i.ActionItem = 'Letter2_Sent' AND PtContactStatus = 'NeedLetter2' THEN 'Letter2_Sent'
WHEN i.ActionItem = 'Letter3_Sent' AND PtContactStatus = 'NeedLetter3' THEN 'Letter3_Sent'
WHEN i.ActionItem = 'LetterReturnedToSender' AND PtContactStatus LIKE 'Letter[1-3]%Sent' THEN 'NeedPtContactInfo' WHEN i.ActionItem = 'MD_Contacted' AND PtContactStatus = 'NeedMD_Contact' THEN 'MD_Contacted' WHEN i.ActionItem = 'PtWasCalled' AND PtContactStatus = 'NeedMD_ToCallPt' THEN 'Current' WHEN i.ActionItem = 'DataReceived' AND PtContactStatus IN ('Letter1_Sent','Letter2_Sent','Letter3_Sent','MD_Contacted') THEN 'NeedDataEntry' WHEN i.ActionItem = 'DataReceived' AND PtContactStatus = 'NeedPtAuthorization' THEN 'NeedMD_Contact' WHEN i.ActionItem = 'DataEntered' AND PtContactStatus = 'NeedDataEntry' THEN 'Current'
WHEN i.ActionItem = 'PtContactInfoUpdated' AND PtContactStatus = 'NeedPtContactInfo' THEN 'Current' END
FROM Patients INNER JOIN Inserted i ON Patients.PatientId = i.PatientId WHERE PtContactStatus <> CASE
WHEN i.ActionItem = 'VitalStatusChecked' AND PtContactStatus = 'NeedVitalStatus' THEN 'Current'
WHEN i.ActionItem = 'Letter1_Sent' AND PtContactStatus = 'NeedLetter1' THEN 'Letter1_Sent'
WHEN i.ActionItem = 'Letter2_Sent' AND PtContactStatus = 'NeedLetter2' THEN 'Letter2_Sent'
WHEN i.ActionItem = 'Letter3_Sent' AND PtContactStatus = 'NeedLetter3' THEN 'Letter3_Sent'
WHEN i.ActionItem = 'LetterReturnedToSender' AND PtContactStatus LIKE 'Letter[1-3]%Sent' THEN 'NeedPtContactInfo'
WHEN i.ActionItem = 'MD_Contacted' AND PtContactStatus = 'NeedMD_Contact' THEN 'MD_Contacted' WHEN i.ActionItem = 'PtWasCalled' AND PtContactStatus = 'NeedMD_ToCallPt' THEN 'Current' WHEN i.ActionItem = 'DataReceived' AND PtContactStatus IN ('Letter1_Sent','Letter2_Sent','Letter3_Sent','MD_Contacted') THEN 'NeedDataEntry' WHEN i.ActionItem = 'DataReceived' AND PtContactStatus = 'NeedPtAuthorization' THEN 'NeedMD_Contact' WHEN i.ActionItem = 'DataEntered' AND PtContactStatus = 'NeedDataEntry' THEN 'Current'
WHEN i.ActionItem = 'PtContactInfoUpdated' AND PtContactStatus = 'NeedPtContactInfo' THEN 'Current' END
Job notturno (Risposta ritardata, può essere completta)
CREATE PROCEDURE dbo.spFollowupUpdatePtContactStatus
AS
BEGIN TRANSACTION
--Change to current if null
UPDATE Patients
SET PtContactStatus = 'Current'
WHERE PtContactStatus = '0' OR PtContactStatus IS NULL
/*
If they are Current and (no data in the last 14 months or dead)
and (vital status has not been checked in the last 60 days) then
change to NeedVitalStatus
- /
UPDATE Patients SET PtContactStatus = 'NeedVitalStatus' FROM Patients LEFT OUTER JOIN FJ_CurrentDataView ON Patients.PatientId = FJ_CurrentDataView.PatientId LEFT OUTER JOIN FJ_VitalStatusCheckedView ON Patients.PatientId = FJ_VitalStatusCheckedView.PatientId WHERE PtContactStatus = 'Current' AND FJ_CurrentDataView.PatientId IS NULL AND FJ_VitalStatusCheckedView.PatientId IS NULL /* If they are Current and (no data in the last 14 months or dead) and (vital status has been checked in the last 60 days) then change to next letter/contact, If the last LetterX_Sent was more than 90 days ago then move to NeedLetter1 so can restart the process */ UPDATE Patients SET PtContactStatus =CASE WHEN LastLetterSent IS NULL THEN 'NeedLetter1' WHEN LastLetterSent LIKE 'Letter1%Sent' THEN 'NeedLetter2' WHEN LastLetterSent LIKE 'Letter2%Sent' THEN 'NeedLetter3' WHEN LastLetterSent LIKE 'Letter3%Sent' THEN 'NeedPtContactInfo' END FROM Patients LEFT OUTER JOIN FJ_CurrentDataView ON Patients.PatientId = FJ_CurrentDataView.PatientId INNER JOIN FJ_VitalStatusCheckedView ON Patients.PatientId = FJ_VitalStatusCheckedView.PatientId LEFT OUTER JOIN FJ_LastLetterSentView ON Patients.PatientId = FJ_LastLetterSentView.PatientId WHERE PtContactStatus = 'Current' AND FJ_CurrentDataView.PatientId IS NULL /* If they are LetterX_Sent or NeedLetterX or NeedVitalStatus and (no LetterX_Sent in the last 90 days) and (have data in the last 14 months or dead) change to Current */ UPDATE Patients SET PtContactStatus = 'Current' FROM Patients INNER JOIN FJ_CurrentDataView ON Patients.PatientId = FJ_CurrentDataView.PatientId LEFT OUTER JOIN FJ_RecentLetterSentView ON Patients.PatientId = FJ_RecentLetterSentView.PatientId WHERE (PtContactStatus LIKE 'Letter[1-3]%Sent' OR PtContactStatus LIKE 'NeedLetter[1-3]' OR PtContactStatus = 'NeedVitalStatus') AND FJ_RecentLetterSentView.PatientId IS NULL /* If they are LetterX_Sent only and (no LetterX_Sent in the last 90 days) and (no data in the last 14 months or dead) and (vital status has not been checked in the last 60 days) change to NeedVitalStatus
- /
UPDATE Patients SET PtContactStatus = 'NeedVitalStatus' FROM Patients LEFT OUTER JOIN FJ_CurrentDataView ON Patients.PatientId = FJ_CurrentDataView.PatientId LEFT OUTER JOIN FJ_RecentLetterSentView ON Patients.PatientId = FJ_RecentLetterSentView.PatientId LEFT OUTER JOIN FJ_VitalStatusCheckedView ON Patients.PatientId = FJ_VitalStatusCheckedView.PatientId WHERE PtContactStatus LIKE 'Letter[1-3]%Sent' AND FJ_CurrentDataView.PatientId IS NULL AND FJ_RecentLetterSentView.PatientId IS NULL AND FJ_VitalStatusCheckedView.PatientId IS NULL /* If they are LetterX_Sent and (no LetterX_Sent in the last 90 days) and (no data in the last 14 months or dead) and (vital status has been checked in the last 60 days) then change to next letter/contact */ UPDATE Patients SET PtContactStatus =CASE WHEN PtContactStatus LIKE 'Letter1%Sent' THEN 'NeedLetter2' WHEN PtContactStatus LIKE 'Letter2%Sent' THEN 'NeedLetter3' WHEN PtContactStatus LIKE 'Letter3%Sent' THEN 'NeedPtContactInfo' END FROM Patients LEFT OUTER JOIN FJ_CurrentDataView ON Patients.PatientId = FJ_CurrentDataView.PatientId LEFT OUTER JOIN FJ_RecentLetterSentView ON Patients.PatientId = FJ_RecentLetterSentView.PatientId INNER JOIN FJ_VitalStatusCheckedView ON Patients.PatientId = FJ_VitalStatusCheckedView.PatientId WHERE PtContactStatus LIKE 'Letter[1-3]%Sent' AND FJ_CurrentDataView.PatientId IS NULL AND FJ_RecentLetterSentView.PatientId IS NULL /* If patient is dead change ContactStatus to Current but only if ContactStatus is not already Current and ContactStatus NOT LIKE '%DoNotContact%'
- /
UPDATE Patients SET PtContactStatus = 'Current' FROM Patients WHERE (PtContactStatus <> 'Current' AND PtContactStatus NOT LIKE '%DoNotContact%') AND (PtDeathDateText IS NOT NULL) COMMIT TRANSACTION GO
Queries utilizzate dal job notturno
CREATE VIEW dbo.FJ_CurrentDataView
AS
--Not all tables are represented here Includes deceased patients SELECT a.PatientId AS PatientId
FROM
(
SELECT BxDate AS SortDate, 'Biopsies' AS TableName, PatientId
FROM Biopsies WHERE BxDate > DATEADD(m,-14,GETDATE())
UNION
SELECT BxDate AS SortDate, 'BiopsiesProstate' AS TableName, PatientId
FROM BiopsiesProstate WHERE BxDate > DATEADD(m,-14,GETDATE())
UNION
SELECT ClinStageDate, 'ClinicalStages', PatientId
FROM ClinicalStages
WHERE ClinStageDate > DATEADD(m,-14,GETDATE())
UNION
SELECT DxDate, 'Diagnostics', PatientId
FROM Diagnostics
WHERE DxDate > DATEADD(m,-14,GETDATE())
UNION
SELECT LabDate, 'LabTests', PatientId
FROM LabTests WHERE LabDate > DATEADD(m,-14,GETDATE())
UNION
SELECT MedTxDate, 'MedicalTherapy', PatientId
FROM MedicalTherapy WHERE MedTxDate > DATEADD(m,-14,GETDATE())
UNION
SELECT OpDate, 'Procedures', PatientId
FROM Procedures
WHERE OpDate > DATEADD(m,-14,GETDATE())
UNION
SELECT SurgDate, 'Surgery', PatientId
FROM Surgeries
WHERE SurgDate > DATEADD(m,-14,GETDATE())
UNION
SELECT EndoDate, 'Endoscopy', PatientId
FROM ProcEndoscopies
WHERE EndoDate > DATEADD(m,-14,GETDATE())
UNION
SELECT CytoDate, 'Cytology', PatientId
FROM Cytologies
WHERE CytoDate > DATEADD(m,-14,GETDATE())
UNION
SELECT BrachyDate, 'BrachyTherapy', PatientId
FROM BrachyTherapy WHERE BrachyDate > DATEADD(m,-14,GETDATE())
UNION
SELECT RadTxDate, 'RadiationTherapy', PatientId
FROM RadiationTherapy WHERE RadTxDate > DATEADD(m,-14,GETDATE())
UNION
SELECT StatusDate, 'Status', PatientId
FROM Status
WHERE StatusDate > DATEADD(m,-14,GETDATE())
UNION
SELECT PtProtocolStatusDate, 'Protocols', PatientId
FROM PatientProtocols INNER JOIN PatientProtocolStatus ON PatientProtocolStatus.PatientProtocolId = PatientProtocols.PatientProtocolId
WHERE PtProtocolStatusDate > DATEADD(m,-14,GETDATE())
UNION
SELECT EncDate, 'Encounters', PatientId
FROM Encounters WHERE EncDate > DATEADD(m,-14,GETDATE())
UNION
SELECT SurveyDate, 'Surveys', PatientId
FROM Surveys
WHERE SurveyDate > DATEADD(m,-14,GETDATE())
--Add in deceased patients classified as having a DeathDateText
UNION
SELECT PtDeathDate, 'Patients',PatientId
FROM Patients
WHERE (PtDeathDateText IS NOT NULL)
) AS a
GROUP BY a.PatientId
CREATE VIEW dbo.FJ_VitalStatusCheckedView
AS
SELECT DISTINCT PatientId
FROM Actions
WHERE ActionItem = 'VitalStatusChecked' AND
ActionDate >= DATEADD(d, - 60, GETDATE())
CREATE VIEW dbo.FJ_LastLetterSentView
AS
SELECT Actions.PatientId AS PatientId, ActionItem AS LastLetterSent
FROM
(
SELECT MAX(ActionDate) AS LastLetterDate, PatientId
FROM Actions
WHERE (ActionItem LIKE 'Letter[1-3]%Sent') AND ActionDate >= DATEADD(d, - 90, GETDATE())
GROUP BY PatientId
) AS a INNER JOIN Actions ON a.PatientId = Actions.PatientId AND
a.LastLetterDate = Actions.ActionDate
WHERE (ActionItem LIKE 'Letter[1-3]%Sent')
CREATE VIEW dbo.FJ_RecentLetterSentView
AS
SELECT DISTINCT PatientId
FROM Actions
WHERE ActionItem LIKE 'Letter[1-3]%Sent' AND
ActionDate >= DATEADD(d, - 90, GETDATE())