VistA-WorldVistAEHR/r/CLINICAL_PROCEDURES-MD/MDPS5.m

42 lines
2.0 KiB
Mathematica

MDPS5 ; HOIFO/NCA - Retrieve List of Consult Procedures for RDV ;3/4/05 13:29
;;1.0;CLINICAL PROCEDURES;**13**;Apr 01, 2004;Build 19
; Integration Agreements:
; Reference IA# 2740 [Subscription] Routine GMRCSLM1.
; IA# 2944 [Subscription] Calls to TIUSRVR1.
; IA# 3067 [Private] Read fields in Consult file (#123) w/FM
;
GP(MDDFN,MDSDT,MDEDT) ; Gather the completed procedure list
N MDCPR,MDCK,MDCPRO,MDCX,MDDTE,MDLP,MDFIL,MDSTK,MDX4 S MDFIL=123,MDSTK="2,9"
D OER^GMRCSLM1(MDDFN,"",MDSDT,MDEDT,MDSTK,1)
I $G(^TMP("GMRCR",$J,"CS",1,0))["< PATIENT DOES NOT HAVE ANY CONSULTS/REQUESTS" Q
S MDLP="" F S MDLP=$O(^TMP("GMRCR",$J,"CS",MDLP)) Q:MDLP="AD" S MDX=$G(^(MDLP,0)) D
.S MDCPRO=$P(MDX,U,5),MDX=+MDX
.Q:$$GET1^DIQ(MDFIL,+MDX_",",13,"I")'="P"
.S MDCPR=$$GET1^DIQ(MDFIL,+MDX_",",4,"I")
.Q:MDCPR'["GMR(123.3"
.S MDCPR=+MDCPR S MDFIL=123.3 Q:'$$GET1^DIQ(MDFIL,+MDCPR_",",.05,"I")
.Q:$O(^MDD(702,"ACON",+MDX,0))
.S MDFIL=123 K MDCX D GETS^DIQ(MDFIL,+MDX_",","50*","I","MDCX")
.S MDCK="" F S MDCK=$O(MDCX(123.03,MDCK)) Q:MDCK<1 S MDX4=$G(MDCX(123.03,MDCK,.01,"I")) D
..I MDX4["TIU" D
...S MDFIL=8925,MDDTE=$$GET1^DIQ(MDFIL,+MDX4_",",1201,"I")
...S Y=MDDTE X ^DD("DD") N MDREV S MDREV=(9999999.9999-MDDTE)
...S:$G(^TMP("MDPLST",$J,MDCPRO,MDREV_"^"_+MDX4))="" ^(MDREV_"^"_+MDX4)=MDCPRO_"^"_+MDX4_"^"_"PRPRO"_"^"_"MDPS4"_"^^"_Y_"^^^^^"_MDCPRO_"^^"_+MDX_"^"_+MDX4,MDFIL=123
...Q
..Q
.Q
K ^TMP("GMRCR",$J,"CS")
Q
PRPRO ; Return the Result Text for File Consult Procedure records
Q:'$G(MCARGDA)
N FFF,MDCLIN,MDCON,MDF,MDIMG,MDMCG,MDMED,MDREC,MDPRILV,MDPTR,MDSTUDY,MDTIU,MDX4,PATID,MDRPG,RESULTS
I '$G(MDALL) K ^TMP("MDPTXT",$J)
S MDIMG=0,$P(FFF,"-",80)="",MDRPG=0,MDF=123
S MDSTUDY=+$G(MCARGDA)
S (MDPRILV,RESULTS)="",MDCLIN=0
I +MDPRILV D TGET^TIUSRVR1(.RESULTS,+MDSTUDY) M ^TMP("MDPTXT",$J,MCARGDA,MCPRO)=@RESULTS K ^TMP("TIUVIEW",$J) Q:+$G(MDALL)
S:+MDPRILV<1 ^TMP("MDPTXT",$J,MCARGDA,MCPRO,1)=$P(MDPRILV,U,2)
NXT Q:+$G(MDALL) Q:+$G(MDRDV)
I $D(ORHFS) U IO G PRINT^MDPS1
G PRINT^MDPS1