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

OROCLM.m

Go to the documentation of this file.
OROCLM ; SLC/AJB - ListManager Display for Cancelled Orders ;May 17, 2018@12:28
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**377**;Dec 17, 1997;Build 582
 Q
VIEW ;
 N DATA,IEN,ORDER,X
 D FULL^VALM1 W @IOF
 S IEN=$O(@VALMAR@("IDX",SEL,""))
 S ORDER=$$GET1^DIQ(100.3,IEN,.07)
 S DATA("DATE")=$$FIXDT($$FMTE^XLFDT($E($$GET1^DIQ(100.3,IEN,.01,"I"),1,12),2))
 S DATA("PATIENT")=$S('+ORDER:$$GET1^DIQ(100.3,IEN,.02),+ORDER:$$GET1^DIQ(100,ORDER,.02))
 S DATA("ENTERED")=$S('+ORDER:$$GET1^DIQ(100.3,IEN,.03),+ORDER:$$GET1^DIQ(100,ORDER,3))
 S DATA("USER")=$$GET1^DIQ(100.3,IEN,.03)
 S DATA("OCCURRENCE")=$$GET1^DIQ(100.3,IEN,.05)
 S X=0
 S X=X+1,DATA(X)="Cancelled Order Information",DATA(X)=$$SETSTR^VALM1(DATA(X),"",IOM-$L(DATA(X))/2,$L(DATA(X))) ;,$P(DATA(X),U,2)="IORVON",$P(DATA(X),U,3)="IORVOFF"
 ;
 S X=X+1,DATA(X)="Date/Time",DATA(X)=$$SETSTR^VALM1("Patient Name",DATA(X),IOM-12/2,12),DATA(X)=$$SETSTR^VALM1("Occurrence",DATA(X),IOM-9,10)
 ;
 S X=X+1,DATA(X)=DATA("DATE"),DATA(X)=$$SETSTR^VALM1(DATA("PATIENT"),DATA(X),IOM-$L(DATA("PATIENT"))/2,$L(DATA("PATIENT")))
 S DATA(X)=$$SETSTR^VALM1(DATA("OCCURRENCE"),DATA(X),IOM-($L(DATA("OCCURRENCE"))-1),$L(DATA("OCCURRENCE"))),$P(DATA(X),U,2)="IOUON",$P(DATA(X),U,3)="IOUOFF"
 ;
 S X=X+1,DATA(X)=""
 S X=X+1,DATA(X)="Orderable Item(s)",$P(DATA(X),U,2)="IORVON",$P(DATA(X),U,3)="IORVOFF"
 ;
 D
 . N CNT,FILE,FLDS,OCC,OUT,ORCHK
 . S OCC=$$GET1^DIQ(100.3,IEN_",",.05,"I")
 . S FILE=$S(OCC="CH":100.3,+ORDER:100,1:100.3)
 . S FLDS=$S(FILE=100:".1*",1:"1*;2*")
 . D GETS^DIQ(FILE,$S(OCC="CH":IEN,+ORDER:ORDER,1:IEN)_",",FLDS,"NE","OUT")
 . I +$D(OUT) S OUT=0,FILE=$O(OUT(FILE)) F  S OUT=$O(OUT(FILE,OUT)) Q:'+OUT  S X=X+1,DATA(X)=OUT(FILE,OUT,.01,"E") ; orderable items
 . ;
 . S FILE=$S(OCC="CH":100.32,+ORDER:100.05,1:100.32) I +ORDER D
 . . N ORCHK D GETOC2^OROCAPI1(ORDER,.ORCHK)
 . . S ORCHK=0 F  S ORCHK=$O(ORCHK(ORDER,ORCHK)) Q:'+ORCHK  D GETS^DIQ(FILE,ORCHK_",","5;6;8","E","OUT")
 . S (CNT,OUT)=0
 . F  S OUT=$O(OUT(FILE,OUT)) Q:'+OUT  D
 . . S CNT=CNT+1
 . . I CNT=1 S X=X+1,DATA(X)="",X=X+1,DATA(X)="Order Check Information",DATA(X)=$$SETSTR^VALM1(DATA(X),"",IOM-$L(DATA(X))/2,$L(DATA(X))) ;,$P(DATA(X),U,2)="IORVON",$P(DATA(X),U,3)="IORVOFF"
 . . I CNT=1 S X=X+1,DATA(X)="Type"
 . . I CNT=1 S X=X+1,DATA(X)="Message",DATA(X)=$$SETSTR^VALM1("Clinical Danger Level",DATA(X),40,41),$P(DATA(X),U,2)="IOUON",$P(DATA(X),U,3)="IOUOFF"
 . . ;
 . . S X=X+1,DATA(X)=OUT(FILE,OUT,$S(OCC="CH":.01,+ORDER:5,1:.01),"E"),DATA(X)=$$SETSTR^VALM1(OUT(FILE,OUT,$S(OCC="CH":.02,+ORDER:6,1:.02),"E"),DATA(X),40,41)
 . . I '+ORDER!(OCC="CH") S X=X+1,DATA(X)=OUT(FILE,OUT,1,"E") ; S X=X+1,DATA(X)=""
 . . ;
 . . N I S I=0 F  S I=$O(OUT(FILE,OUT,$S(OCC="CH":2,+ORDER:8,1:2),I)) Q:'+I  S X=X+1,DATA(X)=OUT(FILE,OUT,$S(OCC="CH":2,+ORDER:8,1:2),I)
 . . S X=X+1,DATA(X)=""
 ;
 S X=0 F  S X=$O(DATA(X)) Q:'+X  D
 . W:X>1 ! I $Y>(IOSL-3) I $$READ("EA",IORVON_"Press <ENTER> to continue..."_IORVOFF) W @IOF
 . W:$P(DATA(X),U,2)'="" @$P(DATA(X),U,2) W $P(DATA(X),U) W:$P(DATA(X),U,3)'="" @$P(DATA(X),U,3)
 F  Q:$Y>(IOSL-3)  W !
 I $$READ("EA",IORVON_"Press <ENTER> to continue..."_IORVOFF)
 Q
EN(SRCH,LOC) ;
 D EN^VALM("OR ORDER CHECKS DISPLAY")
 Q
HDR ;
 S VALMHDR(1)="From "_$$FMTE^XLFDT(SRCH("ADATE"))_" to "_$$FMTE^XLFDT(SRCH("BDATE"))
 S VALMHDR(1)=$$SETSTR^VALM1(VALMHDR(1),"",(IOM-$L(VALMHDR(1)))/2,$L(VALMHDR(1)))
 S VALMHDR(1)="Search Criteria: "_$E(VALMHDR(1),17,80)
 S VALMHDR(2)=""
 N HDR S HDR="BDATE" F  S HDR=$O(SRCH(HDR)) Q:HDR=""  D
 . S VALMHDR(2)=VALMHDR(2)_$S(HDR="CDL":"CLIN DANGER LVL",HDR="ORDCHECK":"ORDER CHK",HDR="ORDITEM":"ORDERABLE ITEM",1:HDR)_$S($O(SRCH(HDR))'="":",",1:"")
 S VALMHDR(2)=$$SETSTR^VALM1(VALMHDR(2),"",(IOM-$L(VALMHDR(2)))/2,$L(VALMHDR(2)))
 D XQORM
 Q
CHANGE ;
 D FULL^VALM1 W @IOF
 S CONT=0 K SRCH
 D LM^ORNORC ; setup search parameters from user
 I '+CONT W !!,"Search parameter entry aborted.",! Q
 S VALMCNT=0 K @LOC D CLEAN^VALM10
 D FIND^ORNORC(.SRCH,LOC) ; find entries that match search criteria
 D HDR,INIT,RE^VALM4
 Q
ASK ;
 D VIEW ; default action
 Q
INIT ;
 N GBL,IEN S GBL=$NA(^OR(100.3))
 K @VALMAR
 S (VALMCNT,IEN)=0 F  S IEN=$O(@LOC@(IEN)) Q:'+IEN  D
 . N DATE,OCC,ORDER,VALUE,X S X="",OCC=$$GET1^DIQ(100.3,IEN_",",.05,"I")
 . S VALMCNT=VALMCNT+1
 . S X=$$SETFLD^VALM1(VALMCNT,X,"NUMBER")
 . S ORDER=$$GET1^DIQ(100.3,IEN,.07)
 . S VALUE=$E($S('+ORDER:$$GET1^DIQ(100.3,IEN,.02),+ORDER:$$GET1^DIQ(100,ORDER,.02)),1,20)
 . S X=$$SETFLD^VALM1(VALUE,X,"PATIENT")
 . S VALUE=$E($S(OCC="CH":$$GET1^DIQ(100.31,"1,"_IEN,.01),'+ORDER:$$GET1^DIQ(100.31,"1,"_IEN,.01),+ORDER:$$GET1^DIQ(100.001,"1,"_ORDER,.01)),1,48)
 . I +$D(^OR(100.3,IEN,1,2)) S VALUE=VALUE_" *"
 . I +ORDER,VALUE'["*",+$D(^OR(100,ORDER,.1,2)) S VALUE=VALUE_" *"
 . S X=$$SETFLD^VALM1(VALUE,X,"ORDERABLE ITEM")
 . S DATE=$$FIXDT($$FMTE^XLFDT($E($$GET1^DIQ(100.3,IEN,.01,"I"),1,12),2))
 . S X=$$SETFLD^VALM1(DATE,X,"DATE")
 . I '+ORDER D
 . . S VALUE=$$GET1^DIQ(100.32,"1,"_IEN,.01)
 . . I +$D(^OR(100.3,IEN,2,2)) S VALUE=VALUE_" *"
 . . S X=$$SETFLD^VALM1($E(VALUE,1,50),X,"ORDER CHECK")
 . . S VALUE=$$GET1^DIQ(100.32,"1,"_IEN,.02)
 . . S X=$$SETFLD^VALM1(VALUE,X,"CDL")
 . . S X=$$SETFLD^VALM1($$GET1^DIQ(100.3,IEN,.03),X,"ENTERED")
 . I +ORDER D
 . . S X=$$SETFLD^VALM1($$GET1^DIQ(100,ORDER,.02),X,"PATIENT")
 . . S X=$$SETFLD^VALM1($$GET1^DIQ(100,ORDER,3),X,"ENTERED")
 . . N ORCHK D GETOC2^OROCAPI1(ORDER,.ORCHK)
 . . S ORCHK="",ORCHK=$O(ORCHK(ORDER,ORCHK))
 . . S VALUE=$$GET1^DIQ(100.05,ORCHK,5)
 . . I +$O(ORCHK(ORDER,ORCHK)) S VALUE=VALUE_" *"
 . . S X=$$SETFLD^VALM1($E(VALUE,1,50),X,"ORDER CHECK")
 . . S VALUE=$$GET1^DIQ(100.05,ORCHK,6)
 . . S X=$$SETFLD^VALM1(VALUE,X,"CDL")
 . S X=$$SETFLD^VALM1($$GET1^DIQ(100.3,IEN,.03),X,"USER")
 . S X=$$SETFLD^VALM1($$GET1^DIQ(100.3,IEN,.05),X,"OCCURRENCE")
 . D SET^VALM10(VALMCNT,X,IEN)
 I VALMCNT=0 S VALMCNT=1 D
 . D SET^VALM10(1," ",0)
 . S X="No records found to satisfy search criteria."
 . S X=$$SETSTR^VALM1(X,"",(IOM-$L(X))/2,$L(X))
 . D SET^VALM10(2,X,0)
 . S VALMCNT=0
 Q
HELP ;
 N DIR
 I X="?" S DIR("A")="Enter RETURN to continue or '^' to exit",DIR(0)="E"
 D FULL^VALM1
 W !!,"* indicates there are multiple entries for this item."
 W !!,"The following actions are available:"
 W !!,"View Order - View Order Details        Change Search - Change Search Parameters"
 W !
 I $D(DIR("A")) D ^DIR
 S VALMBCK="R"
 Q
EXIT ;
 D XQORM
 Q
EXPND ;
 Q
SELECT(ACT) ;
 I ACT="CHANGE" G CHANGE
 I VALMCNT=0 Q
 N SEL,X,Y
 D FULL^VALM1
 S SEL=+$P(XQORNOD(0),"=",2)
 I SEL=0 S SEL=+$$READ("N^1:"_VALMLST_":0","Select Order") Q:'+SEL
 D @ACT
 Q
READ(TYPE,PROMPT,DEFAULT,HELP,SCREEN) ;
 N DIR,X,Y
 S DIR(0)=TYPE
 I $D(SCREEN) S DIR("S")=SCREEN
 I $G(PROMPT)]"" S DIR("A")=PROMPT
 I $G(DEFAULT)]"" S DIR("B")=DEFAULT
 I $D(HELP) S DIR("?")=HELP
 D ^DIR
 I $G(X)="@" S Y="@" Q Y
 I Y]"",($L($G(Y),U)'=2) S Y=Y_U_$G(Y(0),Y)
 Q Y
XQORM ;
 S XQORM("#")=$O(^ORD(101,"B","ORCHK LISTMAN SELECT ENTRY",0))_U_"1:"_VALMCNT
 Q
FIXDT(X) ;
 S $P(X,"/")=$S($P(X,"/")<10:"0"_$P(X,"/"),1:$P(X,"/"))
 S $P(X,"/",2)=$S($P(X,"/",2)<10:"0"_$P(X,"/",2),1:$P(X,"/",2))
 Q X