Ignore:
Timestamp:
Dec 4, 2009, 12:11:15 AM (15 years ago)
Author:
George Lilly
Message:

revised back to 6/30/08 version

Location:
WorldVistAEHR/trunk/r/EVENT_CAPTURE-EC--ECT--ECX
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • WorldVistAEHR/trunk/r/EVENT_CAPTURE-EC--ECT--ECX/ECRRPT.m

    r613 r623  
    1 ECRRPT  ;ALB/JAM;Event Capture Report RPC Broker ;Jan 2, 2001
    2         ;;2.0; EVENT CAPTURE ;**25,32,41,56,61,82,94**;8 May 96;Build 4
    3         ;
    4 REQCHK(ECV)     ;Required data check
    5         N I,C
    6         S C=1
    7         F I=1:1:$L(ECV,U) I '$D(@$P(ECV,U,I)) D
    8         . S ^TMP("ECMSG",$J,C)="0^Required data missing "_$P(ECV,U,I)
    9         . S C=C+1,ECERR=1
    10         Q
    11 DATECHK(ECSD,ECED)      ;Check human format date and converts to FileMan format
    12         ;    Input  ECSD  - Start Date (ex. 10/9/01)
    13         ;           ECED  - End Date
    14         N ECI,X,Y
    15         S %DT="X" F ECI="ECSD","ECED" S X=@ECI D ^%DT S @ECI=Y
    16         S ECSD=$S(ECSD=-1:DT,1:ECSD),ECED=$S(ECED=-1:DT,1:ECED)
    17         S ECDATE=$$FMTE^XLFDT(ECSD)_"^"_$$FMTE^XLFDT(ECED)
    18         Q
    19 QUEUE   ;Queues report to printer
    20         N ZTIO,ZTDESC,ZTRTN,ZTDTH,ZTSAVE,%ZIS,I,IOP,POP
    21         S XNAM=$P($G(^%ZIS(1,ECDEV,0)),U,2)
    22         S IOP="Q;`"_ECDEV,%ZIS="Q" D ^%ZIS I POP D  Q
    23         . ;S IOP="Q;"_XNAM,%ZIS="Q" D ^%ZIS I POP D  Q
    24         . S ^TMP("ECMSG",$J,1)="0^Device selection unsuccessful"
    25         S ZTIO=ION,ZTDESC=ECDESC,ZTRTN=ECROU
    26         S ZTDTH=$$FMTH^XLFDT(ECQDT)
    27         ;D NOW^%DTC S ZTDTH=$S(%'<ECQDT:%+.0002,1:ECQDT)
    28         F I=1:1:$L(ECV,U) I $D(@$P(ECV,U,I)) S ZTSAVE($P(ECV,U,I))=""
    29         M ZTSAVE=ECSAVE
    30         D ^%ZTLOAD,HOME^%ZIS,^%ZISC ;K IO("Q")
    31         I $D(ZTSK) S ^TMP("ECMSG",$J)="1^Report queued. Task #"_ZTSK Q
    32         S ^TMP("ECMSG",$J)="0^Task Rejected"
    33         Q
    34         ;
    35 ECPAT   ;Patient Summary Report for RPC Call
    36         ;     Variables passed in
    37         ;       ECDFN  - Patient IEN for file #2
    38         ;       ECSD   - Start Date or Report
    39         ;       ECED   - End Date or Report
    40         ;       ECRY   - Print Procedure Reason (optional)
    41         ;
    42         ;     Variable return
    43         ;       ^TMP($J,"ECRPT",n)=report output or to print device.
    44         N ECDATE,ECPAT,ECV,DIC,X,Y,ECROU,ECDESC
    45         S ECV="ECDFN^ECSD^ECED" D REQCHK(ECV) I ECERR Q
    46         S DIC=2,DIC(0)="QNMZX",X=ECDFN D ^DIC Q:Y<0  S ECPAT=$P(Y,U,2)
    47         D DATECHK(.ECSD,.ECED)
    48         S ECSD=ECSD-.0001,ECED=ECED+.9999
    49         I $E($G(ECRY))'="Y" K ECRY
    50         I ECPTYP="P" D  Q
    51         . S ECV="ECDFN^ECPAT^ECDATE^ECSD^ECED^ECRY",ECROU="SUM^ECPAT"
    52         . S ECDESC="EVENT CAPTURE PATIENT SUMMARY"
    53         . D QUEUE
    54         D SUM^ECPAT
    55         Q
    56 ECRDSSU ;DSS Unit Workload Summary Report
    57         ;     Variables passed in
    58         ;       ECL    - Location to report (1 or ALL)
    59         ;       ECD    - DSS Unit to report (1, some or ALL)
    60         ;       ECSD   - Start Date or Report
    61         ;       ECED   - End Date or Report
    62         ;       ECDUZ  - User IEN from file (#200)
    63         ;
    64         ;     Variable return
    65         ;       ^TMP($J,"ECRPT",n)=report output or to print device.
    66         N ECLOC,ECDSSU,ECV,ECI,ECSTDT,ECENDDT,ECKEY,ECROU,ECSAVE,ECDESC,ECNT
    67         N ECDATE,ECX,DUZ,DIC,X,Y
    68         S ECV="ECL^ECD0^ECSD^ECED^ECDUZ" D REQCHK(ECV) I ECERR Q
    69         D  I '$D(ECLOC) S ^TMP("ECMSG",$J)="1^Invalid Location." Q
    70         . I ECL="ALL" D LOCARRY^ECRUTL Q
    71         . S DIC=4,DIC(0)="QNZX",X=ECL D ^DIC Q:Y<0  S ECLOC(1)=+Y_"^"_$P(Y,U,2)
    72         D  I '$D(ECDSSU) S ^TMP("ECMSG",$J)="1^Invalid DSS Unit." Q
    73         . I ECD0="ALL" D  Q
    74         . . S ECKEY=$S($D(^XUSEC("ECALLU",ECDUZ)):1,1:0),DUZ=ECDUZ D ALLU^ECRUTL
    75         . S (ECI,ECNT)=0 F ECI=0:1 S ECX="ECD"_ECI Q:'$D(@ECX)  D
    76         . . K DIC S DIC=724,DIC(0)="QNZX",X=@ECX D ^DIC I Y<0 Q
    77         . . S ECNT=ECNT+1,ECDSSU(ECNT)=Y
    78         D DATECHK(.ECSD,.ECED)
    79         S ECSTDT=ECSD-.0001,ECENDDT=ECED+.9999
    80         I ECPTYP="P" D  Q
    81         . S ECV="ECDATE^ECSTDT^ECENDDT",ECROU="STRPT^ECRDSSU"
    82         . S (ECSAVE("ECLOC("),ECSAVE("ECDSSU("))=""
    83         . S ECDESC="DSS UNIT WORKLOAD SUMMARY REPORT"
    84         . D QUEUE
    85         D STRPT^ECRDSSU
    86         Q
    87 PROSUM  ;Provider (1-3) Summary Report for RPC Call
    88         ;     Variables passed in
    89         ;       ECU    - Provider IEN for file #200
    90         ;       ECSD   - Start Date or Report
    91         ;       ECED   - End Date or Report
    92         ;       ECRY   - Print Procedure Reason (optional)
    93         ;
    94         ;     Variable return
    95         ;       ^TMP($J,"ECRPT",n)=report output or to print device.
    96         N ECV,ECDATE,ECUN,ECROU,ECDESC,DIC,X,Y
    97         S ECV="ECU^ECSD^ECED" D REQCHK(ECV) I ECERR Q
    98         S DIC=200,DIC(0)="QNZX",X=ECU D ^DIC D:Y<0  Q:Y<0  S ECUN=$P(Y,U,2)
    99         . S ^TMP("ECMSG",$J)="1^Invalid Provider."
    100         D DATECHK(.ECSD,.ECED)
    101         I ECRY'="Y" K ECRY
    102         I ECPTYP="P" D  Q
    103         . S ECV="ECU^ECUN^ECDATE^ECSD^ECED^ECRY"
    104         . S ECROU="EN^ECPRSUM1",ECDESC="Event Capture Provider Summary"
    105         . D QUEUE
    106         D EN^ECPRSUM1
    107         Q
    108 ECPROV  ;Provider Summary Report for RPC Call
    109         ;     Variables passed in
    110         ;       ECL    - Location to report (1 or ALL)
    111         ;       ECD    - DSS Unit to report (1 or ALL)
    112         ;       ECSD   - Start Date or Report
    113         ;       ECED   - End Date or Report
    114         ;       ECRY   - Print Procedure Reason (optional)
    115         ;       ECDUZ  - User DUZ (ien in #200)
    116         ;
    117         ;     Variable return
    118         ;       ^TMP($J,"ECRPT",n)=report output or to print device.
    119         N ECV,ECDN,ECDATE,ECLN,ECSAVE,ECDESC,ECROU,DIC,X,Y,CNT,UNIT
    120         S ECDN="ALL",ECV="ECL^ECD^ECSD^ECED^ECDUZ" D REQCHK(ECV) I ECERR Q
    121         I ECL'="ALL" D  I ECERR Q
    122         . ;The line below was changed by VMP for NOIS ANN-1003-42305
    123         . S DIC=4,DIC(0)="QNZX",X=ECL D ^DIC D:Y<0  Q:Y<0  S ECLN=$P(Y,U,2)
    124         . . S ^TMP("ECMSG",$J)="1^Invalid Location.",ECERR=1
    125         I ECD'="ALL" K DIC D  I ECERR Q
    126         . S DIC=724,DIC(0)="QNMZX",X=ECD D ^DIC D:Y<0  Q:Y<0  S ECDN=$P(Y,U,2)
    127         . . S ^TMP("ECMSG",$J)="1^Invalid Location.",ECERR=1
    128         I ECD="ALL",'$D(^XUSEC("ECALLU",ECDUZ)) D
    129         . S (ECD,ECDN)="SOME",(X,CNT)=0
    130         . F  S X=$O(^VA(200,ECDUZ,"EC",X)) Q:'X  D
    131         . . S CNT=CNT+1,UNIT=$P(^VA(200,ECDUZ,"EC",X,0),"^")
    132         . . S UNIT(CNT)=UNIT_"^"_$P(^ECD(UNIT,0),"^")
    133         I $E($G(ECRY))'="Y" K ECRY
    134         D DATECHK(.ECSD,.ECED)
    135         S ECSD=ECSD-.0001,ECED=ECED+.9999 S:'$D(UNIT) UNIT=""
    136         I ECPTYP="P" D  Q
    137         . S ECV="ECDATE^ECSD^ECED^ECRY",ECROU="START^ECPROV2"
    138         . S (ECSAVE("ECL*"),ECSAVE("ECD*"),ECSAVE("UNIT*"))=""
    139         . S ECDESC="EVENT CAPTURE PROVIDER SUMMARY"
    140         . D QUEUE
    141         U IO D START^ECPROV2
    142         Q
    143 ECOSSUM ;Ordering Section Summary Report for RPC Call
    144         ;     Variables passed in
    145         ;       ECOS   - Ordering Section
    146         ;       ECSD   - Start Date or Report
    147         ;       ECED   - End Date or Report
    148         ;       ECL    - Location to report (1 or ALL)
    149         ;       ECD    - DSS Unit to report (1, some or ALL)
    150         ;       ECDUZ  - User ien (#200)
    151         ;
    152         ;     Variable return
    153         ;       ^TMP($J,"ECRPT",n)=report output or to print device.
    154         N ECV,ECI,ECOSN,ECLOC,ECDSSU,ECDATE,ECNT,ECSAVE,ECROU,ECDESC,DUZ,DIC,X,Y
    155         S ECV="ECOS^ECL^ECD0^ECSD^ECED^ECDUZ" D REQCHK(ECV) I ECERR Q
    156         S DIC=723,DIC(0)="QNMZX",X=ECOS D ^DIC D:Y<0  Q:Y<0  S ECOSN=$P(Y,U,2)
    157         . S ^TMP("ECMSG",$J)="1^Invalid Ordering Section.",ECERR=1
    158         D  I '$D(ECLOC) S ^TMP("ECMSG",$J)="1^Invalid Location.",ECERR=1 Q
    159         . K DIC I ECL="ALL" D LOCARRY^ECRUTL Q
    160         . S DIC=4,DIC(0)="QNZX",X=ECL D ^DIC Q:Y<0  S ECLOC(1)=+Y_"^"_$P(Y,U,2)
    161         D  I '$D(ECDSSU) S ^TMP("ECMSG",$J)="1^Invalid DSS Unit." Q
    162         . I ECD0="ALL" D  Q
    163         . . S ECKEY=$S($D(^XUSEC("ECALLU",ECDUZ)):1,1:0),DUZ=ECDUZ D ALLU^ECRUTL
    164         . S (ECI,ECNT)=0 F ECI=0:1 S ECX="ECD"_ECI Q:'$D(@ECX)  D
    165         . . K DIC S DIC=724,DIC(0)="QNMZX",X=@ECX D ^DIC I Y<0 Q
    166         . . S ECNT=ECNT+1,ECDSSU(ECNT)=Y
    167         D DATECHK(.ECSD,.ECED)
    168         S ECSD=ECSD-.0001,ECED=ECED+.9999
    169         I ECPTYP="P" D  Q
    170         . S ECV="ECOS^ECSD^ECED^ECOSN",ECROU="START^ECOSSUM"
    171         . S (ECSAVE("ECLOC("),ECSAVE("ECDSSU("))=""
    172         . S ECDESC="EC Ordering Section Summary"
    173         . D QUEUE
    174         D START^ECOSSUM
    175         Q
    176 ECPCER  ;PCE Data Summary Report for RPC Call
    177         ;     Variables passed in
    178         ;       ECDFN  - Patient IEN for file #2
    179         ;       ECSD   - Start Date or Report
    180         ;       ECED   - End Date or Report
    181         ;
    182         ;     Variable return
    183         ;       ^TMP($J,"ECRPT",n)=report output or to print device.
    184         N ECV,ECDATE,ECPAT,ECROU,ECDESC,X,DIC,Y
    185         S ECV="ECDFN^ECSD^ECED" D REQCHK(ECV) I ECERR Q
    186         S DIC=2,DIC(0)="QNMZX",X=ECDFN D ^DIC D:Y<0  Q:Y<0  S ECPAT=$P(Y,U,2)
    187         . S ^TMP("ECMSG",$J)="1^Invalid Provider."
    188         D DATECHK(.ECSD,.ECED)
    189         S ECSD=ECSD-.0001,ECED=ECED+.9999
    190         I ECPTYP="P" D  Q
    191         . S ECV="ECDFN^ECPAT^ECDATE^ECSD^ECED",ECROU="SUM^ECPCER"
    192         . S ECDESC="ECS/PCE PATIENT SUMMARY"
    193         . D QUEUE
    194         D SUM^ECPCER
    195         Q
     1ECRRPT ;ALB/JAM;Event Capture Report RPC Broker ;Jan 2, 2001
     2 ;;2.0; EVENT CAPTURE ;**25,32,41,56,61,82**;8 May 96
     3 ;
     4REQCHK(ECV) ;Required data check
     5 N I,C
     6 S C=1
     7 F I=1:1:$L(ECV,U) I '$D(@$P(ECV,U,I)) D
     8 . S ^TMP("ECMSG",$J,C)="0^Required data missing "_$P(ECV,U,I)
     9 . S C=C+1,ECERR=1
     10 Q
     11DATECHK(ECSD,ECED) ;Check human format date and converts to FileMan format
     12 ;    Input  ECSD  - Start Date (ex. 10/9/01)
     13 ;           ECED  - End Date
     14 N ECI,X,Y
     15 S %DT="X" F ECI="ECSD","ECED" S X=@ECI D ^%DT S @ECI=Y
     16 S ECSD=$S(ECSD=-1:DT,1:ECSD),ECED=$S(ECED=-1:DT,1:ECED)
     17 S ECDATE=$$FMTE^XLFDT(ECSD)_"^"_$$FMTE^XLFDT(ECED)
     18 Q
     19QUEUE ;Queues report to printer
     20 N ZTIO,ZTDESC,ZTRTN,ZTDTH,ZTSAVE,%ZIS,I,IOP,POP
     21 S XNAM=$P($G(^%ZIS(1,ECDEV,0)),U,2)
     22 S IOP="Q;`"_ECDEV,%ZIS="Q" D ^%ZIS I POP D  Q
     23 . ;S IOP="Q;"_XNAM,%ZIS="Q" D ^%ZIS I POP D  Q
     24 . S ^TMP("ECMSG",$J,1)="0^Device selection unsuccessful"
     25 S ZTIO=ION,ZTDESC=ECDESC,ZTRTN=ECROU
     26 S ZTDTH=$$FMTH^XLFDT(ECQDT)
     27 ;D NOW^%DTC S ZTDTH=$S(%'<ECQDT:%+.0002,1:ECQDT)
     28 F I=1:1:$L(ECV,U) I $D(@$P(ECV,U,I)) S ZTSAVE($P(ECV,U,I))=""
     29 M ZTSAVE=ECSAVE
     30 D ^%ZTLOAD,HOME^%ZIS,^%ZISC ;K IO("Q")
     31 I $D(ZTSK) S ^TMP("ECMSG",$J)="1^Report queued. Task #"_ZTSK Q
     32 S ^TMP("ECMSG",$J)="0^Task Rejected"
     33 Q
     34 ;
     35ECPAT ;Patient Summary Report for RPC Call
     36 ;     Variables passed in
     37 ;       ECDFN  - Patient IEN for file #2
     38 ;       ECSD   - Start Date or Report
     39 ;       ECED   - End Date or Report
     40 ;       ECRY   - Print Procedure Reason (optional)
     41 ;
     42 ;     Variable return
     43 ;       ^TMP($J,"ECRPT",n)=report output or to print device.
     44 N ECDATE,ECPAT,ECV,DIC,X,Y,ECROU,ECDESC
     45 S ECV="ECDFN^ECSD^ECED" D REQCHK(ECV) I ECERR Q
     46 S DIC=2,DIC(0)="QNMZX",X=ECDFN D ^DIC Q:Y<0  S ECPAT=$P(Y,U,2)
     47 D DATECHK(.ECSD,.ECED)
     48 S ECSD=ECSD-.0001,ECED=ECED+.9999
     49 I $E($G(ECRY))'="Y" K ECRY
     50 I ECPTYP="P" D  Q
     51 . S ECV="ECDFN^ECPAT^ECDATE^ECSD^ECED^ECRY",ECROU="SUM^ECPAT"
     52 . S ECDESC="EVENT CAPTURE PATIENT SUMMARY"
     53 . D QUEUE
     54 D SUM^ECPAT
     55 Q
     56ECRDSSU ;DSS Unit Workload Summary Report
     57 ;     Variables passed in
     58 ;       ECL    - Location to report (1 or ALL)
     59 ;       ECD    - DSS Unit to report (1, some or ALL)
     60 ;       ECSD   - Start Date or Report
     61 ;       ECED   - End Date or Report
     62 ;       ECDUZ  - User IEN from file (#200)
     63 ;
     64 ;     Variable return
     65 ;       ^TMP($J,"ECRPT",n)=report output or to print device.
     66 N ECLOC,ECDSSU,ECV,ECI,ECSTDT,ECENDDT,ECKEY,ECROU,ECSAVE,ECDESC,ECNT
     67 N ECDATE,ECX,DUZ,DIC,X,Y
     68 S ECV="ECL^ECD0^ECSD^ECED^ECDUZ" D REQCHK(ECV) I ECERR Q
     69 D  I '$D(ECLOC) S ^TMP("ECMSG",$J)="1^Invalid Location." Q
     70 . I ECL="ALL" D LOCARRY^ECRUTL Q
     71 . S DIC=4,DIC(0)="QNZX",X=ECL D ^DIC Q:Y<0  S ECLOC(1)=+Y_"^"_$P(Y,U,2)
     72 D  I '$D(ECDSSU) S ^TMP("ECMSG",$J)="1^Invalid DSS Unit." Q
     73 . I ECD0="ALL" D  Q
     74 . . S ECKEY=$S($D(^XUSEC("ECALLU",ECDUZ)):1,1:0),DUZ=ECDUZ D ALLU^ECRUTL
     75 . S (ECI,ECNT)=0 F ECI=0:1 S ECX="ECD"_ECI Q:'$D(@ECX)  D
     76 . . K DIC S DIC=724,DIC(0)="QNMZX",X=@ECX D ^DIC I Y<0 Q
     77 . . S ECNT=ECNT+1,ECDSSU(ECNT)=Y
     78 D DATECHK(.ECSD,.ECED)
     79 S ECSTDT=ECSD-.0001,ECENDDT=ECED+.9999
     80 I ECPTYP="P" D  Q
     81 . S ECV="ECDATE^ECSTDT^ECENDDT",ECROU="STRPT^ECRDSSU"
     82 . S (ECSAVE("ECLOC("),ECSAVE("ECDSSU("))=""
     83 . S ECDESC="DSS UNIT WORKLOAD SUMMARY REPORT"
     84 . D QUEUE
     85 D STRPT^ECRDSSU
     86 Q
     87PROSUM ;Provider (1-3) Summary Report for RPC Call
     88 ;     Variables passed in
     89 ;       ECU    - Provider IEN for file #200
     90 ;       ECSD   - Start Date or Report
     91 ;       ECED   - End Date or Report
     92 ;       ECRY   - Print Procedure Reason (optional)
     93 ;
     94 ;     Variable return
     95 ;       ^TMP($J,"ECRPT",n)=report output or to print device.
     96 N ECV,ECDATE,ECUN,ECROU,ECDESC,DIC,X,Y
     97 S ECV="ECU^ECSD^ECED" D REQCHK(ECV) I ECERR Q
     98 S DIC=200,DIC(0)="QNZX",X=ECU D ^DIC D:Y<0  Q:Y<0  S ECUN=$P(Y,U,2)
     99 . S ^TMP("ECMSG",$J)="1^Invalid Provider."
     100 D DATECHK(.ECSD,.ECED)
     101 I ECRY'="Y" K ECRY
     102 I ECPTYP="P" D  Q
     103 . S ECV="ECU^ECUN^ECDATE^ECSD^ECED^ECRY"
     104 . S ECROU="EN^ECPRSUM1",ECDESC="Event Capture Provider Summary"
     105 . D QUEUE
     106 D EN^ECPRSUM1
     107 Q
     108ECPROV ;Provider Summary Report for RPC Call
     109 ;     Variables passed in
     110 ;       ECL    - Location to report (1 or ALL)
     111 ;       ECD    - DSS Unit to report (1 or ALL)
     112 ;       ECSD   - Start Date or Report
     113 ;       ECED   - End Date or Report
     114 ;       ECRY   - Print Procedure Reason (optional)
     115 ;       ECDUZ  - User DUZ (ien in #200)
     116 ;
     117 ;     Variable return
     118 ;       ^TMP($J,"ECRPT",n)=report output or to print device.
     119 N ECV,ECDN,ECDATE,ECLN,ECSAVE,ECDESC,ECROU,DIC,X,Y,CNT,UNIT
     120 S ECDN="ALL",ECV="ECL^ECD^ECSD^ECED^ECDUZ" D REQCHK(ECV) I ECERR Q
     121 I ECL'="ALL" D  I ECERR Q
     122 . ;The line below was changed by VMP for NOIS ANN-1003-42305
     123 . S DIC=4,DIC(0)="QNZX",X=ECL D ^DIC D:Y<0  Q:Y<0  S ECLN=$P(Y,U,2)
     124 . . S ^TMP("ECMSG",$J)="1^Invalid Location.",ECERR=1
     125 I ECD'="ALL" K DIC D  I ECERR Q
     126 . S DIC=724,DIC(0)="QNMZX",X=ECD D ^DIC D:Y<0  Q:Y<0  S ECDN=$P(Y,U,2)
     127 . . S ^TMP("ECMSG",$J)="1^Invalid Location.",ECERR=1
     128 I ECD="ALL",'$D(^XUSEC("ECALLU",ECDUZ)) D
     129 . S (ECD,ECDN)="SOME",(X,CNT)=0
     130 . F  S X=$O(^VA(200,ECDUZ,"EC",X)) Q:'X  D
     131 . . S CNT=CNT+1,UNIT=$P(^VA(200,ECDUZ,"EC",X,0),"^")
     132 . . S UNIT(CNT)=UNIT_"^"_$P(^ECD(UNIT,0),"^")
     133 I $E($G(ECRY))'="Y" K ECRY
     134 D DATECHK(.ECSD,.ECED)
     135 S ECSD=ECSD-.0001,ECED=ECED+.9999 S:'$D(UNIT) UNIT=""
     136 I ECPTYP="P" D  Q
     137 . S ECV="ECDATE^ECSD^ECED^ECRY",ECROU="START^ECPROV2"
     138 . S (ECSAVE("ECL*"),ECSAVE("ECD*"),ECSAVE("UNIT*"))=""
     139 . S ECDESC="EVENT CAPTURE PROVIDER SUMMARY"
     140 . D QUEUE
     141 U IO D START^ECPROV2
     142 Q
     143ECOSSUM ;Ordering Section Summary Report for RPC Call
     144 ;     Variables passed in
     145 ;       ECOS   - Ordering Section
     146 ;       ECSD   - Start Date or Report
     147 ;       ECED   - End Date or Report
     148 ;       ECL    - Location to report (1 or ALL)
     149 ;       ECD    - DSS Unit to report (1, some or ALL)
     150 ;       ECDUZ  - User ien (#200)
     151 ;
     152 ;     Variable return
     153 ;       ^TMP($J,"ECRPT",n)=report output or to print device.
     154 N ECV,ECI,ECOSN,ECLOC,ECDSSU,ECDATE,ECNT,ECSAVE,ECROU,ECDESC,DUZ,DIC,X,Y
     155 S ECV="ECOS^ECL^ECD0^ECSD^ECED^ECDUZ" D REQCHK(ECV) I ECERR Q
     156 S DIC=723,DIC(0)="QNMZX",X=ECOS D ^DIC D:Y<0  Q:Y<0  S ECOSN=$P(Y,U,2)
     157 . S ^TMP("ECMSG",$J)="1^Invalid Ordering Section.",ECERR=1
     158 D  I '$D(ECLOC) S ^TMP("ECMSG",$J)="1^Invalid Location.",ECERR=1 Q
     159 . K DIC I ECL="ALL" D LOCARRY^ECRUTL Q
     160 . S DIC=4,DIC(0)="QNZX",X=ECL D ^DIC Q:Y<0  S ECLOC(1)=+Y_"^"_$P(Y,U,2)
     161 D  I '$D(ECDSSU) S ^TMP("ECMSG",$J)="1^Invalid DSS Unit." Q
     162 . I ECD0="ALL" D  Q
     163 . . S ECKEY=$S($D(^XUSEC("ECALLU",ECDUZ)):1,1:0),DUZ=ECDUZ D ALLU^ECRUTL
     164 . S (ECI,ECNT)=0 F ECI=0:1 S ECX="ECD"_ECI Q:'$D(@ECX)  D
     165 . . K DIC S DIC=724,DIC(0)="QNMZX",X=@ECX D ^DIC I Y<0 Q
     166 . . S ECNT=ECNT+1,ECDSSU(ECNT)=Y
     167 D DATECHK(.ECSD,.ECED)
     168 S ECSD=ECSD-.0001,ECED=ECED+.9999
     169 I ECPTYP="P" D  Q
     170 . S ECV="ECOS^ECSD^ECED^ECOSN",ECROU="START^ECOSSUM"
     171 . S (ECSAVE("ECLOC("),ECSAVE("ECDSSU("))=""
     172 . S ECDESC="EC Ordering Section Summary"
     173 . D QUEUE
     174 D START^ECOSSUM
     175 Q
     176ECPCER ;PCE Data Summary Report for RPC Call
     177 ;     Variables passed in
     178 ;       ECDFN  - Patient IEN for file #2
     179 ;       ECSD   - Start Date or Report
     180 ;       ECED   - End Date or Report
     181 ;
     182 ;     Variable return
     183 ;       ^TMP($J,"ECRPT",n)=report output or to print device.
     184 N ECV,ECDATE,ECPAT,ECROU,ECDESC,X,DIC,Y
     185 S ECV="ECDFN^ECSD^ECED" D REQCHK(ECV) I ECERR Q
     186 S DIC=2,DIC(0)="QNMZX",X=ECDFN D ^DIC D:Y<0  Q:Y<0  S ECPAT=$P(Y,U,2)
     187 . S ^TMP("ECMSG",$J)="1^Invalid Provider."
     188 D DATECHK(.ECSD,.ECED)
     189 S ECSD=ECSD-.0001,ECED=ECED+.9999
     190 I ECPTYP="P" D  Q
     191 . S ECV="ECDFN^ECPAT^ECDATE^ECSD^ECED",ECROU="SUM^ECPCER"
     192 . S ECDESC="ECS/PCE PATIENT SUMMARY"
     193 . D QUEUE
     194 D SUM^ECPCER
     195 Q
  • WorldVistAEHR/trunk/r/EVENT_CAPTURE-EC--ECT--ECX/ECUMRPC1.m

    r613 r623  
    1 ECUMRPC1        ;ALB/JAM-Event Capture Management Broker Utilities ;28 Nov 00
    2         ;;2.0; EVENT CAPTURE ;**25,30,33,72,94**;8 May 96;Build 4
    3         ;
    4 DSSUNT(RESULTS,ECARY)   ;
    5         ;
    6         ;This broker entry point returns DSS units from file 724
    7         ;        RPC: EC GETDSSUNIT
    8         ;INPUTS         ECARY - Contains the following subscripted elements
    9         ;               STAT   - Active or inactive DSS Units (optional)
    10         ;               A-ctive (default), I-nactive, B-oth
    11         ;
    12         ;OUTPUTS        RESULTS - Array of DSS units. Data pieces as follows:-
    13         ;               PIECE - Description
    14         ;                 1     IEN of DSS Unit
    15         ;                 2     Name of DSS Unit
    16         ;                 3     Service
    17         ;                 4     Medical Specialty
    18         ;                 5     Cost Center
    19         ;                 6     Unit Number
    20         ;                 7     Inactive Flag
    21         ;                 8     Associated Stop code (if not sending to PCE)
    22         ;                 9     Category flag
    23         ;                 10    Default date entry
    24         ;                 11    Send to PCE Flag
    25         ;
    26         N UNT,STAT,CNT,CAT,NODE,ECS,STR,SRV,MED,CST,UNO,INACT,ASC,PCE,ACT,NODE
    27         N DFD
    28         D SETENV^ECUMRPC
    29         K ^TMP($J,"ECDSSUNT")
    30         S STAT=$P($G(ECARY),U),(CNT,UNT)=0 S:STAT="" STAT="A"
    31         F  S UNT=$O(^ECD(UNT)) Q:'UNT  S NODE=$G(^ECD(UNT,0)) I NODE'="" D
    32         . S ECS=$P(NODE,U,8),ACT=$P(NODE,U,6),ACT=$S(ACT:1,1:0)
    33         . Q:'ECS  I $S(STAT="A"&(ACT):1,STAT="I"&('ACT):1,1:0) Q
    34         . S CNT=CNT+1,CAT=$P(NODE,U,11),CAT=$S(CAT:"Y",1:"N"),UNO=$P(NODE,U,5)
    35         . S SRV=$$GET1^DIQ(49,$P(NODE,U,2),.01,"I")
    36         . S MED=$$GET1^DIQ(723,$P(NODE,U,3),.01,"I")
    37         . S CST=$$GET1^DIQ(420.1,$P(NODE,U,4),.01,"I")
    38         . S INACT=$P(NODE,U,6),INACT=$S(INACT:"I",1:"A"),ASC=$P(NODE,U,10)
    39         . S:ASC ASC=$$GET1^DIQ(40.7,ASC,.01,"I")
    40         . S DFD=$S($P(NODE,U,12)="N":"N",1:"X"),PCE=$P(NODE,U,14)
    41         . S PCE=$S(PCE="A":PCE,PCE="O":PCE,1:"N")
    42         . S STR=UNT_U_$P(NODE,U)_U_SRV_U_MED_U_CST_U_UNO_U_INACT_U_ASC_U_CAT
    43         . S STR=STR_U_DFD_U_PCE,^TMP($J,"ECDSSUNT",CNT)=STR
    44         S RESULTS=$NA(^TMP($J,"ECDSSUNT"))
    45         Q
    46 CAT(RESULTS,ECARY)      ;
    47         ;
    48         ;This broker entry point returns a list of categories from file 726
    49         ;        RPC: EC GETCAT
    50         ;INPUTS         ECARY - Contains the following subscripted elements
    51         ;                STAT - Active or inactive category (optional)
    52         ;                A-ctive (default), I-nactive, B-oth
    53         ;
    54         ;OUTPUTS        RESULTS - Array of category. Data pieces as follows:-
    55         ;               PIECE - Description
    56         ;                 1     IEN of Category
    57         ;                 2     Name of Category
    58         ;                 3     Creation Date
    59         ;                 4     Inactive Date
    60         ;
    61         N STAT,CNT,CAT,NODE,ECDT,INDT,CRDT
    62         D SETENV^ECUMRPC
    63         K ^TMP($J,"ECCAT")
    64         S STAT=$P($G(ECARY),U),(CNT,CAT)=0 S:STAT="" STAT="A"
    65         F  S CAT=$O(^EC(726,CAT)) Q:'CAT  S NODE=$G(^EC(726,CAT,0)) I NODE'="" D
    66         . S ECDT=$P(NODE,U,3)
    67         . I STAT="A",ECDT'="",ECDT'>DT Q
    68         . I STAT="I",ECDT="" Q
    69         . S CRDT=$$FMTE^XLFDT($P(NODE,U,2),"2F")
    70         . S INDT=$$FMTE^XLFDT($P(NODE,U,3),"2F")
    71         . ;S CNT=CNT+1,^TMP($J,"ECCAT",CNT)=CAT_U_$P(NODE,U)_U_CRDT_U_INDT
    72         . S CNT=CNT+1,^TMP($J,"ECCAT",CNT)=CAT_U_$P(NODE,U)_U_$P(CRDT,"@",1)_U_$P(INDT,"@",1)
    73         S RESULTS=$NA(^TMP($J,"ECCAT"))
    74         Q
    75         ;
    76 CATCHK(RESULTS,ECARY)   ;
    77         ;
    78         ;Broker call checks whether category is used in an Event Code Screen.
    79         ;        RPC: EC DSSCATCHECK
    80         ;INPUTS   ECARY  - Contains the following subscripted elements
    81         ;          ECDA  - DSS Unit ien (file #724)
    82         ;
    83         ;OUTPUTS  RESULTS - Category used in Event Code Screen, 1-Yes or 0-No
    84         ;
    85         N ECDA,ECFLG,ECX
    86         D SETENV^ECUMRPC
    87         S ECDA=$P(ECARY,U) I ECDA="" Q
    88         S (ECFLG,ECX)=0
    89         F  S ECX=$O(^ECJ("AP",ECX)) Q:'ECX!(ECFLG)  D
    90         . I $D(^ECJ("AP",ECX,ECDA)) S ECFLG=1
    91         S RESULTS=ECFLG
    92         Q
    93 PXCHK(RESULTS,ECARY)    ;
    94         ;
    95         ;Checks whether procedure description or national number exist
    96         ;INPUTS   ECARY  - Contains the following subscripted elements
    97         ;          ECP - Procedure description
    98         ;          ECN - EC National Number
    99         ;
    100         ;OUTPUTS  RESULTS - Px used^National # used, 1-Yes or 0-No ex. 1^0
    101         ;
    102         N ECX,ECP,ECN
    103         Q:$G(ECARY)
    104         D SETENV^ECUMRPC
    105         S ECP=$P(ECARY,U),ECN=$P(ECARY,U,2),RESULTS="0^0"
    106         I ECP'="",$D(^EC(725,"B",ECP)) S $P(RESULTS,U)=1
    107         I ECN'="" F ECX="E","D","DL" D  I $P(RESULTS,U,2) Q
    108         . I $D(^EC(725,ECX,ECN)) S $P(RESULTS,U,2)=1
    109         Q
    110 SRCLST(RESULTS,ECARY)   ;
    111         ;
    112         ;This broker entry returns an array of codes from a file based on a
    113         ;search string.
    114         ;        RPC: EC GETLIST
    115         ;
    116         ;INPUTS      ECARY   - Contains the following subscripted elements
    117         ;             ECSTR  - Search string
    118         ;             ECFIL  - File to search
    119         ;             ECDIR  - Search order
    120         ;
    121         ;OUTPUTS     RESULTS - Array of values based on the search criteria.
    122         ;
    123         N ECNT,DIC,ECSTR,ECFIL,ECORD,ECER,ECDI
    124         D SETENV^ECUMRPC
    125         S ECNT=0,ECFIL=$P(ECARY,U),ECSTR=$P(ECARY,U,2),ECDIR=$P(ECARY,U,3)
    126         S ECORD=$S(ECDIR=-1:"B",1:"I")
    127         K ^TMP($J,"ECFIND"),^TMP("ECSRCH",$J)
    128         I ECFIL="" Q
    129         S ECNUM=44
    130         I ECFIL=420.1 D CSTCTR            ;Cost Center search
    131         I ECFIL=49 D SERVC                ;Service search
    132         I ECFIL=723 D MEDSPC              ;Medical specialty
    133         I ECFIL=40.7 D STPCDE G EXIT      ;Associated stop code
    134         I ECFIL=724 D DUNT G EXIT         ;DSS Unit
    135         I ECFIL=726 D ECAT                ;Category
    136         I ECFIL=4 D LOC                   ;Location
    137         I ECFIL=44 D ASCLN G EXIT         ;Associated clinic
    138         I ECFIL=757.01 D LEX^ECUMRPC2 G EXIT  ;Lex ICD code
    139         I ECFIL=200 D PROV^ECUMRPC2      ;Providers
    140         I $D(ECER) S ^TMP($J,"ECFIND",1)="0^Error occurred during search" G EXIT
    141         D SORT
    142 EXIT    K ^TMP("ECSRCH",$J)
    143         S RESULTS=$NA(^TMP($J,"ECFIND"))
    144         Q
    145 ASCLN   ;Search for active associated clinics (file #44)
    146         N CNT,NOD,ECDT,INACT,REACT,ERR
    147         S CNT=0,ECDT=DT
    148         F  Q:CNT=ECNUM  S ECSTR=$O(^SC("B",ECSTR),ECDIR) Q:ECSTR=""  S CLN="" D
    149         .F  S CLN=$O(^SC("B",ECSTR,CLN),ECDIR) Q:CLN=""  S NOD=$G(^SC(CLN,0)) D
    150         ..Q:NOD=""  Q:$P(NOD,U,3)'="C"  ;Q:+$G(^SC(CLN,"OOS"))
    151         ..S ERR=0 I $D(^SC(CLN,"I")) D  I ERR Q
    152         ...S INACT=$P(^SC(CLN,"I"),U),REACT=$P(^SC(CLN,"I"),U,2)
    153         ...I INACT D  I ERR Q
    154         ....I REACT="" S:ECDT'<INACT ERR=1 Q
    155         ....I ECDT'<INACT,ECDT<REACT S ERR=1 Q
    156         ...I REACT,ECDT<REACT S ERR=1
    157         ..S CNT=CNT+1,^TMP($J,"ECFIND",CNT)=CLN_U_$P(NOD,U)
    158         Q
    159 CSTCTR  ;Search for cost centers (File #420.1)
    160         N ECNULL,INDX,STR,NSTR,I
    161         S $P(ECNULL," ",7)=" ",INDX="B"
    162         I $E(ECSTR)?.N,$L(ECSTR)<7 S ECSTR=ECSTR_$E(ECNULL,1,7-$L(ECSTR))
    163         I $L($P(ECSTR," "))=6,$P(ECSTR," ",2)?.A D   ;truncate for x-ref
    164         . S ECSTR=$P(ECSTR," ")_" "_$E($P(ECSTR," ",2,999),1,22)
    165         I $E(ECSTR)?.A S INDX="C",(STR,NSTR)="" D  S ECSTR=NSTR
    166         .F I=1:1 S STR=$P(ECSTR," ",I) Q:STR=""  D
    167         ..S STR=$E(STR)_$TR($E(STR,2,9999),"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
    168         ..S NSTR=NSTR_STR
    169         D LISTDIC(ECFIL,"",.01,ECORD,ECNUM,ECSTR,"",INDX,"I '$P(^(0),U,2)","","^TMP(""ECSRCH"",$J)","ECER")
    170         Q
    171 SERVC   ;Search for services (File #49)
    172         D LISTDIC(ECFIL,"",.01,ECORD,ECNUM,ECSTR,"","","","","^TMP(""ECSRCH"",$J)","ECER")
    173         Q
    174 MEDSPC  ;Search for medical specialty (File #723)
    175         D LISTDIC(ECFIL,"",.01,ECORD,ECNUM,ECSTR,"","","","","^TMP(""ECSRCH"",$J)","ECER")
    176         Q
    177 STPCDE  ;Search for associated stop code (File #40.7)
    178         N ECNT,INDX,ECNUL,STR,IEN
    179         S $P(ECNUL,"  ",30)=" ",INDX="B",ECNT=0,ECSTR=$P(ECSTR,"~")
    180         I +ECSTR,+ECSTR?.N S INDX="C",IEN=0 D  Q
    181         .S ECSTR=$O(^DIC(40.7,INDX,+ECSTR)) I ECSTR="" Q
    182         .F  S IEN=$O(^DIC(40.7,INDX,ECSTR,IEN)) Q:'IEN  D  I ECNT>(ECNUM-1) Q
    183         ..S STR=$G(^DIC(40.7,IEN,0)) I (STR="")!($P(STR,U,3)'="") Q
    184         ..S STR=$E($P(STR,U),1,30)_"  ["_$J($P(STR,U,2),3,0)_"]"_U_$P(STR,U,2)_U_IEN
    185         ..S ECNT=ECNT+1,^TMP($J,"ECFIND",ECNT)=STR
    186         D LISTDIC(ECFIL,"",".01;1",ECORD,ECNUM,ECSTR,"",INDX,"I $P(^(0),""^"",3)=""""!($P(^(0),U,3)'<DT)","","^TMP(""ECSRCH"",$J)","ECER")
    187         S ECNT=0
    188         F  S ECNT=$O(^TMP("ECSRCH",$J,"DILIST","ID",ECNT)) Q:'ECNT  D
    189         .S STR=$G(^TMP("ECSRCH",$J,"DILIST","ID",ECNT,.01))_U_$G(^(1))
    190         .S STR=$E($P(STR,U),1,30)_"  ["_$J($P(STR,U,2),3,0)_"]"_U_$P(STR,U,2)
    191         .S ^TMP($J,"ECFIND",ECNT)=STR_U_^TMP("ECSRCH",$J,"DILIST",2,ECNT)
    192         Q
    193 DUNT    ;Search for DSS unit (File #724)
    194         N ECNT,SNDPCE
    195         D LISTDIC(ECFIL,"",".01;10;13",ECORD,ECNUM,ECSTR,"","","I '$P(^(0),""^"",6),$P(^(0),U,8)","","^TMP(""ECSRCH"",$J)","ECER")
    196         S ECNT=0
    197         F  S ECNT=$O(^TMP("ECSRCH",$J,"DILIST","ID",ECNT)) Q:'ECNT  D
    198         .S SNDPCE=$G(^TMP("ECSRCH",$J,"DILIST","ID",ECNT,13))
    199         .S SNDPCE=$S(SNDPCE="O":1,SNDPCE="A":1,1:0)
    200         .S ^TMP($J,"ECFIND",ECNT)=$G(^TMP("ECSRCH",$J,"DILIST","ID",ECNT,.01))_U_^TMP("ECSRCH",$J,"DILIST",2,ECNT)_U_$G(^TMP("ECSRCH",$J,"DILIST","ID",ECNT,10))_U_SNDPCE
    201         Q
    202 ECAT    ;Search for Category (File #726)
    203         D LISTDIC(ECFIL,"",.01,ECORD,ECNUM,ECSTR,"","","I $P(^(0),""^"",3)=""""!($P(^(0),U,3)>DT)","","^TMP(""ECSRCH"",$J)","ECER")
    204         Q
    205 LOC     ;Search for Location (File #4)
    206         D LISTDIC(ECFIL,"",.01,ECORD,ECNUM,ECSTR,"","","I $G(^(""EC""))","","^TMP(""ECSRCH"",$J)","ECER")
    207         Q
    208 LISTDIC(ECFL,ECIEN,ECFLD,ECFLG,ECNUM,ECFRM,ECPRT,ECINDX,ECSCN,ECIND,ECTG,ECER)  ;
    209         ;Produces a list of records in a file base on search string
    210         N DIC
    211         D LIST^DIC(ECFL,ECIEN,ECFLD,ECFLG,ECNUM,ECFRM,ECPRT,ECINDX,ECSCN,ECIND,ECTG,ECER)
    212         K ECFL,ECIEN,ECFLD,ECFLG,ECNUM,ECFRM,ECPRT,ECINDX,ECSCN,ECID
    213         Q
    214 SORT    ;Extracts data to be returned to broker
    215         N ECNT,STR
    216         S ECNT=0
    217         F  S ECNT=$O(^TMP("ECSRCH",$J,"DILIST","ID",ECNT)) Q:'ECNT  D
    218         .S ^TMP($J,"ECFIND",ECNT)=$G(^TMP("ECSRCH",$J,"DILIST","ID",ECNT,.01))_U_^TMP("ECSRCH",$J,"DILIST",2,ECNT)
    219         Q
     1ECUMRPC1 ;ALB/JAM-Event Capture Management Broker Utilities ;28 Nov 00
     2 ;;2.0; EVENT CAPTURE ;**25,30,33,72**;8 May 96
     3 ;
     4DSSUNT(RESULTS,ECARY) ;
     5 ;
     6 ;This broker entry point returns DSS units from file 724
     7 ;        RPC: EC GETDSSUNIT
     8 ;INPUTS         ECARY - Contains the following subscripted elements
     9 ;               STAT   - Active or inactive DSS Units (optional)
     10 ;               A-ctive (default), I-nactive, B-oth
     11 ;
     12 ;OUTPUTS        RESULTS - Array of DSS units. Data pieces as follows:-
     13 ;               PIECE - Description
     14 ;                 1     IEN of DSS Unit
     15 ;                 2     Name of DSS Unit
     16 ;                 3     Service
     17 ;                 4     Medical Specialty
     18 ;                 5     Cost Center
     19 ;                 6     Unit Number
     20 ;                 7     Inactive Flag
     21 ;                 8     Associated Stop code (if not sending to PCE)
     22 ;                 9     Category flag
     23 ;                 10    Default date entry
     24 ;                 11    Send to PCE Flag
     25 ;
     26 N UNT,STAT,CNT,CAT,NODE,ECS,STR,SRV,MED,CST,UNO,INACT,ASC,PCE,ACT,NODE
     27 N DFD
     28 D SETENV^ECUMRPC
     29 K ^TMP($J,"ECDSSUNT")
     30 S STAT=$P($G(ECARY),U),(CNT,UNT)=0 S:STAT="" STAT="A"
     31 F  S UNT=$O(^ECD(UNT)) Q:'UNT  S NODE=$G(^ECD(UNT,0)) I NODE'="" D
     32 . S ECS=$P(NODE,U,8),ACT=$P(NODE,U,6),ACT=$S(ACT:1,1:0)
     33 . Q:'ECS  I $S(STAT="A"&(ACT):1,STAT="I"&('ACT):1,1:0) Q
     34 . S CNT=CNT+1,CAT=$P(NODE,U,11),CAT=$S(CAT:"Y",1:"N"),UNO=$P(NODE,U,5)
     35 . S SRV=$$GET1^DIQ(49,$P(NODE,U,2),.01,"I")
     36 . S MED=$$GET1^DIQ(723,$P(NODE,U,3),.01,"I")
     37 . S CST=$$GET1^DIQ(420.1,$P(NODE,U,4),.01,"I")
     38 . S INACT=$P(NODE,U,6),INACT=$S(INACT:"I",1:"A"),ASC=$P(NODE,U,10)
     39 . S:ASC ASC=$$GET1^DIQ(40.7,ASC,.01,"I")
     40 . S DFD=$S($P(NODE,U,12)="N":"N",1:"X"),PCE=$P(NODE,U,14)
     41 . S PCE=$S(PCE="A":PCE,PCE="O":PCE,1:"N")
     42 . S STR=UNT_U_$P(NODE,U)_U_SRV_U_MED_U_CST_U_UNO_U_INACT_U_ASC_U_CAT
     43 . S STR=STR_U_DFD_U_PCE,^TMP($J,"ECDSSUNT",CNT)=STR
     44 S RESULTS=$NA(^TMP($J,"ECDSSUNT"))
     45 Q
     46CAT(RESULTS,ECARY) ;
     47 ;
     48 ;This broker entry point returns a list of categories from file 726
     49 ;        RPC: EC GETCAT
     50 ;INPUTS         ECARY - Contains the following subscripted elements
     51 ;                STAT - Active or inactive category (optional)
     52 ;                A-ctive (default), I-nactive, B-oth
     53 ;
     54 ;OUTPUTS        RESULTS - Array of category. Data pieces as follows:-
     55 ;               PIECE - Description
     56 ;                 1     IEN of Category
     57 ;                 2     Name of Category
     58 ;                 3     Creation Date
     59 ;                 4     Inactive Date
     60 ;
     61 N STAT,CNT,CAT,NODE,ECDT,INDT,CRDT
     62 D SETENV^ECUMRPC
     63 K ^TMP($J,"ECCAT")
     64 S STAT=$P($G(ECARY),U),(CNT,CAT)=0 S:STAT="" STAT="A"
     65 F  S CAT=$O(^EC(726,CAT)) Q:'CAT  S NODE=$G(^EC(726,CAT,0)) I NODE'="" D
     66 . S ECDT=$P(NODE,U,3)
     67 . I STAT="A",ECDT'="",ECDT'>DT Q
     68 . I STAT="I",ECDT="" Q
     69 . S CRDT=$$FMTE^XLFDT($P(NODE,U,2),"2F")
     70 . S INDT=$$FMTE^XLFDT($P(NODE,U,3),"2F")
     71 . S CNT=CNT+1,^TMP($J,"ECCAT",CNT)=CAT_U_$P(NODE,U)_U_CRDT_U_INDT
     72 S RESULTS=$NA(^TMP($J,"ECCAT"))
     73 Q
     74 ;
     75CATCHK(RESULTS,ECARY) ;
     76 ;
     77 ;Broker call checks whether category is used in an Event Code Screen.
     78 ;        RPC: EC DSSCATCHECK
     79 ;INPUTS   ECARY  - Contains the following subscripted elements
     80 ;          ECDA  - DSS Unit ien (file #724)
     81 ;
     82 ;OUTPUTS  RESULTS - Category used in Event Code Screen, 1-Yes or 0-No
     83 ;
     84 N ECDA,ECFLG,ECX
     85 D SETENV^ECUMRPC
     86 S ECDA=$P(ECARY,U) I ECDA="" Q
     87 S (ECFLG,ECX)=0
     88 F  S ECX=$O(^ECJ("AP",ECX)) Q:'ECX!(ECFLG)  D
     89 . I $D(^ECJ("AP",ECX,ECDA)) S ECFLG=1
     90 S RESULTS=ECFLG
     91 Q
     92PXCHK(RESULTS,ECARY) ;
     93 ;
     94 ;Checks whether procedure description or national number exist
     95 ;INPUTS   ECARY  - Contains the following subscripted elements
     96 ;          ECP - Procedure description
     97 ;          ECN - EC National Number
     98 ;
     99 ;OUTPUTS  RESULTS - Px used^National # used, 1-Yes or 0-No ex. 1^0
     100 ;
     101 N ECX,ECP,ECN
     102 Q:$G(ECARY)
     103 D SETENV^ECUMRPC
     104 S ECP=$P(ECARY,U),ECN=$P(ECARY,U,2),RESULTS="0^0"
     105 I ECP'="",$D(^EC(725,"B",ECP)) S $P(RESULTS,U)=1
     106 I ECN'="" F ECX="E","D","DL" D  I $P(RESULTS,U,2) Q
     107 . I $D(^EC(725,ECX,ECN)) S $P(RESULTS,U,2)=1
     108 Q
     109SRCLST(RESULTS,ECARY) ;
     110 ;
     111 ;This broker entry returns an array of codes from a file based on a
     112 ;search string.
     113 ;        RPC: EC GETLIST
     114 ;
     115 ;INPUTS      ECARY   - Contains the following subscripted elements
     116 ;             ECSTR  - Search string
     117 ;             ECFIL  - File to search
     118 ;             ECDIR  - Search order
     119 ;
     120 ;OUTPUTS     RESULTS - Array of values based on the search criteria.
     121 ;
     122 N ECNT,DIC,ECSTR,ECFIL,ECORD,ECER,ECDI
     123 D SETENV^ECUMRPC
     124 S ECNT=0,ECFIL=$P(ECARY,U),ECSTR=$P(ECARY,U,2),ECDIR=$P(ECARY,U,3)
     125 S ECORD=$S(ECDIR=-1:"B",1:"I")
     126 K ^TMP($J,"ECFIND"),^TMP("ECSRCH",$J)
     127 I ECFIL="" Q
     128 S ECNUM=44
     129 I ECFIL=420.1 D CSTCTR            ;Cost Center search
     130 I ECFIL=49 D SERVC                ;Service search
     131 I ECFIL=723 D MEDSPC              ;Medical specialty
     132 I ECFIL=40.7 D STPCDE G EXIT      ;Associated stop code
     133 I ECFIL=724 D DUNT G EXIT         ;DSS Unit
     134 I ECFIL=726 D ECAT                ;Category
     135 I ECFIL=4 D LOC                   ;Location
     136 I ECFIL=44 D ASCLN G EXIT         ;Associated clinic
     137 I ECFIL=757.01 D LEX^ECUMRPC2 G EXIT  ;Lex ICD code
     138 I ECFIL=200 D PROV^ECUMRPC2      ;Providers
     139 I $D(ECER) S ^TMP($J,"ECFIND",1)="0^Error occurred during search" G EXIT
     140 D SORT
     141EXIT K ^TMP("ECSRCH",$J)
     142 S RESULTS=$NA(^TMP($J,"ECFIND"))
     143 Q
     144ASCLN ;Search for active associated clinics (file #44)
     145 N CNT,NOD,ECDT,INACT,REACT,ERR
     146 S CNT=0,ECDT=DT
     147 F  Q:CNT=ECNUM  S ECSTR=$O(^SC("B",ECSTR),ECDIR) Q:ECSTR=""  S CLN="" D
     148 .F  S CLN=$O(^SC("B",ECSTR,CLN),ECDIR) Q:CLN=""  S NOD=$G(^SC(CLN,0)) D
     149 ..Q:NOD=""  Q:$P(NOD,U,3)'="C"  ;Q:+$G(^SC(CLN,"OOS"))
     150 ..S ERR=0 I $D(^SC(CLN,"I")) D  I ERR Q
     151 ...S INACT=$P(^SC(CLN,"I"),U),REACT=$P(^SC(CLN,"I"),U,2)
     152 ...I INACT D  I ERR Q
     153 ....I REACT="" S:ECDT'<INACT ERR=1 Q
     154 ....I ECDT'<INACT,ECDT<REACT S ERR=1 Q
     155 ...I REACT,ECDT<REACT S ERR=1
     156 ..S CNT=CNT+1,^TMP($J,"ECFIND",CNT)=CLN_U_$P(NOD,U)
     157 Q
     158CSTCTR ;Search for cost centers (File #420.1)
     159 N ECNULL,INDX,STR,NSTR,I
     160 S $P(ECNULL," ",7)=" ",INDX="B"
     161 I $E(ECSTR)?.N,$L(ECSTR)<7 S ECSTR=ECSTR_$E(ECNULL,1,7-$L(ECSTR))
     162 I $L($P(ECSTR," "))=6,$P(ECSTR," ",2)?.A D   ;truncate for x-ref
     163 . S ECSTR=$P(ECSTR," ")_" "_$E($P(ECSTR," ",2,999),1,22)
     164 I $E(ECSTR)?.A S INDX="C",(STR,NSTR)="" D  S ECSTR=NSTR
     165 .F I=1:1 S STR=$P(ECSTR," ",I) Q:STR=""  D
     166 ..S STR=$E(STR)_$TR($E(STR,2,9999),"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
     167 ..S NSTR=NSTR_STR
     168 D LISTDIC(ECFIL,"",.01,ECORD,ECNUM,ECSTR,"",INDX,"I '$P(^(0),U,2)","","^TMP(""ECSRCH"",$J)","ECER")
     169 Q
     170SERVC ;Search for services (File #49)
     171 D LISTDIC(ECFIL,"",.01,ECORD,ECNUM,ECSTR,"","","","","^TMP(""ECSRCH"",$J)","ECER")
     172 Q
     173MEDSPC ;Search for medical specialty (File #723)
     174 D LISTDIC(ECFIL,"",.01,ECORD,ECNUM,ECSTR,"","","","","^TMP(""ECSRCH"",$J)","ECER")
     175 Q
     176STPCDE ;Search for associated stop code (File #40.7)
     177 N ECNT,INDX,ECNUL,STR,IEN
     178 S $P(ECNUL,"  ",30)=" ",INDX="B",ECNT=0,ECSTR=$P(ECSTR,"~")
     179 I +ECSTR,+ECSTR?.N S INDX="C",IEN=0 D  Q
     180 .S ECSTR=$O(^DIC(40.7,INDX,+ECSTR)) I ECSTR="" Q
     181 .F  S IEN=$O(^DIC(40.7,INDX,ECSTR,IEN)) Q:'IEN  D  I ECNT>(ECNUM-1) Q
     182 ..S STR=$G(^DIC(40.7,IEN,0)) I (STR="")!($P(STR,U,3)'="") Q
     183 ..S STR=$E($P(STR,U),1,30)_"  ["_$J($P(STR,U,2),3,0)_"]"_U_$P(STR,U,2)_U_IEN
     184 ..S ECNT=ECNT+1,^TMP($J,"ECFIND",ECNT)=STR
     185 D LISTDIC(ECFIL,"",".01;1",ECORD,ECNUM,ECSTR,"",INDX,"I $P(^(0),""^"",3)=""""!($P(^(0),U,3)'<DT)","","^TMP(""ECSRCH"",$J)","ECER")
     186 S ECNT=0
     187 F  S ECNT=$O(^TMP("ECSRCH",$J,"DILIST","ID",ECNT)) Q:'ECNT  D
     188 .S STR=$G(^TMP("ECSRCH",$J,"DILIST","ID",ECNT,.01))_U_$G(^(1))
     189 .S STR=$E($P(STR,U),1,30)_"  ["_$J($P(STR,U,2),3,0)_"]"_U_$P(STR,U,2)
     190 .S ^TMP($J,"ECFIND",ECNT)=STR_U_^TMP("ECSRCH",$J,"DILIST",2,ECNT)
     191 Q
     192DUNT ;Search for DSS unit (File #724)
     193 N ECNT,SNDPCE
     194 D LISTDIC(ECFIL,"",".01;10;13",ECORD,ECNUM,ECSTR,"","","I '$P(^(0),""^"",6),$P(^(0),U,8)","","^TMP(""ECSRCH"",$J)","ECER")
     195 S ECNT=0
     196 F  S ECNT=$O(^TMP("ECSRCH",$J,"DILIST","ID",ECNT)) Q:'ECNT  D
     197 .S SNDPCE=$G(^TMP("ECSRCH",$J,"DILIST","ID",ECNT,13))
     198 .S SNDPCE=$S(SNDPCE="O":1,SNDPCE="A":1,1:0)
     199 .S ^TMP($J,"ECFIND",ECNT)=$G(^TMP("ECSRCH",$J,"DILIST","ID",ECNT,.01))_U_^TMP("ECSRCH",$J,"DILIST",2,ECNT)_U_$G(^TMP("ECSRCH",$J,"DILIST","ID",ECNT,10))_U_SNDPCE
     200 Q
     201ECAT ;Search for Category (File #726)
     202 D LISTDIC(ECFIL,"",.01,ECORD,ECNUM,ECSTR,"","","I $P(^(0),""^"",3)=""""!($P(^(0),U,3)>DT)","","^TMP(""ECSRCH"",$J)","ECER")
     203 Q
     204LOC ;Search for Location (File #4)
     205 D LISTDIC(ECFIL,"",.01,ECORD,ECNUM,ECSTR,"","","I $G(^(""EC""))","","^TMP(""ECSRCH"",$J)","ECER")
     206 Q
     207LISTDIC(ECFL,ECIEN,ECFLD,ECFLG,ECNUM,ECFRM,ECPRT,ECINDX,ECSCN,ECIND,ECTG,ECER) ;
     208 ;Produces a list of records in a file base on search string
     209 N DIC
     210 D LIST^DIC(ECFL,ECIEN,ECFLD,ECFLG,ECNUM,ECFRM,ECPRT,ECINDX,ECSCN,ECIND,ECTG,ECER)
     211 K ECFL,ECIEN,ECFLD,ECFLG,ECNUM,ECFRM,ECPRT,ECINDX,ECSCN,ECID
     212 Q
     213SORT ;Extracts data to be returned to broker
     214 N ECNT,STR
     215 S ECNT=0
     216 F  S ECNT=$O(^TMP("ECSRCH",$J,"DILIST","ID",ECNT)) Q:'ECNT  D
     217 .S ^TMP($J,"ECFIND",ECNT)=$G(^TMP("ECSRCH",$J,"DILIST","ID",ECNT,.01))_U_^TMP("ECSRCH",$J,"DILIST",2,ECNT)
     218 Q
  • WorldVistAEHR/trunk/r/EVENT_CAPTURE-EC--ECT--ECX/ECUURPC.m

    r613 r623  
    1 ECUURPC ;ALB/JAM;Event Capture Data Entry Broker Utilities ;Aug 28, 2000
    2         ;;2.0; EVENT CAPTURE ;**25,42,49,94**;8 May 96;Build 4
    3         ;
    4 ECHELP(RESULTS,ECARY)   ;
    5         ;
    6         ;Broker call returns the entries from HELP FILE #9.2
    7         ;        RPC: EC GETSCNHELP
    8         ;INPUTS   ECARY - Contains the following elements
    9         ;          HLPDA  - Help Frame Name
    10         ;
    11         ;OUTPUTS  RESULTS - Array of help text in the HELP FRAM File (#9.2)
    12         ;
    13         N HLPDA,DIC,X,Y
    14         S HLPDA=$G(ECARY) I HLPDA="" Q
    15         D SETENV^ECUMRPC K ^TMP($J,"ECHELP")
    16         S DIC="^DIC(9.2,",DIC(0)="MN",X=HLPDA
    17         D ^DIC M ^TMP($J,"ECHELP")=^DIC(9.2,+Y,1)
    18         I $D(^TMP($J,"ECHELP")) D
    19         . S $P(^TMP($J,"ECHELP",0),U)=$P(^DIC(9.2,+Y,0),U,2)
    20         S RESULTS=$NA(^TMP($J,"ECHELP"))
    21         Q
    22 FNDIEN(RESULTS,ECARY)   ;find IEN
    23         ;Broker call returns the IEN from a file
    24         ;        RPC: EC GETIEN
    25         ;INPUTS   ECARY - Contains the following data elements
    26         ;          FIL  - File number
    27         ;          TXT  - .01 description
    28         ;
    29         ;OUTPUTS  RESULTS - File IEN
    30         ;
    31         N TXT,FIL,DIC,X,Y
    32         D SETENV^ECUMRPC
    33         S FIL=$P(ECARY,U),TXT=$P(ECARY,U,2) I TXT=""!(FIL="") Q
    34         S DIC=FIL,DIC(0)="MN",X=TXT
    35         I FIL=81.3 S DIC("S")="I $P(^DIC(81.3,Y,0),U,5)'=1" ;PATCH 94
    36         D ^DIC I Y=-1 Q
    37         S RESULTS=+Y
    38         Q
    39 ECDATE(RESULTS,ECARY)   ;
    40         ;
    41         ;Broker call returns an Fileman internal date
    42         ;        RPC: EC GETDATE
    43         ;INPUTS   ECARY - Contains the following elements
    44         ;          DTSTR  - Date String
    45         ;          FLG    - Date Flag (optional)
    46         ;
    47         ;OUTPUTS  RESULTS - A valid Fileman date format^External format
    48         ;
    49         N ECDTSTR,DIC,X,Y,DTSTR,FLG
    50         D SETENV^ECUMRPC
    51         S DTSTR=$P(ECARY,U),FLG=$P(ECARY,U,2) I DTSTR="" Q
    52         S X=DTSTR,%DT="XT"_$S(FLG="R":"R",1:""),%DT(0)="-NOW" D ^%DT
    53         I +Y<1 S RESULTS="0^Invalid Date/Time" Q
    54         S RESULTS=Y D D^DIQ
    55         S RESULTS=RESULTS_U_Y
    56         Q
    57 PATCH(RESULTS,ECARY)       ;
    58         ;
    59         ;Broker call returns 1 if patch X is installed
    60         ;        RPC: EC GETPATCH
    61         ;INPUTS   ECARY - contains the patch number
    62         ;
    63         ;OUTPUTS  RESULTS 1 OR 0
    64         ;
    65         I ECARY="" Q
    66         D SETENV^ECUMRPC
    67         S RESULTS=$$PATCH^XPDUTL(ECARY)
    68         Q
    69 VERSRV(RESULTS,ECARY,VERSION)     ; Return server version of option name and
    70         ; minimum GUI client version.
    71         ;
    72         ;Server/client version consist of 4 pieces, namely
    73         ;    major version.minor version.release.build  (ex. 2.0.10.1)
    74         ;
    75         ;Broker call returns server version of option name
    76         ;        RPC: EC GETVERSION
    77         ;INPUTS   ECARY - contains the option name
    78         ;         VERSION - EC GUI client version ;stay in partition for session
    79         ;
    80         ;OUTPUTS  RESULTS version number OR null ("")
    81         ;           current server version^minimum client version
    82         ;
    83         S ECCLVER=$G(VERSION)
    84         I $G(ECARY)="" Q
    85         N ECLST,ECMINV
    86         S ECMINV="2.0.10.1"    ; Minimum version of EC GUI client
    87         D FIND^DIC(19,"",1,"X",ECARY,1,,,,"ECLST")
    88         I 'ECLST("DILIST",0) S RESULTS="" Q
    89         S RESULTS=ECLST("DILIST","ID",1,1)
    90         S RESULTS=$P(RESULTS,"version ",2)_U_ECMINV
    91         Q
     1ECUURPC ;ALB/JAM;Event Capture Data Entry Broker Utilities ;Aug 28, 2000
     2 ;;2.0; EVENT CAPTURE ;**25,42,49**;8 May 96
     3 ;
     4ECHELP(RESULTS,ECARY) ;
     5 ;
     6 ;Broker call returns the entries from HELP FILE #9.2
     7 ;        RPC: EC GETSCNHELP
     8 ;INPUTS   ECARY - Contains the following elements
     9 ;          HLPDA  - Help Frame Name
     10 ;
     11 ;OUTPUTS  RESULTS - Array of help text in the HELP FRAM File (#9.2)
     12 ;
     13 N HLPDA,DIC,X,Y
     14 S HLPDA=$G(ECARY) I HLPDA="" Q
     15 D SETENV^ECUMRPC K ^TMP($J,"ECHELP")
     16 S DIC="^DIC(9.2,",DIC(0)="MN",X=HLPDA
     17 D ^DIC M ^TMP($J,"ECHELP")=^DIC(9.2,+Y,1)
     18 I $D(^TMP($J,"ECHELP")) D
     19 . S $P(^TMP($J,"ECHELP",0),U)=$P(^DIC(9.2,+Y,0),U,2)
     20 S RESULTS=$NA(^TMP($J,"ECHELP"))
     21 Q
     22FNDIEN(RESULTS,ECARY) ;find IEN
     23 ;Broker call returns the IEN from a file
     24 ;        RPC: EC GETIEN
     25 ;INPUTS   ECARY - Contains the following data elements
     26 ;          FIL  - File number
     27 ;          TXT  - .01 description
     28 ;
     29 ;OUTPUTS  RESULTS - File IEN
     30 ;
     31 N TXT,FIL,DIC,X,Y
     32 D SETENV^ECUMRPC
     33 S FIL=$P(ECARY,U),TXT=$P(ECARY,U,2) I TXT=""!(FIL="") Q
     34 S DIC=FIL,DIC(0)="MN",X=TXT
     35 D ^DIC I Y=-1 Q
     36 S RESULTS=+Y
     37 Q
     38ECDATE(RESULTS,ECARY) ;
     39 ;
     40 ;Broker call returns an Fileman internal date
     41 ;        RPC: EC GETDATE
     42 ;INPUTS   ECARY - Contains the following elements
     43 ;          DTSTR  - Date String
     44 ;          FLG    - Date Flag (optional)
     45 ;
     46 ;OUTPUTS  RESULTS - A valid Fileman date format^External format
     47 ;
     48 N ECDTSTR,DIC,X,Y,DTSTR,FLG
     49 D SETENV^ECUMRPC
     50 S DTSTR=$P(ECARY,U),FLG=$P(ECARY,U,2) I DTSTR="" Q
     51 S X=DTSTR,%DT="XT"_$S(FLG="R":"R",1:""),%DT(0)="-NOW" D ^%DT
     52 I +Y<1 S RESULTS="0^Invalid Date/Time" Q
     53 S RESULTS=Y D D^DIQ
     54 S RESULTS=RESULTS_U_Y
     55 Q
     56PATCH(RESULTS,ECARY)    ;
     57 ;
     58 ;Broker call returns 1 if patch X is installed
     59 ;        RPC: EC GETPATCH
     60 ;INPUTS   ECARY - contains the patch number
     61 ;
     62 ;OUTPUTS  RESULTS 1 OR 0
     63 ;
     64 I ECARY="" Q
     65 D SETENV^ECUMRPC
     66 S RESULTS=$$PATCH^XPDUTL(ECARY)
     67 Q
     68VERSRV(RESULTS,ECARY,VERSION)   ; Return server version of option name and
     69 ; minimum GUI client version.
     70 ;
     71 ;Server/client version consist of 4 pieces, namely
     72 ;    major version.minor version.release.build  (ex. 2.0.10.1)
     73 ;
     74 ;Broker call returns server version of option name
     75 ;        RPC: EC GETVERSION
     76 ;INPUTS   ECARY - contains the option name
     77 ;         VERSION - EC GUI client version ;stay in partition for session
     78 ;
     79 ;OUTPUTS  RESULTS version number OR null ("")
     80 ;           current server version^minimum client version
     81 ;
     82 S ECCLVER=$G(VERSION)
     83 I $G(ECARY)="" Q
     84 N ECLST,ECMINV
     85 S ECMINV="2.0.10.1"    ; Minimum version of EC GUI client
     86 D FIND^DIC(19,"",1,"X",ECARY,1,,,,"ECLST")
     87 I 'ECLST("DILIST",0) S RESULTS="" Q
     88 S RESULTS=ECLST("DILIST","ID",1,1)
     89 S RESULTS=$P(RESULTS,"version ",2)_U_ECMINV
     90 Q
Note: See TracChangeset for help on using the changeset viewer.