[613] | 1 | TIUPNCV ;SLC/DJP-SF/JLI ;3/3/98 14:00
|
---|
| 2 | ;;1.0;TEXT INTEGRATION UTILITIES;**9**;Jun 20, 1997
|
---|
| 3 | ;
|
---|
| 4 | DRIVER ;Entry point; initializes counters
|
---|
| 5 | S TIUFPRIV=1
|
---|
| 6 | S:'$D(U) U="^" S (GMRPCTR,TIUCTR,ERRCTR)=0 S:'$D(GMRPST) GMRPST=0
|
---|
| 7 | ;above- if not a Restart, initializes counter
|
---|
| 8 | S $P(^TIU(8925.97,1,0),U,2)=$$NOW^XLFDT
|
---|
| 9 | S GMRPFINI=$P($G(^TIU(8925.97,1,0)),U,8)
|
---|
| 10 | S TIUSTRT=$$DATE^TIULS($$NOW^TIULC,"MM/DD/YY HR:MIN")
|
---|
| 11 | ;
|
---|
| 12 | RESTART ;Restarts Progress Note conversion
|
---|
| 13 | S GMRPIFN=GMRPST
|
---|
| 14 | F S GMRPIFN=$O(^GMR(121,GMRPIFN)) Q:'GMRPIFN Q:GMRPIFN=$G(GMRPFINI) D
|
---|
| 15 | . D MAIN
|
---|
| 16 | S TIUEND=$$DATE^TIULS($$NOW^TIULC,"MM/DD/YY HR:MIN")
|
---|
| 17 | ;
|
---|
| 18 | CLEANUP ;Releases Bulletin & kills variables and scratch files
|
---|
| 19 | W !!?20,"***** CONVERSION HAS FINISHED *****",!
|
---|
| 20 | STOP D REPORT^TIUPNCV4
|
---|
| 21 | K GMRPCTR,TIUCTR,GMRPST,GMRPIFN,GMRPFL,TIUFPRIV
|
---|
| 22 | K ^TMP("TIUIFN")
|
---|
| 23 | I $P($G(^TIU(8925.97,1,2)),U,3)'>0
|
---|
| 24 | I S $P(^TIU(8925.97,1,0),U,3)=$$NOW^XLFDT
|
---|
| 25 | S $P(^TIU(8925.97,1,2),U,3)=0
|
---|
| 26 | Q
|
---|
| 27 | ;
|
---|
| 28 | MAIN ;Main loop for each record
|
---|
| 29 | I $P($G(^TIU(8925.97,1,2)),U,3)>0
|
---|
| 30 | I S TIUEND=$$DATE^TIULS($$NOW^TIULC,"MM/DD/YY HR:MIN") G STOP
|
---|
| 31 | N PN S GMRPCTR=GMRPCTR+1
|
---|
| 32 | ;
|
---|
| 33 | MAIN1 ;
|
---|
| 34 | Q:'+$P($G(^GMR(121,GMRPIFN,1)),U,3)
|
---|
| 35 | Q:$P($G(^GMR(121,GMRPIFN,5)),U)="1"
|
---|
| 36 | ;do not convert unsigned/uncosigned notes
|
---|
| 37 | ;
|
---|
| 38 | ;ignore if test patient note
|
---|
| 39 | Q:$E($P($G(^DPT(+$P($G(^GMR(121,GMRPIFN,0)),U,2),0)),U,9),1,5)="00000"
|
---|
| 40 | ;
|
---|
| 41 | Q:$D(^GMR(121,"CNV",GMRPIFN)) ;already converted
|
---|
| 42 | ;
|
---|
| 43 | S GMR0=$G(^GMR(121,GMRPIFN,0)) ;using naked ref below
|
---|
| 44 | S GMR1=$G(^(1)),GMR5=$G(^(5)),GMR9=$G(^(9)),GMR100=$G(^(100))
|
---|
| 45 | F I=1,2,3,5,6 S PN($P(".01^.02^.03^.04^.05^.06",U,I))=$P(GMR0,U,I)
|
---|
| 46 | F I=1:1:5 S PN($P("1^2^3^4^4.1",U,I))=$P(GMR1,U,I)
|
---|
| 47 | F I=1:1:4 S PN($P("5^6^7^7.1",U,I))=$P(GMR5,U,I)
|
---|
| 48 | S PN(9)=$P(GMR9,U)
|
---|
| 49 | S PN(100)=$P(GMR100,U)
|
---|
| 50 | I (PN(.02)="")!(PN(.03)="")!(PN(.05)="")!(PN(1)="")!(PN(2)="") D Q
|
---|
| 51 | . S PROBLEM="Progress Note - IFN #"_GMRPIFN_" is incomplete."
|
---|
| 52 | . D ERRORLOG^TIUPNCV3 K BADREC,PN,PROBLEM Q
|
---|
| 53 | I PN(100),'$D(^GMR(121,"CNV",PN(100))) D Q
|
---|
| 54 | . S PROBLEM="Progress note - IFN # "_GMRPIFN_", addendum to unconverted parent note IFN # "_PN(100)
|
---|
| 55 | . D ERRORLOG^TIUPNCV3 K BADREC,PN,PROBLEM Q
|
---|
| 56 | ;
|
---|
| 57 | D TIUFLDS
|
---|
| 58 | ;
|
---|
| 59 | D TITLE^TIUPNCV3 I $D(BADREC) D CLEANREC Q
|
---|
| 60 | ;
|
---|
| 61 | D RTNODE I $D(TIU("BAD")) D CLEANREC Q
|
---|
| 62 | ;
|
---|
| 63 | D SETFIELD^TIUPNCV1 I $D(BADREC) D WIPEOUT Q
|
---|
| 64 | ;
|
---|
| 65 | ;Builds the TIU record
|
---|
| 66 | S DIE="^TIU(8925,",DA=TIUIFN D COPY I $D(BADREC) D WIPEOUT Q
|
---|
| 67 | D TEXT
|
---|
| 68 | D SIGSET ; D:TIU(1505)'="" SIGSET D:TIU(1511)'="" COSET
|
---|
| 69 | D ^TIUPNCVX ;*** May uncomment for direct X-ref set ***
|
---|
| 70 | ;S DA=TIUIFN,DIK="^TIU(8925," D IX1^DIK ; DO SETS ON X-REFS FOR ENTRY
|
---|
| 71 | S $P(^TIU(8925.97,1,0),U,5)=GMRPIFN ;last PN successfully processed
|
---|
| 72 | S $P(^TIU(8925.97,1,2),U,2)=TIUIFN ;last IEN used within ^TIU(8925,
|
---|
| 73 | I TIUCTR=1 S $P(^TIU(8925.97,1,2),U,1)=TIUIFN ;first IEN in ^TIU(8925,
|
---|
| 74 | S TIUCTR=TIUCTR+1
|
---|
| 75 | S $P(^TIU(8925.97,1,0),U,6)=TIUCTR ;records # of TIU documents built
|
---|
| 76 | S ^GMR(121,"CNV",GMRPIFN)=TIUIFN
|
---|
| 77 | I '(TIUIFN#500) W "."
|
---|
| 78 | D CLEANREC
|
---|
| 79 | Q
|
---|
| 80 | ;
|
---|
| 81 | CLEANREC ;Cleans partition after entry of record
|
---|
| 82 | K TIU,ESIG,PN,ATH,P1,P2,P3,P4,P5,C1,C2,C3,PNT,BADREC,TIUD,TIUNM,TIUT
|
---|
| 83 | K TMSG,TYP,COSIGN,TIUCOMPO,TIUCTYP,TYPE
|
---|
| 84 | K ^TMP("TIUBRK",GMRPIFN)
|
---|
| 85 | Q
|
---|
| 86 | ;
|
---|
| 87 | WIPEOUT ;Clears ^TIU(8925 if record is found to be incomplete
|
---|
| 88 | S DIK="^TIU(8925,",DA=TIUIFN D ^DIK
|
---|
| 89 | K ^TMP("TIUIFN",GMRPIFN)
|
---|
| 90 | I $G(TIU(.03)) S X=TIU(.03) D SUB^AUPNVSIT
|
---|
| 91 | D CLEANREC
|
---|
| 92 | Q
|
---|
| 93 | ;
|
---|
| 94 | TIUFLDS ;Sets TIU variables with PN data
|
---|
| 95 | ;
|
---|
| 96 | ; TIU(.01) SET IN TITLESET TIUPNCV3
|
---|
| 97 | S TIU(.02)=PN(.02) ; .02 PATIENT - .02 PATIENT
|
---|
| 98 | ; TIU(.03) SET IN VISIT TIUPNCV1
|
---|
| 99 | ; TIU(.04) SET IN TITLESET TIUPNCV3
|
---|
| 100 | ; TIU(.05) SET IN SIGVAR/COSVAR TIUPNCV1
|
---|
| 101 | S TIU(.06)=$S(+PN(100):$G(^GMR(121,"CNV",+PN(100))),1:"")
|
---|
| 102 | S TIU(.07)=PN(.03) ; USE DATE/TIME OF NOTE FOR EPISODE DATE TIME
|
---|
| 103 | S TIU(.13)="E"
|
---|
| 104 | S TIU(1201)=PN(.01) ; 1201 ENTRY DATE/TIME - .01 FILE ENTRY DATE
|
---|
| 105 | S (TIU(1202),TIU(1204))=PN(2) ; 1202 AUTHOR/DICTATOR - 2 AUTHOR
|
---|
| 106 | ; expected signer 1204 in TIU is PN(2)- AUTHOR in GMR
|
---|
| 107 | S (TIU(1205),TIU(1211))=PN(9) ; 1205 HOSPITAL LOCATION - 9 LOCATION
|
---|
| 108 | S TIU(1301)=PN(.03) ; 1301 REFERENCE DATE - .03 DATE/TIME OF PROG NOTE
|
---|
| 109 | S TIU(1302)=PN(.05) ; 1302 ENTERED BY - .05 TRANSCRIBER
|
---|
| 110 | S TIU(1303)="C"
|
---|
| 111 | S TIU(1501)=PN(4) ; 1501 SIGNATURE DATE/TIME - 4 DATE/TIME SIGNED
|
---|
| 112 | S TIU(1502)=PN(3) ; 1502 SIGNED BY - 3 E-SIG (AUTHOR)
|
---|
| 113 | S (TIU(1503),TIU(1504),TIU(1505))=""
|
---|
| 114 | S TIU(1506)=PN(5) ; 1506 COSIGNATURE NEEDED - 5 COSIGNATURE REQUIRED
|
---|
| 115 | S TIU(1507)=PN(7) ; 1507 COSIGNATURE DATE/TIME - 7 DATE/TIME COSIGNED
|
---|
| 116 | S (TIU(1208),TIU(1508))=PN(6) ; 1508 COSIGNED BY - 6 COSIGNER
|
---|
| 117 | S (TIU(1509),TIU(1510),TIU(1511))=""
|
---|
| 118 | S (TIU(1512),TIU("SIGCHART"))=PN(4.1) ;1512 - 4.1 SIGNATURE IN CHART
|
---|
| 119 | S (TIU(1513),TIU("COSCHART"))=PN(7.1) ;1513 - 7.1 COSIGNATURE IN CHART
|
---|
| 120 | S TIU("MHCONV")=PN(.06)
|
---|
| 121 | S TIU("PARENT")=$S(+PN(100):$G(^GMR(121,"CNV",+PN(100))),1:"")
|
---|
| 122 | S TIU("SPECDT")=$P(TIU(1201),".",1)
|
---|
| 123 | S TIU("TITLE")=PN(1)
|
---|
| 124 | Q
|
---|
| 125 | ;
|
---|
| 126 | RTNODE ;Sets 0 Node for TIU record
|
---|
| 127 | S TIUFPRIV=1
|
---|
| 128 | S (DIC,DLAYGO)=8925,DIC(0)="LN",X=""""_"`"_TIU(.01)_""""
|
---|
| 129 | D ^DIC I +Y<1 S TIU("BAD")=1 Q
|
---|
| 130 | S TIUIFN=+Y,^TMP("TIUIFN",GMRPIFN)=TIUIFN
|
---|
| 131 | Q
|
---|
| 132 | ;
|
---|
| 133 | COPY ;Writes data from ^GMR(121,GMRPIFN --> ^TIU(8925,TIUIFN
|
---|
| 134 | S ^TIU(8925,TIUIFN,0)=TIU(.01)_U_TIU(.02)_U_TIU(.03)_U_TIU(.04)_U_TIU(.05)_U_TIU(.06)_U_TIU(.07)_U_U_U_U_U_U_TIU(.13)
|
---|
| 135 | S ^TIU(8925,TIUIFN,12)=TIU(1201)_U_TIU(1202)_U_U_TIU(1204)_U_TIU(1205)_U_U_U_TIU(1208)_U_U_U_TIU(1211)
|
---|
| 136 | S ^TIU(8925,TIUIFN,13)=TIU(1301)_U_TIU(1302)_U_TIU(1303)
|
---|
| 137 | I $D(TIUNEWTY) S DR=".01////"_TIUNEWTY D ^DIE K TIUNEWTY
|
---|
| 138 | Q
|
---|
| 139 | ;
|
---|
| 140 | TEXT ;Copies text
|
---|
| 141 | I $D(^TMP("TIUHOLD",GMRPIFN)) M ^TIU(8925,TIUIFN,"TEXT")=^TMP("TIUHOLD",GMRPIFN,10) K ^TMP("TIUHOLD",GMRPIFN),^TMP("TIUMERGE",GMRPIFN) Q
|
---|
| 142 | Q
|
---|
| 143 | ;
|
---|
| 144 | SIGSET ;Sets ^TIU(8925 signature fields
|
---|
| 145 | N X
|
---|
| 146 | I TIU(1502)>0 S TIU(1503)=$$ENCRYPT^TIULC1(TIU(1503),1,$$CHKSUM^TIULC("^TIU(8925,"_TIUIFN_",""TEXT"")")),TIU(1504)=$$ENCRYPT^TIULC1(TIU(1504),1,$$CHKSUM^TIULC("^TIU(8925,"_TIUIFN_",""TEXT"")"))
|
---|
| 147 | I TIU(1508)>0 S TIU(1509)=$$ENCRYPT^TIULC1(TIU(1509),1,$$CHKSUM^TIULC("^TIU(8925,"_TIUIFN_",""TEXT"")")),TIU(1510)=$$ENCRYPT^TIULC1(TIU(1510),1,$$CHKSUM^TIULC("^TIU(8925,"_TIUIFN_",""TEXT"")"))
|
---|
| 148 | S X=TIU(1501)_U_TIU(1502)_U_TIU(1503)_U_TIU(1504)_U_TIU(1505)
|
---|
| 149 | S ^TIU(8925,TIUIFN,15)=X_U_TIU(1506)_U_TIU(1507)_U_TIU(1508)_U_TIU(1509)_U_TIU(1510)_U_TIU(1511)_U_TIU(1512)_U_TIU(1513)
|
---|
| 150 | Q
|
---|