source: FOIAVistA/trunk/r/CLINICAL_REMINDERS-PXRM/PXRMPINF.m@ 1683

Last change on this file since 1683 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 2.2 KB
Line 
1PXRMPINF ; SLC/PKR - Routines relating to patient information. ;10/07/2004
2 ;;2.0;CLINICAL REMINDERS;;Feb 04, 2005
3 ;
4 ;======================================================
5DATACHG ;This entry point is called whenever patient data has changed.
6 ;It is attached to the following event points:
7 ;PXK VISIT DATA EVENT
8 ;
9 I '$D(^TMP("PXKCO",$J)) Q
10 N DATA,DFN,DGBL,NODE,PXRMDFN,VIEN,VISIT,VF,VFL,VGBL
11 S DFN=""
12 ;Look for PXK VISIT DATA EVENT data.
13 S VISIT=$O(^TMP("PXKCO",$J,""))
14 S VIEN=$O(^TMP("PXKCO",$J,VISIT,"VST",""))
15 S NODE=$O(^TMP("PXKCO",$J,VISIT,"VST",VIEN,""))
16 S DATA=$G(^TMP("PXKCO",$J,VISIT,"VST",VIEN,NODE,"AFTER"))
17 I DATA="" S DATA=$G(^TMP("PXKCO",$J,VISIT,"VST",VIEN,NODE,"BEFORE"))
18 S DFN=$P(DATA,U,5)
19 S PXRMDFN="PXRMDFN"_DFN
20 ;Build the list of V Files.
21 S VF=""
22 F S VF=$O(^TMP("PXKCO",$J,VISIT,VF)) Q:VF="" D
23 . S DGBL=$S(VF="CPT":"PXD(811.2,",VF="HF":"AUTTHF(",VF="IMM":"AUTTIMM(",VF="PED":"AUTTEDT(",VF="POV":"PXD(811.2,",VF="SK":"AUTTSK(",VF="XAM":"AUTTEXAM(",1:"")
24 . S VGBL=$S(VF="CPT":"AUPNVCPT(",VF="HF":"AUPNVHF(",VF="IMM":"AUPNVIMM(",VF="PED":"AUPNVPED(",VF="POV":"AUPNVPOV(",VF="SK":"AUPNVSK(",VF="XAM":"AUPNVXAM(",1:"")
25 . S VFL(VF)=DGBL_U_VGBL
26 ;Call the routines that need to process the data.
27 D UPDPAT^PXRMMST(DFN,VISIT,.VFL)
28 Q
29 ;
30 ;======================================================
31DEM(DFN,TODAY,DEMARR) ;Load the patient demographics into DEMARR
32 ;The patient's age is calculated using whatever date is passed as
33 ;TODAY. If there is a date of death and it is greater than TODAY
34 ;then set the date of death to null. Direct read of patient file
35 ;supported DBIA #10035. DATE OF BIRTH and SEX are required fields
36 ;in the patient file.
37 N TEMP
38 K DEMARR
39 I $L(DFN)'>0 S DEMARR("PATIENT")="" Q
40 S TEMP=$G(^DPT(DFN,0))
41 I TEMP="" S DEMARR("PATIENT")="" Q
42 S DEMARR("PATIENT")=$P(TEMP,U,1)
43 S DEMARR("SEX")=$P(TEMP,U,2)
44 S DEMARR("DOB")=$P(TEMP,U,3)
45 S DEMARR("SSN")=$P(TEMP,U,9)
46 S DEMARR("DOD")=$P($G(^DPT(DFN,.35)),U,1)
47 I DEMARR("DOD")>TODAY S DEMARR("DOD")=""
48 S DEMARR("DFN")=DFN
49 S DEMARR("AGE")=$$AGE^PXRMAGE(DEMARR("DOB"),DEMARR("DOD"),TODAY)
50 ;DBIA #1096
51 S TEMP=$O(^DGPM("ATID1",DFN,""))
52 I TEMP'="" S TEMP=9999999.999999-TEMP
53 S DEMARR("LAD")=TEMP
54 Q
55 ;
Note: See TracBrowser for help on using the repository browser.