Ignore:
Timestamp:
Dec 4, 2009, 8:26:01 PM (15 years ago)
Author:
George Lilly
Message:

WorldVistAEHR overlayed on FOIAVistA

Location:
FOIAVistA/tag/r
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • FOIAVistA/tag/r/CLINICAL_PROCEDURES-MD/MDAPI.m

    r628 r636  
    11MDAPI ; HOIFO/DP/NCA - CP API Calls ; [05-05-2003 10:28]
    2  ;;1.0;CLINICAL PROCEDURES;**6**;Apr 01, 2004;Build 102
     2 ;;1.0;CLINICAL PROCEDURES;;Apr 01, 2004
    33 ; Description:
    44 ; These API's are for use by external packages communicating with CP.
    55 ;
    66 ; Integration Agreements:
    7  ; IA# 3378 [Subscription] Documents the APIs that external packages use to communicate with CP.
     7 ; IA# 3378 [Restricted] Documents the APIs that external packages use to communicate with CP.
    88 ; IA# 3468 [Subscription] Use GMRCCP APIs.
    99 ;
     
    138138 ;  1. MDNOTE [Literal/Required] TIU IEN
    139139 ;
    140  N MDGBL,MDRES,MDFDA,MDTRAN,RESULTS
     140 N MDRES,MDFDA,RESULTS
    141141 S MDRES="" F  S MDRES=$O(^MDD(702,"ATIU",MDNOTE,MDRES)) Q:'MDRES  D
    142142 .Q:$G(^MDD(702,+MDRES,0))=""
    143  .;S MDFDA(702,MDRES_",",.05)=""
     143 .S MDFDA(702,MDRES_",",.05)=""
    144144 .S MDFDA(702,MDRES_",",.06)=""
    145145 .D FILE^DIE("","MDFDA")
    146  .S MDTRAN=$O(^MDD(702.001,"ASTUDY",MDRES,MDNOTE,0)) I +MDTRAN N DA,DIK S DA=+MDTRAN,DIK="^MDD(702.001," D ^DIK
    147146 .D STATUS^MDRPCOT(MDRES_",",2,"TIU note deleted.")
    148147 .S DATA("TRANSACTION")=MDRES,DATA("PKG")="TIU"
    149148 .S DATA("MESSAGE")="TIU note deleted." D RPC^MDRPCOT(.RESULTS,"ADDMSG",.DATA)
    150  S MDGBL=$NA(^MDD(702.001,"PK",MDNOTE)) F  S MDGBL=$Q(@MDGBL) Q:MDGBL=""  Q:$QS(MDGBL,2)'="PK"!($QS(MDGBL,3)'=MDNOTE)  S MDTRAN=$QS(MDGBL,6) N DA,DIK S DA=+MDTRAN,DIK="^MDD(702.001," D ^DIK
    151149 Q 1
    152150 ;
     
    161159 ;  7. MDNTIU [Literal/Required] The new reassigned TIU document IEN.
    162160 ;
    163  N MDD,MDGBL,MDTRAN,MDCHK,MDLP,MDMULN,MDN,MDPPR,MDREAS,MDTRANI,MDX
     161 N MDD,MDTRAN,MDCHK,MDLP,MDPPR,MDREAS,MDTRANI,MDX
    164162 I '$G(MDFN) Q "0^No DFN for the TIU note re-assignment."
    165163 I '$G(MDOLDC) Q "0^No Old Consult # for the note re-assignment."
     
    169167 I '$G(MDNTIU) Q "0^No New Reassigned TIU IEN."
    170168 S (MDD,MDCHK,MDREAS,MDTRAN)="",MDPPR=0 K ^TMP("MDTMP",$J)
    171  S MDTRAN=$O(^MDD(702,"ATIU",MDANOTE,0)) I +MDTRAN S MDCHK=$G(^MDD(702,MDTRAN,0)),MDTRANI=MDTRAN_"," D
     169 F  S MDTRAN=$O(^MDD(702,"ACON",MDOLDC,MDTRAN)) Q:'MDTRAN  D
     170 .S MDCHK=$G(^MDD(702,MDTRAN,0)),MDTRANI=MDTRAN_","
    172171 .I $P(MDCHK,U,5)=MDOLDC&($P(MDCHK,U,6)=MDANOTE) D
    173  ..S MDFDA(702,+MDTRAN_",",.06)=""
    174  ..D FILE^DIE("","MDFDA") K MDFDA
    175  S MDGBL=$NA(^MDD(702.001,"PK",MDANOTE))
    176  F  S MDGBL=$Q(@MDGBL) Q:MDGBL=""  Q:$QS(MDGBL,2)'="PK"!($QS(MDGBL,3)'=MDANOTE)  S MDN=$QS(MDGBL,6) N DA,DIK S DA=+MDN,DIK="^MDD(702.001," D ^DIK
    177  S MDMULN=+$O(^MDD(702.001,"ASTUDY",+MDTRAN,0))
    178  I '+MDMULN I +MDTRAN N DA,DIK S DA=+MDTRAN,DIK="^MDD(702," D ^DIK
    179  D NOW^%DTC S MDD=% S MDTRANI=$O(^MDD(702,"ACON",MDNEWC,0))
    180  S MDREAS=$P(MDNEWV,";",3)_";"_$P(MDNEWV,";",2)_";"_$P(MDNEWV,";")
    181  I +MDTRANI&(MDNDFN=+$G(^MDD(702,+MDTRANI,0))) D
    182  .S MDPPR=$P($G(^MDD(702,+MDTRANI,0)),"^",4) Q:'MDPPR
    183  .S MDNEWV=$$GETVSTR^MDRPCOT1(MDNDFN,MDREAS,MDPPR,MDD)
    184  .S MDFDA(702,+MDTRANI_",",.06)=MDNTIU
    185  .S MDFDA(702,"+1,",.07)=$P(MDNEWV,";",3)_";"_$P(MDNEWV,";",2)_";"_$P(MDNEWV,";")
    186  .D FILE^DIE("","MDFDA") K MDFDA
     172 ..S:'MDPPR MDPPR=$P(MDCHK,U,4)
     173 ..N DA,DIK S DA=+MDTRAN,DIK="^MDD(702," D ^DIK
    187174 I 'MDPPR D
    188175 .D CPLIST^GMRCCP(MDNDFN,,$NA(^TMP("MDTMP",$J)))
     
    190177 .F  S MDX=$O(^TMP("MDTMP",$J,MDX)) Q:'MDX  S:$P(^(MDX),U,5)=MDNEWC MDPPR=$P(^(MDX),U,6)
    191178 K ^TMP("MDTMP",$J)
    192  I +MDPPR Q 1
     179 I 'MDPPR Q 1
     180 D NOW^%DTC S MDD=%
     181 S MDREAS=$P(MDNEWV,";",3)_";"_$P(MDNEWV,";",2)_";"_$P(MDNEWV,";")
    193182 S MDNEWV=$$GETVSTR^MDRPCOT1(MDNDFN,MDREAS,MDPPR,MDD)
    194183 S MDFDA(702,"+1,",.01)=MDNDFN
     
    200189 S MDFDA(702,"+1,",.07)=$P(MDNEWV,";",3)_";"_$P(MDNEWV,";",2)_";"_$P(MDNEWV,";")
    201190 S MDFDA(702,"+1,",.09)=0
    202  D UPDATE^DIE("","MDFDA")
     191 D UPDATE^DIE("","MDFDA","MDTRANI") Q:'$G(MDTRANI(1)) 1
    203192 Q 1
    204193 ;
     
    210199 Q STR
    211200 ;
    212 GETCP(RESULTS,MDCSLT) ; API to return CP Study data
    213  ; Input Parameters:
    214  ;   1. RESULTS [Literal/Required] Return Array
    215  ;   2. MDCSLT [Literal/Required] Consult number
    216  ;
    217  ; Output:
    218  ;   RESULTS(0)=-1^Error Message or 1 for success
    219  ;          (N,1)=CP Study Number
    220  ;          (N,2)=Patient DFN
    221  ;          (N,3)=Created Date/Time
    222  ;          (N,4)=Created By
    223  ;          (N,5)=CP Definition (External Name)
    224  ;          (N,6)=Consult Number
    225  ;          (N,7)=TIU Note IEN
    226  ;          (N,8)=VSTR
    227  ;          (N,9)=Transaction Status
    228  ;
    229  ; Where N = 1..n entries
    230  ;
    231  N MDCT,MDX,MDY
    232  I '$G(MDCSLT) S @RESULTS@(0)="-1^No Consult Number passed" Q
    233  S MDX=$O(^MDD(702,"ACON",MDCSLT,0)) I 'MDX S @RESULTS@(0)="-1^No CP Study Entry." Q
    234  S @RESULTS@(0)=1
    235  S MDCT=0,MDX="" F  S MDX=$O(^MDD(702,"ACON",MDCSLT,MDX)) Q:MDX<1  D
    236  .S MDCT=MDCT+1,@RESULTS@(MDCT,1)=MDX
    237  .S MDY=$G(^MDD(702,+MDX,0)),@RESULTS@(MDCT,2)=$P(MDY,U),@RESULTS@(MDCT,3)=$P(MDY,U,2),@RESULTS@(MDCT,4)=$P(MDY,U,3),@RESULTS@(MDCT,5)=$$GET1^DIQ(702,+MDX,.04,"E")
    238  .S @RESULTS@(MDCT,6)=$P(MDY,U,5),@RESULTS@(MDCT,7)=$P(MDY,U,6),@RESULTS@(MDCT,8)=$P(MDY,U,7),@RESULTS@(MDCT,9)=$$GET1^DIQ(702,+MDX,.09,"E")
    239  Q
  • FOIAVistA/tag/r/CLINICAL_PROCEDURES-MD/MDHL7A.m

    r628 r636  
    1 MDHL7A ; HOIFO/WAA - Routine to Decode HL7 for CP ;9/17/07  08:17
    2  ;;1.0;CLINICAL PROCEDURES;**6**;Apr 01, 2004;Build 102
     1MDHL7A ; HOIFO/WAA - Routine to Decode HL7 for CP ; [05-07-2001 10:38]
     2 ;;1.0;CLINICAL PROCEDURES;;Apr 01, 2004
    33 ; Reference DBIA #10035 [Supported] for DPT calls.
    44 ; Reference DBIA #10106 [Supported] for HLFNC calls.
    55 ; Reference DBIA #10062 [Supported] for VADPT6 calls.
    6  ; Reference DBIA #2701 [Supported] for MPIF001 calls
    7  ; Reference DBIA #10096 [Supported] for ^%ZOSF calls
     6 ; Reference DBIA #2701 [Supported] for MPIF001 Calls
    87EN ; [Procedure] Entry Point for Message Array in MSG
    98 N %,BID,CODE,CPT,DA,DATE,DFN,DIK,DLCO,DTO,DZ,ERRTX,EXAM,EXE,MDFLAG,FIL
     
    1312 N ECODE,MDIEN,MDOBX,NUMZ,PNAM,ZCODE,MDDEV,MDD702,DEVNAME,DEVIEN,MDQFLG
    1413 N MDIORD
    15  K ^TMP($J,"MDHL7A"),^TMP($J,"MDHL7"),^TMP($J,"MDHL7A1")
     14 K ^TMP($J,"MDHL7A"),^TMP($J,"MDHL7")
    1615 S MDFLAG=0,MDERROR=0,MDQFLG=0
    17  Q:$G(HLMTIENS)=""
    18  S ^TMP($J,"MDHL7A1")=""
    19  S HLREST="^TMP($J,""MDHL7A1"")"
    20  S X=$$MSGIEN^MDHL7U3(HLMTIENS,HLREST) ; This code is to convert the HL7 Message **6**
    21  I $P(X,U)=0 D  Q
    22  . S DEVIEN=0,ECODE=0
    23  . S ERRTX=$P(X,U,2)
    24  . D ^MDHL7X
    25  . Q
    26  I $P(X,U)=1 D XVERT^MDHL7U3("MDHL7A1","MDHL7A")
    27  K HLNODE,^TMP($J,"MDHL7A1")
     16 F I=1:1 X HLNEXT Q:MDQFLG  S ^TMP($J,"MDHL7A",I)=$TR(HLNODE,$C(10),""),J=0 S:HLQUIT<1 MDQFLG=1 F  S J=$O(HLNODE(J)) Q:J<1  S ^TMP($J,"MDHL7A",I,J)=$TR(HLNODE(J),$C(10),"")
     17 K HLNODE
    2818 ;
    2919EN2 ; [Procedure] No Description
    30  S (DEVIEN,DEVNAME)="",I=0
     20 S (DEVIEN,DEVNAME)=""
    3121 F I=1:1 S X=$G(^TMP($J,"MDHL7A",I)) Q:X=""  Q:$E(X,1,3)="OBX"  D
    3222 . S:$E(X,1,3)="MSH" DEVNAME=$P(X,"|",4)
    33  . I DEVNAME="",HLREC("SFN")'="" S DEVNAME=HLREC("SFN")
    3423 . I $E(X,1,3)="MSH",DEVNAME'="Instrument Manager" S DEVIEN=$O(^MDS(702.09,"B",DEVNAME,0))
    3524 . I $E(X,1,3)="OBR" D
     
    5847 I (ZCODE="M")!(ZCODE="B") D  Q:MDERROR  Q:ZCODE="M"  ;
    5948 . S MDFLAG=1,MDERROR=0 ; Tell Medicine that CP is talking to HL7
     49 . ;S MSG(1)=^TMP($J,"MDHL7A",1)
     50 . ;S MSG(2)=^TMP($J,"MDHL7A",2)
    6051 . D ^MDHL7MCA ; Run the Medicine routines
    6152 . Q:MDERROR  ; Medicine found an error and sent an error back
     53 . ;;I ZCODE="M" D GENACK^MDHL7X
    6254 . Q
    6355 S NUMZ=$O(^TMP($J,"MDHL7A",""),-1)
     
    10496 S MDIORD=$P(X,"|",4)
    10597 S MDD702=$S(+MDIORD<1:"",1:$$GETSTDY^MDRPCOT1(MDIORD))
    106  ;I MDD702'="" S MDD702=$$CHK^MDNCHK(MDD702) ; PATCH 11
    10798 S ORIFN=$P(X,"|",3),(EXAM,%)=$P(X,"|",5) I EXAM'="" S EXAM=$P(%,"^",2) I EXAM="" S EXAM=$P(%,"^",1)
    10899 S CPT=$P(X,"|",5) I $P(CPT,"^",3)["CPT" S CPT=$P(CPT,"^",1)
     
    110101 ;  vvv== Added to address the issues of mismatch
    111102 I $G(MDD702)>0 I DFN'=$$GET1^DIQ(702,MDD702,.01,"I") S ERRTX="Patient name Mismatch. Name in PID doesn't match the name in the CP Order #"_MDD702_"." D ^MDHL7X Q
    112  I $G(MDD702)>0 I MDDOB'=$$GET1^DIQ(2,DFN,.03,"I") S ERRTX="Patient DOB Mismatch. DOB in PID doesn't match the DOB in the CP Order #"_MDD702_"." D ^MDHL7X Q
    113103 I DTO="" S ERRTX="Missing required Date/Time of Procedure in OBR" D ^MDHL7X Q
    114104 ;;S UNIQ=$TR($H,",","-")
     
    119109 S MDRTN=$P($G(^MDS(702.09,INST,.1)),"^",1) S:MDRTN'["^" MDRTN="^"_MDRTN
    120110 S X=MDRTN S:X["^" X=$P(X,"^",2) X ^%ZOSF("TEST") I '$T S ERRTX="Processing routine not found" D ^MDHL7X Q  ; IA %10096
    121  D CPTICD^MDHL7U3(X,MDIEN) ; Update CPT and ICD9
    122  D PHY^MDHL7U3(X,MDIEN) ; Get Doc who did the procedure.
    123111 Q
    124112 ;
     
    126114 S X=$G(^TMP($J,"MDHL7A",NUM)) I $E(X,1,3)'="PID" S ERRTX="PID not second record" D ^MDHL7X Q
    127115 S SEG("PID")=X
    128  S MDDOB=$P(X,"|",8) I MDDOB'="" S MDDOB=($E(MDDOB,1,4)-1700)_$E(MDDOB,5,8)
    129116 I $L($P(X,"|",4))'<16 D  I +DFN=-1 Q
    130117 . N ICN
     
    154141 ;
    155142OBX ; [Observation]
     143 ;Q:$P(^TMP($J,"MDHL7A",NUM),"|")'="OBX"
    156144 D @MDRTN
    157145 Q
    158146NEWID(DFN,DATE,INST,MDD702,HLMTIEN) ; Generate a new entry and ID of 703.1
    159  N NEWID,MDFDA,MDIEN,MDNO
     147 N NEWID,MDFDA,MDIEN
    160148 S NEWID=$TR($H,",","-")  ; Create inital ID
    161149 L +(^MDD(703.1,"B")):60 E  Q "-1"
    162  ;^^--- Unable to get a lock in the file
     150 ;^^--- Unable to get an lock in the file
    163151 F  Q:'$D(^MDD(703.1,"B",NEWID))  H 1 S NEWID=$TR($H,",","-")
    164  ;^^--- Search to create a new ID if current ID is in use
     152 ;^^--- Search to create an new ID in current ID is in use
    165153 S MDFDA(703.1,"+1,",.01)=NEWID
    166154 S MDFDA(703.1,"+1,",.02)=DFN
     
    171159 D UPDATE^DIE("","MDFDA","MDIEN")
    172160 L -(^MDD(703.1,"B"))
    173  I $G(MDIEN(1))>0 D  Q MDIEN(1)_U_NEWID
    174  . S ^MDD(703.1,MDIEN(1),.1,0)="^703.11S^0^0"
    175  . S MDNO=$$NTIU^MDRPCW1(+MDD702)
    176  . Q
     161 I $G(MDIEN(1))>0 S ^MDD(703.1,MDIEN(1),.1,0)="^703.11S^0^0" Q MDIEN(1)_U_NEWID
    177162 ; ^^--- Create Subfile and quit
    178163 Q "-1"  ; Unable to create file
  • FOIAVistA/tag/r/CLINICAL_PROCEDURES-MD/MDHL7MCA.m

    r628 r636  
    1 MDHL7MCA ; HOIFO/REL-Routine to Decode HL7 for MEDICINE ; [05-07-2001 10:38]
    2  ;;1.0;CLINICAL PROCEDURES;**6**;Apr 01, 2004;Build 102
     1MDHL7MCA ; HIRMFO/REL-Routine to Decode HL7 for MEDICINE ; [05-07-2001 10:38]
     2 ;;1.0;CLINICAL PROCEDURES;;Apr 01, 2004
    33 ; Reference DBIA #10035 for DPT calls.
    44 ; Reference DBIA #10062 for VADPT calls.
    55 ; Reference DBIA #10106 for HL7 calls.
    6  ; Reference DBIA #10096 for ^%ZOSF calls.
    76EN ; Entry Point for Message Array in MSG
    87 N MSG
     
    3837 ;I $E(MSG(NUM),1,3)="ORC" S NUM=NUM+1
    3938OBR ; Check OBR
     39 W MSG(NUM)
    4040 S X=$G(MSG(NUM)) I $E(X,1,3)'="OBR" S ERRTX="OBR not found when expected" D ^MDHL7MCX G KIL
    4141 S SEG("OBR")=X
  • FOIAVistA/tag/r/CLINICAL_PROCEDURES-MD/MDHL7U3.m

    r628 r636  
    11MDHL7U3 ; HOIFO/WAA -Utilities for CP to process HL7 messages  ; 7/26/00
    2  ;;1.0;CLINICAL PROCEDURES;**6**;Apr 01, 2004;Build 102
    3  ; Reference DBIA #2729 [Supported]  for XMXPAI
     2 ;;1.0;CLINICAL PROCEDURES;;Apr 01, 2004
    43 ; Reference DBIA #4262 [Supported] for HL7 call.
    5  ; Reference DBIA #3273 [Subscription] for HL7 call.
    6  ; Reference DBIA #10138 [Supported] for HL7 call.
    7  ; Reference DBIA #3990 [Supported] for ICDCODE call
    8  ; Reference DBIA #1131 [Supported] for XMB("NETNAME") reference
    9  ; Reference DBIA #1995 [Supported] for ICPTCOD to handle CPT Codes call
    10  ; Reference DBIA #10082 [Supported] for ^ICD9 reference
    11  ; Reference DBIA #10111 [Supported] for FILE 3.8 call
    12  ; Reference DBIA #10103 [Supported] for XLFDT call
    13  ;
    14 HL7CHK(MDD702) ; Check to see of there is an entry in 703.1 for a patient.
    15  N X
    16  S X="1^"
    17  D
    18  . N Y
    19  . I $G(^MDD(702,MDD702,0))="" S X="-1^No Entry in 702." Q
    20  . I $D(^MDD(703.1,"ASTUDYID",MDD702))=0 Q
    21  . S Y=0
    22  . S Y=$O(^MDD(703.1,"ASTUDYID",MDD702,Y)) I Y>0 S X="-1^This Study has Data on file."
    23  . Q
    24  Q X
    25 XVERT(MDA,MDB) ; Strip out blank Lines
    26  Q:MDA=""
    27  Q:MDB=""
    28  Q:$G(^TMP($J,MDA,1))
    29  N I,CNT,CNT2,NODE,FLG
    30  S (CNT,I,FLG)=0
    31  F  S I=$O(^TMP($J,MDA,I)) Q:I<1  D
    32  . S NODE=$TR(^TMP($J,MDA,I),$C(10),"")
    33  . I NODE="" S FLG=0 Q
    34  . I FLG  D  Q
    35  . . S CNT2=CNT2+1
    36  . . S ^TMP($J,MDB,CNT,CNT2)=NODE
    37  . . Q
    38  . I 'FLG D  Q
    39  . . S CNT=CNT+1
    40  . . S ^TMP($J,MDB,CNT)=NODE
    41  . . S FLG=1,CNT2=0
    42  . . Q
    43  . Q
    44  Q
    454 ;
    465PURGE(MDD7031) ;
     
    5211 S $P(^MDD(703.1,MDD7031,0),U,6)=""
    5312 Q
    54  ;
    55 PHY(X,MDIEN) ; Add the doc who did the exam to the report
    56  Q
    57  ; This will be implemented with the Doctor Lookup when it comes out.
    58  N LINE1,LINE
    59  S LINE1=$P(X,"|",17)
    60  S LINE=$P(LINE1,"^",2) ; Last
    61  S LINE=LINE_$S($P(LINE1,"^",3)'="":", "_$P(LINE1,"^",3),1:"") ; First
    62  S LINE=LINE_$S($P(LINE1,"^",4)'="":" "_$P(LINE1,"^",4),1:"") ; MI
    63  D ADD(MDIEN,"9",LINE)
    64  Q
    65  ;
    66 CPTICD(X,MDIEN) ; Break out CPT and ICD9 codes
    67  N ICD,CPT
    68  Q:MDIEN<1
    69  S CPT=$P(X,"|",45) I CPT'="" D FILECD(MDIEN,CPT,"7")
    70  S ICD=$P(X,"|",14) I ICD'="" D FILECD(MDIEN,ICD,"8")
    71  Q
    72 FILECD(MDIEN,CODE,TYPE) ; fILE THE DATA
    73  N LINE,Y,I,CNT,RESULT
    74  S CNT=$L(CODE,"~")
    75  S LINE=""
    76  F I=1:1:CNT S Y=$P(CODE,"~",I),RESULT=$P(Y,"^",1),LINE(.2,I,0)=RESULT
    77  S LINE(.2,0)="^^"_CNT_"^"_CNT_"^"_$P(%,".")
    78  Q:CNT<1  ; file the results if there is any
    79  D ADD(MDIEN,TYPE,.LINE,CNT)
    80  Q
    81  ;
    82 ADD(MDIEN,TYPE,LINE,CNT) ;
    83  ; Create an entry in the .1 node
    84  N NODE,X
    85  S NODE=$G(^MDD(703.1,MDIEN,.1,0)) Q:NODE=""
    86  S NODE=$P(NODE,"^",3)
    87  S NODE=NODE+1
    88  S $P(^MDD(703.1,MDIEN,.1,0),"^",3,4)=NODE_"^"_NODE
    89  S $P(^MDD(703.1,MDIEN,.1,NODE,0),"^")=TYPE
    90  D NOW^%DTC
    91  M ^MDD(703.1,MDIEN,.1,NODE)=LINE
    92  Q
    93  ;
    94 MSGIEN(MDHLIENS,MDHLREST) ; Return the message as definded in MDHLIENS  to the array in MDHLREST
    95  ; Only TCP type messages
    96  ; input: MDHLIENS= the intern entry number of the message in ^HLMA
    97  ; MDHLREST = the return array that will contain the whole HL7 message
    98  ; output: return "1^Message complete" if message was successful, "0^reason" if failed.
    99  ;
    100  N MDHLIEN,MDHLI,MDHLCNT,MDHLZ,RET
    101  S (MDHLCNT,MDHLI,RET)=0
    102  I $G(MDHLIENS)="" S RET=RET_"^No IEN defined" Q RET  ; Exit because no IEN for ^HLMA was provided
    103  I $G(MDHLREST)="" S RET=RET_"^No Return ARRAY provided" Q RET  ; Exit because no return array was provided
    104  I $G(^HLMA(MDHLIENS,0))="" S RET=RET_"^HLMA entry does not exist" Q RET  ; Exit because invalid OR non-EXISTING HLMA ENTRY
    105  S MDHLIEN=$P(^HLMA(MDHLIENS,0),U)
    106  I MDHLIEN="" S RET=RET_"^No pointer value to file 772" Q RET  ; No Pointer to 772
    107  I $G(^HL(772,MDHLIEN,0))="" S RET=RET_"^772 Entry does not exist" Q RET  ; No 772 entry exist
    108  ;get header
    109  S MDHLZ=$G(^HLMA(MDHLIENS,"MSH",1,0))
    110  I MDHLZ="" S RET=RET_"^No MSH segment found" Q RET  ; No MSH was found
    111  S MDHLCNT=MDHLCNT+1,@MDHLREST@(MDHLCNT)=MDHLZ
    112  S MDHLCNT=MDHLCNT+1,@MDHLREST@(MDHLCNT)=""
    113  ;get body
    114  S MDHLI=0
    115  F  S MDHLI=$O(^HL(772,MDHLIEN,"IN",MDHLI)) Q:'MDHLI  D
    116  . S MDHLCNT=MDHLCNT+1
    117  . S @MDHLREST@(MDHLCNT)=$G(^HL(772,MDHLIEN,"IN",MDHLI,0))
    118  . Q
    119  I MDHLCNT'>2 S RET=RET_"^No message body found" Q RET  ; There was no body
    120  S RET="1^Message complete"
    121  Q RET
    122  ;
    123 CICNV(MDIEN,RETURN) ; This subroutine will read the data in 703.1 and return the results
    124  ;in the indicated global
    125  N NODE,FLG
    126  S FLG=1
    127  Q:MDIEN=""  ; The ien was null
    128  Q:RETURN=""  ; the array was null
    129  S ARRAY(0)="0^0"
    130  I $G(^MDD(703.1,MDIEN,.1,0))="" S FLG=0 Q  ; There is not data.
    131  ; Start the processing of ICD/POV codes Value is 8
    132  S NODE=0
    133  I FLG I $G(^MDD(703.1,MDIEN,.1,0))'="" D
    134  . F  S NODE=$O(^MDD(703.1,MDIEN,.1,NODE)) Q:NODE<1  D
    135  . . S TYPE=$P($G(^MDD(703.1,MDIEN,.1,NODE,0),0),"^",1)
    136  . . I TYPE=8 D PROCESS(MDIEN,NODE,TYPE,.ARRAY)
    137  . . I TYPE=7 D PROCESS(MDIEN,NODE,TYPE,.ARRAY)
    138  . . Q
    139  . Q
    140  M @RETURN=ARRAY
    141  Q
    142 PROCESS(MDIEN,NODE,TYPE,ARRAY) ; This will process the data for each
    143  N CNT,X,CONT,CODE,AR,TP,LOC
    144  S CNT=0,CONT=0
    145  F  S CNT=$O(^MDD(703.1,MDIEN,.1,NODE,.2,CNT)) Q:CNT<1  D
    146  . S CODE=$G(^MDD(703.1,MDIEN,.1,NODE,.2,CNT,0),"") ; Grabbing the ICD9 AND CPT codes
    147  . I CODE="" Q
    148  . I TYPE=8 S AR=1,TP="POV",X=$$ICDDX^ICDCODE(CODE) Q:X=""  ; Reference DBIA #3990 [Supported] for ICDCODE call
    149  . I TYPE=7 S AR=2,TP="CPT",X=$$CPT^ICPTCOD(CODE) Q:X=""  ; Reference DBIA #1995 [Supported] for ICPTCOD to handle CPT Codes call
    150  . S CONT=CONT+1
    151  . S ARRAY(AR)=CONT_"^"_CONT
    152  . I AR=1 D
    153  . . N DESC,IN,LN
    154  . . S IN=$P(X,"^",1) Q:IN<1
    155  . . S LN=$G(^ICD9(IN,0),0) Q:LN=""
    156  . . S DESC=$P(LN,"^",3) Q:DESC=""
    157  . . S I=CONT
    158  . . S $P(ARRAY(AR,I),"^",1)=TP
    159  . . S $P(ARRAY(AR,I),"^",2)=$P(X,"^",1)
    160  . . S $P(ARRAY(AR,I),"^",3)=$P(X,"^",2)
    161  . . S $P(ARRAY(AR,I),"^",5)=DESC
    162  . . S $P(ARRAY(AR,I),"^",6)=$S(I=1:1,1:0)
    163  . . Q
    164  . I AR=2 D
    165  . . N DESC,IN,LN
    166  . . S IN=$P(X,"^",1) Q:IN<1
    167  . . ; S LN=$G(^ICPT(IN,0),0) Q:LN=""
    168  . . S DESC=$P(X,"^",3) Q:DESC=""  ; DBIA1995 $$CPT^ICPTCOD(CODE) returns X and the second piece of X is the DESC
    169  . . S I=CNT
    170  . . S $P(ARRAY(AR,I),"^",1)=TP
    171  . . S $P(ARRAY(AR,I),"^",2)=$P(X,"^",1)
    172  . . S $P(ARRAY(AR,I),"^",3)=$P(X,"^",2)
    173  . . S $P(ARRAY(AR,I),"^",5)=DESC
    174  . . S $P(ARRAY(AR,I),"^",7)=$S(I=1:1,1:0)
    175  . . Q
    176  . Q
    177  I $D(ARRAY(1))!$D(ARRAY(2)) S ARRAY(0)="1^1"
    178  Q
    179  ;
    180 NOTICE(SUBJECT,TXT,DEVIEN,DUZ) ; This will fire off a mail message to the Indicated mail group saying that a study was deleted
    181  ;
    182  N INST,MG,XMTO,XMDUZ,XMSUBJ,XMBODY,N,X
    183  S MG=0
    184  S INST=DEVIEN
    185  I INST>1 S MG=$P($G(^MDS(702.09,INST,0)),"^",2)
    186  I 'MG!('$$MG^MDHL7U2(MG)) S MG=$$FIND1^DIC(3.8,"","BX","MD DEVICE ERRORS") Q:'MG
    187  S MG=$$GET1^DIQ(3.8,+MG_",",.01)
    188  S XMTO="G."_MG_"@"_^XMB("NETNAME"),XMINSTR("FROM")=.5
    189  S XMBODY="TXT"
    190  S XMSUBJ=SUBJECT
    191  D SENDMSG^XMXAPI(DUZ,XMSUBJ,XMBODY,XMTO,.XMINSTR)
    192  Q
    193  ;
    194 ALERT(MDSIEN) ; This is to send an e-mail to the main device mail group that a study has been deleted
    195  D NOW^%DTC
    196  S SUBJECT="Study "_MDSIEN_" for Patient "_$$GET1^DIQ(702,MDSIEN,.01,"E")_" has been DELETED!"
    197  S BODY(1)="The following study has been deleted."
    198  S BODY(2)="         By the USER:       "_$$GET1^DIQ(200,DUZ,.01,"E")
    199  S BODY(3)="             On Date:       "_$$FMTE^XLFDT(%,1)
    200  S BODY(4)="           "
    201  S BODY(5)="                   CP Study Information"
    202  S BODY(6)="------------------------------------------------------------------------------ "
    203  S BODY(7)="CP Study ID:       "_MDSIEN
    204  S BODY(8)="CP Study Def:      "_$$GET1^DIQ(702,MDSIEN,.04,"E")
    205  S BODY(9)="Created on:        "_$$FMTE^XLFDT($$GET1^DIQ(702,MDSIEN,.02,"I"),1)
    206  S BODY(10)="Created by:        "_$$GET1^DIQ(702,MDSIEN,.03,"E")
    207  S BODY(11)="On Instrument:     "_$$GET1^DIQ(702,MDSIEN,.11,"E")
    208  S BODY(12)="For Patient:       "_$$GET1^DIQ(702,MDSIEN,.01,"E")
    209  S BODY(13)="        SSN:       "_$E($$GET1^DIQ(702,MDSIEN,.011,"E"),6,9)
    210  S BODY(14)="        DOB:       "_$$FMTE^XLFDT($$GET1^DIQ(702,MDSIEN,.012,"I"),1)
    211  S DEVIEN=$$GET1^DIQ(702,MDSIEN,.11,"I")
    212  Q
  • FOIAVistA/tag/r/CLINICAL_PROCEDURES-MD/MDHL7X.m

    r628 r636  
    11MDHL7X ; HOIFO/WAA -Generate HL7 Error Message ; 06/08/00
    2  ;;1.0;CLINICAL PROCEDURES;**6**;Apr 01, 2004;Build 102
     2 ;;1.0;CLINICAL PROCEDURES;;Apr 01, 2004
    33 ; Reference IA #1131 for ^XMB("NETNAME") access.
    44 ; Reference IA #2165 for HLMA1 calls.
     
    1212 S MG=$$GET1^DIQ(3.8,+MG_",",.01)
    1313 S XMTO="G."_MG_"@"_^XMB("NETNAME"),XMINSTR("FROM")=.5
    14  I '$D(X) S X=$G(ECODE(0))
     14 I '$D(X) S X=ECODE(0)
    1515 S TXT(1)=ERRTX,TXT(2)=X,TXT(3)=" "
    1616 S N=3
    17  I '$G(ECODE,1) D  ; This is to process Device errors
     17 I 'ECODE D  ; This is to process Device errors
    1818 . N X
    1919 . S X=0
  • FOIAVistA/tag/r/CLINICAL_PROCEDURES-MD/MDRPCOG.m

    r628 r636  
    11MDRPCOG ; HOIFO/DP - CP Gateway ; [01-09-2003 15:20]
    2  ;;1.0;CLINICAL PROCEDURES;**6**;Apr 01, 2004;Build 102
     2 ;;1.0;CLINICAL PROCEDURES;;Apr 01, 2004
    33 ; Description:
    44 ; This is the main routine that manages the CLINICAL PROCEDURES Gateway functions. 
     
    116116 Q
    117117 ;
    118 RUNNING ; [Procedure] Returns 0/1 and message on running status
    119  ; Note: If lock CAN be obtained, then gateway is NOT running
    120  L +^MDD("CPGATEWAY"):1 E  S @RESULTS@(0)="1^RUNNING" Q
    121  L -(^MDD("CPGATEWAY")) S @RESULTS@(0)="0^NOT RUNNING"
    122  Q
    123  ;
    124118SETFILE ; [Procedure] Set filename of new attachment
    125119 S MDFDA(703.11,$P(DATA,U,1),.02)=$P(DATA,U,2)
  • FOIAVistA/tag/r/CLINICAL_PROCEDURES-MD/MDRPCOP.m

    r628 r636  
    1 MDRPCOP ; HOIFO/DP - Object RPCs (TMDPatient) ;3/12/08  09:16
    2  ;;1.0;CLINICAL PROCEDURES;**4,6**;Apr 01, 2004;Build 102
     1MDRPCOP ; HOIFO/DP - Object RPCs (TMDPatient) ; [01-09-2003 15:21]
     2 ;;1.0;CLINICAL PROCEDURES;**4**;Apr 01, 2004;Build 3
    33 ; Integration Agreements:
    4  ; IA# 2263 [Supported] XPAR calls
    54 ; IA# 3027 [Supported] Calls to DGSEC4
    65 ; IA# 2981 [Subscription] Calls to GUI~GMRCP5
     
    98 ; IA# 10061 [Supported] VADPT calls.
    109 ; IA# 3468 [Subscription] Use GMRCCP APIs.
     10 ; IA# 3266 [Subscription] Call to DPTLK1
    1111 ; IA# 10103 [Supported] Call to XLFDT
    1212 ; IA# 10039 [Supported] Ward Location File (#42) Access.
    1313 ; IA# 10035 [Supported] DPT references
     14 ; IA# 3267 [Subscription] Call to DPTLK1
     15 ; IA# 3593 [Supported] Access to routine DPTLK6 utilities for lookup
    1416 ; IA# 3613 [Private] GETVST^MDRPCOP API call
    1517 ; IA# 10099 [Supported] GMRADPT call
    1618 ; IA# 1096 [Controlled Subscription] ^DGPM("ATID1" x-ref loop
    17  ; IA# 358 [Controlled Subscription] FILE 405 references
    1819 ;
    1920ADD(X) ; [Procedure] Add line to @RESULTS@(...
     
    5051 .I +MDHL7=1 S MDFDA(702,MDIENS,.09)=5,MDFDA(702,MDIENS,.08)=""
    5152 .D:$D(MDFDA) FILE^DIE("","MDFDA","MDERR")
    52  ; Patch 6 - Renal Check-In
    53  D:+$G(MDIENS)
    54  .S X=+$P(^MDD(702,+MDIENS,0),U,4) Q:'X
    55  .I $P(^MDS(702.01,X,0),U,6)=2 D  Q  ; Renal Check-In
    56  ..D CP^MDKUTLR(+MDIENS)
    57  ..S MDFDA(702,+MDIENS_",",.09)=5
    58  ..D FILE^DIE("","MDFDA","MDERR")
    59  ; Patch 6 - Renal Check-In
    6053 I '$D(MDERR) S @RESULTS@(0)="1^OK" Q
    6154 D ERROR^MDRPCU(RESULTS,.MDERR)
     
    6861 ;
    6962GETCONS ; [Procedure] Get available consults for patient
    70  K ^TMP("MDTMP",$J) N MDCDT,MDDY,X1,X2,X
    71  S MDDY=$$GET^XPAR("SYS","MD COMPL PROC DISPLAY DAYS",1)
    72  S X1=DT,X2=-$S(MDDY>0:+MDDY,1:365) D C^%DTC S MDCDT=X
     63 K ^TMP("MDTMP",$J)
    7364 D CPLIST^GMRCCP(DFN,,$NA(^TMP("MDTMP",$J)))
    7465 S MDX=0
    7566 F  S MDX=$O(^TMP("MDTMP",$J,MDX)) Q:'MDX  D:"saprc"[$P(^(MDX),U,4)
    7667 .S Y="123;"_$P(^TMP("MDTMP",$J,MDX),U,5)
    77  .I $P($G(^TMP("MDTMP",$J,MDX)),U,4)="c" Q:$P($G(^TMP("MDTMP",$J,MDX)),U,1)<MDCDT
    7868 .F X=2,3,4,1,6,5 S Y=Y_U_$P(^TMP("MDTMP",$J,MDX),U,X)
    7969 .S Y=Y_U_+$O(^MDD(702,"ACON",+$P(^TMP("MDTMP",$J,MDX),U,5)))
     
    124114 ;
    125115GETTRAN ; [Procedure] Get a patients transactions
    126  K ^TMP("MDTMP",$J),^TMP("MDCONL",$J) N MDCDT,MDCOM,MDMULT,MDNUM,MDREQ,MDREQDT,MDYR,X1,X2,X
    127  S MDNUM=$$GET^XPAR("SYS","MD DAYS TO RETAIN COM STUDY",1) S MDCOM=0
    128  I +MDNUM>0 S X1=DT,X2=-MDNUM D C^%DTC S MDCOM=X
    129  D CPLIST^GMRCCP(DFN,,$NA(^TMP("MDTMP",$J)))
    130  S X1=DT,X2=-365 D C^%DTC S MDCDT=X
    131  S MDX=0 F  S MDX=$O(^TMP("MDTMP",$J,MDX)) Q:'MDX  D:"saprc"[$P(^(MDX),U,4)
    132  .I $P($G(^TMP("MDTMP",$J,MDX)),U,4)="c" Q:$P($G(^TMP("MDTMP",$J,MDX)),U,1)<MDCDT
    133  .S ^TMP("MDCONL",$J,$P($G(^TMP("MDTMP",$J,MDX)),U,5))=$P($G(^TMP("MDTMP",$J,MDX)),U,1)
    134  K ^TMP("MDTMP",$J)
    135116 F MDX=0:0 S MDX=$O(^MDD(702,"B",DFN,+MDX))_"," Q:'MDX  D
    136  .Q:'$$GET1^DIQ(702,MDX,.05,"I")
    137  .Q:$G(^TMP("MDCONL",$J,+$$GET1^DIQ(702,MDX,.05,"I")))=""
    138  .S MDMULT=+$$GET1^DIQ(702,MDX,".04:.12","I")
    139  .S MDYR=$S(MDMULT<1:MDCOM,1:MDCDT)
    140  .I MDNUM Q:$$GET1^DIQ(702,MDX,.09,"I")=3&($$GET1^DIQ(702,MDX,.02,"I")<MDYR)
    141  .S MDREQDT="" I +$$GET1^DIQ(702,MDX,.05,"I") S MDREQDT=$G(^TMP("MDCONL",$J,+$$GET1^DIQ(702,MDX,.05,"I")))
    142  .I MDREQDT'="" S MDREQDT=$$FMTE^XLFDT(MDREQDT,"1P")
    143  .S MDREQ=$$GET1^DIQ(702,MDX,.04)_"  "_+MDX_"  (Consult #:"_$$GET1^DIQ(702,MDX,.05,"I")_$S(MDREQDT'="":" Requested: "_MDREQDT,1:"")_")"
    144  .S Z=$$GET1^DIQ(702,MDX,".04:.02","I")_U_MDREQ_U_$$GET1^DIQ(702,MDX,.02,"I")_U_$$GET1^DIQ(702,MDX,.09)_U_$$GET1^DIQ(702,MDX,.11)_U_$$GET1^DIQ(702,MDX,.991)
     117 .S Z=$$GET1^DIQ(702,MDX,".04:.02","I")_U_$$GET1^DIQ(702,MDX,.04)_U_$$GET1^DIQ(702,MDX,.02,"I")_U_$$GET1^DIQ(702,MDX,.09)_U_$$GET1^DIQ(702,MDX,.11)_U_$$GET1^DIQ(702,MDX,.991)
    145118 .S Y=$O(@RESULTS@(""),-1)+1
    146119 .S @RESULTS@(Y)="702;"_+MDX_U_Z
    147120 S @RESULTS@(0)=+$O(@RESULTS@(""),-1)
    148  K ^TMP("MDCONL",$J)
    149121 Q
    150122 ;
    151123GETVST ; [Procedure] Return list of visits
    152  N BEG,END,VAERR,VASD,BDT,DTM,EDT,LOC,NOW,MDQUERY,MDLST,MDTDF,STI,STS,TODAY,I,J,K,XI,XE,X
    153  S NOW=$$NOW^XLFDT(),TODAY=$P(NOW,".",1),MDTDF=DFN
    154  S BEG=$$X2FM($$GETBEG),END=$$X2FM($$GETEND)+0.2359
     124 N BEG,END,VAERR,VASD,BDT,DTM,EDT,LOC,NOW,MDQUERY,MDLST,STI,STS,TODAY,I,J,K,XI,XE,X
     125 S NOW=$$NOW^XLFDT(),TODAY=$P(NOW,".",1)
     126 S BEG=$$X2FM("T-200"),END=$$X2FM("T")+0.2359
    155127 S MDLST="",MDSTOP=""
    156128 I END>NOW D   ; get future encounters, past cancels/no-shows from VADPT
     
    179151 .D CLOSE^SDQ(.MDQUERY)
    180152 N TIM,MOV,MDX0,Y,MTIM,XTYP,XLOC,XLOCI,HLOC,EARLY,DONE ; admits
    181  S EARLY=BEG,DONE=0 S:$G(DFN)="" DFN=MDTDF
     153 S EARLY=BEG,DONE=0
    182154 S TIM="" F  S TIM=$O(^DGPM("ATID1",DFN,TIM)) Q:TIM'>0  D  Q:DONE
    183155 .S MOV=0  F  S MOV=$O(^DGPM("ATID1",DFN,TIM,MOV)) Q:MOV'>0  D  Q:DONE
     
    192164 ..S K=0 F  S K=$O(MDLST(I,J,K)) Q:'K  D
    193165 ...S @RESULTS@($O(@RESULTS@(""),-1)+1)=MDLST(I,J,K)
    194  S:$G(DFN)="" DFN=MDTDF S @RESULTS@(0)=+$O(@RESULTS@(""),-1)_U_($$GET1^DIQ(2,DFN_",",.1)]"")
    195  Q
    196  ;
    197 GETBEG() ; Get Beginning Date Range
    198  I $$GET^XPAR("SYS","MD APPOINT START DATE",1)>1 Q "T-"_$$GET^XPAR("SYS","MD APPOINT START DATE",1)
    199  Q "T-200"
    200 GETEND() ; Get Ending Date Range
    201  I $$GET^XPAR("SYS","MD APPOINT END DATE",1)>1 Q "T+"_$$GET^XPAR("SYS","MD APPOINT END DATE",1)
    202  Q "T"
     166 S @RESULTS@(0)=+$O(@RESULTS@(""),-1)_U_($$GET1^DIQ(2,DFN_",",.1)]"")
     167 Q
     168 ;
    203169LOGSEC ; [Procedure] Log Security
    204  N RES
    205  D NOTICE^DGSEC4(.RES,DFN,DATA,1)
    206  S @RESULTS@(0)=$S(+RES:"1^Logged",1:"-1^Unable to log")
     170 D NOTICE^DGSEC4(.RESULTS,DFN,DATA,1)
     171 S @RESULTS@(0)=$S(RESULTS:"1^Logged",1:"-1^Unable to log")
    207172 Q
    208173 ;
     
    216181 ;
    217182SELECT ; [Procedure] Select patient
    218  ; Moved to continuation routine at MD*1.0*6 due to routine size
    219  D SELECT^MDRPCOP1
     183 I '$D(^DPT(+$G(DFN),0))#2 S @RESULTS@(0)="-1^No such patient" Q
     184 S @RESULTS@(0)="1^Required Identifiers & messages"
     185 S IENS=DFN_","
     186 D FILE^DID(2,,"REQUIRED IDENTIFIERS","MDIDS")
     187 F MDX=0:0 S MDX=$O(MDIDS("REQUIRED IDENTIFIERS",MDX)) Q:'MDX  D
     188 .S MDFLD=MDIDS("REQUIRED IDENTIFIERS",MDX,"FIELD")
     189 .S MDID="$$PTID^"_$$GET1^DID(2,MDFLD,"","LABEL")
     190 .S MDID=MDID_U_$$GET1^DIQ(2,IENS,MDFLD)
     191 .D:MDFLD=.03
     192 ..S MDID=MDID_" ("_$$GET1^DIQ(2,IENS,.033)_")"
     193 ..S MDID=MDID_U_$$DOB^DPTLK1(+IENS)
     194 .D:MDFLD=.09
     195 ..S X=$P(MDID,U,3),X=$E(X,1,3)_"-"_$E(X,4,5)_"-"_$E(X,6,10)
     196 ..S $P(MDID,U,3)=X,$P(MDID,U,4)=$$SSN^DPTLK1(+IENS)
     197 .S @RESULTS@($O(@RESULTS@(""),-1)+1)=MDID
     198 S MDID="$$PTID^"_$$GET1^DID(2,.1,"","LABEL")
     199 S MDID=MDID_U_$$GET1^DIQ(2,IENS,.1)
     200 S @RESULTS@($O(@RESULTS@(""),-1)+1)=MDID
     201 S MDID="$$PTID^"_$$GET1^DID(2,.101,"","LABEL")
     202 S MDID=MDID_U_$$GET1^DIQ(2,IENS,.101)
     203 S @RESULTS@($O(@RESULTS@(""),-1)+1)=MDID
     204 K MDRET
     205 D GUIBS5A^DPTLK6(.MDRET,DFN) D:MDRET(1)=1
     206 .D ADD("$$MSGHDR^2^SAME LAST NAME AND LAST 4")
     207 .S MDX=1
     208 .F  S MDX=$O(MDRET(MDX)) Q:'MDX!(+$G(MDRET(MDX)))  D
     209 ..D ADD($P(MDRET(MDX),U,2))
     210 .D ADD(" ")
     211 .S MDX=1
     212 .F  S MDX=$O(MDRET(MDX)) Q:'MDX  D:+MDRET(MDX)
     213 ..S MDDFN=+$P(MDRET(MDX),U,2)
     214 ..D ADD($$GET1^DIQ(2,MDDFN_",",.01)_"    "_$$DOB^DPTLK1(MDDFN)_"    "_$$SSN^DPTLK1(MDDFN))
     215 .D ADD(" ")
     216 .D ADD("Please review carefully before continuing")
     217 .D ADD("$$MSGEND")
     218 K MDRET
     219 D PTSEC^DGSEC4(.MDRET,DFN) D:MDRET(1)'=0
     220 .D:MDRET(1)=3
     221 ..D ADD("$$MSGHDR^0^CAN'T ACCESS YOUR OWN RECORD!!")
     222 .D:MDRET(1)=-1
     223 ..D ADD("$$MSGHDR^0^INCOMPLETE INFORMATION - CAN'T PROCEED")
     224 .D:MDRET(1)=1
     225 ..D ADD("$$MSGHDR^1^SENSITIVE RECORD ACCESS")
     226 .D:MDRET(1)'=-1&(MDRET(1)'=3)&(MDRET(1)'=1)
     227 ..D ADD("$$MSGHDR^3^SENSITIVE RECORD ACCESS")
     228 .S MDX=1
     229 .F  S MDX=$O(MDRET(MDX)) Q:'MDX  D ADD($TR(MDRET(MDX),"*"," "))
     230 .D ADD("$$MSGEND")
     231 D GUIMTD^DPTLK6(.MDRET,DFN) D:MDRET(1)=1
     232 .D ADD("$$MSGHDR^1^NOTICE")
     233 .F MDX=1:0 S MDX=$O(MDRET(MDX)) Q:'MDX  D ADD(MDRET(MDX))
     234 .D ADD("$$MSGEND")
    220235 Q
    221236 ;
  • FOIAVistA/tag/r/CLINICAL_PROCEDURES-MD/MDRPCOT.m

    r628 r636  
    1 MDRPCOT ; HOIFO/DP/NCA - Object RPCs (TMDTransaction) ;3/12/08  09:18
    2  ;;1.0;CLINICAL PROCEDURES;**5,6**;Apr 01, 2004;Build 102
     1MDRPCOT ; HOIFO/DP/NCA - Object RPCs (TMDTransaction) ;12/5/02  15:33
     2 ;;1.0;CLINICAL PROCEDURES;**5**;Apr 01, 2004;Build 1
    33 ; Integration Agreements:
    44 ; IA# 2693 [Subscription] TIU Extractions.
     
    2222 ; Sets @RESULTS@(0)="-1^Reason for not deleting" or "1^Study Deleted"
    2323 ;
    24  N MDAST,MDHOLD,MDNOTE,MDRES,MDSIEN,BODY,SUBJECT,DEVIEN
     24 N MDHOLD,MDNOTE,MDRES,MDSIEN
    2525 S (MDHOLD,MDSIEN)=+DATA,MDRES=0,MDNOTE=""
    26  D ALERT^MDHL7U3(MDSIEN) ; Builds the body of the mail message
    27  I $G(^MDD(702,+MDSIEN,0))="" S @RESULTS@(0)="1^Study Deleted." D NOTICE^MDHL7U3(SUBJECT,.BODY,DEVIEN,DUZ) Q  ;deleting message
    2826 S:+$P(^MDD(702,MDSIEN,0),U,6) MDNOTE=$P(^MDD(702,MDSIEN,0),U,6)
    2927 I "13"[$P(^MDD(702,MDSIEN,0),U,9) S @RESULTS@(0)="-1^Can't Delete TIU Note from a "_$$GET1^DIQ(702,MDSIEN,.09,"E")_" Study." Q
     
    3735 .Q
    3836 E  D
    39  .I $D(^MDD(702.001,"ASTUDY",MDSIEN)) S @RESULTS@(0)="-1^Note associated with study, can not delete." Q
    40  .S MDAST=$$HL7CHK^MDHL7U3(+MDSIEN) I +MDAST<1 S @RESULTS@(0)=MDAST Q
    41  .D NOTICE^MDHL7U3(SUBJECT,.BODY,DEVIEN,DUZ) ; delete message
    4237 .S MDFDA(702,DATA_",",.01)=""
    43  .; Check for renal study to delete as well
    44  .S:$D(^MDK(704.202,DATA)) MDFDA(704.202,DATA_",",.01)=""
    4538 .D FILE^DIE("","MDFDA")
    4639 .N DA,DIK S DA=+MDSIEN,DIK="^MDD(702," D ^DIK
     
    5851 NEW MDFDA,MDIEN,MDIENS,MDRET,P1,P2,P3,P4
    5952 S P1=$P(DATA,U,1),P2=$P(DATA,U,2),P3=$P(DATA,U,3),P4=$P(DATA,U,4)
    60  S MDIEN=0 I $G(^MDD(702,+P1,0))="" Q
     53 S MDIEN=0
    6154 ; Look for file (All comparisons done on lower case values)
    6255 F  S MDIEN=$O(^MDD(702,P1,.1,MDIEN)) Q:'MDIEN  D  Q:X=P3
     
    9992 S MDFDA(702,DATA,.09)=TYPE
    10093 D FILE^DIE("","MDFDA")
    101  I TYPE=3&($G(^MDK(704.202,+DATA,0))'="") K MDFDA S MDFDA(704.202,DATA,.09)=0 D FILE^DIE("","MDFDA") K MDFDA
    10294 Q
    10395 ;
     
    124116 S MDRESUL=$$NEWTIUN(MDSTUDY)
    125117 ; File TIU Error messages
     118 ;I +MDRESUL<0 D FILEMSG(MDSTUDY,"TIU",2,MDRESUL) Q MDRESUL
    126119 I +MDRESUL<0 D  Q
    127120 .D FILEMSG(MDSTUDY,"TIU",2,MDRESUL)
     
    168161 .S MDVSTR=$$GETVSTR^MDRPCOT1(DFN,MDVSTR,MDPROC,$$GET1^DIQ(702,MDIEN,.02,"I"))
    169162 .S MDLOC=$P(MDVSTR,";",1)
    170  I $$GET1^DIQ(702.01,+MDPROC_",",.12,"I")=1 Q DFN_"^"_MDTITL_"^"_MDLOC_"^^"_MDCON_"^"_MDPROC_"^"_MDVSTR_"^"_MDNVST
    171163 ; Does TIU doc already exist?
    172164 I $$GET1^DIQ(702,MDIEN,.06,"I") Q DFN_"^"_MDTITL_"^"_MDLOC_"^"_+$$GET1^DIQ(702,MDIEN,.06,"I")_"^"_MDCON_"^"_MDPROC_"^"_MDVSTR_"^"_MDNVST
     
    178170 ; Input: STUDY - IENS of CP study entry
    179171 ; Return: TIU Document IEN
    180  N CTR,DFN,MDCON,MDFDA,MDGST,MDL,MDLOC,MDNOTE,MDPDT,MDPROC,MDRESU,MDTITL,MDTSTR,MDVST,MDVSTR,MDWP,MDPT S CTR=0,MDGST=+STUDY,MDRESU=""
     172 N CTR,DFN,MDCON,MDFDA,MDGST,MDL,MDLOC,MDNOTE,MDPDT,MDPROC,MDRESU,MDTITL,MDTSTR,MDVST,MDVSTR,MDWP S CTR=0,MDGST=+STUDY,MDRESU=""
    181173 ; Get data for TIU Note Creation
    182174 S (MDTSTR,MDRESU)=$$GETDATA(MDGST)
     
    192184 ; Create new visit, if no vstring
    193185 S MDPDT=$$PDT^MDRPCOT1(MDGST)
    194  I 'MDPDT S MDPT=$O(^MDD(703.1,"ASTUDYID",+MDGST,0)),MDPDT=$P($G(^MDD(703.1,+MDPT,0)),U,3)
    195186 S:'MDPDT MDPDT=$P(MDVSTR,";",2) ; If No D/T Performed grab visit D/T
    196  I $P(MDVSTR,";",3)="V" S $P(MDVSTR,";",3)="A"
    197187 ; Build variables for TIU Call
    198188 S MDWP(.05)=1 ; Undicated Status
    199189 S MDWP(1405)=+MDCON_";GMR(123," ; Package Reference
    200  S MDWP(70201)=5 ; Default Procedure Summary Code "Machine Resulted"
    201190 I MDPDT S MDWP(70202)=MDPDT ; Date/Time Performed
    202191 ; File PCE Error message
    203  I MDNVST S MDRESU=$$EN1^MDPCE(MDGST,$P(MDVSTR,";",2),MDPROC,$P(MDVSTR,";",3),"P") I +MDRESU S MDVST=+MDRESU,MDVSTR=$P(MDRESU,"^",2)
     192 I MDNVST S MDRESU=$$EN1^MDPCE(MDGST,MDPDT,MDPROC,$P(MDVSTR,";",3),"P") I +MDRESU S MDVST=+MDRESU,MDVSTR=$P(MDRESU,"^",2)
    204193 I MDNVST&(+MDRESU<0) D FILEMSG(MDGST,"PCE",2,$P(MDRESU,"^",2)) Q MDRESU
    205194 ; Create the TIU note stub
     
    209198 S MDFDA(702,STUDY_",",.06)=+MDNOTE
    210199 S MDFDA(702,STUDY_",",.08)=""
    211  S:MDVST>0 MDFDA(702,STUDY_",",.13)=MDVST
    212200 D FILE^DIE("","MDFDA")
    213  D UPD^MDKUTLR(STUDY,+MDNOTE)
    214201 Q 1
    215202 ;
Note: See TracChangeset for help on using the changeset viewer.