TIULD ; SLC/JER - Admission related functions ; 1/13/03
;;1.0;TEXT INTEGRATION UTILITIES;**7,21,148,156**;Jun 20, 1997
GETTIU(TIUY,TIUDA) ; Gets admission array for existing DCS
N TIUMVN,TIUPTF,TIUVSTR,TIUDTYP,TIUD0,TIUD12,TIUD14
S TIUD0=$G(^TIU(8925,+TIUDA,0)),TIUD12=$G(^(12)),TIUD14=$G(^(14))
S TIUDTYP=+TIUD0,DFN=+$P(TIUD0,U,2),TIUMVN=$P(TIUD14,U)
S TIUVSTR=$P(TIUD12,U,11)_";"_$P(TIUD0,U,7)_";"_$P(TIUD0,U,13)
S TIUY("DOCTYP")=TIUDTYP_U_$$PNAME^TIULC1(TIUDTYP)
I +$G(^TIU(8925,+TIUDA,13)) S TIUY("REFDT")=+$G(^(13))
; If the Patient Movement Pointer's broken, try to fix
I +TIUMVN,'$D(^DGPM(+TIUMVN,0)),+$G(TIUVSTR) D FIXMOVE(.TIUY,DFN,TIUVSTR,TIUDA) Q:+$G(TIUY("AD#"))
D PATVADPT^TIULV(.TIUY,DFN,TIUMVN,TIUVSTR)
Q
FIXMOVE(TIUY,DFN,TIUVSTR,TIUDA) ; See if Admission has been reinstated, and fix
N TIUEDT,TIULDT,TIULOC
S TIUEDT=$P(TIUVSTR,";",2) Q:+TIUEDT'>0
S TIULDT=$$FMADD^XLFDT(TIUEDT,1),TIULOC=+TIUVSTR
Q:+TIULDT'>0!(+TIULOC'>0)
D MAIN^TIUMOVE(.TIUY,DFN,"",TIUEDT,TIULDT,1,"LAST",0,+TIULOC)
I +$G(TIU("AD#"))>0,$D(^DGPM(+$G(TIU("AD#")))) D
. N DIE,DR,DA S DA=TIUDA,DR="1401////"_+$G(TIU("AD#")),DIE="^TIU(8925,"
. D ^DIE
Q
CHEKDS(X) ; Display/validate correct patient/treatment episode
N DIR,Y,TIURC S Y=0
I X("AD#")'>0!(X("EDT")="") D G CHEKDSX
. W !!,"Movement data doesn't exist for admission, can't create "
. W "Summary",!
I +$$ISA^USRLM(DUZ,"TRANSCRIPTIONIST")>0 S Y=1 G CHEKDSX
W !!?1,"Patient: ",$$NAME^TIULS(X("PNM"),"LAST, FIRST MI"),?40,"SSN: "
W X("SSN"),?62,"Sex: ",$S(X("SEX")]"":$P(X("SEX"),U,2),1:"UNKNOWN"),!
W ?5,"Age: ",$S(X("AGE")]"":X("AGE"),1:"UNKNOWN"),?40,"Claim #: "
W $S(X("CLAIM")]"":X("CLAIM"),1:"UNKNOWN"),!
W "Adm Date: ",$$DATE^TIULS($P(X("EDT"),U),"MM/DD/YY"),?40,"Ward: "
W $P(X("WARD"),U,2),!
W:X("LDT")]"" "Dis Date: ",$$DATE^TIULS(X("LDT"),"MM/DD/YY"),!
W ?2,"Adm Dx: ",X("ADDX")
; Below TIU*148
I $G(X("NUMRACE"))>0 D
. W !?4,"Race: " F TIURC=1:1:X("NUMRACE") W ?10,$P(X("RACE",TIURC),U,2),!
I $G(X("RACENO"))=0 W !?4,"Race: ",$P($G(X("RACE")),U,2),!
I $D(X("DICTDT")) D
. W !,"A DISCHARGE SUMMARY is already on file:",!
. W ?2,"Dict'd: ",X("DICTDT"),?41,"By: ",X("AUTHOR"),!
. W ?2,"Signed: ",X("SIGDT"),?35,"Cosigned: ",X("COSDT"),!
. S Y=1
E S Y=$$READ^TIUU("YO","Correct VISIT","YES")
W !
CHEKDSX Q Y
CHEKPN(X,TIUBY) ; Display/validate demographic/visit information
W !!,"Enter/Edit "
W $S(+$G(TIUCLASS):$S(TIUCLASS=3:"PROGRESS NOTE",TIUCLASS=+$$CLASS^TIUCNSLT:"CONSULT RESULT",1:$$PNAME^TIULC1(+TIUCLASS)),1:"PROGRESS NOTE"),"..."
W !?10,"Patient Location: ",$S(+X("LOC"):$P(X("LOC"),U,2),1:"UNKNOWN")
W !?$S(+$G(X("AD#")):4,1:8),"Date/time of "
W $S(+$G(X("AD#")):"Admission: ",1:"Visit: ")
W $S(+$P($G(X("VSTR")),";",2):$$DATE^TIULS($P(X("VSTR"),";",2),"MM/DD/YY HR:MIN"),1:"UNKNOWN")
W !?9,"Date/time of Note: "
W $S(+$G(X("REFDT"))>0:$$DATE^TIULS(X("REFDT"),"MM/DD/YY HR:MIN"),1:"NOW")
S:+$G(X("REFDT"))'>0 X("REFDT")=$$NOW^TIULC
W !?12,"Author of Note: "
W $$PERSNAME^TIULC1($S($D(TIUAUTH):+TIUAUTH,1:DUZ))
S Y=$$READ^TIUU("YO"," ...OK","YES")
I $S($D(DIROUT):1,$D(DUOUT):1,$D(DTOUT):1,1:0) Q 0
S TIUBY=+Y
S:'+Y Y=$$READ^TIUU("YO","Correct VISIT","YES")
I $S($D(DIROUT):1,$D(DUOUT):1,$D(DTOUT):1,1:0) Q 0
I +Y'>0 D
. K X N TIUINOUT
. S TIUINOUT=$$INOUT^TIUVSIT
. I $S($D(DIROUT):1,$D(DUOUT):1,$D(DTOUT):1,1:0) Q
. I $P(TIUINOUT,U)="o" D MAIN^TIUVSIT(.X,DFN,"","","","",1)
. I $P(TIUINOUT,U)'="o" D MAIN^TIUMOVE(.X,DFN,"","","",1,"LAST",1)
. S Y=$S($D(X)>9:$$CHEKPN(.X,.TIUBY),1:0)
Q Y
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HTIULD 3592 printed Oct 16, 2024@18:42:47 Page 2
TIULD ; SLC/JER - Admission related functions ; 1/13/03
+1 ;;1.0;TEXT INTEGRATION UTILITIES;**7,21,148,156**;Jun 20, 1997
GETTIU(TIUY,TIUDA) ; Gets admission array for existing DCS
+1 NEW TIUMVN,TIUPTF,TIUVSTR,TIUDTYP,TIUD0,TIUD12,TIUD14
+2 SET TIUD0=$GET(^TIU(8925,+TIUDA,0))
SET TIUD12=$GET(^(12))
SET TIUD14=$GET(^(14))
+3 SET TIUDTYP=+TIUD0
SET DFN=+$PIECE(TIUD0,U,2)
SET TIUMVN=$PIECE(TIUD14,U)
+4 SET TIUVSTR=$PIECE(TIUD12,U,11)_";"_$PIECE(TIUD0,U,7)_";"_$PIECE(TIUD0,U,13)
+5 SET TIUY("DOCTYP")=TIUDTYP_U_$$PNAME^TIULC1(TIUDTYP)
+6 IF +$GET(^TIU(8925,+TIUDA,13))
SET TIUY("REFDT")=+$GET(^(13))
+7 ; If the Patient Movement Pointer's broken, try to fix
+8 IF +TIUMVN
IF '$DATA(^DGPM(+TIUMVN,0))
IF +$GET(TIUVSTR)
DO FIXMOVE(.TIUY,DFN,TIUVSTR,TIUDA)
if +$GET(TIUY("AD#"))
QUIT
+9 DO PATVADPT^TIULV(.TIUY,DFN,TIUMVN,TIUVSTR)
+10 QUIT
FIXMOVE(TIUY,DFN,TIUVSTR,TIUDA) ; See if Admission has been reinstated, and fix
+1 NEW TIUEDT,TIULDT,TIULOC
+2 SET TIUEDT=$PIECE(TIUVSTR,";",2)
if +TIUEDT'>0
QUIT
+3 SET TIULDT=$$FMADD^XLFDT(TIUEDT,1)
SET TIULOC=+TIUVSTR
+4 if +TIULDT'>0!(+TIULOC'>0)
QUIT
+5 DO MAIN^TIUMOVE(.TIUY,DFN,"",TIUEDT,TIULDT,1,"LAST",0,+TIULOC)
+6 IF +$GET(TIU("AD#"))>0
IF $DATA(^DGPM(+$GET(TIU("AD#"))))
Begin DoDot:1
+7 NEW DIE,DR,DA
SET DA=TIUDA
SET DR="1401////"_+$GET(TIU("AD#"))
SET DIE="^TIU(8925,"
+8 DO ^DIE
End DoDot:1
+9 QUIT
CHEKDS(X) ; Display/validate correct patient/treatment episode
+1 NEW DIR,Y,TIURC
SET Y=0
+2 IF X("AD#")'>0!(X("EDT")="")
Begin DoDot:1
+3 WRITE !!,"Movement data doesn't exist for admission, can't create "
+4 WRITE "Summary",!
End DoDot:1
GOTO CHEKDSX
+5 IF +$$ISA^USRLM(DUZ,"TRANSCRIPTIONIST")>0
SET Y=1
GOTO CHEKDSX
+6 WRITE !!?1,"Patient: ",$$NAME^TIULS(X("PNM"),"LAST, FIRST MI"),?40,"SSN: "
+7 WRITE X("SSN"),?62,"Sex: ",$SELECT(X("SEX")]"":$PIECE(X("SEX"),U,2),1:"UNKNOWN"),!
+8 WRITE ?5,"Age: ",$SELECT(X("AGE")]"":X("AGE"),1:"UNKNOWN"),?40,"Claim #: "
+9 WRITE $SELECT(X("CLAIM")]"":X("CLAIM"),1:"UNKNOWN"),!
+10 WRITE "Adm Date: ",$$DATE^TIULS($PIECE(X("EDT"),U),"MM/DD/YY"),?40,"Ward: "
+11 WRITE $PIECE(X("WARD"),U,2),!
+12 if X("LDT")]""
WRITE "Dis Date: ",$$DATE^TIULS(X("LDT"),"MM/DD/YY"),!
+13 WRITE ?2,"Adm Dx: ",X("ADDX")
+14 ; Below TIU*148
+15 IF $GET(X("NUMRACE"))>0
Begin DoDot:1
+16 WRITE !?4,"Race: "
FOR TIURC=1:1:X("NUMRACE")
WRITE ?10,$PIECE(X("RACE",TIURC),U,2),!
End DoDot:1
+17 IF $GET(X("RACENO"))=0
WRITE !?4,"Race: ",$PIECE($GET(X("RACE")),U,2),!
+18 IF $DATA(X("DICTDT"))
Begin DoDot:1
+19 WRITE !,"A DISCHARGE SUMMARY is already on file:",!
+20 WRITE ?2,"Dict'd: ",X("DICTDT"),?41,"By: ",X("AUTHOR"),!
+21 WRITE ?2,"Signed: ",X("SIGDT"),?35,"Cosigned: ",X("COSDT"),!
+22 SET Y=1
End DoDot:1
+23 IF '$TEST
SET Y=$$READ^TIUU("YO","Correct VISIT","YES")
+24 WRITE !
CHEKDSX QUIT Y
CHEKPN(X,TIUBY) ; Display/validate demographic/visit information
+1 WRITE !!,"Enter/Edit "
+2 WRITE $SELECT(+$GET(TIUCLASS):$SELECT(TIUCLASS=3:"PROGRESS NOTE",TIUCLASS=+$$CLASS^TIUCNSLT:"CONSULT RESULT",1:$$PNAME^TIULC1(+TIUCLASS)),1:"PROGRESS NOTE"),"..."
+3 WRITE !?10,"Patient Location: ",$SELECT(+X("LOC"):$PIECE(X("LOC"),U,2),1:"UNKNOWN")
+4 WRITE !?$SELECT(+$GET(X("AD#")):4,1:8),"Date/time of "
+5 WRITE $SELECT(+$GET(X("AD#")):"Admission: ",1:"Visit: ")
+6 WRITE $SELECT(+$PIECE($GET(X("VSTR")),";",2):$$DATE^TIULS($PIECE(X("VSTR"),";",2),"MM/DD/YY HR:MIN"),1:"UNKNOWN")
+7 WRITE !?9,"Date/time of Note: "
+8 WRITE $SELECT(+$GET(X("REFDT"))>0:$$DATE^TIULS(X("REFDT"),"MM/DD/YY HR:MIN"),1:"NOW")
+9 if +$GET(X("REFDT"))'>0
SET X("REFDT")=$$NOW^TIULC
+10 WRITE !?12,"Author of Note: "
+11 WRITE $$PERSNAME^TIULC1($SELECT($DATA(TIUAUTH):+TIUAUTH,1:DUZ))
+12 SET Y=$$READ^TIUU("YO"," ...OK","YES")
+13 IF $SELECT($DATA(DIROUT):1,$DATA(DUOUT):1,$DATA(DTOUT):1,1:0)
QUIT 0
+14 SET TIUBY=+Y
+15 if '+Y
SET Y=$$READ^TIUU("YO","Correct VISIT","YES")
+16 IF $SELECT($DATA(DIROUT):1,$DATA(DUOUT):1,$DATA(DTOUT):1,1:0)
QUIT 0
+17 IF +Y'>0
Begin DoDot:1
+18 KILL X
NEW TIUINOUT
+19 SET TIUINOUT=$$INOUT^TIUVSIT
+20 IF $SELECT($DATA(DIROUT):1,$DATA(DUOUT):1,$DATA(DTOUT):1,1:0)
QUIT
+21 IF $PIECE(TIUINOUT,U)="o"
DO MAIN^TIUVSIT(.X,DFN,"","","","",1)
+22 IF $PIECE(TIUINOUT,U)'="o"
DO MAIN^TIUMOVE(.X,DFN,"","","",1,"LAST",1)
+23 SET Y=$SELECT($DATA(X)>9:$$CHEKPN(.X,.TIUBY),1:0)
End DoDot:1
+24 QUIT Y