source: WorldVistAEHR/trunk/r/HEALTH_SUMMARY-GMTS/GMTSRM1.m@ 703

Last change on this file since 703 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 5.0 KB
Line 
1GMTSRM1 ;SLC/JER,DLT - Create/Modify Health Summary (cont'd) ; 07/18/2000
2 ;;2.7;Health Summary;**7,36,37,62**;Oct 20, 1995
3 ;
4 ; External References
5 ; DBIA 10006 ^DIC
6 ; DBIA 10026 ^DIR
7 ; DBIA 10018 ^DIE
8 ;
9NXTCMP ; Edit, add, or delete components from existing structure
10 N CMP,D,D0,DI,DIC,DIR,OLDSO,SEL,X,Y K DIRUT
11 K DUOUT S GMTSQIT=0,GMTSNEW=0
12 S DIC="^GMT(142.1,",DIC(0)="AEMQ",D="B",DIC("W")="W ?40,"" "",$P(^(0),U,4)",DIC("A")="Select COMPONENT: ",DIC("S")="I $P(^(0),U,6)'=""P""" S:$D(GMCMP) DIC("B")=$P(^GMT(142.1,+GMCMP,0),U)
13 D ^DIC K DIC S:('$D(DTOUT)&('$D(DUOUT))&(Y=-1)) GMTSQIT=2 S:(Y=-1&(X'="^LOOP")) DUOUT=1
14 I $D(DUOUT),(X="^LOOP") K DUOUT D LOOP K DUOUT Q
15 I $D(DUOUT) Q
16 D CHKCMP Q:$D(DUOUT)!(GMTSQIT)!(GMTSQIT="D")
17 S DIR(0)="142.01,.01",DIR("B")=+$G(CNT)
18 D ^DIR K DIR K:$D(DUOUT) DUOUT D:'$D(DIRUT) CHKSO^GMTSRM1A Q:$D(DIRUT)!(GMTSQIT)
19 D ASKCMP I $D(GMCMP) S DUOUT=""
20 Q
21LOOP ; Loop through STRUCTURE multiple and call ASKCMP for each
22 N GMI,GMJ
23 S GMI=0 F S GMI=$O(^GMT(142,GMTSIFN,1,GMI)) Q:GMI'>0!$D(DUOUT)!+GMTSQIT!(GMTSQIT="D") D
24 . N CMP,DIR,X,Y
25 . S CMP=$P(^GMT(142,GMTSIFN,1,GMI,0),U,2),CMP("NM")=$P($G(^GMT(142.1,+CMP,0)),U),CMP(1)=+CMP
26 . S CMP(0)=$G(^GMT(142,+GMTSIFN,1,+GMI,0))
27 . S CMP(.01)=GMI
28 . S GMJ=0 F S GMJ=$O(^GMT(142,+GMTSIFN,1,+GMI,1,GMJ)) Q:+GMJ'>0 D
29 . . S CMP(142.14,GMJ)=$G(^GMT(142,GMTSIFN,1,GMI,1,GMJ,0))
30 . W !!?3,CMP("NM")
31 . S (NXTCMP,NXTCMP(0))=NXTCMP+1 D ASKCMP I $D(Y),'$D(DTOUT) D
32 . . S DIR(0)="Y",DIR("A")="WANT TO STOP LOOPING",DIR("B")="YES"
33 . . D ^DIR K DIR W ! I +Y S GMTSQIT="D" W !!?4,"LOOP ENDED!",!!
34 Q
35ASKCMP ; Ask parameters for each component
36 N IEN,MAXOCC,TIME,OCC,HOSP,ICD,PROV,CPT,SELCNT,GMTSNCNT,GMTSN
37 N OLDLIM,OLDOCC,OLDHEAD,OLDSO,OLDHOSP,OLDICD,OLDPROV,OLDCPT,SUMORD,CMPNAM
38 S MAXOCC=$S($P($G(^GMT(142.1,CMP(1),0)),U,5)="Y":1,1:0)
39 S TIME=$S($P($G(^GMT(142.1,CMP(1),0)),U,3)="Y":1,1:0)
40 S HOSP=$S($P($G(^GMT(142.1,CMP(1),0)),U,10)="Y":1,1:0)
41 S ICD=$S($P($G(^GMT(142.1,CMP(1),0)),U,11)="Y":1,1:0)
42 S PROV=$S($P($G(^GMT(142.1,CMP(1),0)),U,12)="Y":1,1:0)
43 S CPT=$S($P($G(^GMT(142.1,CMP(1),0)),U,14)="Y":1,1:0)
44 S OLDOCC=$P($G(CMP(0)),U,3),OLDLIM=$P($G(CMP(0)),U,4)
45 S OLDHOSP=$P($G(CMP(0)),U,6),OLDICD=$P($G(CMP(0)),U,7)
46 S OLDPROV=$P($G(CMP(0)),U,8),OLDCPT=$P($G(CMP(0)),U,9)
47 S OLDHEAD=$S($L($P($G(CMP(0)),U,5)):$P($G(CMP(0)),U,5),$L($P(^GMT(142.1,+CMP(1),0),U,9)):$P(^(0),U,9),1:"")
48 S SEL=$O(^GMT(142.1,CMP(1),1,0))
49 I SEL D
50 . S SEL(0)=^GMT(142.1,CMP(1),1,SEL,0),SEL=$P(SEL(0),U),SELCNT=$P(SEL(0),U,2)
51 . I SEL S DIC("V")="I +Y(0)=SEL",IEN=0,DIC(0)="AEMQ" F S IEN=$O(CMP(142.14,IEN)) Q:'IEN D LOADSEL^GMTSRM1A
52 I EXISTS=0 S EXISTS=1
53 I '$D(^GMT(142,GMTSIFN,1,0)) S ^(0)="^142.01IA^0^0",GMTSNEW=1
54 S SUMORD=$G(CMP(.01)),CMPNAM=$G(CMP(1))
55 ;
56 ; New .01 Summary Order N .001-9999.999
57 ; New/Existing 1 Component Name P 142.1
58 ;
59 I +($G(GMTSNEW)) D
60 . S DR=".01///^S X=SUMORD;1///^S X=CMPNAM;2///^S X=OLDOCC;3///^S X=OLDLIM;6///^S X=OLDHOSP;7///^S X=OLDICD;8///^S X=OLDPROV;9///^S X=OLDCPT;"
61 E S DR="1///^S X=CMPNAM;"
62 ;
63 ; First Edit 2 Occurrence Limit N 1-99999
64 ; 3 Time Limit F 1-5
65 ; 6 Hospital Loc Disp Y/N/""
66 ; 7 ICD Text Displayed L/S/C/T/N
67 ; 8 Provider Narr Disp Y/N/""
68 ; 9 CPT Mod Displayed Y/N/""
69 ;
70 S:+($G(MAXOCC))>0 DR=DR_"2//"_OLDOCC_";" S:+($G(TIME))>0 DR=DR_"3//"_OLDLIM_";"
71 S:+($G(HOSP))>0 DR=DR_"6//"_OLDHOSP_";" S:+($G(ICD))>0 DR=DR_"7//"_OLDICD_";"
72 S:+($G(PROV))>0 DR=DR_"8//"_OLDPROV_";" S:+($G(CPT))>0 DR=DR_"9//"_OLDCPT_";"
73 S DIE="^GMT(142,"_GMTSIFN_",1,",DA(1)=GMTSIFN,DA=CMP(.01)
74 D ^DIE Q:$D(Y)
75 ;
76 ; Second Edit 4 Selection Item 142.14 Items
77 ; 5 Header Name F 2-20
78 ;
79 S DR(2,142.14)=".01;D EXIT^GMTSRM3 I +SELCNT,(GMTSNCNT'<SELCNT) S DTOUT="""""
80 S DR="5//^S X=$G(OLDHEAD);I 'SEL S Y=0;D EN^GMTSRM3;4"
81 D ^DIE K DIC("V")
82 S (GMTSNCNT,GMTSN)=0 F S GMTSN=$O(^GMT(142,DA(1),1,DA,1,GMTSN)) Q:'GMTSN S GMTSNCNT=GMTSNCNT+1
83 I +GMTSNCNT>1 D REITEM^GMTSRM3(DA(1),DA)
84 Q
85CHKCMP ; Checks selected component for duplication
86 N DIR,SEL,SO,SOACTION
87 K OLDSO
88 S SOACTION="",CMP=+Y,CMP("NM")=$P(Y,U,2),(NXTCMP(0),NXTCMP)=NXTCMP+1
89 I '$D(^GMT(142,GMTSIFN,1,"C",+CMP)) D Q
90 . S CMP(1)=+CMP,CNT=$$GETCNT^GMTSRM(GMTSIFN)
91 . I +CMP>300,$O(^GMT(142.1,+CMP(1),1,0)),'$D(CMP(142.14)) D GETSEL^GMTSRM1A(.CMP)
92 S SO=$O(^GMT(142,GMTSIFN,1,"C",+CMP,0))
93 W !,$P(Y,U,2)," is already a component of this summary."
94 S DIR(0)="SO^E:Edit component parameters;D:Delete component from summary;"
95 S DIR("A")="Select Action"
96 D ^DIR K DIR
97 I $D(DUOUT) S NXTCMP=NXTCMP-1 Q
98 I $D(DIRUT)&('$D(DTOUT)) S GMTSQIT=$S('$D(GMCMP):"D",1:1) W ! Q
99 I $D(DIRUT) S GMTSQIT=1 Q
100 S OLDSO=SO I Y="D" S SOACTION="D" D DELCMP^GMTSRM4 W ! S GMTSQIT="D" Q
101 S SOACTION="E",CMP(1)=+CMP,CNT=SO K Y
102 S CMP(0)=^GMT(142,GMTSIFN,1,SO,0)
103 S SEL=0 F S SEL=$O(^GMT(142,GMTSIFN,1,SO,1,SEL)) Q:+SEL'>0 S CMP(142.14,SEL)=^(SEL,0)
104 I +CMP>100,$O(^GMT(142.1,+CMP(1),1,0)),'$D(CMP(142.14)) D
105 . D GETSEL^GMTSRM1A(.CMP)
106 Q
Note: See TracBrowser for help on using the repository browser.