Changeset 636 for FOIAVistA/tag/r/CLINICAL_PROCEDURES-MD
- Timestamp:
- Dec 4, 2009, 8:26:01 PM (15 years ago)
- Location:
- FOIAVistA/tag/r
- Files:
-
- 8 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
FOIAVistA/tag/r/CLINICAL_PROCEDURES-MD/MDAPI.m
r628 r636 1 1 MDAPI ; HOIFO/DP/NCA - CP API Calls ; [05-05-2003 10:28] 2 ;;1.0;CLINICAL PROCEDURES; **6**;Apr 01, 2004;Build 1022 ;;1.0;CLINICAL PROCEDURES;;Apr 01, 2004 3 3 ; Description: 4 4 ; These API's are for use by external packages communicating with CP. 5 5 ; 6 6 ; 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. 8 8 ; IA# 3468 [Subscription] Use GMRCCP APIs. 9 9 ; … … 138 138 ; 1. MDNOTE [Literal/Required] TIU IEN 139 139 ; 140 N MD GBL,MDRES,MDFDA,MDTRAN,RESULTS140 N MDRES,MDFDA,RESULTS 141 141 S MDRES="" F S MDRES=$O(^MDD(702,"ATIU",MDNOTE,MDRES)) Q:'MDRES D 142 142 .Q:$G(^MDD(702,+MDRES,0))="" 143 . ;S MDFDA(702,MDRES_",",.05)=""143 .S MDFDA(702,MDRES_",",.05)="" 144 144 .S MDFDA(702,MDRES_",",.06)="" 145 145 .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 ^DIK147 146 .D STATUS^MDRPCOT(MDRES_",",2,"TIU note deleted.") 148 147 .S DATA("TRANSACTION")=MDRES,DATA("PKG")="TIU" 149 148 .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 ^DIK151 149 Q 1 152 150 ; … … 161 159 ; 7. MDNTIU [Literal/Required] The new reassigned TIU document IEN. 162 160 ; 163 N MDD,MD GBL,MDTRAN,MDCHK,MDLP,MDMULN,MDN,MDPPR,MDREAS,MDTRANI,MDX161 N MDD,MDTRAN,MDCHK,MDLP,MDPPR,MDREAS,MDTRANI,MDX 164 162 I '$G(MDFN) Q "0^No DFN for the TIU note re-assignment." 165 163 I '$G(MDOLDC) Q "0^No Old Consult # for the note re-assignment." … … 169 167 I '$G(MDNTIU) Q "0^No New Reassigned TIU IEN." 170 168 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_"," 172 171 .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 187 174 I 'MDPPR D 188 175 .D CPLIST^GMRCCP(MDNDFN,,$NA(^TMP("MDTMP",$J))) … … 190 177 .F S MDX=$O(^TMP("MDTMP",$J,MDX)) Q:'MDX S:$P(^(MDX),U,5)=MDNEWC MDPPR=$P(^(MDX),U,6) 191 178 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,";") 193 182 S MDNEWV=$$GETVSTR^MDRPCOT1(MDNDFN,MDREAS,MDPPR,MDD) 194 183 S MDFDA(702,"+1,",.01)=MDNDFN … … 200 189 S MDFDA(702,"+1,",.07)=$P(MDNEWV,";",3)_";"_$P(MDNEWV,";",2)_";"_$P(MDNEWV,";") 201 190 S MDFDA(702,"+1,",.09)=0 202 D UPDATE^DIE("","MDFDA" )191 D UPDATE^DIE("","MDFDA","MDTRANI") Q:'$G(MDTRANI(1)) 1 203 192 Q 1 204 193 ; … … 210 199 Q STR 211 200 ; 212 GETCP(RESULTS,MDCSLT) ; API to return CP Study data213 ; Input Parameters:214 ; 1. RESULTS [Literal/Required] Return Array215 ; 2. MDCSLT [Literal/Required] Consult number216 ;217 ; Output:218 ; RESULTS(0)=-1^Error Message or 1 for success219 ; (N,1)=CP Study Number220 ; (N,2)=Patient DFN221 ; (N,3)=Created Date/Time222 ; (N,4)=Created By223 ; (N,5)=CP Definition (External Name)224 ; (N,6)=Consult Number225 ; (N,7)=TIU Note IEN226 ; (N,8)=VSTR227 ; (N,9)=Transaction Status228 ;229 ; Where N = 1..n entries230 ;231 N MDCT,MDX,MDY232 I '$G(MDCSLT) S @RESULTS@(0)="-1^No Consult Number passed" Q233 S MDX=$O(^MDD(702,"ACON",MDCSLT,0)) I 'MDX S @RESULTS@(0)="-1^No CP Study Entry." Q234 S @RESULTS@(0)=1235 S MDCT=0,MDX="" F S MDX=$O(^MDD(702,"ACON",MDCSLT,MDX)) Q:MDX<1 D236 .S MDCT=MDCT+1,@RESULTS@(MDCT,1)=MDX237 .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:172 ;;1.0;CLINICAL PROCEDURES; **6**;Apr 01, 2004;Build 1021 MDHL7A ; HOIFO/WAA - Routine to Decode HL7 for CP ; [05-07-2001 10:38] 2 ;;1.0;CLINICAL PROCEDURES;;Apr 01, 2004 3 3 ; Reference DBIA #10035 [Supported] for DPT calls. 4 4 ; Reference DBIA #10106 [Supported] for HLFNC calls. 5 5 ; 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 8 7 EN ; [Procedure] Entry Point for Message Array in MSG 9 8 N %,BID,CODE,CPT,DA,DATE,DFN,DIK,DLCO,DTO,DZ,ERRTX,EXAM,EXE,MDFLAG,FIL … … 13 12 N ECODE,MDIEN,MDOBX,NUMZ,PNAM,ZCODE,MDDEV,MDD702,DEVNAME,DEVIEN,MDQFLG 14 13 N MDIORD 15 K ^TMP($J,"MDHL7A"),^TMP($J,"MDHL7") ,^TMP($J,"MDHL7A1")14 K ^TMP($J,"MDHL7A"),^TMP($J,"MDHL7") 16 15 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 28 18 ; 29 19 EN2 ; [Procedure] No Description 30 S (DEVIEN,DEVNAME)="" ,I=020 S (DEVIEN,DEVNAME)="" 31 21 F I=1:1 S X=$G(^TMP($J,"MDHL7A",I)) Q:X="" Q:$E(X,1,3)="OBX" D 32 22 . S:$E(X,1,3)="MSH" DEVNAME=$P(X,"|",4) 33 . I DEVNAME="",HLREC("SFN")'="" S DEVNAME=HLREC("SFN")34 23 . I $E(X,1,3)="MSH",DEVNAME'="Instrument Manager" S DEVIEN=$O(^MDS(702.09,"B",DEVNAME,0)) 35 24 . I $E(X,1,3)="OBR" D … … 58 47 I (ZCODE="M")!(ZCODE="B") D Q:MDERROR Q:ZCODE="M" ; 59 48 . 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) 60 51 . D ^MDHL7MCA ; Run the Medicine routines 61 52 . Q:MDERROR ; Medicine found an error and sent an error back 53 . ;;I ZCODE="M" D GENACK^MDHL7X 62 54 . Q 63 55 S NUMZ=$O(^TMP($J,"MDHL7A",""),-1) … … 104 96 S MDIORD=$P(X,"|",4) 105 97 S MDD702=$S(+MDIORD<1:"",1:$$GETSTDY^MDRPCOT1(MDIORD)) 106 ;I MDD702'="" S MDD702=$$CHK^MDNCHK(MDD702) ; PATCH 11107 98 S ORIFN=$P(X,"|",3),(EXAM,%)=$P(X,"|",5) I EXAM'="" S EXAM=$P(%,"^",2) I EXAM="" S EXAM=$P(%,"^",1) 108 99 S CPT=$P(X,"|",5) I $P(CPT,"^",3)["CPT" S CPT=$P(CPT,"^",1) … … 110 101 ; vvv== Added to address the issues of mismatch 111 102 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 Q113 103 I DTO="" S ERRTX="Missing required Date/Time of Procedure in OBR" D ^MDHL7X Q 114 104 ;;S UNIQ=$TR($H,",","-") … … 119 109 S MDRTN=$P($G(^MDS(702.09,INST,.1)),"^",1) S:MDRTN'["^" MDRTN="^"_MDRTN 120 110 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 ICD9122 D PHY^MDHL7U3(X,MDIEN) ; Get Doc who did the procedure.123 111 Q 124 112 ; … … 126 114 S X=$G(^TMP($J,"MDHL7A",NUM)) I $E(X,1,3)'="PID" S ERRTX="PID not second record" D ^MDHL7X Q 127 115 S SEG("PID")=X 128 S MDDOB=$P(X,"|",8) I MDDOB'="" S MDDOB=($E(MDDOB,1,4)-1700)_$E(MDDOB,5,8)129 116 I $L($P(X,"|",4))'<16 D I +DFN=-1 Q 130 117 . N ICN … … 154 141 ; 155 142 OBX ; [Observation] 143 ;Q:$P(^TMP($J,"MDHL7A",NUM),"|")'="OBX" 156 144 D @MDRTN 157 145 Q 158 146 NEWID(DFN,DATE,INST,MDD702,HLMTIEN) ; Generate a new entry and ID of 703.1 159 N NEWID,MDFDA,MDIEN ,MDNO147 N NEWID,MDFDA,MDIEN 160 148 S NEWID=$TR($H,",","-") ; Create inital ID 161 149 L +(^MDD(703.1,"B")):60 E Q "-1" 162 ;^^--- Unable to get a lock in the file150 ;^^--- Unable to get an lock in the file 163 151 F Q:'$D(^MDD(703.1,"B",NEWID)) H 1 S NEWID=$TR($H,",","-") 164 ;^^--- Search to create a new ID ifcurrent ID is in use152 ;^^--- Search to create an new ID in current ID is in use 165 153 S MDFDA(703.1,"+1,",.01)=NEWID 166 154 S MDFDA(703.1,"+1,",.02)=DFN … … 171 159 D UPDATE^DIE("","MDFDA","MDIEN") 172 160 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 177 162 ; ^^--- Create Subfile and quit 178 163 Q "-1" ; Unable to create file -
FOIAVistA/tag/r/CLINICAL_PROCEDURES-MD/MDHL7MCA.m
r628 r636 1 MDHL7MCA ; H OIFO/REL-Routine to Decode HL7 for MEDICINE ; [05-07-2001 10:38]2 ;;1.0;CLINICAL PROCEDURES; **6**;Apr 01, 2004;Build 1021 MDHL7MCA ; HIRMFO/REL-Routine to Decode HL7 for MEDICINE ; [05-07-2001 10:38] 2 ;;1.0;CLINICAL PROCEDURES;;Apr 01, 2004 3 3 ; Reference DBIA #10035 for DPT calls. 4 4 ; Reference DBIA #10062 for VADPT calls. 5 5 ; Reference DBIA #10106 for HL7 calls. 6 ; Reference DBIA #10096 for ^%ZOSF calls.7 6 EN ; Entry Point for Message Array in MSG 8 7 N MSG … … 38 37 ;I $E(MSG(NUM),1,3)="ORC" S NUM=NUM+1 39 38 OBR ; Check OBR 39 W MSG(NUM) 40 40 S X=$G(MSG(NUM)) I $E(X,1,3)'="OBR" S ERRTX="OBR not found when expected" D ^MDHL7MCX G KIL 41 41 S SEG("OBR")=X -
FOIAVistA/tag/r/CLINICAL_PROCEDURES-MD/MDHL7U3.m
r628 r636 1 1 MDHL7U3 ; 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 4 3 ; 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 call8 ; Reference DBIA #1131 [Supported] for XMB("NETNAME") reference9 ; Reference DBIA #1995 [Supported] for ICPTCOD to handle CPT Codes call10 ; Reference DBIA #10082 [Supported] for ^ICD9 reference11 ; Reference DBIA #10111 [Supported] for FILE 3.8 call12 ; Reference DBIA #10103 [Supported] for XLFDT call13 ;14 HL7CHK(MDD702) ; Check to see of there is an entry in 703.1 for a patient.15 N X16 S X="1^"17 D18 . N Y19 . I $G(^MDD(702,MDD702,0))="" S X="-1^No Entry in 702." Q20 . I $D(^MDD(703.1,"ASTUDYID",MDD702))=0 Q21 . S Y=022 . S Y=$O(^MDD(703.1,"ASTUDYID",MDD702,Y)) I Y>0 S X="-1^This Study has Data on file."23 . Q24 Q X25 XVERT(MDA,MDB) ; Strip out blank Lines26 Q:MDA=""27 Q:MDB=""28 Q:$G(^TMP($J,MDA,1))29 N I,CNT,CNT2,NODE,FLG30 S (CNT,I,FLG)=031 F S I=$O(^TMP($J,MDA,I)) Q:I<1 D32 . S NODE=$TR(^TMP($J,MDA,I),$C(10),"")33 . I NODE="" S FLG=0 Q34 . I FLG D Q35 . . S CNT2=CNT2+136 . . S ^TMP($J,MDB,CNT,CNT2)=NODE37 . . Q38 . I 'FLG D Q39 . . S CNT=CNT+140 . . S ^TMP($J,MDB,CNT)=NODE41 . . S FLG=1,CNT2=042 . . Q43 . Q44 Q45 4 ; 46 5 PURGE(MDD7031) ; … … 52 11 S $P(^MDD(703.1,MDD7031,0),U,6)="" 53 12 Q 54 ;55 PHY(X,MDIEN) ; Add the doc who did the exam to the report56 Q57 ; This will be implemented with the Doctor Lookup when it comes out.58 N LINE1,LINE59 S LINE1=$P(X,"|",17)60 S LINE=$P(LINE1,"^",2) ; Last61 S LINE=LINE_$S($P(LINE1,"^",3)'="":", "_$P(LINE1,"^",3),1:"") ; First62 S LINE=LINE_$S($P(LINE1,"^",4)'="":" "_$P(LINE1,"^",4),1:"") ; MI63 D ADD(MDIEN,"9",LINE)64 Q65 ;66 CPTICD(X,MDIEN) ; Break out CPT and ICD9 codes67 N ICD,CPT68 Q:MDIEN<169 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 Q72 FILECD(MDIEN,CODE,TYPE) ; fILE THE DATA73 N LINE,Y,I,CNT,RESULT74 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)=RESULT77 S LINE(.2,0)="^^"_CNT_"^"_CNT_"^"_$P(%,".")78 Q:CNT<1 ; file the results if there is any79 D ADD(MDIEN,TYPE,.LINE,CNT)80 Q81 ;82 ADD(MDIEN,TYPE,LINE,CNT) ;83 ; Create an entry in the .1 node84 N NODE,X85 S NODE=$G(^MDD(703.1,MDIEN,.1,0)) Q:NODE=""86 S NODE=$P(NODE,"^",3)87 S NODE=NODE+188 S $P(^MDD(703.1,MDIEN,.1,0),"^",3,4)=NODE_"^"_NODE89 S $P(^MDD(703.1,MDIEN,.1,NODE,0),"^")=TYPE90 D NOW^%DTC91 M ^MDD(703.1,MDIEN,.1,NODE)=LINE92 Q93 ;94 MSGIEN(MDHLIENS,MDHLREST) ; Return the message as definded in MDHLIENS to the array in MDHLREST95 ; Only TCP type messages96 ; input: MDHLIENS= the intern entry number of the message in ^HLMA97 ; MDHLREST = the return array that will contain the whole HL7 message98 ; output: return "1^Message complete" if message was successful, "0^reason" if failed.99 ;100 N MDHLIEN,MDHLI,MDHLCNT,MDHLZ,RET101 S (MDHLCNT,MDHLI,RET)=0102 I $G(MDHLIENS)="" S RET=RET_"^No IEN defined" Q RET ; Exit because no IEN for ^HLMA was provided103 I $G(MDHLREST)="" S RET=RET_"^No Return ARRAY provided" Q RET ; Exit because no return array was provided104 I $G(^HLMA(MDHLIENS,0))="" S RET=RET_"^HLMA entry does not exist" Q RET ; Exit because invalid OR non-EXISTING HLMA ENTRY105 S MDHLIEN=$P(^HLMA(MDHLIENS,0),U)106 I MDHLIEN="" S RET=RET_"^No pointer value to file 772" Q RET ; No Pointer to 772107 I $G(^HL(772,MDHLIEN,0))="" S RET=RET_"^772 Entry does not exist" Q RET ; No 772 entry exist108 ;get header109 S MDHLZ=$G(^HLMA(MDHLIENS,"MSH",1,0))110 I MDHLZ="" S RET=RET_"^No MSH segment found" Q RET ; No MSH was found111 S MDHLCNT=MDHLCNT+1,@MDHLREST@(MDHLCNT)=MDHLZ112 S MDHLCNT=MDHLCNT+1,@MDHLREST@(MDHLCNT)=""113 ;get body114 S MDHLI=0115 F S MDHLI=$O(^HL(772,MDHLIEN,"IN",MDHLI)) Q:'MDHLI D116 . S MDHLCNT=MDHLCNT+1117 . S @MDHLREST@(MDHLCNT)=$G(^HL(772,MDHLIEN,"IN",MDHLI,0))118 . Q119 I MDHLCNT'>2 S RET=RET_"^No message body found" Q RET ; There was no body120 S RET="1^Message complete"121 Q RET122 ;123 CICNV(MDIEN,RETURN) ; This subroutine will read the data in 703.1 and return the results124 ;in the indicated global125 N NODE,FLG126 S FLG=1127 Q:MDIEN="" ; The ien was null128 Q:RETURN="" ; the array was null129 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 8132 S NODE=0133 I FLG I $G(^MDD(703.1,MDIEN,.1,0))'="" D134 . F S NODE=$O(^MDD(703.1,MDIEN,.1,NODE)) Q:NODE<1 D135 . . 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 . . Q139 . Q140 M @RETURN=ARRAY141 Q142 PROCESS(MDIEN,NODE,TYPE,ARRAY) ; This will process the data for each143 N CNT,X,CONT,CODE,AR,TP,LOC144 S CNT=0,CONT=0145 F S CNT=$O(^MDD(703.1,MDIEN,.1,NODE,.2,CNT)) Q:CNT<1 D146 . S CODE=$G(^MDD(703.1,MDIEN,.1,NODE,.2,CNT,0),"") ; Grabbing the ICD9 AND CPT codes147 . I CODE="" Q148 . I TYPE=8 S AR=1,TP="POV",X=$$ICDDX^ICDCODE(CODE) Q:X="" ; Reference DBIA #3990 [Supported] for ICDCODE call149 . I TYPE=7 S AR=2,TP="CPT",X=$$CPT^ICPTCOD(CODE) Q:X="" ; Reference DBIA #1995 [Supported] for ICPTCOD to handle CPT Codes call150 . S CONT=CONT+1151 . S ARRAY(AR)=CONT_"^"_CONT152 . I AR=1 D153 . . N DESC,IN,LN154 . . S IN=$P(X,"^",1) Q:IN<1155 . . S LN=$G(^ICD9(IN,0),0) Q:LN=""156 . . S DESC=$P(LN,"^",3) Q:DESC=""157 . . S I=CONT158 . . S $P(ARRAY(AR,I),"^",1)=TP159 . . 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)=DESC162 . . S $P(ARRAY(AR,I),"^",6)=$S(I=1:1,1:0)163 . . Q164 . I AR=2 D165 . . N DESC,IN,LN166 . . S IN=$P(X,"^",1) Q:IN<1167 . . ; 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 DESC169 . . S I=CNT170 . . S $P(ARRAY(AR,I),"^",1)=TP171 . . 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)=DESC174 . . S $P(ARRAY(AR,I),"^",7)=$S(I=1:1,1:0)175 . . Q176 . Q177 I $D(ARRAY(1))!$D(ARRAY(2)) S ARRAY(0)="1^1"178 Q179 ;180 NOTICE(SUBJECT,TXT,DEVIEN,DUZ) ; This will fire off a mail message to the Indicated mail group saying that a study was deleted181 ;182 N INST,MG,XMTO,XMDUZ,XMSUBJ,XMBODY,N,X183 S MG=0184 S INST=DEVIEN185 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:'MG187 S MG=$$GET1^DIQ(3.8,+MG_",",.01)188 S XMTO="G."_MG_"@"_^XMB("NETNAME"),XMINSTR("FROM")=.5189 S XMBODY="TXT"190 S XMSUBJ=SUBJECT191 D SENDMSG^XMXAPI(DUZ,XMSUBJ,XMBODY,XMTO,.XMINSTR)192 Q193 ;194 ALERT(MDSIEN) ; This is to send an e-mail to the main device mail group that a study has been deleted195 D NOW^%DTC196 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: "_MDSIEN204 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 1 1 MDHL7X ; HOIFO/WAA -Generate HL7 Error Message ; 06/08/00 2 ;;1.0;CLINICAL PROCEDURES; **6**;Apr 01, 2004;Build 1022 ;;1.0;CLINICAL PROCEDURES;;Apr 01, 2004 3 3 ; Reference IA #1131 for ^XMB("NETNAME") access. 4 4 ; Reference IA #2165 for HLMA1 calls. … … 12 12 S MG=$$GET1^DIQ(3.8,+MG_",",.01) 13 13 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) 15 15 S TXT(1)=ERRTX,TXT(2)=X,TXT(3)=" " 16 16 S N=3 17 I ' $G(ECODE,1)D ; This is to process Device errors17 I 'ECODE D ; This is to process Device errors 18 18 . N X 19 19 . S X=0 -
FOIAVistA/tag/r/CLINICAL_PROCEDURES-MD/MDRPCOG.m
r628 r636 1 1 MDRPCOG ; HOIFO/DP - CP Gateway ; [01-09-2003 15:20] 2 ;;1.0;CLINICAL PROCEDURES; **6**;Apr 01, 2004;Build 1022 ;;1.0;CLINICAL PROCEDURES;;Apr 01, 2004 3 3 ; Description: 4 4 ; This is the main routine that manages the CLINICAL PROCEDURES Gateway functions. … … 116 116 Q 117 117 ; 118 RUNNING ; [Procedure] Returns 0/1 and message on running status119 ; Note: If lock CAN be obtained, then gateway is NOT running120 L +^MDD("CPGATEWAY"):1 E S @RESULTS@(0)="1^RUNNING" Q121 L -(^MDD("CPGATEWAY")) S @RESULTS@(0)="0^NOT RUNNING"122 Q123 ;124 118 SETFILE ; [Procedure] Set filename of new attachment 125 119 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:162 ;;1.0;CLINICAL PROCEDURES;**4 ,6**;Apr 01, 2004;Build 1021 MDRPCOP ; HOIFO/DP - Object RPCs (TMDPatient) ; [01-09-2003 15:21] 2 ;;1.0;CLINICAL PROCEDURES;**4**;Apr 01, 2004;Build 3 3 3 ; Integration Agreements: 4 ; IA# 2263 [Supported] XPAR calls5 4 ; IA# 3027 [Supported] Calls to DGSEC4 6 5 ; IA# 2981 [Subscription] Calls to GUI~GMRCP5 … … 9 8 ; IA# 10061 [Supported] VADPT calls. 10 9 ; IA# 3468 [Subscription] Use GMRCCP APIs. 10 ; IA# 3266 [Subscription] Call to DPTLK1 11 11 ; IA# 10103 [Supported] Call to XLFDT 12 12 ; IA# 10039 [Supported] Ward Location File (#42) Access. 13 13 ; IA# 10035 [Supported] DPT references 14 ; IA# 3267 [Subscription] Call to DPTLK1 15 ; IA# 3593 [Supported] Access to routine DPTLK6 utilities for lookup 14 16 ; IA# 3613 [Private] GETVST^MDRPCOP API call 15 17 ; IA# 10099 [Supported] GMRADPT call 16 18 ; IA# 1096 [Controlled Subscription] ^DGPM("ATID1" x-ref loop 17 ; IA# 358 [Controlled Subscription] FILE 405 references18 19 ; 19 20 ADD(X) ; [Procedure] Add line to @RESULTS@(... … … 50 51 .I +MDHL7=1 S MDFDA(702,MDIENS,.09)=5,MDFDA(702,MDIENS,.08)="" 51 52 .D:$D(MDFDA) FILE^DIE("","MDFDA","MDERR") 52 ; Patch 6 - Renal Check-In53 D:+$G(MDIENS)54 .S X=+$P(^MDD(702,+MDIENS,0),U,4) Q:'X55 .I $P(^MDS(702.01,X,0),U,6)=2 D Q ; Renal Check-In56 ..D CP^MDKUTLR(+MDIENS)57 ..S MDFDA(702,+MDIENS_",",.09)=558 ..D FILE^DIE("","MDFDA","MDERR")59 ; Patch 6 - Renal Check-In60 53 I '$D(MDERR) S @RESULTS@(0)="1^OK" Q 61 54 D ERROR^MDRPCU(RESULTS,.MDERR) … … 68 61 ; 69 62 GETCONS ; [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) 73 64 D CPLIST^GMRCCP(DFN,,$NA(^TMP("MDTMP",$J))) 74 65 S MDX=0 75 66 F S MDX=$O(^TMP("MDTMP",$J,MDX)) Q:'MDX D:"saprc"[$P(^(MDX),U,4) 76 67 .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)<MDCDT78 68 .F X=2,3,4,1,6,5 S Y=Y_U_$P(^TMP("MDTMP",$J,MDX),U,X) 79 69 .S Y=Y_U_+$O(^MDD(702,"ACON",+$P(^TMP("MDTMP",$J,MDX),U,5))) … … 124 114 ; 125 115 GETTRAN ; [Procedure] Get a patients transactions 126 K ^TMP("MDTMP",$J),^TMP("MDCONL",$J) N MDCDT,MDCOM,MDMULT,MDNUM,MDREQ,MDREQDT,MDYR,X1,X2,X127 S MDNUM=$$GET^XPAR("SYS","MD DAYS TO RETAIN COM STUDY",1) S MDCOM=0128 I +MDNUM>0 S X1=DT,X2=-MDNUM D C^%DTC S MDCOM=X129 D CPLIST^GMRCCP(DFN,,$NA(^TMP("MDTMP",$J)))130 S X1=DT,X2=-365 D C^%DTC S MDCDT=X131 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)<MDCDT133 .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)135 116 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) 145 118 .S Y=$O(@RESULTS@(""),-1)+1 146 119 .S @RESULTS@(Y)="702;"_+MDX_U_Z 147 120 S @RESULTS@(0)=+$O(@RESULTS@(""),-1) 148 K ^TMP("MDCONL",$J)149 121 Q 150 122 ; 151 123 GETVST ; [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,X153 S NOW=$$NOW^XLFDT(),TODAY=$P(NOW,".",1) ,MDTDF=DFN154 S BEG=$$X2FM( $$GETBEG),END=$$X2FM($$GETEND)+0.2359124 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 155 127 S MDLST="",MDSTOP="" 156 128 I END>NOW D ; get future encounters, past cancels/no-shows from VADPT … … 179 151 .D CLOSE^SDQ(.MDQUERY) 180 152 N TIM,MOV,MDX0,Y,MTIM,XTYP,XLOC,XLOCI,HLOC,EARLY,DONE ; admits 181 S EARLY=BEG,DONE=0 S:$G(DFN)="" DFN=MDTDF153 S EARLY=BEG,DONE=0 182 154 S TIM="" F S TIM=$O(^DGPM("ATID1",DFN,TIM)) Q:TIM'>0 D Q:DONE 183 155 .S MOV=0 F S MOV=$O(^DGPM("ATID1",DFN,TIM,MOV)) Q:MOV'>0 D Q:DONE … … 192 164 ..S K=0 F S K=$O(MDLST(I,J,K)) Q:'K D 193 165 ...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 ; 203 169 LOGSEC ; [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") 207 172 Q 208 173 ; … … 216 181 ; 217 182 SELECT ; [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") 220 235 Q 221 236 ; -
FOIAVistA/tag/r/CLINICAL_PROCEDURES-MD/MDRPCOT.m
r628 r636 1 MDRPCOT ; HOIFO/DP/NCA - Object RPCs (TMDTransaction) ; 3/12/08 09:182 ;;1.0;CLINICAL PROCEDURES;**5 ,6**;Apr 01, 2004;Build 1021 MDRPCOT ; HOIFO/DP/NCA - Object RPCs (TMDTransaction) ;12/5/02 15:33 2 ;;1.0;CLINICAL PROCEDURES;**5**;Apr 01, 2004;Build 1 3 3 ; Integration Agreements: 4 4 ; IA# 2693 [Subscription] TIU Extractions. … … 22 22 ; Sets @RESULTS@(0)="-1^Reason for not deleting" or "1^Study Deleted" 23 23 ; 24 N MD AST,MDHOLD,MDNOTE,MDRES,MDSIEN,BODY,SUBJECT,DEVIEN24 N MDHOLD,MDNOTE,MDRES,MDSIEN 25 25 S (MDHOLD,MDSIEN)=+DATA,MDRES=0,MDNOTE="" 26 D ALERT^MDHL7U3(MDSIEN) ; Builds the body of the mail message27 I $G(^MDD(702,+MDSIEN,0))="" S @RESULTS@(0)="1^Study Deleted." D NOTICE^MDHL7U3(SUBJECT,.BODY,DEVIEN,DUZ) Q ;deleting message28 26 S:+$P(^MDD(702,MDSIEN,0),U,6) MDNOTE=$P(^MDD(702,MDSIEN,0),U,6) 29 27 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 … … 37 35 .Q 38 36 E D 39 .I $D(^MDD(702.001,"ASTUDY",MDSIEN)) S @RESULTS@(0)="-1^Note associated with study, can not delete." Q40 .S MDAST=$$HL7CHK^MDHL7U3(+MDSIEN) I +MDAST<1 S @RESULTS@(0)=MDAST Q41 .D NOTICE^MDHL7U3(SUBJECT,.BODY,DEVIEN,DUZ) ; delete message42 37 .S MDFDA(702,DATA_",",.01)="" 43 .; Check for renal study to delete as well44 .S:$D(^MDK(704.202,DATA)) MDFDA(704.202,DATA_",",.01)=""45 38 .D FILE^DIE("","MDFDA") 46 39 .N DA,DIK S DA=+MDSIEN,DIK="^MDD(702," D ^DIK … … 58 51 NEW MDFDA,MDIEN,MDIENS,MDRET,P1,P2,P3,P4 59 52 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))="" Q53 S MDIEN=0 61 54 ; Look for file (All comparisons done on lower case values) 62 55 F S MDIEN=$O(^MDD(702,P1,.1,MDIEN)) Q:'MDIEN D Q:X=P3 … … 99 92 S MDFDA(702,DATA,.09)=TYPE 100 93 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 MDFDA102 94 Q 103 95 ; … … 124 116 S MDRESUL=$$NEWTIUN(MDSTUDY) 125 117 ; File TIU Error messages 118 ;I +MDRESUL<0 D FILEMSG(MDSTUDY,"TIU",2,MDRESUL) Q MDRESUL 126 119 I +MDRESUL<0 D Q 127 120 .D FILEMSG(MDSTUDY,"TIU",2,MDRESUL) … … 168 161 .S MDVSTR=$$GETVSTR^MDRPCOT1(DFN,MDVSTR,MDPROC,$$GET1^DIQ(702,MDIEN,.02,"I")) 169 162 .S MDLOC=$P(MDVSTR,";",1) 170 I $$GET1^DIQ(702.01,+MDPROC_",",.12,"I")=1 Q DFN_"^"_MDTITL_"^"_MDLOC_"^^"_MDCON_"^"_MDPROC_"^"_MDVSTR_"^"_MDNVST171 163 ; Does TIU doc already exist? 172 164 I $$GET1^DIQ(702,MDIEN,.06,"I") Q DFN_"^"_MDTITL_"^"_MDLOC_"^"_+$$GET1^DIQ(702,MDIEN,.06,"I")_"^"_MDCON_"^"_MDPROC_"^"_MDVSTR_"^"_MDNVST … … 178 170 ; Input: STUDY - IENS of CP study entry 179 171 ; Return: TIU Document IEN 180 N CTR,DFN,MDCON,MDFDA,MDGST,MDL,MDLOC,MDNOTE,MDPDT,MDPROC,MDRESU,MDTITL,MDTSTR,MDVST,MDVSTR,MDWP ,MDPTS 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="" 181 173 ; Get data for TIU Note Creation 182 174 S (MDTSTR,MDRESU)=$$GETDATA(MDGST) … … 192 184 ; Create new visit, if no vstring 193 185 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)195 186 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"197 187 ; Build variables for TIU Call 198 188 S MDWP(.05)=1 ; Undicated Status 199 189 S MDWP(1405)=+MDCON_";GMR(123," ; Package Reference 200 S MDWP(70201)=5 ; Default Procedure Summary Code "Machine Resulted"201 190 I MDPDT S MDWP(70202)=MDPDT ; Date/Time Performed 202 191 ; 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) 204 193 I MDNVST&(+MDRESU<0) D FILEMSG(MDGST,"PCE",2,$P(MDRESU,"^",2)) Q MDRESU 205 194 ; Create the TIU note stub … … 209 198 S MDFDA(702,STUDY_",",.06)=+MDNOTE 210 199 S MDFDA(702,STUDY_",",.08)="" 211 S:MDVST>0 MDFDA(702,STUDY_",",.13)=MDVST212 200 D FILE^DIE("","MDFDA") 213 D UPD^MDKUTLR(STUDY,+MDNOTE)214 201 Q 1 215 202 ;
Note:
See TracChangeset
for help on using the changeset viewer.