source: FOIAVistA/trunk/r/AUTOMATED_INFO_COLLECTION_SYS-IBD/IBDFRPC3.m@ 1783

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

initial load of FOIAVistA 6/30/08 version

File size: 4.1 KB
Line 
1IBDFRPC3 ;ALB/AAS - AICS Identify patient form form id ; 12-FEB-96
2 ;;3.0;AUTOMATED INFO COLLECTION SYS;**6,3,17**;APR 24, 1997
3 ;
4 ; -- used by AICS Data Entry System (routine IBDFDE)
5 ; used by AICS Workstation software
6 ;
7IDPAT(RESULT,FORMID) ; -- Procedure
8 ; -- Broker call to identify patient, clinic, form, and appt. from
9 ; Encounter form ID
10 ; rpc := IBD EXPAND FORMID
11 ;
12 ; -- input FORMID = pointer to form tracking (357.96)
13 ; if Formid := Formid_"LOOKUP" then no errors created
14 ; Result = called by reference
15 ;
16 ; -- output The format of the returned array is as follows
17 ; result = $p1 := Patient Name^
18 ; $p2 := Patient IEN
19 ; $p3 := patient primary identifier (pid)
20 ; $p4 := form name
21 ; $p5 := form IEN (pointer to 357)
22 ; $p6 := Clinic Name
23 ; $p7 := Clinic ien
24 ; $p8 := Clinic Physical Location
25 ; $p9 := Appt. date/time (fm format)
26 ; $P10:= Appt. date/time (external format)
27 ; $P11:= Appt Status internal
28 ; $P12:= Appt Status external
29 ; $P13:= form input status internal
30 ; $p14:= form input status external
31 ; $p15:= form definition ien (357.95)
32 ; $p16:= default provider (for clinic) internal
33 ; $p17:= default provider (for clinic) external
34 ; $P18:= # Scannable pages on form
35 ; $p19:= shortedge/long edge binding
36 ; $p20:= check out date time
37 ;
38 N C,I,J,X,Y,NODE,PATNM,DFN,PID,CLIN,CLINNM,FORMNM,FORM,APPT,APPTNM,STATUS,STATNM,FRMDEF,PROVDEF,APPTSTI,APPTSTE,CLINPH,DUPLX,SCANPG,CO,LOOKUP
39 K RESULT
40 S FORMID("SOURCE")=1
41 S LOOKUP=0
42 ;
43 ; -- formid is for lookup only
44 I $E(FORMID,($L(FORMID)-5),$L(FORMID))="LOOKUP" S FORMID=+FORMID,LOOKUP=1
45 ;
46 ; -- scanner may send in leading spaces, strip it off
47 I +FORMID'=FORMID,$L(FORMID) S FORMID=+$P(FORMID," ",3)
48 S RESULT="Form ID not a valid value, null or zero^^^"
49 I '$G(FORMID) D:'$G(LOOKUP) LOGERR^IBDF18E2(3579604,.FORMID) G IDPATQ
50 ;
51 S RESULT="Form ID not found^^^"
52 S NODE=$G(^IBD(357.96,+FORMID,0))
53 I NODE="" D:'$G(LOOKUP) LOGERR^IBDF18E2(3579605,.FORMID) G IDPATQ
54 ;
55 S DFN=+$P(NODE,"^",2)
56 I 'DFN S RESULT="Patient Information is Missing^^^^" G IDPATQ
57 S PATNM=$P($G(^DPT(DFN,0)),"^"),PID=$P($G(^DPT(DFN,.36)),"^",3)
58 S APPT=+$P(NODE,"^",3)
59 S APPTSTI=$P($G(^DPT(DFN,"S",APPT,0)),"^",2)
60 S APPTNM=$$FMTE^XLFDT(APPT)
61 ;
62 S X=$$STATUS^SDAM1(DFN,APPT,+$G(^DPT(DFN,"S",APPT,0)),$G(^(0)))
63 S APPTSTE=$P(X,";",3),CO=$P(X,";",5)
64 I $G(^DPT(DFN,"S",APPT,0))="",CO="" D
65 .S CO=+$$SDV(DFN,APPT)
66 .I CO S APPTSTE="COMPLETE"
67 .I +$G(CO)<1 S APPTSTE="ACTION REQUIRED"
68 ;
69 S CLIN=+$P(NODE,"^",10)
70 S CLINNM=$P($G(^SC(CLIN,0)),"^"),CLINPH=$P($G(^SC(CLIN,0)),"^",11)
71 S PROVDEF=$$PRDEF(CLIN)
72 S FRMDEF=$P(NODE,"^",4)
73 S FORM=+$P($G(^IBD(357.95,+FRMDEF,0)),"^",21)
74 S FORMNM=$P($G(^IBE(357,FORM,0)),"^")
75 S DUPLX=$P($G(^IBE(357,FORM,0)),"^",2) ; Duplex/simplex
76 S (SCANPG,I)=0 F S I=$O(^IBD(357.96,+FORMID,9,I)) Q:'I S SCANPG=SCANPG+1
77 S STATUS=$P(NODE,"^",11)
78 S Y=STATUS,C=$P(^DD(357.96,.11,0),"^",2) D Y^DIQ S STATNM=Y
79 S RESULT=PATNM_"^"_DFN_"^"_PID_"^"_FORMNM_"^"_FORM_"^"_CLINNM_"^"_CLIN_"^"_CLINPH_"^"_APPT_"^"_APPTNM_"^"_APPTSTI_"^"_APPTSTE_"^"_STATUS_"^"_STATNM_"^"_FRMDEF_"^"_PROVDEF_"^"_$P($G(^VA(200,+PROVDEF,0)),"^")_"^"_SCANPG_"^"_DUPLX_"^"_CO
80 ;
81IDPATQ Q
82 ;
83PRDEF(CLIN) ;Provider Default for Clinic
84 ; Input -- SDCL Hospital Location file IEN
85 ; IF DEFINED: DFN - ptr to PATIENT File
86 ; Output -- Default
87 N Y,X
88 S Y=$P($G(^SC(+$G(CLIN),"PR",+$O(^SC("ADPR",CLIN,0)),0)),"^")
89 I $G(Y)="",$G(^SC(+$G(CLIN),"PC")),$D(DFN),$L($T(NMPCPR^SCAPMCU2)) S Y=+$$NMPCPR^SCAPMCU2(DFN,DT,1)
90 Q $G(Y)
91 ;
92SDV(DFN,APPT) ; -- try to find checkout date of stand alone encounter
93 N CO,IBOE,IBVAL,IBCBK
94 S CO="",IBOE=""
95 S IBVAL("DFN")=DFN,IBVAL("BDT")=APPT,IBVAL("EDT")=APPT+.000001
96 S IBCBK="I '$P(Y0,U,6),$P(Y0,U,8)=3 S IBOE=Y,CO=$P(Y0,U,7),SDSTOP=1"
97 D SCAN^IBSDU("PATIENT/DATE",.IBVAL,"",IBCBK,1)
98 Q CO_"^"_IBOE
99 ;
Note: See TracBrowser for help on using the repository browser.