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

LRAPDA.m

Go to the documentation of this file.
  1. LRAPDA ;DALOI/STAFF - ANATOMIC PATH DATA ENTRY ;08/10/16 13:22
  1. ;;5.2;LAB SERVICE;**72,73,91,121,248,259,295,317,365,350,422,462**;Sep 27, 1994;Build 44
  1. ;
  1. ; Reference to ^VA(200 supported by IA #10060
  1. ;
  1. S LRDATA=0,LRAU=$S(LRSS'="AU":0,1:1)
  1. W !?20,LRO(68)," (",LRABV,")",!
  1. S:'$D(LRSOP) LRSOP=1 S:'$D(LRD(1)) LRD(1)="0"
  1. S:'$D(^LRO(69.2,LRAA,2,0)) ^(0)="^69.23A^0^0"
  1. ;
  1. SEL K LR(1)
  1. I $D(LR(2)) D G:%<1 END S:%=1 LR(1)=1
  1. . W !!,"Enter Etiology, Function, Procedure & Disease "
  1. . S %=2 D YN^LRU
  1. ;
  1. ;
  1. AK ; from LRAPD1
  1. N CORRECT
  1. S:'$D(LRSFLG) LRSFLG=""
  1. W !!,"Data entry for ",LRH(0)," "
  1. S %=1 D YN^LRU G:%<1 END
  1. I %=2 D G:Y<1 END S LRAD=$E(Y,1,3)_"0000",LRH(0)=$E(Y,1,3)+1700
  1. .S %DT="AE",%DT(0)="-N",%DT("A")="Enter YEAR: " D ^%DT K %DT
  1. I '$O(^LRO(68,LRAA,1,LRAD,1,0)) D Q
  1. . W $C(7),!!,"NO ",LRO(68)," ACCESSIONS IN FILE FOR ",LRH(0),!!
  1. W ;
  1. D LOOKUP^LRAPUTL(.LRDATA,LRH(0),LRO(68),LRSS,LRAD,LRAA)
  1. I LRDATA=-1!('$G(LRSEL))!('$D(LRI)) S LREND=1 Q
  1. S LRIDT=LRI
  1. I LRSEL=2 G:LRUID="" W D REST,OERR^LR7OB63D G W
  1. I LRSEL=3 D REST,OERR^LR7OB63D G W
  1. I LRSEL=1 D REST S:$D(DR(1))#2 DR=DR(1) D OERR^LR7OB63D G W
  1. ;
  1. ;
  1. REST ;
  1. N LRXSTOP,LRX,LRX1
  1. ;W " for ",LRH(0)
  1. I '$D(^LRO(68,LRAA,1,LRAD,1,LRAN,0)) D Q
  1. . W $C(7),!!,"Accession # ",LRAN," for ",LRH(0)," not in ",LRO(68),!!
  1. S X=^LRO(68,LRAA,1,LRAD,1,LRAN,0),LRLLOC=$P(X,"^",7),LRDFN=+X,LRODT=$P(X,"^",4),LRSN=$P(X,"^",5)
  1. Q:'$D(^LR(LRDFN,0)) S X=^(0) D ^LRUP
  1. ;W !,LRP," ID: ",SSN
  1. S (LRIDT,LRI)=+$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,3)),"^",5)
  1. I LRSS'="AU",'$D(^LR(LRDFN,LRSS,LRI,0)) D Q
  1. . W $C(7),!,"Inverse date missing or incorrect in Accession Area file "
  1. . W "for",!,LRO(68)," Year: ",$E(LRAD,2,3)," Accession: ",LRAN
  1. ;I "SPCYEM"[LRSS,$O(^LR(LRDFN,LRSS,LRI,.1,0)) D
  1. ;.W !,"Specimen(s):"
  1. ;.S X=0 F S X=$O(^LR(LRDFN,LRSS,LRI,.1,X)) Q:'X D
  1. ;..W !,$P($G(^LR(LRDFN,LRSS,LRI,.1,X,0)),"^")
  1. ;
  1. ; Don't allow supp. report to be added to a released report if modifications are being added via MM option
  1. S LRXSTOP=0,(LRX,LRX1)=""
  1. I LRSS'="AU",LRD(1)="S" D
  1. . S LRX=$P($G(^LR(LRDFN,LRSS,LRI,0)),"^",11) ;release date/time
  1. . S LRX1=$P($G(^LR(LRDFN,LRSS,LRI,0)),"^",15) ;orig rel date/time
  1. I LRSS="AU",LRSOP="R" D
  1. . S LRX=$P($G(^LR(LRDFN,"AU")),"^",15) ;release date/time
  1. . S LRX1=$P($G(^LR(LRDFN,"AU")),"^",3) ;date report completed
  1. I 'LRX,LRX1 D
  1. . W $C(7),!!,"This "_$G(LRAA(1))_" report is currently being"
  1. . W !,"modified; it must first be released before Supplementary"
  1. . W !,"report can be added.",!
  1. . S LRXSTOP=1
  1. Q:LRXSTOP
  1. ;
  1. ;
  1. DIE ;Edit
  1. I LRSS="AU" D D AUE Q
  1. . S LRICDT=$P($G(^LR(LRDFN,"AU")),U,1),ICDFMT=1
  1. . S LRCDSYS=$S(LRICDT'<$$IMPDATE^LEXU("10D"):30,1:1),ICDSYS=LRCDSYS,LRDXV=LRDFN_";"_LRSS
  1. N LRRDT1,LRRDT2,LRIENS,LREL,LRQUIT,LRSNO,LRCPT,LRESCPT
  1. S (LREL,LRESCPT,LRQUIT,LRSNO,LRCPT)=0,LRIENS=LRI_","_LRDFN_","
  1. S LRRDT1=$$GET1^DIQ(LRSF,LRIENS,.11,"I")
  1. S LRRDT2=$$GET1^DIQ(LRSF,LRIENS,.15,"I")
  1. S LRICDT=$$GET1^DIQ(LRSF,LRIENS,.1,"I"),ICDFMT=1
  1. S LRCDSYS=$S(LRICDT'<$$IMPDATE^LEXU("10D"):30,1:1),ICDSYS=LRCDSYS,LRDXV=LRDFN_";"_LRSS_";"_LRI
  1. S:LRRDT1!LRRDT2 LREL=1
  1. ; Determine if CPT activated
  1. I $T(ES^LRCAPES)'="" S LRESCPT=$$ES^LRCAPES()
  1. I LRSOP="G",LREL D Q
  1. . W $C(7),!!,"Report verified. Cannot edit with this option."
  1. I LRSOP'="","ABM"[LRSOP,LREL D Q:LRQUIT
  1. . ;Allow SNOMED and CPT coding even after release.
  1. . W $C(7),!!,"Report has been verified. "
  1. . I 'LRESCPT,LRSOP'="B" D Q
  1. . . W "Cannot edit with this option."
  1. . . S LRQUIT=1
  1. . W "Only "
  1. . I LRESCPT W "CPT " W:LRSOP="B" "and "
  1. . W:LRSOP="B" "SNOMED "
  1. . W "coding permitted.",!
  1. . I LRSOP="B" D
  1. . . K DIR S DIR(0)="Y",DIR("A")="Enter SNOMED coding",DIR("B")="NO"
  1. . . D ^DIR W !
  1. . . S LRSNO=+Y
  1. . Q:'LRESCPT
  1. . K DIR S DIR(0)="Y",DIR("A")="Enter CPT coding",DIR("B")="NO"
  1. . D ^DIR W !
  1. . S LRCPT=+Y
  1. . I "AM"[LRSOP,'LRCPT S LRQUIT=1 Q
  1. . I LRSOP="B",'LRCPT,'LRSNO S LRQUIT=1
  1. ;
  1. ;
  1. RESET ; Reset DR string if altered by prior accession/patient
  1. ; Reset DR to orig value in LRAPD1
  1. I LRSOP'="","AMBS"[LRSOP,$G(LRD)'="" D @LRD
  1. I LRSFLG="S",$G(LRD)'="" D @LRD ;For CY,EM Supp entry
  1. S:LRSNO DR=10 ;Modify DR string if only SNOMED coding permitted
  1. I 'LRSNO,LRCPT S DR="" ;Set DR string to null in only CPT coding
  1. ; If adding supp rpt to released rpt, remove date rpt completed from DR
  1. I LRRDT1,LRSOP="S"!(LRSFLG="S") S DR=".09///^S X=LRWHO;10"
  1. ;
  1. EDIT ; Call to ^DIE
  1. W !
  1. S LRA=^LR(LRDFN,LRSS,LRI,0),LRRC=$P(LRA,"^",10)
  1. I LRCAPA,"SPCYEM"[LRSS D C^LRAPSWK
  1. S DIE="^LR(LRDFN,LRSS,",DA=LRI,DA(1)=LRDFN
  1. D CK^LRU Q:$D(LR("CK"))
  1. I LRSS="SP",LRSOP="B",$O(^LR(LRDFN,LRSS,LRI,1.3,0)) D
  1. . W $C(7),!!,"This accession has a FROZEN SECTION report."
  1. . W !,"Be sure 'FROZEN SECTION' is entered as a SNOMED code in the PROCEDURE field"
  1. . W !,"for the appropriate organ or tissue.",!!
  1. ; Code S LRELSD is in DR string setup in LRAPR
  1. N LRELSD S LRELSD=0
  1. D ^DIE
  1. ;
  1. ; Ask for performing laboratory assignment
  1. I LRSFLG'="S" D EDIT^LRRPLU(LRDFN,LRSS,LRI)
  1. ;
  1. ; Update accession and order file, releasing facility and send CPRS alerts
  1. I LRELSD D
  1. . D ACCCOMP^LRAPRES
  1. . I LRSS'="AU" D
  1. . . D SETRL^LRVERA(LRDFN,LRSS,LRI,DUZ(2))
  1. . . D MAIN^LRAPRES1(LRDFN,LRSS,LRI,LRSF,LRP,$P(LRA,"^",6))
  1. . . ;;*Make call to update CPRS order on release *462
  1. . . N LRTEST S LRTEST(+$G(LRT))="" D NEW^LR7OB1(LRODT,LRSN,"RE",,.LRTEST)
  1. ;
  1. ; Update clinical reminders
  1. D UPDATE^LRPXRM(LRDFN,LRSS,LRI)
  1. ;
  1. D:LRSFLG="S"&('$D(Y)) ^LRAPDSR
  1. D FRE^LRU
  1. I LRSOP'="","ABM"[LRSOP D CPTCOD
  1. ;
  1. WKLD ; Capture Workload
  1. I LRSOP="Z","CYSP"[LRSS,LRCAPA D S^LRAPR Q
  1. I LRCAPA,"SPCYEM"[LRSS,LRD(1)'="","MBA"[LRD(1) D C1^LRAPSWK
  1. I LRCAPA,"SPCYEM"[LRSS,LRSOP="G" D C1^LRAPSWK
  1. ;
  1. QUEUES ; Update Queues
  1. S X=$P(^LR(LRDFN,LRSS,LRI,0),"^",4)
  1. I X,$D(^VA(200,X,0)) S LR("TR")=$P(^(0),"^")
  1. I "CYEMSP"[LRSS,$D(LR(6)),LRSOP="G" Q:$D(^LRO(69.2,LRAA,1,LRAN,0)) D Q
  1. . L +^LRO(69.2,LRAA,1):DILOCKTM I '$T D Q
  1. . . N MSG
  1. . . S MSG(1)="The preliminary reports queue is in use by another person.",MSG(1,"F")="!!"
  1. . . S MSG(2)=" You will need to add this accession to the queue later."
  1. . . D EN^DDIOL(.MSG)
  1. . S ^LRO(69.2,LRAA,1,LRAN,0)=LRDFN_"^"_LRI_"^"_LRH(0)
  1. . S X=^LRO(69.2,LRAA,1,0),^(0)=$P(X,"^",1,2)_"^"_LRAN_"^"_($P(X,"^",4)+1)
  1. . L -^LRO(69.2,LRAA,1)
  1. I "CYEMSP"[LRSS,$D(LR(7)),'$D(^LRO(69.2,LRAA,2,LRAN,0)),LRD(1)'="S" D
  1. . L +^LRO(69.2,LRAA,2):DILOCKTM I '$T D Q
  1. . . N MSG
  1. . . S MSG(1)="The final reports queue is in use by another person. ",MSG(1,"F")="!!"
  1. . . S MSG(2)="You will need to add this accession to the queue later."
  1. . . D EN^DDIOL(.MSG)
  1. . S ^LRO(69.2,LRAA,2,LRAN,0)=LRDFN_"^"_LRI_"^"_LRH(0)
  1. . S X=^LRO(69.2,LRAA,2,0),^(0)=$P(X,"^",1,2)_"^"_LRAN_"^"_($P(X,"^",4)+1)
  1. . L -^LRO(69.2,LRAA,2)
  1. D:LRSOP="M"!(LRSOP="B") EN^LRSPGD
  1. Q
  1. ;
  1. ;
  1. NM ;
  1. I X'["@"!(X["@"&(Y(Z)="")) D Q
  1. .W $C(7),!?4,"ENTER WHOLE NUMBERS ONLY",! K X
  1. I Y(Z)'="" W $C(7),?40,"OK TO DELETE" S %=2 D YN^LRU I %'=1 K X Q
  1. S Y(Z)="" Q
  1. ;
  1. ;
  1. AUE ; Autopsy Data Entry
  1. W !
  1. N LREL,LRQUIT,LRSNO,LRESCPT,LRCPT
  1. S (LREL,LRQUIT,LRSNO,LRCPT)=0
  1. S LREL=+$$GET1^DIQ(63,LRDFN_",",14.7,"I")
  1. ; Determine if CPT activated
  1. I $T(ES^LRCAPES)'="" S LRESCPT=$$ES^LRCAPES()
  1. ; Allow supp report to be added on verified AU
  1. I LRSOP'="","AFIP"[LRSOP,LREL D Q:LRQUIT
  1. . Q:LRESCPT&("AP"[LRSOP)
  1. . W $C(7),!!,"Report verified. Cannot edit with this option!"
  1. . S LRQUIT=1
  1. I LRSOP'="","ABP"[LRSOP,LREL D Q:LRQUIT
  1. . W $C(7),!!,"Report has been verified. "
  1. . W "Only "
  1. . I LRESCPT W "CPT " W:LRSOP="B" "and "
  1. . W:LRSOP="B" "SNOMED "
  1. . W "coding permitted.",!
  1. . I LRSOP="B" D
  1. . . K DIR S DIR(0)="Y",DIR("A")="Enter SNOMED coding",DIR("B")="NO"
  1. . . D ^DIR W !
  1. . . S LRSNO=+Y
  1. . Q:'LRESCPT
  1. . K DIR S DIR(0)="Y",DIR("A")="Enter CPT coding",DIR("B")="NO"
  1. . D ^DIR W !
  1. . S LRCPT=+Y
  1. . I "AP"[LRSOP,'LRCPT S LRQUIT=1 Q
  1. . I LRSOP="B",'LRCPT,'LRSNO S LRQUIT=1
  1. ;
  1. AURESET ; Reset DR to orig value in LRAUDA
  1. I LRSOP'="","AP"[LRSOP D @(LRSOP_"DR^LRAUDA")
  1. I LRSOP="B" D BDR^LRAUDA
  1. S:LRSNO DR=32 ;Modify DR string if only SNOMED coding permitted
  1. I 'LRSNO,LRCPT S DR="" ;Set DR string to null inf only CPT coding
  1. ; ;
  1. ; Not all of the autopsy fields are within the AU subscript.
  1. ; Therefore, we must lock the entire LRDFN.
  1. L +^LR(LRDFN):DILOCKTM I '$T D Q
  1. . S MSG="This record is locked by another user. "
  1. . S MSG=MSG_"Please wait and try again."
  1. . D EN^DDIOL(MSG,"","!!") K MSG
  1. I LRSFLG'="S" D
  1. . N LRELSD S LRELSD=0
  1. . S DIE="^LR(",DA=LRDFN
  1. . D ^DIE
  1. . S LRA=^LR(LRDFN,"AU"),LRI=$P(LRA,U),LRAC=$P(LRA,U,6)
  1. . I LRELSD D MAIN^LRAPRES1(LRDFN,LRSS,LRI,LRSF,LRP,LRAC)
  1. ;
  1. D:LRSFLG="S" ^LRAPDSR
  1. ;
  1. ; Ask for performing laboratory assignment
  1. W !! D EDIT^LRRPLU(LRDFN,LRSS,LRI)
  1. ;
  1. D UPDATE^LRPXRM(LRDFN,"AU")
  1. L -^LR(LRDFN)
  1. D:"BAP"[LRSOP AU
  1. D:LRSOP="R" R
  1. I LRSOP'="","ABP"[LRSOP D CPTCOD
  1. Q
  1. ;
  1. ;
  1. AU I '$D(^LRO(69.2,LRAA,2,LRAN,0)) D
  1. .L +^LRO(69.2,LRAA,2):DILOCKTM I '$T D Q
  1. ..S MSG(1)="The final reports queue is in use by another person. "
  1. ..S MSG(1,"F")="!!"
  1. ..S MSG(2)="You will need to add this accession to the queue later."
  1. ..D EN^DDIOL(.MSG) K MSG
  1. .S ^LRO(69.2,LRAA,2,LRAN,0)=LRDFN
  1. .S X=^LRO(69.2,LRAA,2,0),^(0)=$P(X,"^",1,2)_"^"_LRAN_"^"_($P(X,"^",4)+1)
  1. .L -^LRO(69.2,LRAA,2)
  1. D AU^LRSPGD
  1. Q
  1. ;
  1. ;
  1. R I '$D(^LRO(69.2,LRAA,3,LRAN,0)) D
  1. . L +^LRO(69.2,LRAA,3):DILOCKTM I '$T D Q
  1. . . S MSG(1)="The interim reports queue is in use by another person. "
  1. . . S MSG(1,"F")="!!"
  1. . . S MSG(2)="You will need to add this accession to the queue later."
  1. . . D EN^DDIOL(.MSG) K MSG
  1. . S ^LRO(69.2,LRAA,3,LRAN,0)=LRDFN
  1. . S X=^LRO(69.2,LRAA,3,0),^(0)=$P(X,"^",1,2)_"^"_LRAN_"^"_($P(X,"^",4)+1)
  1. . L -^LRO(69.2,LRAA,3)
  1. Q
  1. ;
  1. ;
  1. PNAME ; Patient Name Lookup
  1. ; LRPFLG tells LRUPS to limit accessions to the chosen year.
  1. N LRPFLG
  1. S X=LRPNM,LRPFLG=1
  1. K LRPNM,DIC,VADM,VAIN,VA
  1. S DFN=-1,DIC(0)="EQM",(LRX,LRDPF)=""
  1. D:'$D(LRLABKY) LABKEY^LRPARAM
  1. D DPA1^LRDPA
  1. I DFN=-1 S LRAN=-1 Q
  1. D I^LRUPS
  1. Q
  1. ;
  1. ;
  1. CPTCOD ; CPT Coding
  1. N LRPRO
  1. Q:$T(CPT^LRCAPES)=""
  1. Q:LREL&('LRCPT)
  1. I 'LREL D
  1. . K DIR S DIR(0)="Y",DIR("A")="Enter CPT coding",DIR("B")="NO"
  1. . D ^DIR W !
  1. . S LRCPT=+Y
  1. Q:'LRCPT
  1. ; SET PROVIDER TO CURRENT USER, ALLOW UPDATES
  1. S LRPRO=DUZ
  1. D PROVIDR^LRAPUTL
  1. Q:LRQUIT
  1. D CPT^LRCAPES(LRAA,LRAD,LRAN,LRPRO)
  1. Q
  1. ;
  1. ;
  1. END K LRSFLG,LRICDT,LRCDSYS,ICDSYS,ICDFMT,LRDXV
  1. D:$T(CLEAN^LRCAPES)'="" CLEAN^LRCAPES
  1. D V^LRU
  1. Q
  1. ;