[1064] | 1 | BSDX25 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 1/6/11 1:57pm
|
---|
[1085] | 2 | ;;1.5;BSDX;;Jan 25, 2011
|
---|
| 3 | ;
|
---|
| 4 | ; Change Log:
|
---|
| 5 | ; 3110106: SMH -> Changed Check-in EP - Removed unused paramters. Will change C#
|
---|
[614] | 6 | ;
|
---|
| 7 | ;
|
---|
| 8 | CHECKIND(BSDXY,BSDXAPTID,BSDXCDT,BSDXCC,BSDXPRV,BSDXROU,BSDXVCL,BSDXVFM,BSDXOG) ;EP
|
---|
| 9 | ;Entry point for debugging
|
---|
| 10 | ;
|
---|
| 11 | ;I +$G(^BSDXDBUG("BREAK","CHECKIN")),+$G(^BSDXDBUG("BREAK"))=DUZ D DEBUG^%Serenji("CHECKIN^BSDX25(.BSDXY,BSDXAPTID,BSDXCDT,BSDXCC,BSDXPRV,BSDXROU,BSDXVCL,BSDXVFM,BSDXOG)",$P(^BSDXDBUG("BREAK"),U,2))
|
---|
| 12 | ;E G ENDBG
|
---|
| 13 | Q
|
---|
| 14 | ;
|
---|
[1085] | 15 | CHECKIN(BSDXY,BSDXAPTID,BSDXCDT) ; ,BSDXCC,BSDXPRV,BSDXROU,BSDXVCL,BSDXVFM,BSDXOG) ;EP Check in appointment
|
---|
[1064] | 16 | ; Private to GUI; use BSDXAPI for general API to checkin patients
|
---|
[1085] | 17 | ; Parameters:
|
---|
| 18 | ; BSDXY: Global Out
|
---|
| 19 | ; BSDXAPTID: Appointment ID in ^BSDXAPPT
|
---|
| 20 | ; BSDXCDT: Checkin Date --> Changed
|
---|
| 21 | ; BSDXCC: Clinic Stop IEN (not used)
|
---|
| 22 | ; BSDXPRV: Provider IEN (not used)
|
---|
| 23 | ; BSDXROU: Print Routing Slip? (not used)
|
---|
| 24 | ; BSDXVCL: PCC+ Clinic IEN (not used)
|
---|
| 25 | ; BSDXVFM: PCC+ Form IEN (not used)
|
---|
| 26 | ; BSDXOG: PCC+ Outguide (true or false)
|
---|
| 27 | ;
|
---|
| 28 | ; Output:
|
---|
| 29 | ; ADO.net table with 1 column ErrorID, 1 row result
|
---|
| 30 | ; - 0 if all okay
|
---|
| 31 | ; - Another number or text if not
|
---|
[614] | 32 | ENDBG ;
|
---|
| 33 | N BSDXNOD,BSDXPATID,BSDXSTART,DIK,DA,BSDXID,BSDXI,BSDXZ,BSDXIENS,BSDXVEN
|
---|
| 34 | N BSDXNOEV
|
---|
| 35 | S BSDXNOEV=1 ;Don't execute protocol
|
---|
| 36 | ;
|
---|
| 37 | D ^XBKVAR S X="ERROR^BSDX25",@^%ZOSF("TRAP")
|
---|
| 38 | S BSDXI=0
|
---|
| 39 | K ^BSDXTMP($J)
|
---|
| 40 | S BSDXY="^BSDXTMP("_$J_")"
|
---|
| 41 | S ^BSDXTMP($J,0)="T00020ERRORID"_$C(30)
|
---|
| 42 | I '+BSDXAPTID D ERR("BSDX25: Invalid Appointment ID") Q
|
---|
| 43 | I '$D(^BSDXAPPT(BSDXAPTID,0)) D ERR("BSDX08: Invalid Appointment ID") Q
|
---|
[1064] | 44 | ; Remove Date formatting v.1.5. Client will send date as FM Date.
|
---|
| 45 | ;S:BSDXCDT["@0000" BSDXCDT=$P(BSDXCDT,"@")
|
---|
| 46 | ;S %DT="T",X=BSDXCDT D ^%DT S BSDXCDT=Y
|
---|
[1085] | 47 | S BSDXCDT=+BSDXCDT ; Strip off zeros if C# sends them
|
---|
[614] | 48 | I BSDXCDT=-1 D ERR(70) Q
|
---|
| 49 | I BSDXCDT>$$NOW^XLFDT S BSDXCDT=$$NOW^XLFDT
|
---|
| 50 | ;Checkin BSDX APPOINTMENT entry
|
---|
| 51 | D BSDXCHK(BSDXAPTID,BSDXCDT)
|
---|
| 52 | S BSDXNOD=^BSDXAPPT(BSDXAPTID,0)
|
---|
| 53 | S BSDXPATID=$P(BSDXNOD,U,5)
|
---|
| 54 | S BSDXSTART=$P(BSDXNOD,U)
|
---|
| 55 | ;
|
---|
| 56 | S BSDXSC1=$P(BSDXNOD,U,7) ;RESOURCEID
|
---|
| 57 | I BSDXSC1]"",$D(^BSDXRES(BSDXSC1,0)) D I +$G(BSDXZ) D ERR($P(BSDXZ,U,2)) Q
|
---|
| 58 | . S BSDXNOD=^BSDXRES(BSDXSC1,0)
|
---|
| 59 | . S BSDXSC1=$P(BSDXNOD,U,4) ;HOSPITAL LOCATION
|
---|
| 60 | . I BSDXSC1]"",$D(^SC(BSDXSC1,0)) D APCHK(.BSDXZ,BSDXSC1,BSDXPATID,BSDXCDT,BSDXSTART)
|
---|
| 61 | ;
|
---|
| 62 | S BSDXI=BSDXI+1
|
---|
| 63 | ;S ^BSDXTMP($J,BSDXI)="-1"_$C(30)
|
---|
| 64 | S ^BSDXTMP($J,BSDXI)="0"_$C(30)
|
---|
| 65 | S BSDXI=BSDXI+1
|
---|
| 66 | S ^BSDXTMP($J,BSDXI)=$C(31)
|
---|
| 67 | Q
|
---|
| 68 | ;
|
---|
| 69 | BSDXCHK(BSDXAPTID,BSDXCDT) ;
|
---|
| 70 | ;
|
---|
| 71 | S BSDXIENS=BSDXAPTID_","
|
---|
| 72 | S BSDXFDA(9002018.4,BSDXIENS,.03)=BSDXCDT
|
---|
| 73 | D FILE^DIE("","BSDXFDA","BSDXMSG")
|
---|
| 74 | Q
|
---|
| 75 | ;
|
---|
| 76 | APCHK(BSDXZ,BSDXSC1,BSDXDFN,BSDXCDT,BSDXSTART) ;
|
---|
| 77 | ;Checkin appointment for patient BSDXDFN in clinic BSDXSC1
|
---|
| 78 | ;at time BSDXSTART
|
---|
| 79 | S BSDXZ=$$CHECKIN1^BSDXAPI(BSDXDFN,BSDXSC1,BSDXSTART)
|
---|
| 80 | Q
|
---|
| 81 | ;
|
---|
| 82 | CHKEVT(BSDXPAT,BSDXSTART,BSDXSC) ;EP Called by BSDX CHECKIN APPOINTMENT event
|
---|
| 83 | ;when appointments CHECKIN via PIMS interface.
|
---|
| 84 | ;Propagates CHECKIN to BSDXAPPT and raises refresh event to running GUI clients
|
---|
| 85 | ;
|
---|
| 86 | Q:+$G(BSDXNOEV)
|
---|
| 87 | Q:'+$G(BSDXSC)
|
---|
| 88 | N BSDXSTAT,BSDXFOUND,BSDXRES
|
---|
| 89 | S BSDXSTAT=""
|
---|
| 90 | S:$G(SDATA("AFTER","STATUS"))["CHECKED IN" BSDXSTAT=$P(SDATA("AFTER","STATUS"),"^",4)
|
---|
| 91 | S BSDXFOUND=0
|
---|
| 92 | I $D(^BSDXRES("ALOC",BSDXSC)) S BSDXRES=$O(^BSDXRES("ALOC",BSDXSC,0)) S BSDXFOUND=$$CHKEVT1(BSDXRES,BSDXSTART,BSDXPAT,BSDXSTAT)
|
---|
| 93 | I BSDXFOUND D CHKEVT3(BSDXRES) Q
|
---|
| 94 | I $D(^BXDXRES("ASSOC",BSDXSC)) S BSDXRES=$O(^BSDXRES("ASSOC",BSDXSC,0)) S BSDXFOUND=$$CHKEVT1(BSDXRES,BSDXSTART,BSDXPAT,BSDXSTAT)
|
---|
| 95 | I BSDXFOUND D CHKEVT3(BSDXRES)
|
---|
| 96 | Q
|
---|
| 97 | ;
|
---|
| 98 | CHKEVT1(BSDXRES,BSDXSTART,BSDXPAT,BSDXSTAT) ;
|
---|
| 99 | ;Get appointment id in BSDXAPT
|
---|
| 100 | ;If found, call BSDXNOS(BSDXAPPT) and return 1
|
---|
| 101 | ;else return 0
|
---|
| 102 | N BSDXFOUND,BSDXAPPT
|
---|
| 103 | S BSDXFOUND=0
|
---|
| 104 | Q:'+$G(BSDXRES) BSDXFOUND
|
---|
| 105 | Q:'$D(^BSDXAPPT("ARSRC",BSDXRES,BSDXSTART)) BSDXFOUND
|
---|
| 106 | S BSDXAPPT=0 F S BSDXAPPT=$O(^BSDXAPPT("ARSRC",BSDXRES,BSDXSTART,BSDXAPPT)) Q:'+BSDXAPPT D Q:BSDXFOUND
|
---|
| 107 | . S BSDXNOD=$G(^BSDXAPPT(BSDXAPPT,0)) Q:BSDXNOD=""
|
---|
| 108 | . I $P(BSDXNOD,U,5)=BSDXPAT,$P(BSDXNOD,U,12)="" S BSDXFOUND=1 Q
|
---|
| 109 | I BSDXFOUND,+$G(BSDXAPPT) D BSDXCHK(BSDXAPPT,BSDXSTAT)
|
---|
| 110 | Q BSDXFOUND
|
---|
| 111 | ;
|
---|
| 112 | CHKEVT3(BSDXRES) ;
|
---|
| 113 | ;Call RaiseEvent to notify GUI clients
|
---|
| 114 | ;
|
---|
| 115 | N BSDXRESN
|
---|
| 116 | S BSDXRESN=$G(^BSDXRES(BSDXRES,0))
|
---|
| 117 | Q:BSDXRESN=""
|
---|
| 118 | S BSDXRESN=$P(BSDXRESN,"^")
|
---|
| 119 | ;D EVENT^BSDX23("SCHEDULE-"_BSDXRESN,"","","")
|
---|
| 120 | D EVENT^BMXMEVN("BSDX SCHEDULE",BSDXRESN)
|
---|
| 121 | Q
|
---|
| 122 | ;
|
---|
| 123 | ERROR ;
|
---|
| 124 | D ERR("RPMS Error")
|
---|
| 125 | Q
|
---|
| 126 | ;
|
---|
| 127 | ERR(ERRNO) ;Error processing
|
---|
| 128 | I +ERRNO S BSDXERR=ERRNO+134234112 ;vbObjectError
|
---|
| 129 | E S BSDXERR=ERRNO
|
---|
| 130 | S BSDXI=BSDXI+1
|
---|
| 131 | S ^BSDXTMP($J,BSDXI)=BSDXERR_$C(30)
|
---|
| 132 | S BSDXI=BSDXI+1
|
---|
| 133 | S ^BSDXTMP($J,BSDXI)=$C(31)
|
---|
| 134 | Q
|
---|