source: WorldVistAEHR/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSODP.m@ 1147

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

initial load of WorldVistAEHR

File size: 3.3 KB
Line 
1PSODP ;BHAM ISC/JrR - SORT AND PRINT DUE ANSWER SHEETS ; 11/17/92 10:19
2 ;;7.0;OUTPATIENT PHARMACY;;DEC 1997
3 ;
4PSOSUMM W !,"Do you want a Report Summary"
5 S %=2 D YN^DICN
6 I '% D QUES,QUES1 G PSOSUMM
7 G:%=-1 EXIT
8 S PSOSUMM=%=1
9 I 'PSOSUMM S PSONLY=0 G DIP
10 ;
11PSONLY W !,"Do you want a SUMMARY only"
12 S %=2 D YN^DICN
13 I '% D QUES,QUES2 G PSONLY
14 G:%=-1 EXIT
15 S PSONLY=%=1
16 ;
17DIP K FR,TO,PG,DHIT,DIOEND,DIOBEG,DCOPIES,DIS,PSOQL
18 S PSCNT=0
19 S DIC="^PS(50.0731,",DHD="@"
20 S DIOEND="W:'PSCNT !!,?5,""0 matches found!!!"",!"
21 S DHIT="S PSCNT=PSCNT+1"
22 I PSOSUMM S DIOBEG="K ^TMP(""PSOD"",$J)",DIOEND="D SUMM^PSODP",DHIT="D ACCUM^PSODP"
23 S BY="10,@",L="SORT ANSWER SHEETS",FLDS=$S(PSONLY:"",1:"[PSOD PRINT ANSWER SHEET]")
24 D EN1^DIP
25EXIT K %,D0,DCOPIES,DHD,DHIT,DIC,DIOBEG,DIOEND,DIS,FLDS,FR,L,PG,PSOA,PSOATOT
26 K PSODA,PSODN,PSODQA,PSONLY,PSOQ,PSOQA,PSOQAM,PSOQATOT,PSOQL,PSOQM
27 K PSOQN,PSOSUMM,PSPOP,PSCNT
28 K ^TMP("PSOD",$J)
29 QUIT
30ACCUM ;Enter here from DHIT="D ACCUM^PSODP"
31 ;Requires D0 which is defined from ^DIP call above
32 S PSODQA=+$P(^PS(50.0731,D0,0),"^",2)
33 S ^(PSODQA)=$S('$D(^TMP("PSOD",$J,PSODQA)):1,1:^(PSODQA)+1)
34 Q:'$D(^PS(50.073,PSODQA,0))
35 Q:'$D(^PS(50.0731,D0,1,0))
36 F PSODN=0:0 S PSODN=$O(^PS(50.0731,D0,1,PSODN)) Q:'PSODN S PSOQN=$P(^(PSODN,0),"^",2),PSOQM=+$P(^(0),"^") I $D(^PS(50.0732,PSOQN,0)),$P(^(0),"^",2)=1 D COUNT
37 QUIT
38COUNT S PSODA=$S($D(^PS(50.0731,D0,1,PSODN,1)):^(1),1:"")
39 S:PSODA="" PSODA="NULL"
40 S ^(PSODA)=$S('$D(^TMP("PSOD",$J,PSODQA,PSOQM,PSODA)):1,1:^(PSODA)+1)
41 Q
42SUMM ;Enter here from ^DIP to print Summary
43 W:$Y @IOF
44 S PSOQATOT=0,PSOATOT=0,$P(PSOQL,"-",IOM)=""
45 F PSOA=-1:0 S PSOA=$O(^TMP("PSOD",$J,PSOA)) Q:PSOA="" S PSOQATOT=PSOQATOT+1,PSOATOT=PSOATOT+^(PSOA)
46 W !!!,"Following is a Summary of the DUE Questionnaires and the",!,"corresponding Answers found in your report."
47 W !,"This Summary contains a cumulative total of the YES/NO/UNKNOWN type answers.",!!
48 I $D(^TMP("PSOD",$J,0)),^(0) S %=^(0) W !,%," ANSWER SHEET"_$S(%>1:"S",1:"")_" HAD A MISSING QUESTIONNAIRE FIELD!" S PSOQATOT=PSOQATOT-1
49 W !!!,"TOTAL ANSWER SHEETS FOUND: ",PSOATOT
50 W !,"TOTAL QUESTIONNAIRES FOUND: ",PSOQATOT
51 S PSPOP=0
52 F PSOQA=0:0 S PSOQA=$O(^TMP("PSOD",$J,PSOQA)) Q:'PSOQA!PSPOP D SUMMHD Q:PSPOP F PSOQ=0:0 S PSOQ=$O(^TMP("PSOD",$J,PSOQA,PSOQ)) Q:'PSOQ D SUMMOUT
53 W:$E(IOST)="P"&$Y @IOF
54 Q
55SUMMOUT W !?(2-($L(PSOQ)\2)),PSOQ
56 S %=$S($D(^TMP("PSOD",$J,PSOQA,PSOQ,"YES")):^("YES"),1:0) W ?(16-($L(%)\2)),%
57 S %=$S($D(^TMP("PSOD",$J,PSOQA,PSOQ,"NO")):^("NO"),1:0) W ?(25-($L(%)\2)),%
58 S %=$S($D(^TMP("PSOD",$J,PSOQA,PSOQ,"UNKNOWN")):^("UNKNOWN"),1:0) W ?(38-($L(%)\2)),%
59 S %=$S($D(^TMP("PSOD",$J,PSOQA,PSOQ,"NULL")):^("NULL"),1:0) W ?(56-($L(%)\2)),%
60 Q
61SUMMHD I $E(IOST)="C" S DIR(0)="E" W !! D ^DIR I X="^" S PSPOP=1 Q
62 W @IOF
63 S PSOQAM=$P(^PS(50.073,PSOQA,0),"^")
64 W !!?(40-($L(PSOQAM)\2)),PSOQAM
65 W !!,"Number of Answer Sheets: ",^TMP("PSOD",$J,PSOQA)
66 W !!,"QUEST #",?15,"YES",?25,"NO",?35,"UNKNOWN",?50,"NOT ANSWERED"
67 W !,PSOQL
68 W:'$O(^TMP("PSOD",$J,PSOQA,0)) !!,"*** This Questionnaire has no YES/NO/UNKNOWN type answers. ***"
69 Q
70QUES W !?5,"A Summary will be printed at the end of this report detailing the"
71 W !?5,"number of times a question was answered YES, NO, UNKNOWN, or NOT ANSWERED."
72 Q
73QUES2 W !?5,"Answer 'YES' if you want to see the Summary ONLY."
74 Q
75QUES1 W !?5,"Answer 'YES' if you want to print this Summary."
76 Q
Note: See TracBrowser for help on using the repository browser.