Ignore:
Timestamp:
Jun 19, 2012, 8:19:03 PM (12 years ago)
Author:
Sam Habiel
Message:

removed transactions from BSDX07... still more work to be done though

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Scheduling/trunk/m/BSDXAPI.m

    r1450 r1451  
    1 BSDXAPI ; IHS/ANMC/LJF & VW/SMH - SCHEDULING APIs ; 6/18/12 5:31pm
    2         ;;1.6;BSDX;;Aug 31, 2011;Build 18
     1BSDXAPI ; IHS/ANMC/LJF & VW/SMH - SCHEDULING APIs ; 6/19/12 5:42pm
     2        ;;1.7T1;BSDX;;Aug 31, 2011;Build 18
    33        ; Licensed under LGPL 
    44        ;
     
    3232        ; More user friendly message if patient already has appointment in $$MAKE:
    3333        ;  Spits out pt name and user friendly date.
    34     ; 2012-06-18 (v 1.7)
     34        ; 2012-06-18 (v 1.7)
    3535        ; 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
    3840        ;
    3941MAKE1(DFN,CLIN,TYP,DATE,LEN,INFO)       ; Simplified PEP w/ parameters for $$MAKE - making appointment
     
    7072        N BSDXMKCK S BSDXMKCK=$$MAKECK(.BSDR) ; Check if we can make appointment
    7173        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
    7578        ;
    7679        I $D(^DPT(BSDR("PAT"),"S",BSDR("ADT"),0)),$P(^(0),U,2)["C" D
    7780        . ; "un-cancel" existing appt in file 2
    78         . N BSDXFDA,BSDXIENS,BSDXMSG
    7981        . S BSDXIENS=BSDR("ADT")_","_BSDR("PAT")_","
    8082        . S BSDXFDA(2.98,BSDXIENS,".01")=BSDR("CLN")
     
    8890        . S BSDXFDA(2.98,BSDXIENS,"20")=$$NOW^XLFDT
    8991        . D FILE^DIE("","BSDXFDA","BSDXMSG")
    90         . N BSDXTEMP S BSDXTEMP=$G(BSDXMSG)
    91         E  D 
    92         . N BSDXFDA,BSDXIENS,BSDXMSG
     92        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
    9395        . S BSDXIENS="?+2,"_BSDR("PAT")_","
    9496        . S BSDXIENS(2)=BSDR("ADT")
     
    9799        . S BSDXFDA(2.98,BSDXIENS,"9.5")=9
    98100        . 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
    103106        I '$D(^SC(BSDR("CLN"),"S",0)) S ^SC(BSDR("CLN"),"S",0)="^44.001DA^^"
    104107        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")
     
    106109        . S DIC("P")="44.001DA",DIC(0)="L",DLAYGO=44.001
    107110        . S Y=1 I '$D(@(DIC_X_")")) D FILE^DICN
    108    
    109         ;
     111        ;
     112        ; add appt for file 44, second subfile (Appointment/Patient)
    110113        ; Sep 28 2010: Changed old style API to new style API. Keep for reference //smh
    111114        ;K DIC,DA,X,Y,DLAYGO,DD,DO,DINUM
     
    136139        ;
    137140MAKECK(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        ;
    138145        I '$D(^DPT(+$G(BSDR("PAT")),0)) Q 1_U_"Patient not on file: "_$G(BSDR("PAT"))
    139146        I '$D(^SC(+$G(BSDR("CLN")),0)) Q 1_U_"Clinic not on file: "_$G(BSDR("CLN"))
     
    142149        I $G(BSDR("ADT"))'?7N.1".".4N Q 1_U_"Appt Date/Time error: "_$G(BSDR("ADT"))
    143150        ;
    144     ; Appt Length check removed in v 1.5
    145     ;
     151        ; Appt Length check removed in v 1.5
     152        ;
    146153        I '$D(^VA(200,+$G(BSDR("USR")),0)) Q 1_U_"User Who Made Appt Error: "_$G(BSDR("USR"))
    147154        ; More verbose error message in v1.5
     
    160167        . . S BSDXERR=BSDXERR_$C(13,10)_"Scheduling GUI clinic: "_BSDXRESNAM ; tell the user of the BSDX clinic
    161168        Q 0
    162     ;
     169        ;
    163170UNMAKE(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        ;
    181190CHECKIN1(DFN,CLIN,APDATE)       ; Simplified PEP w/ parameters for $$CHECKIN - Checking in
    182191        ; Call like this for DFN 23435 checking in now at Hospital Location 33
Note: See TracChangeset for help on using the changeset viewer.