Changeset 1450 for Scheduling/trunk/m


Ignore:
Timestamp:
Jun 18, 2012, 8:08:50 PM (12 years ago)
Author:
Sam Habiel
Message:

more changes

Location:
Scheduling/trunk/m
Files:
3 edited

Legend:

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

    r1449 r1450  
    1 BSDX07  ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS  ; 6/18/12 2:27pm
     1BSDX07  ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS  ; 6/18/12 5:12pm
    22        ;;1.7T1;BSDX;;Aug 31, 2011;Build 18
    33        ; Licensed under LGPL
     
    2525        ; -10: Couldn't add appointment to files 2 and/or 44
    2626        ; -100: Mumps Error
    27        
     27        ;
    2828APPADDD(BSDXY,BSDXSTART,BSDXEND,BSDXPATID,BSDXRES,BSDXLEN,BSDXNOTE,BSDXATID)       ;EP
    2929        ;Entry point for debugging
     
    3838    . N $ET S $ET="D ^%ZTER B"
    3939        . S HLRESIENS=$$UTCR^BSDX35(RESNAM)
    40     . I %<0 S $EC=",U1," ; not supposed to happen
    41     ;
    42     N HLIEN,RESIEN 
     40    . I HLRESIENS<0 S $EC=",U1," ; not supposed to happen
     41    ;
     42    N HLIEN,RESIEN
    4343    S HLIEN=$P(HLRESIENS,U)
    4444    S RESIEN=$P(HLRESIENS,U,2)
     
    5858        I '$D(^DPT(3,"S",APPTTIME)) W "Error Making Appt-3"
    5959        I '$D(^SC(HLIEN,"S",APPTTIME)) W "Error Making Appt-4"
     60    ;
     61    ; Do it again for a different patient
     62        D APPADD(.ZZZ,APPTTIME,ENDTIME,2,RESNAM,30,"Sam's Note",1)
     63        N APPID S APPID=+$P(^BSDXTMP($J,1),U) B
     64        I 'APPID W "Error Making Appt-5" QUIT
     65        I +^BSDXAPPT(APPID,0)'=APPTTIME W "Error Making Appt-6"
     66        I '$D(^DPT(2,"S",APPTTIME)) W "Error Making Appt-7"
     67        I '$D(^SC(HLIEN,"S",APPTTIME)) W "Error Making Appt-8"
    6068    ;
    6169        ; Test for bad start date
     
    6977        ; I +$P(^BSDXTMP($J,1),U,2)'=-4 W "Error in -4",!
    7078        ; Test for mumps error
    71         S bsdxdie=1
    72         D APPADD(.ZZZ,APPTTIME,ENDTIME,2,RESNAM,30,"Sam's Note",1)
     79        S BSDXDIE=1
     80        D APPADD(.ZZZ,APPTTIME,ENDTIME,1,RESNAM,30,"Sam's Note",1)
    7381        I +$P(^BSDXTMP($J,1),U,2)'=-100 W "Error in -100: M Error",!
    74         K bsdxdie
     82        K BSDXDIE
    7583        ; Test for TRESTART
    76         s bsdxrestart=1
     84        s BSDXRESTART=1
    7785        D APPADD(.ZZZ,APPTTIME,ENDTIME,3,RESNAM,30,"Sam's Note",1)
    7886        I +$P(^BSDXTMP($J,1),U,2)'=0&(+$P(^BSDXTMP($J,1),U,2)'=-10) W "Error in TRESTART",!
    79         k bsdxrestart
     87        k BSDXRESTART
    8088        ; Test for non-numeric patient
    8189        D APPADD(.ZZZ,APPTTIME,ENDTIME,"CAT,DOG",RESNAM,30,"Sam's Note",1)
     
    158166           ;
    159167           ;;;test for error inside transaction. See if %ZTER works
    160            I $G(bsdxdie) S X=1/0
     168           I $G(BSDXDIE) S X=1/0
    161169           ;;;test
    162170           ;;;test for TRESTART
    163            I $G(bsdxrestart) K bsdxrestart TRESTART
     171           I $G(BSDXRESTART) K BSDXRESTART TRESTART
    164172           ;;;test
    165173           ;
     
    256264           S:BSDXATID="WALKIN" BSDXFDA(9002018.4,"+1,",.13)="y"
    257265           S:BSDXATID?.N BSDXFDA(9002018.4,"+1,",.06)=BSDXATID
    258            S BSDXFDA(9002018.4,"+1,",.14)=BSDXRADEXAM
     266           S BSDXFDA(9002018.4,"+1,",.14)=$G(BSDXRADEXAM)
    259267           N BSDXIEN,BSDXMSG
    260268           D UPDATE^DIE("","BSDXFDA","BSDXIEN","BSDXMSG")
  • Scheduling/trunk/m/BSDX26.m

    r1187 r1450  
    1 BSDX26   ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 4/28/11 10:24am
    2            ;;1.6T2;BSDX;;May 16, 2011
     1BSDX26   ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 6/18/12 5:33pm
     2           ;;1.7T1;BSDX;;Aug 31, 2011;Build 18
    33           ; Licensed under LGPL
    44           ; Change History:
     
    104104           N BSDXRES S BSDXRES=0 ; Result
    105105           ; Update Note only if we have a linked hospital location.
    106            I HLIEN S BSDXRES=$$UPDATENOTE^BSDXAPI(PTIEN,HLIEN,DATE,BSDXNOTE(.5))
     106           I HLIEN S BSDXRES=$$UPDATENT^BSDXAPI(PTIEN,HLIEN,DATE,BSDXNOTE(.5))
    107107           ; If we get an error (denoted by -1 in BSDXRES), return error to client
    108108           I BSDXRES<0 D ERR(BSDXI,"-4~BSDX26: BSDXAPI reports an error: "_BSDXRES) QUIT
  • Scheduling/trunk/m/BSDXAPI.m

    r1187 r1450  
    1 BSDXAPI ; IHS/ANMC/LJF & VW/SMH - SCHEDULING APIs ; 4/28/11 10:30am
    2         ;;1.6T2;BSDX;;May 16, 2011;Build 7
     1BSDXAPI ; IHS/ANMC/LJF & VW/SMH - SCHEDULING APIs ; 6/18/12 5:31pm
     2        ;;1.6;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         ; 
     34    ; 2012-06-18 (v 1.7)
     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.
    3538        ;
    3639MAKE1(DFN,CLIN,TYP,DATE,LEN,INFO)       ; Simplified PEP w/ parameters for $$MAKE - making appointment
     
    6568        ;   = 1^message:  error and reason
    6669        ;
    67         I '$D(^DPT(+$G(BSDR("PAT")),0)) Q 1_U_"Patient not on file: "_$G(BSDR("PAT"))
    68         I '$D(^SC(+$G(BSDR("CLN")),0)) Q 1_U_"Clinic not on file: "_$G(BSDR("CLN"))
    69         I ($G(BSDR("TYP"))<3)!($G(BSDR("TYP"))>4) Q 1_U_"Appt Type error: "_$G(BSDR("TYP"))
    70         I $G(BSDR("ADT")) S BSDR("ADT")=+$E(BSDR("ADT"),1,12)  ;remove seconds
    71         I $G(BSDR("ADT"))'?7N.1".".4N Q 1_U_"Appt Date/Time error: "_$G(BSDR("ADT"))
    72         ;
    73         ;I ($G(BSDR("LEN"))<5)!($G(BSDR("LEN"))>240) Q 1_U_"Appt Length error: "_$G(BSDR("LEN")) ; v 1.42 - no check on length is done anymore. see top comments for details.
    74         I '$D(^VA(200,+$G(BSDR("USR")),0)) Q 1_U_"User Who Made Appt Error: "_$G(BSDR("USR"))
    75         ;I $D(^DPT(BSDR("PAT"),"S",BSDR("ADT"),0)),$P(^(0),U,2)'["C" Q 1_U_"Patient "_BSDR("PAT")_" already has appt at "_BSDR("ADT") ; v.1.5 more user friendly err msg
    76         ;
    77         ; Following block to give an error message to user if there is already an appointment for patient. More verbose than others.
    78         N BSDXERR ; place to store error message
    79         I $D(^DPT(BSDR("PAT"),"S",BSDR("ADT"),0)),$P(^(0),U,2)'["C" DO  QUIT BSDXERR  ; If there's an appt in the "S" node of file 2 and it's not cancelled
    80         . S BSDXERR=1_U_"Patient "_$P(^DPT(BSDR("PAT"),0),U)_" ("_BSDR("PAT")_") "
    81         . S BSDXERR=BSDXERR_"already has appt at "_$$FMTE^XLFDT(BSDR("ADT"))
    82         . N BSDXSCIEN S BSDXSCIEN=$P(^DPT(BSDR("PAT"),"S",BSDR("ADT"),0),U)  ; Clinic IEN in ^SC (0 piece of 0 node of "S" multiple in file 2)
    83         . N BSDXSCNAM S BSDXSCNAM=$P(^SC(BSDXSCIEN,0),U) ; PIMS Name of Clinic
    84         . S BSDXERR=BSDXERR_$C(13,10)_"PIMS clinic: "_BSDXSCNAM ; tell the user of the PIMS clinic
    85         . I $D(^BSDXRES("ALOC",BSDXSCIEN)) DO  ; if the Clinic is linked to a BSDX Resource (we find out using the index ALOC in the BSDX RESOURCE file)
    86         . . N BSDXRESIEN S BSDXRESIEN=$O(^BSDXRES("ALOC",BSDXSCIEN,""))
    87         . . QUIT:'BSDXRESIEN  ; Safeguard if index is corrupt
    88         . . N BSDXRESNAM S BSDXRESNAM=$P(^BSDXRES(BSDXRESIEN,0),U)
    89         . . S BSDXERR=BSDXERR_$C(13,10)_"Scheduling GUI clinic: "_BSDXRESNAM ; tell the user of the BSDX clinic
     70        N BSDXMKCK S BSDXMKCK=$$MAKECK(.BSDR) ; Check if we can make appointment
     71        I BSDXMKCK Q BSDXMKCK ; If we can't, quit with the reason why.
     72    ; Otherwise, we continue
    9073        ;
    9174        NEW DIC,DA,Y,X,DD,DO,DLAYGO
     
    10689        . D FILE^DIE("","BSDXFDA","BSDXMSG")
    10790        . N BSDXTEMP S BSDXTEMP=$G(BSDXMSG)
    108         E  D  I $G(BSDXERR(1)) Q 1_U_"FileMan add to DPT error: Patient="_BSDR("PAT")_" Appt="_BSDR("ADT") 
     91        E  D 
    10992        . N BSDXFDA,BSDXIENS,BSDXMSG
    11093        . S BSDXIENS="?+2,"_BSDR("PAT")_","
     
    11598        . S BSDXFDA(2.98,BSDXIENS,"20")=$$NOW^XLFDT
    11699        . D UPDATE^DIE("","BSDXFDA","BSDXIENS","BSDXERR(1)")
    117         ; add appt to file 44
     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
    118102        K DIC,DA,X,Y,DLAYGO,DD,DO
    119103        I '$D(^SC(BSDR("CLN"),"S",0)) S ^SC(BSDR("CLN"),"S",0)="^44.001DA^^"
     
    122106        . S DIC("P")="44.001DA",DIC(0)="L",DLAYGO=44.001
    123107        . S Y=1 I '$D(@(DIC_X_")")) D FILE^DICN
     108   
    124109        ;
    125110        ; Sep 28 2010: Changed old style API to new style API. Keep for reference //smh
     
    150135        Q 0
    151136        ;
     137MAKECK(BSDR) ; $$ - Is it okay to make an appointment? ; PEP
     138        I '$D(^DPT(+$G(BSDR("PAT")),0)) Q 1_U_"Patient not on file: "_$G(BSDR("PAT"))
     139        I '$D(^SC(+$G(BSDR("CLN")),0)) Q 1_U_"Clinic not on file: "_$G(BSDR("CLN"))
     140        I ($G(BSDR("TYP"))<3)!($G(BSDR("TYP"))>4) Q 1_U_"Appt Type error: "_$G(BSDR("TYP"))
     141        I $G(BSDR("ADT")) S BSDR("ADT")=+$E(BSDR("ADT"),1,12)  ;remove seconds
     142        I $G(BSDR("ADT"))'?7N.1".".4N Q 1_U_"Appt Date/Time error: "_$G(BSDR("ADT"))
     143        ;
     144    ; Appt Length check removed in v 1.5
     145    ;
     146        I '$D(^VA(200,+$G(BSDR("USR")),0)) Q 1_U_"User Who Made Appt Error: "_$G(BSDR("USR"))
     147        ; More verbose error message in v1.5
     148        ; Following block to give an error message to user if there is already an appointment for patient. More verbose than others.
     149        N BSDXERR ; place to store error message
     150        I $D(^DPT(BSDR("PAT"),"S",BSDR("ADT"),0)),$P(^(0),U,2)'["C" DO  QUIT BSDXERR  ; If there's an appt in the "S" node of file 2 and it's not cancelled
     151        . S BSDXERR=1_U_"Patient "_$P(^DPT(BSDR("PAT"),0),U)_" ("_BSDR("PAT")_") "
     152        . S BSDXERR=BSDXERR_"already has appt at "_$$FMTE^XLFDT(BSDR("ADT"))
     153        . N BSDXSCIEN S BSDXSCIEN=$P(^DPT(BSDR("PAT"),"S",BSDR("ADT"),0),U)  ; Clinic IEN in ^SC (0 piece of 0 node of "S" multiple in file 2)
     154        . N BSDXSCNAM S BSDXSCNAM=$P(^SC(BSDXSCIEN,0),U) ; PIMS Name of Clinic
     155        . S BSDXERR=BSDXERR_$C(13,10)_"PIMS clinic: "_BSDXSCNAM ; tell the user of the PIMS clinic
     156        . I $D(^BSDXRES("ALOC",BSDXSCIEN)) DO  ; if the Clinic is linked to a BSDX Resource (we find out using the index ALOC in the BSDX RESOURCE file)
     157        . . N BSDXRESIEN S BSDXRESIEN=$O(^BSDXRES("ALOC",BSDXSCIEN,""))
     158        . . QUIT:'BSDXRESIEN  ; Safeguard if index is corrupt
     159        . . N BSDXRESNAM S BSDXRESNAM=$P(^BSDXRES(BSDXRESIEN,0),U)
     160        . . S BSDXERR=BSDXERR_$C(13,10)_"Scheduling GUI clinic: "_BSDXRESNAM ; tell the user of the BSDX clinic
     161        Q 0
     162    ;
     163UNMAKE(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
    152181CHECKIN1(DFN,CLIN,APDATE)       ; Simplified PEP w/ parameters for $$CHECKIN - Checking in
    153182        ; Call like this for DFN 23435 checking in now at Hospital Location 33
     
    325354        ; remove check-in using filer.
    326355        N BSDXIENS S BSDXIENS=SDDA_","_DATE_","_CLINIC_","
    327         S BSDXFDA(44.003,BSDXIENS,309)="@"      ; CHECKED-IN
    328         S BSDXFDA(44.003,BSDXIENS,302)="@"      ; CHECK IN USER
    329         S BSDXFDA(44.003,BSDXIENS,305)="@"      ; CHECK IN ENTERED
     356        S BSDXFDA(44.003,BSDXIENS,309)="@" ; CHECKED-IN
     357        S BSDXFDA(44.003,BSDXIENS,302)="@" ; CHECK IN USER
     358        S BSDXFDA(44.003,BSDXIENS,305)="@" ; CHECK IN ENTERED
    330359        N BSDXERR
    331360        D FILE^DIE("","BSDXFDA","BSDXERR")
     
    359388        Q $S(X:1,1:0)
    360389        ;
    361 UPDATENOTE(PAT,CLINIC,DATE,NOTE)        ; PEP; Update Note in ^SC for patient's appointment @ DATE
     390UPDATENT(PAT,CLINIC,DATE,NOTE)  ; PEP; Update Note in ^SC for patient's appointment @ DATE
    362391        ; PAT = DFN
    363392        ; CLINIC = SC IEN
Note: See TracChangeset for help on using the changeset viewer.