Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ACKQUTL7

ACKQUTL7.m

Go to the documentation of this file.
ACKQUTL7 ;HCIOFO/BH - Template Inquire - A&SP Patient/Visit ;18 Jun 2013  10:54 AM
 ;;3.0;QUASAR;**8,22,21**;Feb 11, 2000;Build 40
 ;
 ; Reference/IA
 ;  $$CSI^ICDEX - 5747
 ;
INP ;  PRINT INPATIENT INFO
 W !,"WARD: ",ACK(6),?20,"ROOM/BED: ",ACK(7),?40,"TREATING SPEC:"
 W $E(ACK(8),1,25)
 Q
 ;
 ;
EN ;  Get Demographics
 N I,X,Y K ACKDIRUT
 D DEM^VADPT,INP^VADPT,ELIG^VADPT
 S ACKIVD=$$NUMDT^ACKQUTL($P(^ACK(509850.2,ACKPAT,0),U,2))
 K ACK S ACK(1)=VADM(1),ACK(2)=$P(VADM(3),U,2),ACK(3)=$P(VADM(2),U,2)
 S ACK(4)=VADM(7),ACK(6)=$P(VAIN(4),U,2)
 S ACKINP=$S($L(ACK(6)):1,1:0),ACK(5)="Patient is "_$S(ACKINP:"",1:"not ")_"currently an inpatient."
 S ACK(7)=VAIN(5),ACK(8)=$P(VAIN(3),U,2),ACK(9)=$P(VAEL(1),U,2)
PRINT ;
 W @IOF
 S X="QUASAR V.3.  "_ACKVISIT_" VISIT ENTRY" D CNTR^ACKQUTL(X)
 ;
 ;
 D TPLTE
 ;
 ;
 ;  D RATDIS^ACKQNQ  ;  Display any Rated Disabilities
 ;
 W !!,"Patient Diagnostic History",!
 W $S($P(VADM(5),U)="F":"Ms. ",1:"Mr. "),$P(VADM(1),",")
 W " has been seen for the following:",!
 I $Y>(IOSL-8) S DIR(0)="E" D ^DIR K DIR Q:$D(DIRUT)  W @IOF
 D DIHEAD,ICDSORT
 K DIRUT W !
 I $D(ACKICD)'=11 W !,"No A&SP Diagnostic Data for this Patient" G EXIT
 S ACKI=""
 ;F  S ACKI=$O(ACKICD(ACKI)) Q:ACKI=""  D:$Y>(IOSL-5) WAIT Q:$D(DIRUT)  W !,$P(ACKICD(ACKI),U),?15,$P(ACKICD(ACKI),U,3),?60,$$NUMDT^ACKQUTL($P(ACKICD(ACKI),U,4))
 S ACKICDX=""
 F  S ACKI=$O(ACKICD(ACKI)) Q:ACKI=""  D:$Y>(IOSL-5) WAIT Q:$D(DIRUT)  D
 . S ACKICDX=""
 . S ACKICDX=$O(ACKICD(ACKI,ACKICDX))
 . S ACKCDST(ACKICDX)=ACKICDX
 I $D(ACKCDST(1)),$D(ACKCDST(30)) D
 . S ACKI="",CNTR9=0,CNTR0=0
 . F  S ACKI=$O(ACKICD(ACKI)) Q:ACKI=""  D
 . . S ACKICD=""
 . . F  S ACKICD=$O(ACKICD(ACKI,ACKICD)) Q:ACKICD=""  D
 . . . S ACKDX=$P(ACKICD(ACKI,ACKICD),U)
 . . . S ACKDESC=$P(ACKICD(ACKI,ACKICD),U,3)
 . . . S ACKDATE=$$NUMDT^ACKQUTL($P(ACKICD(ACKI,ACKICD),U,4))
 . . . I ACKICD=1 S CNTR9=CNTR9+1 S ACKICD9(CNTR9)=ACKDX_U_ACKDESC_U_ACKDATE
 . . . I ACKICD=30 S CNTR0=CNTR0+1 S ACKICD0(CNTR0)=ACKDX_U_ACKDESC_U_ACKDATE
 . D PRTHEAD,EXIT Q
 S ACKI="" F  S ACKI=$O(ACKICD(ACKI)) Q:ACKI=""  D:$Y>(IOSL-5) WAIT Q:$D(DIRUT)  D
 . S ACKICDX=""
 . S ACKICDX=$O(ACKICD(ACKI,ACKICDX)) D
 . . W !,$P(ACKICD(ACKI,ACKICDX),U),?10,$P(ACKICD(ACKI,ACKICDX),U,3),?72,$$NUMDT^ACKQUTL($P(ACKICD(ACKI,ACKICDX),U,4))
