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

GMTSULT3.m

Go to the documentation of this file.
  1. GMTSULT3 ; SLC/KER - HS Type Lookup (Save) ; 08/27/2002
  1. ;;2.7;Health Summary;**30,32,56**;Oct 20, 1995
  1. ;
  1. ; External References
  1. ; DBIA 10060 ^VA(200,
  1. ; DBIA 2056 $$GET1^DIQ (file #200)
  1. ;
  1. Q
  1. SM ; Save match
  1. ;
  1. ; GMTSIEN Type Internal Entry Number
  1. ; GMTSKWRD Keyword from AW index
  1. ; GMTSWRDS Parsed word array
  1. ; GMTSEO Exact Match (One) OE
  1. ; GMTSEQ Exact Match Required X
  1. ; GMTSIF Interal Entry Number N
  1. ;
  1. S GMTSIEN=+($G(GMTSIEN)),GMTSKWRD=$G(GMTSKWRD),GMTSEO=+($G(GMTSEO)),GMTSEQ=+($G(GMTSEQ)),GMTSIF=+($G(GMTSIF)),U="^"
  1. N GMTSCOMP,GMTSCF,GMTSWRD,GMTSWDS,GMTSEQ,GMTSLOK,GMTSOK,GMTSLT,GMTSLI,GMTSASM,GMTSI1,GMTSI2,GMTSI3,GMTSNAM,GMTSTTL,GMTSOW,GMTSLOC,GMTSCMP,GMTSRC
  1. S (GMTSNAM,GMTSTTL,GMTSOW,GMTSLOC,GMTSCMP,GMTSRC)="",GMTSLOK=0,GMTSRC="Name",GMTSWRD=$G(GMTSWRDS(1)),GMTSWDS=+($O(GMTSWRDS(" "),-1))
  1. ; Get Internal Entry Number (IEN)
  1. S GMTSI1=+($G(GMTSIEN)) Q:'$D(^GMT(142,GMTSI1,0))
  1. ; Check Screen - DIC("S")
  1. S GMTSOK=1 I $L($G(GMTSDICS)) S GMTSOK=$$DICS^GMTSULT2(GMTSDICS,X,GMTSI1) Q:'GMTSOK
  1. ; Get Health Summary Type
  1. ; Components
  1. S GMTSCMP=$$CM^GMTSULT2(+GMTSI1)
  1. ; Name
  1. S GMTSNAM=$P($G(^GMT(142,+GMTSI1,0)),U,1)
  1. ; Title
  1. S GMTSTTL=$P($G(^GMT(142,+GMTSI1,"T")),U,1)
  1. S:$L(GMTSTTL) GMTSRC="Title"
  1. ; Owner
  1. S GMTSOW=+($P($G(^GMT(142,+GMTSI1,0)),U,3)) S:GMTSOW<1 GMTSOW=""
  1. S:+GMTSOW>0 GMTSOW=$$GET1^DIQ(200,(+GMTSOW_","),.01)
  1. I $L($G(GMTSKWRD)) S:$L(GMTSOW)&(GMTSOW[GMTSKWRD) GMTSRC="Title/Owner"
  1. ; Name/Title
  1. D NT^GMTSULT4
  1. ; Location
  1. D LC^GMTSULT4
  1. S:'$L($G(GMTSLT("C")))&($L($G(GMTSLI("C")))) GMTSLOC=$G(GMTSLI("C"))
  1. ; Get Composite String
  1. D CMA^GMTSULT4
  1. ; Find words in string
  1. S (GMTSCF,GMTSFND)=0 I GMTSWDS>0 F GMTSI=1:1:GMTSWDS D
  1. . Q:'$L(GMTSWRDS(GMTSI))
  1. . S GMTSCF=+($$CHKW^GMTSULT4(GMTSWRDS(GMTSI)))
  1. . S:GMTSCF GMTSFND=GMTSFND+1
  1. . S:$L(GMTSOW)&(GMTSOW[$$UP^GMTSULT2(GMTSWRDS(GMTSI))) GMTSRC="Title/Owner"
  1. ;
  1. ; If input is not an Internal Entry Number +GMTSIF=0
  1. ; and not all of the words were found GMTSFND'=GMTSWDS
  1. ; then quit
  1. ;
  1. Q:'(+($G(GMTSIF)))&(GMTSFND'=GMTSWDS)
  1. ;
  1. ; Save Health Summary Type
  1. ; Exact match only DIC(0)["O" & DIC(0)["E"
  1. I '(+($G(GMTSIF))),+($G(GMTSEO)),($$UP^GMTSULT2(GMTSNAM)'=$$UP^GMTSULT2(X)&($$UP^GMTSULT2(GMTSLOC)'=$$UP^GMTSULT2(X))) Q
  1. S:$L(GMTSLOC) GMTSRC="Location"
  1. ; Quit if Health Summary is already saved
  1. Q:$D(^TMP("GMTSULT2",$J,"IEN",+GMTSI1))&(+($G(^TMP("GMTSULT2",$J,"EM")))'=+GMTSI1)
  1. ;
  1. ; Assemble string and store in TMP Global
  1. ; IEN^Name^Title^Owner^Location^Components^Source
  1. S GMTSC=+($O(^TMP("GMTSULT2",$J," "),-1))+1
  1. S GMTSASM=GMTSI1_U_GMTSNAM_U_GMTSTTL_U_GMTSOW_U_GMTSLOC_U_GMTSCMP_U_GMTSRC
  1. S ^TMP("GMTSULT2",$J,"IEN",+GMTSI1)="",^TMP("GMTSULT2",$J,GMTSC)=GMTSASM,^TMP("GMTSULT2",$J,"B",(GMTSNAM_" "),GMTSC)=""
  1. S:+($G(^TMP("GMTSULT2",$J,"EM")))=GMTSI1 ^TMP("GMTSULT2",$J,"EMI")=GMTSC,^TMP("GMTSULT2",$J,"EMB")=GMTSNAM_" "
  1. Q
  1. ;
  1. REO ; Reorder List
  1. S GMTSEO=+($G(GMTSEO)),GMTSEQ=+($G(GMTSEQ)),GMTSIF=+($G(GMTSIF))
  1. N GMTSC,GMTSFND,GMTSG,GMTSI,GMTSIEN,GMTSKEY,GMTSL,GMTSCMP,GMTSOW,GMTSTTL,GMTSLOC,GMTSMN,GMTSNM
  1. S GMTSI=0,GMTSFND=""
  1. ; Add exact match to the top of the selection list
  1. I '$D(^TMP("GMTSULT2",$J,"E")),+($G(GMTSEO)) K ^TMP("GMTSULT2",$J)
  1. I $D(^TMP("GMTSULT2",$J,"E")) D
  1. . S GMTSI=0,GMTSC="E" D ADD
  1. . S ^TMP("GMTSULT",$J,0)=GMTSI
  1. . K ^TMP("GMTSULT2",$J,"E")
  1. . ; Kill global (quit) if Exact Match is found
  1. . ; and DIR(0) either contains OE or X
  1. . K:+($G(GMTSEQ)) ^TMP("GMTSULT2",$J) K:+($G(GMTSEO)) ^TMP("GMTSULT2",$J)
  1. ; Kill global (quit) if Exact Match is not
  1. ; found and DIR(0)["OE"
  1. I '$D(^TMP("GMTSULT2",$J,"E")),+($G(GMTSEO)) K ^TMP("GMTSULT2",$J)
  1. ; Add remaining entries in Alphabetical Order
  1. F S GMTSFND=$O(^TMP("GMTSULT2",$J,"B",GMTSFND)) Q:GMTSFND="" D
  1. . S GMTSC=0 F S GMTSC=$O(^TMP("GMTSULT2",$J,"B",GMTSFND,GMTSC)) Q:+GMTSC=0 D
  1. . . D ADD
  1. D CLEAN^GMTSULT
  1. Q
  1. ;
  1. ADD ; Add to list in appropriate order
  1. N GMTS0,GMTS1,GMTS2,GMTS3,GMTS4,GMTS5,GMTS6,GMTS7
  1. S GMTSI=+($G(GMTSI))+1,GMTS0=$G(^TMP("GMTSULT2",$J,GMTSC))
  1. ;
  1. ; Piece Data Element
  1. ;
  1. ; 1 Internal Entry Number
  1. S (GMTS1,GMTSIEN)=+($P(GMTS0,U,1))
  1. ; 2 Health Summary Name
  1. S (GMTSG,GMTSMN,GMTS2)=$$MX^GMTSULT2($P(GMTS0,U,2))
  1. S GMTSNM=$$UP^GMTSULT2(GMTSMN)
  1. ; 3 Health Summary Title
  1. S (GMTS3,GMTSTTL)=$$MX^GMTSULT2($P(GMTS0,U,3)),GMTSTTL=GMTSTTL_")"
  1. ; 4 Health Summary Owner
  1. S (GMTS4,GMTSOW)=$$MX^GMTSULT2($P(GMTS0,U,4)),GMTSOW=GMTSOW_")"
  1. ; 5 Health Summary Location
  1. S (GMTS5,GMTSLOC)=$$MX^GMTSULT2($P(GMTS0,U,5)),GMTSLOC=GMTSLOC_")"
  1. ; 6 Health Summary Components
  1. S (GMTS6,GMTSCMP)=$P(GMTS0,U,6)
  1. S GMTSL=$P(GMTS0,U,4)
  1. ; 7 Recommended Display Text
  1. S GMTSKEY=$$UP^GMTSULT2($P(GMTS0,U,7))
  1. ;
  1. ; Recommended Display Text
  1. D RDT^GMTSULT4
  1. ;
  1. ; Assemble string and store in TMP Global
  1. ; IEN^Name^Title^Owner^Location^Components^Display Text
  1. S:$L(GMTSG)&(GMTSG'[")")&(GMTSG'["(")&(+GMTS6=0)&($L(GMTS6)) GMTSG=GMTSG_" ("_GMTS6_")" S GMTS7=GMTSG
  1. S ^TMP("GMTSULT",$J,GMTSI)=GMTS1_U_GMTS2_U_GMTS3_U_GMTS4_U_GMTS5_U_GMTS6_U_GMTS7
  1. S ^TMP("GMTSULT",$J,0)=GMTSI
  1. Q