void CalculaMedia(TPilha *pilha_alunos,TFila *fila_notas){ int achou,aux_cod,continua; float media,soma = 0,contador = 0; do{ LimpaTela(); achou = -1; printf("\nDigite o codigo do aluno a consulta: \n"); scanf("%d",&aux_cod); achou = Pesquisa_na_pilha(pilha_alunos,aux_cod); if(achou != -1){ printf("\n\nAluno: %s cod: %d",pilha_alunos->alunos[achou].nome_aluno,pilha_alunos->alunos[achou].cod_aluno); for(int i = 0; i < fila_notas->tamanho_fila;i++ ){ if(pilha_alunos->alunos[achou].cod_aluno == fila_notas->notas[i].fk_cod_aluno){ contador++; soma = soma +fila_notas->notas[i].nota; } } media = soma / contador; printf("\n****** Media: %.1f ********",media); }else{ printf("\nAluno nao encontrado. \n"); } getch(); LimpaTela(); printf("\nDeseja consultar outro aluno: 1-Sim 2-Nao\n"); scanf("%d",&continua); }while(continua != 2); }
void InsereNotas(TPilha *pilha_alunos,TFila *fila_notas){ int aux_cod, achou,continua; //ExibeListas(pilha_alunos); do{ LimpaTela(); achou = -1; printf("\n"); printf("\n * Digite o codigo do aluno *\n"); scanf("%d",&aux_cod); achou = Pesquisa_na_pilha(pilha_alunos,aux_cod); //veruificar sealuno estana pilha if (achou != -1){ do{ printf("\nDigite a nota para o aluno: %s\n",pilha_alunos->alunos[achou].nome_aluno); fila_notas->notas[fila_notas->tamanho_fila].fk_cod_aluno = aux_cod; fflush(stdin); scanf("%f",&fila_notas->notas[fila_notas->tamanho_fila].nota); printf("\nNota cadastrada \n"); getch(); LimpaTela(); fila_notas->tamanho_fila++; printf("Deseja adicionar mais notas p/este aluno: 1 - Sim 2 - Nao"); scanf("%d",&continua); }while(continua != 2); } else printf("Aluno nao encontrado."); getch(); LimpaTela(); printf("Deseja adicionar mais notas p/ outro aluno: 1-Sim 2-Nao"); scanf("%d",&continua); }while(continua != 2); }
void AmbienteDados() { LimpaTela(); setcolor(1); CriaJanelaGrafica(0,80,0,640,344,"ENTRADA DE DADOS DO PACIENTE"); AtivaJanelaGrafica(0); changetextstyle(DEFAULT_FONT,HORIZ_DIR,1); gprintf(10,10,"NOME: %s",Paciente.Nome); gprintf(10,23,"No DO PRONTUARIO: %s",Paciente.Prontuario); gprintf(10,36,"SEXO: %s",Paciente.Sexo); if (*Paciente.Sexo!=NULL) outtextxy(66,36, Paciente.Sexo[0]=='M' ? "asculino" : "eminino"); gprintf(10,49,"DATA DE NASCIMENTO: %2s/%2s/%2s",Paciente.Dia,Paciente.Mes,Paciente.Ano); if (*PacienteIdade!=NULL) gprintf(300,49,"IDADE: %2s anos",PacienteIdade); gprintf(10,62,"ADULTO ou CRIANCA ? (A/C): %s",Paciente.Fase); if (*Paciente.Fase!=NULL) outtextxy(234,62, Paciente.Fase[0]=='A' ? "dulto" : "rianca"); gprintf(10,75,"ALTURA (cm): %s",Paciente.Altura); gprintf(10,88,"PESO (Kg): %s",Paciente.Peso); if (SupCorp>0.0) gprintf(300,88,"SUPERFICIE CORPORAL: %-5.2f",SupCorp); gprintf(10,118,"FUMANTE ? (S/N/E): %s",Paciente.Fumante); if (strchr ( "Ss" , Paciente.Fumante[0] ) != NULL) { gprintf(40,131,"HA QUANTOS ANOS ? : %s",Paciente.tempfumo); gprintf(40,144,"No CIGARROS/DIA : %s",Paciente.cigardia); } else if (strchr ( "Ee" , Paciente.Fumante[0] ) != NULL) { gprintf(40,131,"HA QUANTO TEMPO DEIXOU DE FUMAR ? :"" %2s ANOS %2s MESES",Paciente.deixfumoA,Paciente.deixfumoM); gprintf(40,144,"QUANTOS ANOS FUMOU ? : %2s",Paciente.tempfumo); gprintf(40,157,"No CIGARROS/DIA : %2s",Paciente.cigardia); } gprintf(10,177,"INSTITUICAO: %s",institu); gprintf(10,190,"PACIENTE INTERNO OU AMBULATORIAL ? (I/A): %s",IouA); gprintf(10,203,"JUSTIFICATIVA PARA O EXAME: %s",justif); gprintf(10,216,"MEDICO REQUISITANTE: %s",medico); gprintf(10,229,"SERVICO REQUISITANTE: %s",servico); gprintf(10,242,"PACIENTE ATUALMENTE COM ALGUM DIAGNOSTICO ? (S/N): %s",temdiag); if (strchr ( "Ss" , temdiag[0] ) != NULL) gprintf(40,255,"DIAGNOSTICO: %s",diagnost); gprintf(10,268,"CIRURGIA PREVIA ? (S/N): %s",temcirur); if (strchr ( "Ss" , temcirur[0] ) != NULL) { gprintf(40,281,"CIRURGIA: %s",cirurgia); gprintf(40,294,"DATA: %2s/%2s/%2s",cirurgiaD,cirurgiaM,cirurgiaA); } } /* AmbienteDados */
int NovoPaciente() { char resposta[2]; LimpaTela(); gprintf(160,124,"NOVO PACIENTE (S/N) ? "); do { LeituraC(222,124,resposta,"NnSs"); } while (resposta[0]!='S' && resposta[0]!='N'); ApagaLinha(124); if (strchr ( "Ss" , resposta[0] ) != NULL) { LeData(); FlagIntegridade=FALSE; FlagComent=FALSE; *Paciente.Nome=NULL; *Paciente.Prontuario=NULL; *Paciente.Sexo=NULL; *Paciente.Dia=NULL; *Paciente.Mes=NULL; *Paciente.Ano=NULL; *Paciente.Fase=NULL; *Paciente.Altura=NULL; *Paciente.Peso=NULL; *Paciente.Fumante=NULL; *Paciente.tempfumo=NULL; *Paciente.cigardia=NULL; *Paciente.deixfumoA=NULL; *Paciente.deixfumoM=NULL; *PacienteIdade=NULL; *medico=NULL; *servico=NULL; *cirurgiaD=NULL; *cirurgiaM=NULL; *cirurgiaA=NULL; *institu=NULL; *IouA=NULL; *justif=NULL; *temdiag=NULL; *diagnost=NULL; *temcirur=NULL; *cirurgia=NULL; *comentario=NULL; SupCorp=0.0; return(TRUE); } else return(FALSE); }
void menu(){ LimpaTela(); printf("\n* Escolha uma opcao do menu *\n"); printf("\n0- Exiba lista:"); printf("\n1- Cadastrar aluno"); printf("\n2- Cadastrar nota"); printf("\n3- Calcular média de um aluno"); printf("\n4- Listar os nomes dos alunos sem nota"); printf("\n5- Excluir aluno"); printf("\n6- Excluir nota"); printf("\n7- Sair"); printf("\n8- Exiba lista com notas:\n"); }
void DadosPaciente() { static int PrimeiroPaciente=TRUE; int novopaciente=FALSE; char Resposta[2]; LimpaTela(); if (PrimeiroPaciente && !DadosPacienteOk) { novopaciente=TRUE; PrimeiroPaciente=FALSE; } else novopaciente=NovoPaciente(); AmbienteDados(); do { do { Leitura (58,10,Paciente.Nome,45); } while (*Paciente.Nome==NULL); LeituraN(154,23,Paciente.Prontuario,5,1,99999L); do { LeituraC(58,36,Paciente.Sexo,"MmFf"); } while (Paciente.Sexo[0]!='M' && Paciente.Sexo[0]!='F'); ApagaWord(66,36,8); if (Paciente.Sexo[0]=='M') gprintf(66,36,"asculino"); else gprintf(66,36,"eminino"); LeituraN(170,49,Paciente.Dia,2,1,31); if (atoi(Paciente.Dia)<10) if (*Paciente.Dia!='0') { *(Paciente.Dia+1)=*Paciente.Dia; *Paciente.Dia='0'; ApagaWord(170,49,2); gprintf(170,49,"%2s",Paciente.Dia); } LeituraN(194,49,Paciente.Mes,2,1,12); if (atoi(Paciente.Mes)<10) if (*Paciente.Mes!='0') { *(Paciente.Mes+1)=*Paciente.Mes; *Paciente.Mes='0'; ApagaWord(194,49,2); gprintf(194,49,"%2s",Paciente.Mes); } do { LeituraN(218,49,Paciente.Ano,2,1,99); if (atoi(Paciente.Ano)<10) if (*Paciente.Ano!='0') { *(Paciente.Ano+1)=*Paciente.Ano; *Paciente.Ano='0'; ApagaWord(218,49,2); gprintf(218,49,"%2s",Paciente.Ano); } CalculaIdade(); ApagaWord(356,49,2); gprintf(300,49,"IDADE: %2s anos",PacienteIdade); } while (atoi(PacienteIdade)<6 || atoi(PacienteIdade)>90); if (atoi(PacienteIdade)<16) *Paciente.Fase='C'; else if (atoi(PacienteIdade)>18) *Paciente.Fase='A'; else do { LeituraC(226,62,Paciente.Fase,"AaCc"); } while (Paciente.Fase[0]!='A' && Paciente.Fase[0]!='C'); ApagaWord(234,62,6); if (Paciente.Fase[0]=='A') gprintf(226,62,"Adulto"); else { setcolor(0); gprintf(226,62,"A"); setcolor(1); gprintf(226,62,"Crianca"); } if (Paciente.Fase[0]=='A') { LeituraN(114,75,Paciente.Altura,3,110,210); LeituraN(98,88,Paciente.Peso,3,20,150); } else { LeituraN(114,75,Paciente.Altura,3,110,210); if (atof(Paciente.Altura)>170) { *Paciente.Fase='A'; setcolor(0); gprintf(226,62,"Crianca"); setcolor(1); gprintf(226,62,"Adulto"); } LeituraN(98,88,Paciente.Peso,3,10,150); } CalculaSupCorporea(); ApagaWord(468,88,5); gprintf(300,88,"SUPERFICIE CORPORAL: %-5.2f",SupCorp); LeituraC(162,118,Paciente.Fumante,"SsNnEe"); ApagaLinha(131); ApagaLinha(144); ApagaLinha(157); if (strchr ( "Ss" , Paciente.Fumante[0] ) != NULL) { gprintf(40,131,"HA QUANTOS ANOS ? : %s",Paciente.tempfumo); gprintf(40,144,"No CIGARROS/DIA : %s",Paciente.cigardia); LeituraN(200,131,Paciente.tempfumo,2,1,99); LeituraN(200,144,Paciente.cigardia,2,1,99); } else if (strchr ( "Ee" , Paciente.Fumante[0] ) != NULL) { gprintf(40,131,"HA QUANTO TEMPO DEIXOU DE FUMAR ? :"" %2s ANOS %2s MESES",Paciente.deixfumoA,Paciente.deixfumoM); gprintf(40,144,"QUANTOS ANOS FUMOU ? : %2s",Paciente.tempfumo); gprintf(40,157,"No CIGARROS/DIA : %2s",Paciente.cigardia); LeituraN(328,131,Paciente.deixfumoA,2,1,99); LeituraN(400,131,Paciente.deixfumoM,2,1,12); LeituraN(224,144,Paciente.tempfumo,2,1,99); LeituraN(184,157,Paciente.cigardia,2,1,99); } Leitura(114,177,institu,52); LeituraC(346,190,IouA,"IiAa"); Leitura(234,203,justif,37); Leitura(178,216,medico,38); Leitura(186,229,servico,43); LeituraC(418,242,temdiag,"SsNn"); ApagaLinha(255); if (strchr ( "Ss" , temdiag[0] ) != NULL) { gprintf(40,255,"DIAGNOSTICO: %s",diagnost); Leitura(144,255,diagnost,30); } LeituraC(210,268,temcirur,"SsNn"); ApagaLinha(281); ApagaLinha(294); if (strchr ( "Ss" , temcirur[0] ) != NULL) { gprintf(40,281,"CIRURGIA: %s",cirurgia); gprintf(40,294,"DATA: %2s/%2s/%2s",cirurgiaD,cirurgiaM,cirurgiaA); Leitura(120,281,cirurgia,43); LeituraN(88,294,cirurgiaD,2,1,31); if (atoi(cirurgiaD)<10) if (*cirurgiaD!='0') { *(cirurgiaD+1)=*cirurgiaD; *cirurgiaD='0'; ApagaWord(88,294,2); gprintf(88,294,"%2s",cirurgiaD); } LeituraN(112,294,cirurgiaM,2,1,12); if (atoi(cirurgiaM)<10) if (*cirurgiaM!='0') { *(cirurgiaM+1)=*cirurgiaM; *cirurgiaM='0'; ApagaWord(112,294,2); gprintf(112,294,"%2s",cirurgiaM); } LeituraN(136,294,cirurgiaA,2,1,99); if (atoi(cirurgiaA)<10) if (*cirurgiaA!='0') { *(cirurgiaA+1)=*cirurgiaA; *cirurgiaA='0'; ApagaWord(136,294,2); gprintf(136,294,"%2s",cirurgiaA); } } Resposta[0] = 'S'; Resposta[1] = NULL; outtextxy(352,322,"Dados Corretos ? (S/N) "); LeituraC(536,322,Resposta,"SsNn"); ApagaLinha(322); } while(strchr ( "Nn" , *Resposta ) != NULL); CalculaCVteorico(); CalculaVVMteorico(); CalculaFLUXteorico(); DadosPacienteOk = TRUE; if (novopaciente) { *ApontEspirometria = NULL; *ApontVVM = NULL; ApontFluxPreBD = NULL; ApontFluxPosBD = NULL; } } /* DadosPaciente */
/* ------------------------------------------------------------------------ */ void Esforco() /* ------------------------------------------------------------------------ */ { int i = 0, ultimo = 0, le = 0, j = 0, t = 0, prox = 0, k, var; CriaJanelaGrafica(ESFORCO,0,0,MAXX,MAXY,0,""); tempo = (struct time*) malloc(sizeof(struct time)); var = VEF1UN; AmbienteFluxVol (); FVposBD(); LimpaTela(); AmbienteEsforco(); outtextxy(310,2,"PROVA DE ESFORCO"); if (Paciente.Nome){ valor[0].nome=Paciente.Nome; valor[0].clock=0; for(k=0;k<6;k++) valor[0].pontos[k]=0; } do { if (kbhit()) le=getch(); /* le possivel saida ou help*/ if (le==ESC) return; if (le==20) novopaciente(); if (le=='?'){ chama_help("01"); return;} le=''; if (valor[i].clock==0){ valor_pac[i] = 1; AmbienteFluxVol (); valor[i].clock= (int) (atoi(tempo->ti_hour)*60+ atoi(tempo->ti_min)); valor[i].pontos[0] = VEF1UN; /* Atualiza paciente*/ /* pt[0]=valor[i].pontos[0]; pt[1]=valor[i].pontos[1]; pt[2]=valor[i].pontos[4]; pt[3]=valor[i].pontos[3]; pt[4]=valor[i].pontos[4]; pt[5]=valor[i].pontos[5]; */ plota(valor[i].pontos,var,escala); /* plota os pontos e dados do paciente*/ le=getch(); /* le possivel saida ou help */ if (le==ESC) return; if (le==20) novopaciente(); if (le=='?') chama_help("01"); le=''; } gettime(tempo); valor[i].clock += (int) atoi(tempo->ti_hour)*60+ atoi(tempo->ti_min); aproxima(valor[i].clock); switch (valor[i].clock){ case 5: case 10: case 15: case 30: case 63: AmbienteFluxVol (); FVposBD(); AmbienteEsforco(); outtextxy(310,2,"PROVA DE ESFORCO"); j++; valor[i].pontos[j] = VEF1UN; plota(valor[i].pontos,var,escala); break; } i=prox; /* if ( le == F1) chama_help(114);*/ if ( (valor[i].clock == 63) || (le==ESC) ) { /* guarda(&valor[i]); for(t=i;t<ultimo;t++){ valor[t].nome=valor[t+1].nome; valor[t].clock=valor[t+1].clock; for(k=0;k<6;k++) { valor[t].pontos[k]=valor[t+1].pontos[k]; valor_pac[i] = 0; } } valor[ultimo].nome =""; valor[ultimo].clock =0; for(k=0;k<6;k++) valor[ultimo].pontos[k]=0; /* atribuicao suspeita */ ultimo--; } }while (valor_pac[i] !='');
void MelhorProvaVVM(int old, int nnew) { register int i, ncol, nlin, escala, y0, y1, y2; int y_ini0, y_ini1; int cor; int janelaAtiva; float far *apt; float far *aptaux; register float flux, sum_flux; float sum[4]; char *p_ch; char setaE[2], setaD[2]; setaE[0] = 27; setaD[0] = 26; setaE[1] = setaD[1] = '\0'; #ifndef MODO_VGA_640X480_HIG setactivepage(1); setvisualpage(1); #else MODO_VGA_640X480_HIG LimpaTela(); #endif MODO_VGA_640X480_HIG setviewport ( 0, 0, MAXX, MAXY, 1 ); clearviewport (); cor = getcolor(); setcolor (bea_color[12]); CriaJanelaGrafica( MANOB1, 0, 0, (int) ((MAXX * 49L)/100), (int) ((MAXY * 90L)/100), 0, "MANOBRA %02d", old ); clearviewport(); CriaJanelaGrafica( MANOB2, (int) ((MAXX * 51L)/100), 0, MAXX, (int) ((MAXY * 90L)/100), 0, "MANOBRA %02d", nnew ); clearviewport(); setcolor (cor); AtivaJanelaGrafica(MANOB1,0); setcolor ( bea_color[14] ); getviewsettings (&vp); DesenhaEixos( DELTA_X(2), DELTA_X(96), DELTA_Y(4), DELTA_Y(98), DELTA_X(6), DELTA_Y(22), DELTA_X(22),DELTA_Y(14) ); sum_flux = 0.0; escala = DELTA_Y(14); coluna = DELTA_X( 8); y0 = y_ini0 = DELTA_Y(76); y2 = y1 = y_ini1 = DELTA_Y(92); apt = inicVVM2; aptaux = inicVVM2Int; sum[0] = sum[1] = sum[2] = sum[3] = 0.0; ScalaVVMBetter(); for ( i = 0; (*apt != FIM_1) && (apt < inicVVM2 + NUMMAXPONTOSINF); apt++, i++ ) { flux = *aptaux; aptaux++; #ifdef VVM_ALCAP_ sum_flux += flux / SampleRatio; sum[0] = (.01 * sum_flux) + (.19 * sum[1]) + (.30 * sum[2]) + (.50 * sum[3]); sum[3] = sum[2]; sum[2] = sum[1]; sum[1] = sum[0]; #else VVM_ALCAP_ sum_flux = sum_flux; flux = flux; y_ini1 = y_ini1; y0 = y0; y1 = y1; y2 = y2; #endif VVM_ALCAP_ ncol = (int) ( (((long) i) * DELTA_X(88))/2400 + DELTA_X( 8) ); if ( ncol != coluna ) { cor = getcolor(); /* -------------------------- */ /* Tracado do Volume Expirado */ /* -------------------------- */ nlin = (int) ((y_ini0 - (((long) escala ) * (*apt))/10)); moveto(coluna, y0); lineto( coluna, nlin ); y0 = nlin; #ifdef VVM_ALCAP_ setcolor (bea_color[ 7]); /* ----------------------------- */ /* Tracado do Volume (Invertido) */ /* ----------------------------- */ nlin = (int) ((y_ini1 + (((long) escala ) * (sum_flux))/2)); moveto(coluna, y1); lineto( coluna, nlin ); y1 = nlin; setcolor (bea_color[11]); /* -------------------------------------------------- */ /* Tracado Valor Medio filtrado do Volume (Invertido) */ /* -------------------------------------------------- */ nlin = (int) ((y_ini1 + (((long) escala ) * (sum[0]))/2)); moveto(coluna, y2); lineto( coluna, nlin ); y2 = nlin; #endif VVM_ALCAP_ setcolor (cor); coluna = ncol; } } outtextxy(DELTA_X(10) , DELTA_Y(10), "Param Teor Calc %"); cor = getcolor (); setcolor (bea_color[15]); gprintf( DELTA_X(10), DELTA_Y(11) + CharH, "VVM %6.2f %6.2f %4.0f", VentVolMaxteorico, VentVolMax2, (VentVolMaxpercen2 + 0.5) ); #ifdef VVM_ALCAP_ gprintf (DELTA_X(10), DELTA_Y(12) + 2 * CharH, "ALCAP -- %7.2f - ", VolAlcaponado2); #endif VVM_ALCAP_ /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */ setcolor (cor); AtivaJanelaGrafica(MANOB2,0); setcolor ( bea_color[14] ); getviewsettings (&vp); DesenhaEixos( DELTA_X(2), DELTA_X(96), DELTA_Y(4), DELTA_Y(98), DELTA_X(6), DELTA_Y(22), DELTA_X(22),DELTA_Y(14) ); sum_flux = 0.0; escala = DELTA_Y(14); coluna = DELTA_X( 8); y0 = y_ini0 = DELTA_Y(76); y2 = y1 = y_ini1 = DELTA_Y(92); apt = inicVVM1; aptaux = inicVVM1Int; sum[0] = sum[1] = sum[2] = sum[3] = 0.0; ScalaVVMBetter(); for ( i = 0; (*apt != FIM_1) && (apt < inicVVM1 + NUMMAXPONTOSINF); apt++, i++ ) { flux = *aptaux; aptaux++; #ifdef VVM_ALCAP_ sum_flux += flux / SampleRatio; sum[0] = (.01 * sum_flux) + (.19 * sum[1]) + (.30 * sum[2]) + (.50 * sum[3]); sum[3] = sum[2]; sum[2] = sum[1]; sum[1] = sum[0]; #endif VVM_ALCAP_ ncol = (int) ( (((long) i) * DELTA_X(88))/2400 + DELTA_X( 8) ); if ( ncol != coluna ) { cor = getcolor(); /* -------------------------- */ /* Tracado do Volume Expirado */ /* -------------------------- */ nlin = (int) ((y_ini0 - (((long) escala ) * (*apt))/10)); moveto(coluna, y0); lineto( coluna, nlin ); y0 = nlin; #ifdef VVM_ALCAP_ setcolor (bea_color[ 7]); /* ----------------------------- */ /* Tracado do Volume (Invertido) */ /* ----------------------------- */ nlin = (int) ((y_ini1 + (((long) escala ) * (sum_flux))/2)); moveto(coluna, y1); lineto( coluna, nlin ); y1 = nlin; setcolor (bea_color[11]); /* -------------------------------------------------- */ /* Tracado Valor Medio filtrado do Volume (Invertido) */ /* -------------------------------------------------- */ nlin = (int) ((y_ini1 + (((long) escala ) * (sum[0]))/2)); moveto(coluna, y2); lineto( coluna, nlin ); y2 = nlin; #endif VVM_ALCAP_ setcolor (cor); coluna = ncol; } } outtextxy(DELTA_X(10) , DELTA_Y(10), "Param Teor Calc %"); cor = getcolor (); setcolor (bea_color[15]); gprintf( DELTA_X(10) , DELTA_Y(11) + CharH, "VVM %6.2f %6.2f %4.0f", VentVolMaxteorico, VentVolMax, (VentVolMaxpercent + 0.5) ); #ifdef VVM_ALCAP_ gprintf (DELTA_X(10), DELTA_Y(12) + 2 * CharH, "ALCAP -- %7.2f - ", VolAlcaponado); #endif VVM_ALCAP_ setcolor (cor); DesativaJanelaGrafica(MANOB2); cor = getcolor(); setcolor (bea_color[12]); p_ch = "ESCOLHA DA MELHOR MANOBRA (%1s %1s)"; gprintf((MAXX - textwidth(p_ch))/2, (int) ((MAXY * 95L)/100), p_ch, setaE, setaD); AtivaJanelaGrafica(MANOB1,0); setcolor ( bea_color[14] ); janelaAtiva = 0; do { LimpaBufferTeclado(); sc.c = LeTeclado(); if (sc.ch[0] == 0) if (sc.ch[1]==75 || sc.ch[1]==77) { DesativaJanelaGrafica(janelaAtiva); janelaAtiva = (janelaAtiva + 1) % 2; AtivaJanelaGrafica(janelaAtiva,0); setcolor ( bea_color[14] ); } } while(sc.ch[0] != ENTER); setcolor (cor); DesativaJanelaGrafica(janelaAtiva); if (janelaAtiva == 0) { inicVVM1 = inicVVM2; inicVVM1Int = inicVVM2Int; VentVolMax = VentVolMax2; VentVolMaxpercent = VentVolMaxpercen2 ; VolAlcaponado = VolAlcaponado2; } else ManobVVMAtiva = nnew; #ifndef MODO_VGA_640X480_HIG setactivepage(0); setvisualpage(0); #endif MODO_VGA_640X480_HIG } /* MelhorProvaVVM */
void AmbienteVentVolMax (void) { char id; LimpaTela(); setcolor ( bea_color[12] ); CriaJanelaGrafica( MENU_3, PER_X(62), PER_Y( 3), PER_X(99), PER_Y(28), 0, "VENTILACAO VOLUNTARIA MAXIMA"); CriaJanelaGrafica( DADOS, PER_X( 1), PER_Y( 3), PER_X(61), PER_Y(28), 0,"DADOS DO PACIENTE"); CriaJanelaGrafica( GRAF1, PER_X( 1), PER_Y(30), PER_X(61), PER_Y(99), 0,"MANOBRA"); CriaJanelaGrafica( GRAF2, PER_X(62), PER_Y(30), PER_X(99), PER_Y(99), 0,"MANOBRA ANTERIOR"); AtivaJanelaGrafica(DADOS,0); setcolor ( bea_color[14] ); getviewsettings(&vp); gprintf( DELTA_X( 2), DELTA_Y(15), "NOME: %s",Paciente.Nome); id = Paciente.Prontuario[7]; Paciente.Prontuario[7] = '\0'; gprintf( DELTA_X( 2), DELTA_Y(35), "No DO PRONTUARIO: %s %c",Paciente.Prontuario, id); Paciente.Prontuario[7] = id; gprintf( DELTA_X(70), DELTA_Y(35), "SEXO: %s",Paciente.Sexo); gprintf( DELTA_X( 2), DELTA_Y(55), "IDADE: %s",PacienteIdade); gprintf( DELTA_X(30), DELTA_Y(55), "ALTURA(cm): %s",Paciente.Altura); gprintf( DELTA_X(70), DELTA_Y(55), "PESO(Kg): %s",Paciente.Peso); gprintf( DELTA_X( 2), DELTA_Y(75), "SUP.CORPOREA(m2): %3.2f",SupCorp); AtivaJanelaGrafica(MENU_3, 0); setcolor ( bea_color[14] ); getviewsettings(&vp); outtextxy( DELTA_X(50) - textwidth(menuVVM[0])/2, DELTA_Y(35), menuVVM[0]); outtextxy( DELTA_X(50) - textwidth(menuVVM[1])/2, DELTA_Y(60), menuVVM[1]); } /* AmbienteVentVolMax */
void FluxVol ( void ) { int opcao,opc; char *opcoes[NUMOPC] = {"BRONCO-DILATACAO","BRONCO-PROVOCACAO", "ESPIROMETRIA DE ESFORCO","POS SIMPLES", "RETORNAR"}; char *menuFlux[3] = { "PRE-TESTE","POS-TESTE","RETORNAR"}; AmbienteFluxVol (); if (*ApontFluxPreBD == NULL) { ManobAtivaPreBD = ManobAtivaPosBD = ManobAtiva = 1; NumManobPreBD = NumManobPosBD = NumManob = 0; *UltimaManobra = NULL; grafSecundFlux = VAZIO; } else { if (UltimaManobra == ApontFluxPreBD) { VariaveisTemporarias ( preBD ); grafSecundFlux = preBD; } else { VariaveisTemporarias ( posBD ); grafSecundFlux = posBD; } GraficoFluxSecund (); } teste2Flux = FALSE; while ((opcao = menu(MENU,NUM,menuFlux)) != RETORNAR){ /* ativa as provas */ Abortou = FALSE; switch(opcao){ case ESC : setcolor(COR_MOLDURA); break; case preBD : FVpreBD(); break; case posBD : if (*ApontFluxPreBD == NULL) break; while((opc=menu(POSFARM,NUMOPC,opcoes)) != 4){ switch (opc){ case ESC : setcolor(COR_MOLDURA); break; case 0 : Provas(1);/*broncoDilatacao(); */break; case 1 : Provas(3);/*BroncoRestricao(); */break; case 2 : Provas(2);/*Esforco()*/ break; case 3 : FVposBD(); break; case 4 : break; } /* switch posBD */ LimpaTela(); AmbienteFluxVol(); } /* while opc */ } /* switch opcao */ } /* while opcao */ setcolor(COR4); if (teste2Flux) MelhorProvaCurvaFlux ( ManobAtiva , NumManob ); if ((UltimaManobra == ApontFluxPreBD) && (*ApontFluxPreBD != NULL)) { VariaveisReais ( preBD ); areaFlux = ApontFluxPreBD = UltimaManobra = areaFluxPreBD; } else if ((UltimaManobra == ApontFluxPosBD) && (*ApontFluxPosBD != NULL)) { VariaveisReais ( posBD ); areaFlux = ApontFluxPosBD = UltimaManobra = areaFluxPosBD; } ConfereApontador (); setcolor ( COR2 ); if (*ApontFluxPosBD != NULL) ImprimeFlux ( 0 ); }
void main ( int argc , char **argv ) { #define QTD_MPRINC 8 #define QTD_MSECUN 4 char *opcao1[8] = { "Configuracao","Calibrar Sistema","Dados do Paciente", "Ventilacao Voluntaria Maxima","Espirometria Forcada", "Capacidade Vital Lenta","Resultados","Terminar" }; char *opcao2[4] = { "Visualizar","Imprimir","Arquivo","Retornar"}; int exit = FALSE; extern int GlobOffSetP; if (argc > 1 && strcmp ( strupr ( argv[1] ) , "-V1" ) == 0) /* sem correcao de BTPS */ Versao = 1, --argc, ++argv; else if (argc > 1 && strcmp ( strupr ( argv[1] ) , "-V2" ) == 0) /* com correcao para ar expirado */ Versao = 2, --argc, ++argv; else if (argc > 1 && strcmp ( strupr ( argv[1] ) , "-V3" ) == 0) /* com correcao para ar ambiente a 37 graus */ Versao = 3, --argc, ++argv; else /* Nao escolheu nenhuma versao, assume -V2 */ Versao = 2; if (argc > 1) GlobOffSetP = atoi(argv[1]); else GlobOffSetP = 4; /* printf( "Usando OffsetP==%d\n", GlobOffSetP ); getchar(); */ #if defined(ENT_ARQ) || defined(ENT_ARQ_R) strcpy ( NomeCurva , argv[1] ); #endif _control87 ( MCW_EM , MCW_EM ); #ifdef LINX vetor = getvect(0x1c); setvect(0x1c,TrataInterrup); /* seta a Interrupcao 11 do vetor para a funcao a*/ #endif #ifdef PLACA12 setvect ( 10 , TrataInterrup ); #else setvect ( 11 , TrataInterrup ); #endif LeCoef (); /* le coeficientes */ /* *ApontEspirometria = NULL; *ApontVVM = NULL; *ApontFluxPreBD = NULL; *ApontFluxPosBD = NULL; */ RegistroTimer(); LeData (); ModoGrafico (); Chama_Padrao(); /* pega valores default de cor,laudo,pereira,impressora */ do{ if (limpar) LimpaTela (); LimpaBufferTeclado (); InitialScreen(); switch (menu(MENUPRINCIPAL,QTD_MPRINC,opcao1)) { case 0 : Padrao(); limpar=TRUE; break; case 1 : if(GanhoOk) LiberaAreas(); Calibragem (); if(GanhoOk) ReservaAreas (); limpar = TRUE; break; case 2 :if(GanhoOk){ DadosPaciente (); limpar = TRUE; } break; case 3 : if (GanhoOk && DadosPacienteOk) { VentVol (); limpar = TRUE; } else limpar = FALSE; break; case 4 : #if !defined(ENT_ARQ) && !defined(ENT_ARQ_R) if ((GanhoOk && DadosPacienteOk) || (Versao == 3)) { #endif FluxVol (); #if !defined(ENT_ARQ) && !defined(ENT_ARQ_R) limpar = TRUE; } else limpar = FALSE; #endif break; case 5 : if (GanhoOk && DadosPacienteOk) { setviewport ( 0 , 0 , 719 , 347 , 1 ); gprintf(585,280,"Ar Residual ? (S/N)"); do{ LEITURA('c',683,280,Resp,1,0,0); }while(!pertence(*Resp,"SsNn")); if(pertence(*Resp,"Ss")) { VAR_RESP=TRUE; Volume_de_ar_residual(); } else VAR_RESP=FALSE; Espirometria (); limpar = TRUE; } else limpar = FALSE; break; case 6 :if ((DadosPacienteOk || OK) && GanhoOk){ switch(menu(MENUSECUNDARIO,QTD_MSECUN,opcao2)){ case SALVAR: Arquivar(); break; case IMPRIMIR: if (DadosPacienteOk) Impressao(1); break; case VISUALIZAR:if (DadosPacienteOk) Impressao(0); break; case 27: case 3: break; /* case 9: chama_help(002); break;*/ } limpar=TRUE; } else limpar=FALSE; break; /*case 9: chama_help(002); break;*/ case 7: exit = TRUE; break; } } while (!exit); closegraph (); LiberaAreas (); }
/* ----------------------------------------------------------------------- */ void FluxVol() /* ----------------------------------------------------------------------- */ { int opcao,opc; char *opcoes[NUMOPC] = {"BRONCO-DILATACAO","BRONCO-PROVOCACAO", "ESPIROMETRIA DE ESFORCO","POS SIMPLES", "RETORNAR"}; char *menuFlux[3] = { "PRE-TESTE","POS-TESTE","RETORNAR"}; /* cria todas as janelas de fluxvol, coloca dados do paciente e ativajanela de menu */ AmbienteFluxVol(); if (*ApontFluxPreBD==NULL){ ManobAtivaPreBD = ManobAtivaPosBD = ManobAtiva = 1; NumManobPreBD = NumManobPosBD = NumManob = 0; *UltimaManobra = NULL; grafSecundFlux = VAZIO; } else { if (UltimaManobra == ApontFluxPreBD) { VariaveisTemporarias(preBD); grafSecundFlux = preBD; } else { VariaveisTemporarias(posBD); grafSecundFlux = posBD; } GraficoFluxSecund(); } teste2Flux = FALSE; /* desenha o menu e devolve a opcao escolhida */ while ((opcao = menu(MENU_FLUXVOL,NUM,menuFlux)) != RETORNAR){ /* ativa as provas */ Abortou = FALSE; switch(opcao){ case ESC : setcolor(COR_MOLDURA); break; case preBD : FVpreBD(); break; case posBD : while((opc=menu(POSFARM,NUMOPC,opcoes)) != 4){ switch (opc){ case ESC : setcolor(COR_MOLDURA); break; case 0 : broncoDilatacao(); break; case 1 : BroncoRestricao(); break; case 2 : Esforco(); break; case 3 : FVposBD(); break; case 4 : break; } /* switch posBD */ LimpaTela(); AmbienteFluxVol(); } /* while opc */ } /* switch opcao */ } /* while opcao */ setcolor(COR4); if (teste2Flux) MelhorProvaCurvaFlux(ManobAtiva,NumManob); if ((UltimaManobra == ApontFluxPreBD)&&(*ApontFluxPreBD != NULL)) { VariaveisReais(preBD); areaFlux = ApontFluxPreBD = UltimaManobra = areaFluxPreBD; } else if ((UltimaManobra == ApontFluxPosBD)&&(*ApontFluxPosBD != NULL)) { VariaveisReais(posBD); areaFlux = ApontFluxPosBD = UltimaManobra = areaFluxPosBD; } ConfereApontador(); if (*ApontFluxPosBD != NULL) (void) ImprimeFlux(0); } /* FluxVol */