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

59 lines
3.2 KiB
Mathematica

MDPS4 ; HOIFO/NCA - Retrieve List of Consult Procedures ;1/26/06 12:45
;;1.0;CLINICAL PROCEDURES;**13**;Apr 01, 2004;Build 19
; Integration Agreements:
; Reference IA# 2740 [Subscription] Routine GMRCSLM1.
; IA# 2693 [Subscription] TIU Extractions.
; IA# 2944 [Subscription] Calls to TIUSRVR1.
; IA# 3067 [Private] Read fields in Consult file (#123) w/FM
; IA# 4792 [Private] CANDO^TIUSRVA call
;
GP(MDDFN,MDSDT,MDEDT) ; Gather the completed procedure list
N MDCPR,MDCK,MDCPRO,MDCX,MDDTE,MDLP,MDFIL,MDX4,MDSTK,MDX S MDSTK="2,9",MDFIL=123
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=0 F S MDLP=$O(^TMP("GMRCR",$J,"CS",MDLP)) Q:MDLP="AD"!(MDLP<1) S MDX=$G(^(MDLP,0)) D
.S MDCPRO=$P(MDX,U,5),MDX=+MDX
.Q:$$GET1^DIQ(MDFIL,+MDX_",",13,"I")'="P"
.;S MDFIL=123,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,MDREV,MDCPRO_"~"_+MDX4))="" ^(MDCPRO_"~"_+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,MDCK1,MDCLIN,MDCON,MDFIL,MDIMG,MDLCT,MDMCG,MDMED,MDNAME,MDREC,MDPRILV,MDPTR,MDSTUDY,MDTIM,MDTIU,MDTL,MDX4,PATID,MDRPG,RESULTS,MDXX,X
I '$G(MDALL) K ^TMP("MDPTXT",$J)
K ^TMP("MDTMPT",$J) D NOW^%DTC S X=% D DTIME^MCARP S MDTIM=$$FMTE^XLFDT(X,2) K %
S MDIMG=0,$P(FFF,"-",80)="",(MDLCT,MDRPG)=0,MDF=123
S MDSTUDY=+$G(MCARGDA)
S (MDPRILV,RESULTS)="",MDCLIN=0
D CANDO^TIUSRVA(.MDPRILV,+MDSTUDY,"VIEW")
I +MDPRILV D TGET^TIUSRVR1(.RESULTS,+MDSTUDY) M ^TMP("MDTMPT",$J,MCARGDA,MCPRO)=@RESULTS K ^TMP("TIUVIEW",$J) Q:+$G(MDALL)
S:+MDPRILV<1 ^TMP("MDTMPT",$J,MCARGDA,MCPRO,1)=$P(MDPRILV,U,2)
K ^TMP("MDTIUST",$J) N MDTIUER,MDTST S (MDNAME,MDTIUER,MDTST)=""
D EXTRACT^TIULQ(+MDSTUDY,"^TMP(""MDTIUST"",$J)",MDTIUER,".01;.02;1405","IE") Q:+MDTIUER
S MDTST=$G(^TMP("MDTIUST",$J,+MDSTUDY,1405,"I")),MDTST=$S(MDTST["GMR(123":+MDTST,1:0)
S MDNAME=$G(^TMP("MDTIUST",$J,+MDSTUDY,.02,"E")),MDRPG=MDRPG+1
S MDXX=$G(^TMP("MDTIUST",$J,+MDSTUDY,.01,"E"))
S MDFIL=123 S MDTL=$S(+MDTST:$$GET1^DIQ(MDFIL,+MDTST_",",4,"E"),1:MDXX)
I '$G(MDHDR) D
.S MDLCT=MDLCT+1,^TMP("MDPTXT",$J,MCARGDA,MCPRO,MDLCT)="Pg. "_MDRPG_$J(" ",25)_$$HOSP^MDPS2(DFN)_$J(" ",25)_MDTIM
.S MDLCT=MDLCT+1 S ^TMP("MDPTXT",$J,MCARGDA,MCPRO,MDLCT)=$J(" ",25)_MDTL
.S MDLCT=MDLCT+1 S ^TMP("MDPTXT",$J,MCARGDA,MCPRO,MDLCT)=$$DEMO^MDPS2(DFN)
.S MDLCT=MDLCT+1 S ^TMP("MDPTXT",$J,MCARGDA,MCPRO,MDLCT)=FFF
S MDCK1="" F S MDCK1=$O(^TMP("MDTMPT",$J,MCARGDA,MCPRO,MDCK1)) Q:MDCK1<1 S MDXX=$G(^(MDCK1)),MDLCT=MDLCT+1,^TMP("MDPTXT",$J,MCARGDA,MCPRO,MDLCT)=MDXX
K ^TMP("MDTMPT",$J,MCARGDA,MCPRO)
NXT Q:+$G(MDALL) Q:+$G(MDRDV)
I $D(ORHFS) U IO G PRINT^MDPS1
G PRINT^MDPS1