TIUPNCV1 ;SLC/DJP-SF/JLI ;11/24/97 14:31
;;1.0;TEXT INTEGRATION UTILITIES;**9**;Jun 20, 1997
SETFIELD ;Sets fields for copy into TIU Document File
D VISIT,SIGVAR,COSVAR,ADDENDA,FIELDS
Q
;
VISIT ;Sets Visit Tracking data elements
N DFN,VDT,TIUVSIT
S DFN=TIU(.02),VDT=TIU(1301)
D PXAPI^TIUPXAP1(.TIUVSIT,DFN,"",VDT,"E")
I +$G(TIUVSIT)'>0 S PROBLEM="Progress Note - IFN "_GMRPIFN_": Unable to create Visit Tracking entry based on entry date." D ERRORLOG^TIUPNCV3 K PROBLEM Q
S TIU(.03)=+$G(TIUVSIT)
Q
;
FIELDS ;Individual fields, such as S-O-A-P, are converted as a single document
S CNT1=0,CNT2=0,RENUM=0
F GMRPFLD=10,20,21,22,23,30,32,33,34,40,41,42,43,44,45,46,47,48,8 I $D(^GMR(121,GMRPIFN,GMRPFLD)) D WHATSIT^TIUPNCV2
I RENUM=1 D RENUM^TIUPNCV2 K RENUM
Q
;
SIGVAR ;Sets additional variables for signature block --
;.05 STATUS
;1503 SIGNATURE BLOCK NAME
;1504 SIGNATURE BLOCK TITLE
;1505 SIGNATURE BLOCK MODE
I TIU(1502)="",TIU("SIGCHART")="" S TIUSTAT="UNSIGNED",TIU(.05)=$$STATUS^TIUPNCV3(TIUSTAT),TIU(1505)="" K TIUSTAT Q
S:TIU("SIGCHART")'="" TIU(1502)=TIU(1512)
S DR=$G(^VA(200,TIU(1502),20)),TIU(1503)=$P(DR,U,2)
S TIU(1504)=$P(DR,U,3),TIU(1505)=$S(TIU(1512)="":"E",1:"")
S TIUSTAT="COMPLETED",TIU(.05)=$$STATUS^TIUPNCV3(TIUSTAT)
I TIU(1512)'="" S TIUSTAT="COMPLETED",TIU(.05)=$$STATUS^TIUPNCV3(TIUSTAT),TIU(1505)="C"
K DIC,X,Y,DIQ,DR,TIUSTAT,DA Q
;
COSVAR ;Sets required variables for cosignature block
;.05 STATUS
;1509 COSIGNATURE BLOCK NAME
;1510 COSIGNATURE BLOCK TITLE
;1511 COSIGNATURE BLOCK MODE
S TIU(1511)="" I TIU(1506)="",TIU(1508)="",TIU("COSCHART")="" Q
I TIU(1508)="",TIU("COSCHART")="" Q:TIU(1502)=""&(TIU("SIGCHART")="") S TIUSTAT="UNCOSIGNED",TIU(.05)=$$STATUS^TIUPNCV3(TIUSTAT),TIU(1208)=$G(TIUECS) K TIUSTAT Q
S:TIU("COSCHART")'="" TIU(1508)=TIU(1513)
S DR=$G(^VA(200,TIU(1508),20)),TIU(1509)=$P(DR,U,2)
S TIU(1510)=$P(DR,U,3),TIU(1511)=$S(TIU(1513)="":"E",1:"")
S TIUSTAT="COMPLETED",TIU(.05)=$$STATUS^TIUPNCV3(TIUSTAT)
I TIU(1513)'="" S TIUSTAT="COMPLETED",TIU(.05)=$$STATUS^TIUPNCV3(TIUSTAT),TIU(1511)="C"
K DIC,X,Y,DIQ,DR,TIUSTAT,DA Q
;
ADDENDA ;sets the Parent variable for notes that are addenda - .06 PARENT
Q:TIU("PARENT")=""
S PARENT=$G(^GMR(121,GMRPIFN,100))
S TIU("PARENT")=$G(^GMR(121,"CNV",PARENT))
S TIUNEWTY=+$$WHATITLE^TIUPUTU("ADDENDUM")
S TIU(.04)=$$DOCCLASS^TIULC1(TIUNEWTY)
Q
TIUPNCV1 ;SLC/DJP-SF/JLI ;11/24/97 14:31
+1 ;;1.0;TEXT INTEGRATION UTILITIES;**9**;Jun 20, 1997
SETFIELD ;Sets fields for copy into TIU Document File
+1 DO VISIT
DO SIGVAR
DO COSVAR
DO ADDENDA
DO FIELDS
+2 QUIT
+3 ;
VISIT ;Sets Visit Tracking data elements
+1 NEW DFN,VDT,TIUVSIT
+2 SET DFN=TIU(.02)
SET VDT=TIU(1301)
+3 DO PXAPI^TIUPXAP1(.TIUVSIT,DFN,"",VDT,"E")
+4 IF +$GET(TIUVSIT)'>0
SET PROBLEM="Progress Note - IFN "_GMRPIFN_": Unable to create Visit Tracking entry based on entry date."
DO ERRORLOG^TIUPNCV3
KILL PROBLEM
QUIT
+5 SET TIU(.03)=+$GET(TIUVSIT)
+6 QUIT
+7 ;
FIELDS ;Individual fields, such as S-O-A-P, are converted as a single document
+1 SET CNT1=0
SET CNT2=0
SET RENUM=0
+2 FOR GMRPFLD=10,20,21,22,23,30,32,33,34,40,41,42,43,44,45,46,47,48,8
IF $DATA(^GMR(121,GMRPIFN,GMRPFLD))
DO WHATSIT^TIUPNCV2
+3 IF RENUM=1
DO RENUM^TIUPNCV2
KILL RENUM
+4 QUIT
+5 ;
SIGVAR ;Sets additional variables for signature block --
+1 ;.05 STATUS
+2 ;1503 SIGNATURE BLOCK NAME
+3 ;1504 SIGNATURE BLOCK TITLE
+4 ;1505 SIGNATURE BLOCK MODE
+5 IF TIU(1502)=""
IF TIU("SIGCHART")=""
SET TIUSTAT="UNSIGNED"
SET TIU(.05)=$$STATUS^TIUPNCV3(TIUSTAT)
SET TIU(1505)=""
KILL TIUSTAT
QUIT
+6 IF TIU("SIGCHART")'=""
SET TIU(1502)=TIU(1512)
+7 SET DR=$GET(^VA(200,TIU(1502),20))
SET TIU(1503)=$PIECE(DR,U,2)
+8 SET TIU(1504)=$PIECE(DR,U,3)
SET TIU(1505)=$SELECT(TIU(1512)="":"E",1:"")
+9 SET TIUSTAT="COMPLETED"
SET TIU(.05)=$$STATUS^TIUPNCV3(TIUSTAT)
+10 IF TIU(1512)'=""
SET TIUSTAT="COMPLETED"
SET TIU(.05)=$$STATUS^TIUPNCV3(TIUSTAT)
SET TIU(1505)="C"
+11 KILL DIC,X,Y,DIQ,DR,TIUSTAT,DA
QUIT
+12 ;
COSVAR ;Sets required variables for cosignature block
+1 ;.05 STATUS
+2 ;1509 COSIGNATURE BLOCK NAME
+3 ;1510 COSIGNATURE BLOCK TITLE
+4 ;1511 COSIGNATURE BLOCK MODE
+5 SET TIU(1511)=""
IF TIU(1506)=""
IF TIU(1508)=""
IF TIU("COSCHART")=""
QUIT
+6 IF TIU(1508)=""
IF TIU("COSCHART")=""
IF TIU(1502)=""&(TIU("SIGCHART")="")
QUIT
SET TIUSTAT="UNCOSIGNED"
SET TIU(.05)=$$STATUS^TIUPNCV3(TIUSTAT)
SET TIU(1208)=$GET(TIUECS)
KILL TIUSTAT
QUIT
+7 IF TIU("COSCHART")'=""
SET TIU(1508)=TIU(1513)
+8 SET DR=$GET(^VA(200,TIU(1508),20))
SET TIU(1509)=$PIECE(DR,U,2)
+9 SET TIU(1510)=$PIECE(DR,U,3)
SET TIU(1511)=$SELECT(TIU(1513)="":"E",1:"")
+10 SET TIUSTAT="COMPLETED"
SET TIU(.05)=$$STATUS^TIUPNCV3(TIUSTAT)
+11 IF TIU(1513)'=""
SET TIUSTAT="COMPLETED"
SET TIU(.05)=$$STATUS^TIUPNCV3(TIUSTAT)
SET TIU(1511)="C"
+12 KILL DIC,X,Y,DIQ,DR,TIUSTAT,DA
QUIT
+13 ;
ADDENDA ;sets the Parent variable for notes that are addenda - .06 PARENT
+1 IF TIU("PARENT")=""
QUIT
+2 SET PARENT=$GET(^GMR(121,GMRPIFN,100))
+3 SET TIU("PARENT")=$GET(^GMR(121,"CNV",PARENT))
+4 SET TIUNEWTY=+$$WHATITLE^TIUPUTU("ADDENDUM")
+5 SET TIU(.04)=$$DOCCLASS^TIULC1(TIUNEWTY)
+6 QUIT