EXIT ;
 I $G(DIRUT)=1 S ACKDIRUT=1  ;  Quit flag for template
 W !!
 K %ZIS,ACK,ACKCDST,ACKDC,ACKDD,ACKDESC,ACKDFN,ACKDN,ACKDX,ACKI,ACKICD,ACKINP,ACKIVD,ACKLINE
 K ACKRD,ACKDATE,ACKICD0,ACKICD9,ACKICDX,ACKINFO
 K CNTR0,CNTR9,DATA,DIRUT,DTOUT,DUOUT,VA,VADM,VAEL,VAERR,VAIN,X,X1,Y,ZTDESC,ZTIO
 K ZTRTN,ZTSAVE
 W:$E(IOST)'="C" @IOF D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
 Q
 ;
WAIT ;
 K DIRUT I $E(IOST)'="C" W @IOF Q
 S DIR(0)="E" D ^DIR K DIR Q:$D(DIRUT)  W @IOF,"Patient Diagnostic History (Cont'd)","  (",ACK(1),")" D DIHEAD
 Q
DIHEAD ;
 W ?72,"DATE"
 W !,"DIAGNOSIS",?72,"ENTERED" S ACKLINE="",$P(ACKLINE,"-",IOM)="" W !,ACKLINE
 Q
ICDSORT ;
 S ACKI=0 F  S ACKI=$O(^ACK(509850.2,DFN,1,ACKI)) Q:'ACKI  D
 . S ACKDC=^ACK(509850.2,DFN,1,ACKI,0),ACKDD=$P(ACKDC,U,2)
 . S ACKICD=$$CSI^ICDEX(80,+ACKDC) ; returns 1 for ICD9 and 30 for ICD10
 . S ACKINFO=$$ICDDATA^ICDXCODE(ACKICD,+ACKDC,ACKDD,"I")
 . S ACKTGT=$P(ACKINFO,U,3)
 . S ACKDN=$P(ACKINFO,U,2)
 . S ACKICD(ACKDN,ACKICD)=ACKDN_U_ACKTGT_U_$$DIAGTXT^ACKQUTL8(+ACKDC,ACKDD)_U_ACKDD
 K ACKTGT,ACKMSG
 Q
 ;
TPLTE ;  Display Visit Clinic and Division
 N ACKTMPE
 W !!,"CLINIC: ",$$GET1^DIQ(509850.6,ACKVIEN,"2.6")
 W ?45,"DIVISION: ",$$GET1^DIQ(509850.6,ACKVIEN,60),!
 ;  Display more Patient data
 W "PATIENT: ",ACK(1),?45,"DOB: ",ACK(2),?63,"SSN: ",ACK(3)
 ;  If no Visit Eligibility on visit file display Primary Elig.
 S ACKTMPE=$$GET1^DIQ(509850.6,ACKVIEN_",",80,"E")
 I ACKTMPE D 
 . W !,"VISIT ELIGIBILITY: "_ACKTMPE
 ;
 I 'ACKTMPE D
 .W !,"ELIGIBILITY: ",ACK(9)
 W ?45,"INITIAL VISIT DATE: ",ACKIVD
 W:$L(ACK(4)) !,ACK(4) W !,ACK(5) D:ACKINP INP
 ;  D VISIT
 ;
 Q
 ;
VISIT ;  Displays Service connected data
 ;
 I 'ACKSC Q        ;  If Patient not service connected QUIT
 I 'ACKPCE Q       ;  If system not set up for PCE then QUIT
 ;
 N ACKX,ACKVV,ACKPP,ACKVSC,ACKAAO,ACKEENV,ACKRRAD,ACK,ACKSTR
 ;
 D GETDATA
 I ACKVISIT="NEW",$G(ACKPCENO)="" D UNKNOWN Q
 I 'ACKVSC D NOT("This Visit's Treatment :",ACKAAO,ACKRRAD,ACKEENV) Q
 I ACKVSC D CONNECT
 Q
 ;
 ;
