Changeset 1454 for Scheduling


Ignore:
Timestamp:
Jun 21, 2012, 7:24:56 PM (12 years ago)
Author:
Sam Habiel
Message:

Moved Unit Tests and UT Set-up to BSDXUT, started refactoring BSDX08.

Location:
Scheduling/trunk/m
Files:
1 added
3 edited

Legend:

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

    r1452 r1454  
    1 BSDX07  ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS  ; 6/20/12 3:28pm
     1BSDX07  ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS  ; 6/21/12 3:54pm
    22        ;;1.7T1;BSDX;;Aug 31, 2011;Build 18
    33        ; Licensed under LGPL
     
    77        ; v1.3 July 13 2010 - Add support i18n - Dates input as FM dates, not US.
    88        ; v1.42 Oct 22 2010 - Transaction now restartable by providing arguments
    9         ;   thanks to Rick Marshall and Zach Gonzalez at Oroville.
    109        ; v1.42 Oct 30 2010 - Extensive refactoring.
    1110        ; v1.5  Mar 15 2011 - End time does not have to have time anymore.
     
    3231        Q
    3332        ;
    34 UT      ; Unit Tests - Assumes you have Patients with DFNs 1,2 and 3
    35         ; Set-up - Create Clinics
    36         N RESNAM S RESNAM="UTCLINIC"
    37         N HLRESIENS ; holds output of UTCR^BSDX35 - HL IEN^Resource IEN
    38         D
    39         . N $ET S $ET="D ^%ZTER B"
    40         . S HLRESIENS=$$UTCR^BSDX35(RESNAM)
    41         . I HLRESIENS<0 S $EC=",U1," ; not supposed to happen - hard crash if so
    42         ;
    43         N HLIEN,RESIEN
    44         S HLIEN=$P(HLRESIENS,U)
    45         S RESIEN=$P(HLRESIENS,U,2)
    46         ;
    47         ; Get start and end times
    48         N TIMES S TIMES=$$TIMES^BSDX35 ; appt time^end time
    49         N APPTTIME S APPTTIME=$P(TIMES,U)
    50         N ENDTIME S ENDTIME=$P(TIMES,U,2)
    51         ;
    52         N ZZZ,DFN
    53         ; Test for normality:
    54         S DFN=3
    55         D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
    56         ; Does Appt exist?
    57         N APPID S APPID=+$P(^BSDXTMP($J,1),U)
    58         I 'APPID W "Error Making Appt-1" QUIT
    59         I +^BSDXAPPT(APPID,0)'=APPTTIME W "Error Making Appt-2"
    60         I '$D(^DPT(DFN,"S",APPTTIME)) W "Error Making Appt-3"
    61         I '$$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error Making Appt-4"
    62         ;
    63         ; Do it again for a different patient
    64         S DFN=2
    65         D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
    66         N APPID S APPID=+$P(^BSDXTMP($J,1),U)
    67         I 'APPID W "Error Making Appt-5" QUIT
    68         I +^BSDXAPPT(APPID,0)'=APPTTIME W "Error Making Appt-6"
    69         I '$D(^DPT(DFN,"S",APPTTIME)) W "Error Making Appt-7"
    70         I '$$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error Making Appt-8"
    71         ;
    72         ; Again for a different patient (4)
    73         S DFN=4
    74         D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
    75         N APPID S APPID=+$P(^BSDXTMP($J,1),U)
    76         I 'APPID W "Error Making Appt-9" QUIT
    77         I +^BSDXAPPT(APPID,0)'=APPTTIME W "Error Making Appt-10"
    78         I '$D(^DPT(DFN,"S",APPTTIME)) W "Error Making Appt-11"
    79         I '$$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error Making Appt-12"
    80         ;
    81         ; Delete appointment set for Patient 4 (made above)
    82         N BSDX,DFN
    83         S DFN=4
    84         S BSDX("PAT")=DFN
    85         S BSDX("CLN")=HLIEN
    86         S BSDX("ADT")=APPTTIME
    87         D ROLLBACK(APPID,.BSDX)
    88         I +$G(^BSDXAPPT(APPID,0)) W "Error in deleting appointment-1",!
    89         I $D(^DPT(DFN,"S",APPTTIME)) W "Error in deleting appointment-2",!
    90         I $$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error in deleting appointment-3",!
    91         ;
    92         ; Again for a different patient (5)
    93         S DFN=5
    94         D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
    95         N APPID S APPID=+$P(^BSDXTMP($J,1),U)
    96         I 'APPID W "Error Making Appt-13" QUIT
    97         I +^BSDXAPPT(APPID,0)'=APPTTIME W "Error Making Appt-14"
    98         I '$D(^DPT(DFN,"S",APPTTIME)) W "Error Making Appt-15"
    99         I '$$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error Making Appt-16"
    100         ; Now cancel that appointment
    101         D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")
    102         ; Now make it again
    103         D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
    104         N APPID S APPID=+$P(^BSDXTMP($J,1),U)
    105         I 'APPID W "Error Making Appt-17" QUIT
    106         I +^BSDXAPPT(APPID,0)'=APPTTIME W "Error Making Appt-18"
    107         I '$D(^DPT(DFN,"S",APPTTIME)) W "Error Making Appt-19"
    108         I '$$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error Making Appt-20"
    109         ;
    110         ; Delete appointment set for Patient 1 (not made)... needs to not crash
    111         D
    112         . N $ET S $ET="D ^%ZTER S $EC="""" W ""Failure to del non-existent appt"",!"
    113         . N BSDX
    114         . S BSDX("PAT")=1
    115         . S BSDX("CLN")=HLIEN
    116         . S BSDX("ADT")=APPTTIME
    117         . D ROLLBACK(APPID,.BSDX)
    118         ;
    119         ; Test for bad start date
    120         D APPADD(.ZZZ,2100123,3100123.3,2,RESNAM,30,"Sam's Note",1)
    121         I +$P(^BSDXTMP($J,1),U,2)'=-2 W "Error in -2",!
    122         ; Test for bad end date
    123         D APPADD(.ZZZ,3100123,2100123.3,2,RESNAM,30,"Sam's Note",1)
    124         I +$P(^BSDXTMP($J,1),U,2)'=-3 W "Error in -3",!
    125         ; Test for end date without time - obsolete
    126         ; D APPADD(.ZZZ,3100123.1,3100123,2,RESNAM,30,"Sam's Note",1)
    127         ; I +$P(^BSDXTMP($J,1),U,2)'=-4 W "Error in -4",!
    128         ; Test for mumps error
    129         S BSDXDIE=1
    130         D APPADD(.ZZZ,APPTTIME,ENDTIME,1,RESNAM,30,"Sam's Note",1)
    131         I +$P(^BSDXTMP($J,1),U,2)'=-100 W "Error in -100: M Error",!
    132         K BSDXDIE
    133         ; Test for TRESTART -- retired in v 1.7
    134         ; S BSDXRESTART=1
    135         ; D APPADD(.ZZZ,APPTTIME,ENDTIME,3,RESNAM,30,"Sam's Note",1)
    136         ; I +$P(^BSDXTMP($J,1),U,2)'=0&(+$P(^BSDXTMP($J,1),U,2)'=-10) W "Error in TRESTART",!
    137         ; K BSDXRESTART
    138         ; Test for non-numeric patient
    139         D APPADD(.ZZZ,APPTTIME,ENDTIME,"CAT,DOG",RESNAM,30,"Sam's Note",1)
    140         I +$P(^BSDXTMP($J,1),U,2)'=-5 W "Error in -5",!
    141         ; Test for a non-existent patient
    142         D APPADD(.ZZZ,APPTTIME,ENDTIME,8989898989,RESNAM,30,"Sam's Note",1)
    143         I +$P(^BSDXTMP($J,1),U,2)'=-6 W "Error in -6",!
    144         ; Test for a non-existent resource name
    145         D APPADD(.ZZZ,APPTTIME,ENDTIME,3,"lkajsflkjsadf",30,"Sam's Note",1)
    146         I +$P(^BSDXTMP($J,1),U,2)'=-7 W "Error in -7",!
    147         ; Test for corrupted resource
    148         ; Can't test for -8 since it requires DB corruption
    149         ; Test for inability to add appointment to BSDX Appointment (-9)
    150         ; Also requires something wrong in the DB
    151         ; Test for inability to add appointment to 2,44
    152         ; Test by creating a duplicate appointment
    153         ; Get start and end times
    154         N TIMES S TIMES=$$TIMES^BSDX35 ; appt time^end time
    155         N APPTTIME S APPTTIME=$P(TIMES,U)
    156         N ENDTIME S ENDTIME=$P(TIMES,U,2)
    157         D APPADD(.ZZZ,APPTTIME,ENDTIME,3,RESNAM,30,"Sam's Note",1)
    158         D APPADD(.ZZZ,APPTTIME,ENDTIME,3,RESNAM,30,"Sam's Note",1)
    159         I +$P(^BSDXTMP($J,1),U,2)'=-10 W "Error in -10",!
    160         ;
    161         ; Test that rollback occurs properly in various places
    162         N TIMES S TIMES=$$TIMES^BSDX35 ; appt time^end time
    163         N APPTTIME S APPTTIME=$P(TIMES,U)
    164         N ENDTIME S ENDTIME=$P(TIMES,U,2)
    165         S DFN=4
    166         N BSDXSIMERR1 S BSDXSIMERR1=1
    167         D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
    168         N APPID S APPID=$O(^BSDXAPPT("B",APPTTIME,""))
    169         I +APPID W "Error in deleting appointment-4",!
    170         I $D(^DPT(DFN,"S",APPTTIME)) W "Error in deleting appointment-5",!
    171         I $$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error in deleting appointment-6",!
    172         ;
    173         K BSDXSIMERR1
    174         N BSDXSIMERR2 S BSDXSIMERR2=1
    175         D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
    176         N APPID S APPID=$O(^BSDXAPPT("B",APPTTIME,""))
    177         I +APPID W "Error in deleting appointment-7",!
    178         I $D(^DPT(DFN,"S",APPTTIME)) W "Error in deleting appointment-8",!
    179         I $$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error in deleting appointment-9",!
    180         ;
    181         K BSDXSIMERR2
    182         N BSDXSIMERR4 S BSDXSIMERR4=1
    183         D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
    184         N APPID S APPID=$O(^BSDXAPPT("B",APPTTIME,""))
    185         I +APPID W "Error in deleting appointment-16",!
    186         I $D(^DPT(DFN,"S",APPTTIME)) W "Error in deleting appointment-17",!
    187         I $$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error in deleting appointment-18",!
    188         ;
    189         K BSDXSIMERR4
    190         N BSDXSIMERR5 S BSDXSIMERR5=1
    191         D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
    192         N APPID S APPID=$O(^BSDXAPPT("B",APPTTIME,""))
    193         I +APPID W "Error in deleting appointment-19",!
    194         I $D(^DPT(DFN,"S",APPTTIME)) W "Error in deleting appointment-20",!
    195         I $$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error in deleting appointment-21",!
    196         QUIT
    197         ;
    19833APPADD(BSDXY,BSDXSTART,BSDXEND,BSDXPATID,BSDXRES,BSDXLEN,BSDXNOTE,BSDXATID,BSDXRADEXAM) ;EP
    19934        ;
     
    299134        N BSDXC ; Array to send to MAKE and MAKECK APIs
    300135        ; Only if we have a valid Hosp Location
    301         I +BSDXSCD,$D(^SC(BSDXSCD,0)) D
     136        I +BSDXSCD,$D(^SC(BSDXSCD,0)) D  I +BSDXERR D ERR(BSDXI,"-10~BSDX07 Error: MAKECK^BSDXAPI returned error code: "_BSDXERR) Q  ; no need for roll back
    302137        . S BSDXC("PAT")=BSDXPATID
    303138        . S BSDXC("CLN")=BSDXSCD
     
    311146        . S BSDXC("USR")=DUZ
    312147        . S BSDXERR=$$MAKECK^BSDXAPI(.BSDXC)
    313         I +BSDXERR D ERR(BSDXI,"-10~BSDX07 Error: MAKECK^BSDXAPI returned error code: "_BSDXERR) Q  ; no need for roll back
    314148        ;
    315149        ; Done with all checks, let's make appointment in BSDX APPOINTMENT
  • Scheduling/trunk/m/BSDX08.m

    r1452 r1454  
    1 BSDX08  ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS ; 6/20/12 3:52pm
     1BSDX08  ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS ; 6/21/12 4:49pm
    22        ;;1.6;BSDX;;Aug 31, 2011;Build 18
    33        ;
     
    3838        Q
    3939        ;
    40 UT      ; Unit Tests
    41         N RESNAM S RESNAM="UTCLINIC"
    42         N HLRESIENS ; holds output of UTCR^BSDX35 - HL IEN^Resource IEN
    43         D
    44         . N $ET S $ET="D ^%ZTER B"
    45         . S HLRESIENS=$$UTCR^BSDX35(RESNAM)
    46         . I HLRESIENS<0 S $EC=",U1," ; not supposed to happen - hard crash if so
    47         ;
    48         N HLIEN,RESIEN
    49         S HLIEN=$P(HLRESIENS,U)
    50         S RESIEN=$P(HLRESIENS,U,2)
    51         ;
    52         ; Get start and end times
    53         N TIMES S TIMES=$$TIMES^BSDX35 ; appt time^end time
    54         N APPTTIME S APPTTIME=$P(TIMES,U)
    55         N ENDTIME S ENDTIME=$P(TIMES,U,2)
    56         ;
    57         ; Test 1: Make normal appointment and cancel it. See if every thing works
    58         N ZZZ,DFN
    59         S DFN=3
    60         D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
    61         S APPID=+$P(^BSDXTMP($J,1),U)
    62         D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")
    63         I $P(^BSDXAPPT(APPID,0),U,12)'>0 W "Error in Cancellation-1"
    64         I $O(^SC(2,"S",APPTTIME,1,0))]"" W "Error in Cancellation-2"
    65         I $P(^DPT(4,"S",APPTTIME,0),U,2)'="PC" W "Error in Cancellation-3"
    66         I ^DPT(4,"S",3110123.2,"R")'="Sam's Cancel Note" W "Error in Cancellation-4"
    67         ;
    68         ; Test 2: Check for -1
    69         ; Make appt
    70         D APPADD^BSDX07(.ZZZ,3110125.2,3110125.3,4,"Dr Office",10,"Sam's Note",1)
    71         ; Lock the node in another job
    72         S APPID=+$P(^BSDXTMP($J,1),U)
    73         ; W "Lock ^BSDXAPPT("_APPID_") in another session. You have 10 seconds." H 10
    74         D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")
    75         ;
    76         ; Test 3: Check for -100
    77         S bsdxdie=1
    78         D APPADD^BSDX07(.ZZZ,3110126.2,3110126.3,4,"Dr Office",10,"Sam's Note",1)
    79         S APPID=+$P(^BSDXTMP($J,1),U)
    80         D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Reasons")
    81         I $P(^BSDXTMP($J,1),"~")'=-100 W "Error in -100",!
    82         K bsdxdie
    83         ;
    84         ; Test 4: Restartable transaction
    85         S bsdxrestart=1
    86         D APPADD^BSDX07(.ZZZ,3110128.2,3110128.3,4,"Dr Office",10,"Sam's Note",1)
    87         S APPID=+$P(^BSDXTMP($J,1),U)
    88         D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Reasons")
    89         I $P(^DPT(4,"S",3110128.2,0),U,2)'="PC" W "Error in Restartable Transaction",!
    90         ;
    91         ; Test 5: for invalid Appointment ID (-2 and -3)
    92         D APPDEL^BSDX08(.ZZZ,0,"PC",1,"Reasons")
    93         I $P(^BSDXTMP($J,1),"~")'=-2 W "Error in -2",!
    94         D APPDEL^BSDX08(.ZZZ,999999,"PC",1,"Reasons")
    95         I $P(^BSDXTMP($J,1),"~")'=-3 W "Error in -3",!
    96 UT2     ; More unit Tests
    97         ;
    98         ; Test 6: for Cancelling walkin and checked-in appointments
    99         S BSDXSTART=$E($$NOW^XLFDT,1,12),BSDXEND=BSDXSTART+.0001
    100         D APPADD^BSDX07(.ZZZ,BSDXSTART,BSDXEND,4,"Dr Office",10,"Sam's Note",1) ; Add appt
    101         S APPID=+$P(^BSDXTMP($J,1),U)
    102         I APPID=0 W "Error in test 6",!
    103         D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; check-in
    104         D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; Delete appt
    105         I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!
    106         ;
    107         ; Test 7: for cancelling walkin and checked-in appointments
    108         S BSDXSTART=$E($$NOW^XLFDT,1,12)+.0001,BSDXEND=BSDXSTART+.0001
    109         D APPADD^BSDX07(.ZZZ,BSDXSTART,BSDXEND,4,"Dr Office",10,"Sam's Note",1) ; Add appt
    110         S APPID=+$P(^BSDXTMP($J,1),U)
    111         I APPID=0 W "Error in test 6",!
    112         D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; Checkin
    113         S BSDXRES=$O(^BSDXRES("B","Dr Office",""))
    114         S BSDXCLN=$P(^BSDXRES(BSDXRES,0),U,4)
    115         S BSDXRESULT=$$RMCI^BSDXAPI(4,BSDXCLN,BSDXSTART) ; remove checkin
    116         D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; delete appt
    117         I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!
    118         QUIT
    11940APPDEL(BSDXY,BSDXAPTID,BSDXTYP,BSDXCR,BSDXNOT)         ;EP
    12041        ;Called by RPC: BSDX CANCEL APPOINTMENT
     
    14162        ; Counter
    14263        N BSDXI S BSDXI=0
     64        ;
    14365        ; Header Node
    14466        S ^BSDXTMP($J,BSDXI)="T00100ERRORID"_$C(30)
     
    15880        ;
    15981        ;;;test for error inside transaction. See if %ZTER works
    160         I $G(bsdxdie) S X=1/0
     82        I $G(BSDXDIE) S X=1/0
    16183        ;;;test
    16284        ;;;test for TRESTART
    163         I $G(bsdxrestart) K bsdxrestart TRESTART
     85        I $G(BSDXRESTART) K BSDXRESTART tRESTART
    16486        ;;;test
    16587        ;
     
    187109        N BSDXERR S BSDXERR=0
    188110        ; Only file in 2/44 if there is an associated hospital location
    189         I BSDXLOC D  QUIT:BSDXERR 
     111        I BSDXLOC D  QUIT:BSDXERR
    190112        . I '$D(^SC(BSDXLOC,0)) S BSDXERR=1 D ERR(BSDXI,"-6~BSDX08: Invalid Hosp Location stored in Database") QUIT
    191113        . ; Get the IEN of the appointment in the "S" node of ^SC
     
    215137        ;See SDCNP0
    216138        N SD,S  ; Start Date
    217         S (SD,S)=BSDXSTART 
     139        S (SD,S)=BSDXSTART
    218140        N I ; Clinic IEN in 44
    219141        S I=BSDXSCD
     
    244166        ; Y#1 -> Minutes; *SI -> * Slots per hour; \.6 trunc min to hour
    245167        ; Y\1 -> Hours since start of day; * SI: * slots
    246         S ST=Y#1*SI\.6+(Y\1*SI) 
     168        S ST=Y#1*SI\.6+(Y\1*SI)
    247169        N SS ; how many slots are supposed to be taken by appointment
    248170        S SS=SL*HSI/60 ; (nb: try SL: 30 min; HSI: 4 slots)
     
    251173        . ; loop through pattern. Tired of documenting.
    252174        . F I=ST+ST:SDDIF D  Q:Y=""  Q:SS'>0
    253         . . S Y=$E(STR,$F(STR,$E(S,I+1))) Q:Y="" 
     175        . . S Y=$E(STR,$F(STR,$E(S,I+1))) Q:Y=""
    254176        . . S S=$E(S,1,I)_Y_$E(S,I+2,999)
    255         . . S SS=SS-1 
     177        . . S SS=SS-1
    256178        . . Q:SS'>0
    257179        S ^SC(BSDXSCD,"ST",SD\1,1)=S  ; new pattern; global set
  • Scheduling/trunk/m/BSDX35.m

    r1449 r1454  
    1 BSDX35  ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 6/18/12 2:27pm
     1BSDX35  ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 6/21/12 3:57pm
    22        ;;1.7T1;BSDX;;Aug 31, 2011;Build 18
    33        ; Licensed under LGPL 
     
    7474        S ^BSDXTMP($J,BSDXI)=$C(31)
    7575        Q
    76 UTCR(RESNAM) ; $$ - Create Unit Test Clinic and Resource Pair ; Private
    77  ; Input: Resource Name By Value
    78  ; Output: -1^Error or HLIEN^RESIEN for Success (file 44 IEN^file 9002018.1 IEN)
    79  ; DO NOT USE IN A PRODUCTION ENVIRONTMENT. INTENDED FOR TESTING ONLY
    80  N HLIEN S HLIEN=$$UTCR44(RESNAM)
    81  I +HLIEN=-1 QUIT HLIEN
    82  ;
    83  N RESIEN S RESIEN=$$UTCRRES(RESNAM,HLIEN)
    84  I +RESIEN=-1 QUIT RESIEN
    85  E  QUIT HLIEN_U_RESIEN
    86  ;
    87 UTCR44(HLNAME) ; $$ - Create Unit Test Clinic in File 44; Private ; TESTING ONLY CODE
    88  ; Output: -1^Error or IEN for Success
    89  ; Input: Hosp Location Name by Value
    90  ; DO NOT USE IN A PRODUCTION ENVIRONTMENT. INTENDED FOR TESTING ONLY
    91  ;
    92  I $D(^SC("B",HLNAME)) Q $O(^(HLNAME,""))
    93  ;
    94  N SAM
    95  S SAM(44,"?+1,",.01)=HLNAME            ; Name
    96  S SAM(44,"?+1,",2)="C"                 ; Type = Clinic
    97  S SAM(44,"?+1,",2.1)=1                 ; Type Extension (not used)
    98  S SAM(44,"?+1,",3.5)=$O(^DG(40.8,0))   ; Division (not yet used)
    99  S SAM(44,"?+1,",8)=295                 ; Stop Code Number (not used)
    100  S SAM(44,"?+1,",9)="M"          ; Service (not used)
    101  S SAM(44,"?+1,",1912)=15               ; Length of Appt (not used)
    102  S SAM(44,"?+1,",1917)=4                ; Display increments per hour (not used)
    103  S SAM(44,"?+1,",1918)=8                ; Overbooks/day max (not used)
    104  S SAM(44,"?+1,",2000.5)=0              ; Require Action Profiles: Yes (not used)
    105  S SAM(44,"?+1,",2001)=999              ; Allowable consecutive no-shows (not used)
    106  S SAM(44,"?+1,",2002)=999              ; Max # days for Future Booking (not used)
    107  S SAM(44,"?+1,",2005)=365              ; Max # days for Auto Rebook (not used)
    108  S SAM(44,"?+1,",2502)="N"             ; Non-Count Clinic (not used)
    109  S SAM(44,"?+1,",2504)="Y"            ; Clinic meets at this Facility? (not used)
    110  S SAM(44,"?+1,",2507)=9              ; Appointment Type (not used)
    111  ;
    112  N BSDXERR,BSDXIEN
    113  D UPDATE^DIE("",$NA(SAM),$NA(BSDXIEN),$NA(BSDXERR))
    114  Q $S($D(BSDXERR):-1_U_BSDXERR("DIERR",1,"TEXT",1),1:BSDXIEN(1))
    115  ;
    116 UTCRRES(NAME,HLIEN) ; $$ - Create Unit Test Resource in 9002018.1 (BSDX RESOURCE); Private
    117  ; Input: Hospital Location IEN
    118  ; Output: -1^Error or IEN for Success
    119  ; DO NOT USE IN A PRODUCTION ENVIRONTMENT. INTENDED FOR TESTING ONLY
    120  I $D(^BSDXRES("B",NAME)) Q $O(^(NAME,""))
    121  D RSRC^BSDX16(.RES,"|"_NAME_"||"_HLIEN)
    122  N RTN S RTN=@$Q(^BSDXTMP($J,0)) ; return array next value
    123  Q $S(RTN=0:-1_U_RTN,1:+RTN) ; 0 means an error has occurred; 1 means IEN returned
    124  ;
    125 TIMES() ; $$ - Create a next available appointment time^ending time; Private
    126  N NOW S NOW=$$NOW^XLFDT() ; Now time
    127  N LAST S LAST=$O(^BSDXAPPT("B"," "),-1) ; highest time in file
    128  N TIME2USE S TIME2USE=$S(NOW>LAST:NOW,1:LAST) ; Which time to use?
    129  S TIME2USE=$E(TIME2USE,1,12) ; Strip away seconds
    130  N APPTIME S APPTIME=$$FMADD^XLFDT(TIME2USE,0,0,15,0) ; Add 15 min
    131  N ENDTIME S ENDTIME=$$FMADD^XLFDT(APPTIME,0,0,15,0) ; Add 15 more min
    132  Q APPTIME_U_ENDTIME ; quit with apptime^endtime
Note: See TracChangeset for help on using the changeset viewer.