Changeset 1451 for Scheduling/trunk/m/BSDXAPI.m
- Timestamp:
- Jun 19, 2012, 8:19:03 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/m/BSDXAPI.m
r1450 r1451 1 BSDXAPI ; IHS/ANMC/LJF & VW/SMH - SCHEDULING APIs ; 6/1 8/12 5:31pm2 ;;1. 6;BSDX;;Aug 31, 2011;Build 181 BSDXAPI ; IHS/ANMC/LJF & VW/SMH - SCHEDULING APIs ; 6/19/12 5:42pm 2 ;;1.7T1;BSDX;;Aug 31, 2011;Build 18 3 3 ; Licensed under LGPL 4 4 ; … … 32 32 ; More user friendly message if patient already has appointment in $$MAKE: 33 33 ; Spits out pt name and user friendly date. 34 34 ; 2012-06-18 (v 1.7) 35 35 ; Removing transacions. Means that code SHOULD NOT fail. Took all checks 36 ; out for making an appointment to MAKECK. We call this first to make sure 37 ; that the appointment is okay to make before committing to make it. 36 ; out for making an appointment to MAKECK. We call this first to make sure 37 ; that the appointment is okay to make before committing to make it. We 38 ; still have the provision to delete the data though if we fail when we 39 ; actually make the appointment 38 40 ; 39 41 MAKE1(DFN,CLIN,TYP,DATE,LEN,INFO) ; Simplified PEP w/ parameters for $$MAKE - making appointment … … 70 72 N BSDXMKCK S BSDXMKCK=$$MAKECK(.BSDR) ; Check if we can make appointment 71 73 I BSDXMKCK Q BSDXMKCK ; If we can't, quit with the reason why. 72 ; Otherwise, we continue 73 ; 74 NEW DIC,DA,Y,X,DD,DO,DLAYGO 74 ; 75 ;Otherwise, we continue 76 ; 77 N BSDXFDA,BSDXIENS,BSDXMSG ; FILE/UPDATE^DIE variables 75 78 ; 76 79 I $D(^DPT(BSDR("PAT"),"S",BSDR("ADT"),0)),$P(^(0),U,2)["C" D 77 80 . ; "un-cancel" existing appt in file 2 78 . N BSDXFDA,BSDXIENS,BSDXMSG79 81 . S BSDXIENS=BSDR("ADT")_","_BSDR("PAT")_"," 80 82 . S BSDXFDA(2.98,BSDXIENS,".01")=BSDR("CLN") … … 88 90 . S BSDXFDA(2.98,BSDXIENS,"20")=$$NOW^XLFDT 89 91 . D FILE^DIE("","BSDXFDA","BSDXMSG") 90 . N BSDXTEMP S BSDXTEMP=$G(BSDXMSG)91 E D92 . N BSDXFDA,BSDXIENS,BSDXMSG92 Q:$D(BSDXMSG) 1_U_"Fileman edit to DPT error: Patient="_BSDR("PAT")_" Appt="_BSDR("ADT")_" Error="_BSDXMSG("DIERR",1,"TEXT",1) 93 ; 94 E D ; File new appointment/edit existing appointment in file 2 93 95 . S BSDXIENS="?+2,"_BSDR("PAT")_"," 94 96 . S BSDXIENS(2)=BSDR("ADT") … … 97 99 . S BSDXFDA(2.98,BSDXIENS,"9.5")=9 98 100 . S BSDXFDA(2.98,BSDXIENS,"20")=$$NOW^XLFDT 99 . D UPDATE^DIE("","BSDXFDA","BSDXIENS","BSDXERR(1)") 100 I $G(BSDXERR(1)) Q 1_U_"FileMan add to DPT error: Patient="_BSDR("PAT")_" Appt="_BSDR("ADT") 101 ; add appt to file 44 102 K DIC,DA,X,Y,DLAYGO,DD,DO 101 . D UPDATE^DIE("","BSDXFDA","BSDXIENS","BSDXMSG") 102 Q:$D(BSDXMSG) 1_U_"FileMan add to DPT error: Patient="_BSDR("PAT")_" Appt="_BSDR("ADT")_" Error="_BSDXMSG("DIERR",1,"TEXT",1) 103 ; 104 ; add appt to file 44. This adds it to the FIRST subfile (Appointment) 105 N DIC,DA,Y,X,DD,DO,DLAYGO 103 106 I '$D(^SC(BSDR("CLN"),"S",0)) S ^SC(BSDR("CLN"),"S",0)="^44.001DA^^" 104 107 I '$D(^SC(BSDR("CLN"),"S",BSDR("ADT"),0)) D I Y<1 Q 1_U_"Error adding date to file 44: Clinic="_BSDR("CLN")_" Date="_BSDR("ADT") … … 106 109 . S DIC("P")="44.001DA",DIC(0)="L",DLAYGO=44.001 107 110 . S Y=1 I '$D(@(DIC_X_")")) D FILE^DICN 108 109 ; 111 ; 112 ; add appt for file 44, second subfile (Appointment/Patient) 110 113 ; Sep 28 2010: Changed old style API to new style API. Keep for reference //smh 111 114 ;K DIC,DA,X,Y,DLAYGO,DD,DO,DINUM … … 136 139 ; 137 140 MAKECK(BSDR) ; $$ - Is it okay to make an appointment? ; PEP 141 ; Input: Same as $$MAKE 142 ; Output: 1^error or 0 for success 143 ; NB: This subroutine saves no data. Only checks whether it's okay. 144 ; 138 145 I '$D(^DPT(+$G(BSDR("PAT")),0)) Q 1_U_"Patient not on file: "_$G(BSDR("PAT")) 139 146 I '$D(^SC(+$G(BSDR("CLN")),0)) Q 1_U_"Clinic not on file: "_$G(BSDR("CLN")) … … 142 149 I $G(BSDR("ADT"))'?7N.1".".4N Q 1_U_"Appt Date/Time error: "_$G(BSDR("ADT")) 143 150 ; 144 145 151 ; Appt Length check removed in v 1.5 152 ; 146 153 I '$D(^VA(200,+$G(BSDR("USR")),0)) Q 1_U_"User Who Made Appt Error: "_$G(BSDR("USR")) 147 154 ; More verbose error message in v1.5 … … 160 167 . . S BSDXERR=BSDXERR_$C(13,10)_"Scheduling GUI clinic: "_BSDXRESNAM ; tell the user of the BSDX clinic 161 168 Q 0 162 169 ; 163 170 UNMAKE(BSDR) ; Reverse Make - Private $$ 164 ; Only used in Emergiencies where Fileman data filing fails. 165 ; If previous data exists, which caused an error, it's destroyed. 166 N BSDXFDA,BSDXIENS 167 S BSDXIENS=BSDR("ADT")_","_BSDR("PAT")_"," 168 S BSDXFDA(2.98,BSDXIENS,".01")="@" 169 ; 170 I '$D(^SC(BSDR("CLN"),"S",BSDR("ADT"),1)) QUIT 0 ; No stuff in HL file 171 N X S X=0 F S X=$O(^SC(BSDR("CLN"),"S",BSDR("ADT"),1,X)) Q:'X Q:+^(X,0)=BSDR("PAT") 172 ; 173 I 'X QUIT 0 ; Patient doesn't have appointment 174 ; 175 S BSDXIENS=X_","_BSDR("ADT")_","_BSDR("CLN")_"," 176 S BSDXFDA(44.003,BSDXIENS,.01)="@" 177 N BSDXMSG 178 D FILE^DIE("","BSDXFDA","BSDXMSG") 179 I $D(BSDXMSG) S $EC=",U1," ; If we get an error here, we are REALLY out of control 180 QUIT 0 171 ; Only used in Emergiencies where Fileman data filing fails. 172 ; If previous data exists, which caused an error, it's destroyed. 173 ; NB: ^DIK stops for nobody 174 ; Input: Same array as $$MAKE 175 ; Output: Always 0 176 NEW DIK,DA 177 S DIK="^DPT("_BSDR("PAT")_",""S""," 178 S DA(1)=BSDR("PAT"),DA=BSDX("ADT") 179 D ^DIK 180 ; 181 N IEN S IEN=$$SCIEN(BSDR("PAT"),BSDR("CLN"),BSDR("ADT")) 182 I 'IEN QUIT 0 183 ; 184 NEW DIK,DA 185 S DIK="^SC("_BSDR("CLN")_",""S"","_BSDR("ADT")_",1," 186 S DA(2)=BSDR("CLN"),DA(1)=BSDR("ADT"),DA=IEN 187 D ^DIK 188 QUIT 0 189 ; 181 190 CHECKIN1(DFN,CLIN,APDATE) ; Simplified PEP w/ parameters for $$CHECKIN - Checking in 182 191 ; Call like this for DFN 23435 checking in now at Hospital Location 33
Note:
See TracChangeset
for help on using the changeset viewer.