GETDATA ;  Get visit data
 ;
 K ACK
 D GETS^DIQ(509850.6,ACKVIEN,"20;25;30;35","I","ACK")
 S ACKVSC=ACK(509850.6,ACKVIEN_",",20,"I")
 S ACKAAO=ACK(509850.6,ACKVIEN_",",25,"I")
 S ACKEENV=ACK(509850.6,ACKVIEN_",",35,"I")
 S ACKRRAD=ACK(509850.6,ACKVIEN_",",30,"I")
 K ACK
 Q
 ;
CONNECT W !!,"This visit's Treatment is Service Connected.",!
 Q
 ;
NOT(ACKSTR,ACKAAO,ACKRRAD,ACKEENV) ;
 W !!,ACKSTR,!
 W "------------------------------------------------------------------------------"
 ;
 W !,"Related to AGENT ORANGE ? : "_$S(ACKAAO="1":"YES",1:"NO") W ?50,"Service Connected ? : NO"
 ;       
 W !,"Related to RADIATION EXPOSURE ? : "_$S(ACKRRAD="1":"YES",1:"NO")
 ;               
 W !,"Related to ENVIRONMENTAL CONTAMINANTS ? : "_$S(ACKEENV="1":"YES",1:"NO")
 Q
 ;
UNKNOWN N ACKPASS
 S ACKPASS=0
 W !!,"This visit's Treatment:",!
 W "------------------------------------------------------------------------------",!
 I ACKAO W "Related to AGENT ORANGE ? : UNKNOWN" D:'ACKPASS SERV
 I ACKRAD W !,"Related to RADIATION EXPOSURE ? : UNKNOWN" D:'ACKPASS SERV
 I ACKENV W !,"Related to ENVIRONMENTAL CONTAMINANTS ? : UNKNOWN" D:'ACKPASS SERV
 D:'ACKPASS SERV
 W !
 Q
 ;
SERV ;
 W ?50,"Service Connected ? : UNKNOWN" S ACKPASS=1
 Q
 ;
ERROR ; Display error message if registration returns error that indicates
 ; that the Appointment Management database is not available.
 ;
 N ACKERR
 W !!!!,"   ** The Appointment Management Data Base is unavailable. **"
 W !!,"   ** Please report this problem to IRM as soon as possible. **",!!!
 W "   Press any key to continue."
 R ACKERR:DTIME
 ; 
 Q
 ;
PRTHEAD ;
 S CNTR9=0,CNTR0=0
 W !,"ICD-9-CM",!
 F CNTR9=1:1 S DATA=$G(ACKICD9(CNTR9)) Q:'$D(ACKICD9(CNTR9))  D
 . S ACKDX=$P(DATA,U)
 . S ACKDESC=$P(DATA,U,2)
 . S ACKDATE=$P(DATA,U,3)
 . K ACKICDDS,ACKARNUM S ACKICDDS=ACKDESC D BRKDESC^ACKQR3(57)
 . ;W !,ACKDX,?10,ACKDESC,?72,ACKDATE
 . W !,ACKDX,?10,ACKICDDS(1),?71,ACKDATE
 . F ACKARNM2=2:1:ACKARNUM W !?10,ACKICDDS(ACKARNM2)
 . K ACKICDDS,ACKARNUM,ACKARNM2
 W !!,"ICD-10-CM",!
 F CNTR0=1:1 S DATA=$G(ACKICD0(CNTR0)) Q:'$D(ACKICD0(CNTR0))  D
 . S ACKDX=$P(DATA,U)
 . S ACKDESC=$P(DATA,U,2)
 . S ACKDATE=$P(DATA,U,3)
 . K ACKICDDS,ACKARNUM S ACKICDDS=ACKDESC D BRKDESC^ACKQR3(57)
 . ;W !,ACKDX,?10,ACKDESC,?72,ACKDATE
 . W !,ACKDX,?10,ACKICDDS(1),?71,ACKDATE
 . F ACKARNM2=2:1:ACKARNUM W !?10,ACKICDDS(ACKARNM2)
 . K ACKICDDS,ACKARNUM,ACKARNM2
 Q
 ;