⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 runkey.h

📁 该程序是基于PC104的工控板的多参数监护仪的源程序.监护内容包含:心电血氧呼吸无创血压等等.
💻 H
📖 第 1 页 / 共 5 页
字号:
  if((DataHand+point)->TEMP2!=455){//体温2
     if(TEMP2UNIT->value==V_C_)//摄氏度
     	sprintf(tempstr, "%4.1f", (DataHand+point)->TEMP2/10.0);
     else
     	sprintf(tempstr, "%5.1f", (DataHand+point)->TEMP2*0.18+32.0);
  }else{
     sprintf(tempstr, "--.- ");
  }
  outtext(405, 496, tempstr, GRPDATA_COLOR, BLACK, FONT10);
  
  if((DataHand+point)->RESP!=255)//呼吸
     sprintf(tempstr, "%2d", (DataHand+point)->RESP);
  else
     sprintf(tempstr, "--");
  outtext(422, 496, tempstr, GRPDATA_COLOR, BLACK, FONT10);
  
  if((DataHand+point)->SYST!=255){//收缩压
     if(NIBPUNIT->value==V_MMHG)
     	sprintf(tempstr, " %3d", (DataHand+point)->SYST);
     else
     	sprintf(tempstr, "%4.1f", (DataHand+point)->SYST/7.5);
  }else{
     if(NIBPUNIT->value==V_MMHG)
     	sprintf(tempstr, " ---");
     else
     	sprintf(tempstr, "--.-");
  }
  outtext(477, 456, tempstr, GRPDATA_COLOR, BLACK, FONT10);
  
  if((DataHand+point)->DIAS!=255){//舒张压
     if(NIBPUNIT->value==V_MMHG)
     	sprintf(tempstr, "%3d", (DataHand+point)->DIAS);
     else
     	sprintf(tempstr, "%4.1f", (DataHand+point)->DIAS/7.5);
  }else{
     if(NIBPUNIT->value==V_MMHG)
     	sprintf(tempstr, "---");
     else
     	sprintf(tempstr, "--.-");
  }
  outtext(477, 512, tempstr, GRPDATA_COLOR, BLACK, FONT10);
  
  if((DataHand+point)->MEAN!=255){//平均压
     if(NIBPUNIT->value==V_MMHG)
     	sprintf(tempstr, "%3d", (DataHand+point)->MEAN);
     else
     	sprintf(tempstr, "%4.1f", (DataHand+point)->MEAN/7.5);
  }else{
     if(NIBPUNIT->value==V_MMHG)
     	sprintf(tempstr, "---");
     else
     	sprintf(tempstr, "--.-");
  }
  outtext(495, 496, tempstr, GRPDATA_COLOR, BLACK, FONT10);
  #undef GRPDATA_COLOR
  return;
}

//画趋势图形曲线
void DisTrdGrp(void)
{
 int height, i_i;
 unsigned  point_x=GRPPAGE_ENDX-1, datapoint;
 unsigned char timescale[]={1, 2, 3, 4, 6, 12};
 int ySYST,yMEAN,yDIAS; ///血压 y位置

 SETCOLOR(LIGHTGREEN);
 SETMODE(PUT_COPY);
 for(i_i=0; i_i<timescale[GTIMESCALE->value]*(MOVECURS->up-MOVECURS->low+1); i_i+=timescale[GTIMESCALE->value]){
    height=0;
    datapoint=(DataCurPoint+MONDATAL-i_i)%MONDATAL;
    switch(PARAMETER->value){
	case 0: if((DataHand+datapoint)->HR!=255&&(DataHand+datapoint)->HR>30)
				height=GRPPAGE_ENDY-((DataHand+datapoint)->HR-30)*16/27;
			break;//300-30
	case 1: if((DataHand+datapoint)->PR!=255&&(DataHand+datapoint)->PR>30)
		 		height=GRPPAGE_ENDY-((DataHand+datapoint)->PR-30)*16/27;
			break;
	case 2: if((DataHand+datapoint)->ST!=127)
				height=GRPPAGE_ENDY-((((DataHand+datapoint)->ST+80)*16)>>4);
			break;//80-(-80)
	case 3: if((DataHand+datapoint)->SPO2!=255)
				height=GRPPAGE_ENDY-(DataHand+datapoint)->SPO2*16/10;
			break;
	case 4: if((DataHand+datapoint)->TEMP1!=455&&(DataHand+datapoint)->TEMP1>250)
				height=GRPPAGE_ENDY-((DataHand+datapoint)->TEMP1-250)*16/21;
			break;//500-250
	case 5: if((DataHand+datapoint)->TEMP2!=455&&(DataHand+datapoint)->TEMP2>250)
				height=GRPPAGE_ENDY-((DataHand+datapoint)->TEMP2-250)*16/21;
			 break;
	case 6:  if((DataHand+datapoint)->RESP!=255)
				 height=GRPPAGE_ENDY-(DataHand+datapoint)->RESP*16/10;
			 break;
    }
    if(height<GRPPAGE_ENDY && height>=GRPPAGE_ENDY-GRPPAGE_HIGH){
	point(height, point_x);
	point(height, point_x-1);
    }else{
       point(GRPPAGE_ENDY-1, point_x);
	   point(GRPPAGE_ENDY-1, point_x-1);
    }
    if(PARAMETER->value==7){//NIBP
    if((DataHand+datapoint)->SYST>250) ySYST=GRPPAGE_ENDY-GRPPAGE_HIGH;
    else if((DataHand+datapoint)->SYST>20) ySYST=GRPPAGE_ENDY-((DataHand+datapoint)->SYST-20)*16/23; //250-20
    else ySYST=GRPPAGE_ENDY;
    if((DataHand+datapoint)->MEAN>250) yMEAN=GRPPAGE_ENDY-GRPPAGE_HIGH;
    else if((DataHand+datapoint)->MEAN>20) yMEAN=GRPPAGE_ENDY-((DataHand+datapoint)->MEAN-20)*16/23;
    else yMEAN=GRPPAGE_ENDY;
    if((DataHand+datapoint)->DIAS>250) yDIAS=GRPPAGE_ENDY-GRPPAGE_HIGH;
    else if((DataHand+datapoint)->DIAS>20) yDIAS=GRPPAGE_ENDY-((DataHand+datapoint)->DIAS-20)*16/23;
    else yDIAS=GRPPAGE_ENDY;
    if((DataHand+datapoint)->DIAS!=255&&(DataHand+datapoint)->SYST!=255&&(DataHand+datapoint)->SYST!=255){
	    SETCOLOR(LIGHTGREEN);
	    commline(ySYST, point_x, yMEAN-1, point_x);
	    SETCOLOR(LIGHTMAGENTA);
	    commline(yMEAN+1, point_x, yDIAS, point_x);
	}else{
	    SETCOLOR(RED);
	    commline(GRPPAGE_ENDY-1, point_x, GRPPAGE_ENDY-1, point_x-1);
	}
    }///血压
    point_x-=3;
   }
   return ;
}

void GrpTrdPage(char next_back)
{ 
  char timescale[]={1, 2, 3, 4, 6, 12};
  char tempstr[10];
  char hour, min;
  int  page_var;
  int  pagelen;
  int  datapoint;
  if(GRPTURNPG->up<1)
	GRPTURNPG->up=1;
  if(GRPTURNPG->up>timescale[GTIMESCALE->up-GTIMESCALE->value])
  	GRPTURNPG->up=1;
  sprintf(tempstr, "%02d", GRPTURNPG->value);
  outtext(495, 304, tempstr,  WHITE, BLACK, FONT10);//显示当前页号
  //计算当前页起始点的指针
  DataCurPoint=(DataEndPoint+MONDATAL-(GRPTURNPG->value-1)*timescale[GTIMESCALE->value]*GRPPAGE_LEN)%MONDATAL;
  SETCOLOR(CYAN);
  if(next_back==GOTO_NEXTPAGE){//到下一页的开头
 	commline(GRPPAGE_ENDY-GRPPAGE_HIGH, GRPPAGE_ENDX, GRPPAGE_ENDY, GRPPAGE_ENDX);//趋势图的起始光标线
  	MOVECURS->value=MOVECURS->up;
  	datapoint=DataCurPoint;
  }else{//返回上一页的末尾
  	commline(GRPPAGE_ENDY-GRPPAGE_HIGH, GRPPAGE_ENDX-GRPPAGE_WIDTH+3, GRPPAGE_ENDY, GRPPAGE_ENDX-GRPPAGE_WIDTH+3);//趋势图的起始光标线
  	MOVECURS->value=1;
  	datapoint=(DataEndPoint+MONDATAL-(GRPTURNPG->value)*timescale[GTIMESCALE->value]*(GRPPAGE_LEN-1))%MONDATAL;
  }
  
  
  if(Datafill){
  	MOVECURS->low=1;
  }else{
  	if((int)(DataCurPoint-GRPPAGE_LEN*timescale[GTIMESCALE->value])<0)//不足一满页
  	    MOVECURS->low=GRPPAGE_LEN-DataCurPoint/timescale[GTIMESCALE->value];
  	else
  	    MOVECURS->low=1;
  }

  hour=trdtime.ti_hour;
  min=trdtime.ti_min-((DataEndPoint+MONDATAL-datapoint)%MONDATAL)%60;
  if(min<0){
  	min+=60;	--hour;
  }
  hour=(hour+24-((DataEndPoint+MONDATAL-datapoint)%MONDATAL)/60)%24;
  DisGrpData(datapoint);//显示当前趋势图数据
  sprintf(tempstr,"%02d:%02d", hour, min);
  outtext(495, 360, tempstr, WHITE, BLACK, FONT10);//显示时间
  outtext(MOVECURS->vy, MOVECURS->vx, tempstr, VM_COLOR, VM_BCOLOR, FONT10);//移动光标的时间显示
  DisTrdGrp();//画趋势图形
  return;
}

void DisNIBPList(void)
{
 PrtLstLen=0;//打印列表的个数
 if(NoWriteRealData){//如果有数据保存
  char *err[]={"NO DATA","没有数据"};
  outtext(ECG_IENDY+65, 224, err[LANGUAGE->value], LIGHTRED, BLACK, FONT16);
 }else{//already save data;
  char hour, min, sec, i_i, tempstr[15];
  unsigned point, maxp;
  unsigned row=ECG_IENDY+25;
  
  if(NIBPLSTPAGE->value<=REALDATALEN/PRTLSTLEN){
     if(NIBPListFill){//血压数据列表满
  	point=(RealDataCurrnt+(NIBPLSTPAGE->value-1)*PRTLSTLEN)%REALDATALEN;
     }else{
     	point=(NIBPLSTPAGE->value-1)*PRTLSTLEN;
     }
     for(i_i=0; i_i<PRTLSTLEN; i_i++,row+=17){
     	if(!NIBPListFill && point>=RealDataCurrnt){
      	    fillrect(row,  8,  row+9,  535,  BLACK);
      	    continue;
        }
  	hour=trdtime.ti_hour;
  	min=trdtime.ti_min-((InListCount+REALTIMELEN-(RealData_Sta+point)->TIME)/60)%60;//分钟
  	sec=trdtime.ti_sec-(InListCount+REALTIMELEN-(RealData_Sta+point)->TIME)%60;  //秒钟
  	if(sec<0){ sec+=60; --min;  }
  	if(min<0){ min+=60; --hour; }
  	hour=(hour+24-(InListCount-(RealData_Sta+point)->TIME+REALTIMELEN)/3600)%24;
  	PrtLstHour[i_i]=hour;
  	PrtLstMin[i_i]=min;
  	PrtLstLen++;
  	sprintf(tempstr,"%02d:%02d:%02d", PrtLstHour[i_i], PrtLstMin[i_i], sec);
      	outtext(row, 8, tempstr, WHITE, BLACK, FONT10);
  	PrtLstBuff[i_i].HR=(RealData_Sta+point)->DATA.HR;
        PrtLstBuff[i_i].PR=(RealData_Sta+point)->DATA.PR;
        PrtLstBuff[i_i].ST=(RealData_Sta+point)->DATA.ST;
        PrtLstBuff[i_i].SPO2=(RealData_Sta+point)->DATA.SPO2;
        PrtLstBuff[i_i].TEMP1=(RealData_Sta+point)->DATA.TEMP1;
        PrtLstBuff[i_i].TEMP2=(RealData_Sta+point)->DATA.TEMP2;
        PrtLstBuff[i_i].RESP=(RealData_Sta+point)->DATA.RESP;
        PrtLstBuff[i_i].SYST=(RealData_Sta+point)->DATA.SYST;
        PrtLstBuff[i_i].DIAS=(RealData_Sta+point)->DATA.DIAS;
        PrtLstBuff[i_i].MEAN=(RealData_Sta+point)->DATA.MEAN;
        DisListData(row, PrtLstBuff+i_i);
        point=(point+1)%REALDATALEN;
     }
  }//End page control
 }
 return;
}

void DisLstPage(void)
{
 char timescale[]={1, 2, 5, 10, 30};
 char tempstr[30];
 char hour, min;
 //unsigned char step;
 unsigned point;
 unsigned datapoint;
 unsigned i_i, row;
 #define  LIST_BAK_COLOR	0
 row=ECG_IENDY+25;
 
 point=0;
 DataCurPoint=(DataStaPoint+(LSTTURNPG->value-1)*timescale[LTIMESCALE->value]*PRTLSTLEN)%MONDATAL;
 
 PrtLstLen=0;//打印列表的个数
 for(i_i=0; i_i<timescale[LTIMESCALE->value]*PRTLSTLEN; i_i+=timescale[LTIMESCALE->value], point++, row+=17){
      datapoint=(DataCurPoint+i_i)%MONDATAL;
      if(!Datafill && datapoint>DataEndPoint){
      	    fillrect(row,  8,  row+9,  535,  LIST_BAK_COLOR);
      	    continue;
      }
      hour=trdtime.ti_hour;
      min=trdtime.ti_min-((DataEndPoint+MONDATAL-DataCurPoint-i_i)%MONDATAL)%60;
      if(min<0){
      	    min+=60;  --hour;
      }
      PrtLstHour[point]=(hour+24-((DataEndPoint+MONDATAL-DataCurPoint-i_i)%MONDATAL)/60)%24;
      PrtLstMin[point]=min;
      PrtLstLen++;
      sprintf(tempstr,"%02d:%02d", PrtLstHour[point], PrtLstMin[point]);
      outtext(row, 8, tempstr, WHITE, LIST_BAK_COLOR, FONT10);
      PrtLstBuff[point].HR=(DataHand+datapoint)->HR;
      PrtLstBuff[point].PR=(DataHand+datapoint)->PR;
      PrtLstBuff[point].ST=(DataHand+datapoint)->ST;
      PrtLstBuff[point].SPO2=(DataHand+datapoint)->SPO2;
      PrtLstBuff[point].TEMP1=(DataHand+datapoint)->TEMP1;
      PrtLstBuff[point].TEMP2=(DataHand+datapoint)->TEMP2;
      PrtLstBuff[point].RESP=(DataHand+datapoint)->RESP;
      PrtLstBuff[point].SYST=(DataHand+datapoint)->SYST;
      PrtLstBuff[point].DIAS=(DataHand+datapoint)->DIAS;
      PrtLstBuff[point].MEAN=(DataHand+datapoint)->MEAN;
      DisListData(row, PrtLstBuff+point);
  }
  return;
}


void ExeCMD(void)
{
 int var, i_i, row;
 char tempstr[20];
  
 if(CMD_ID!=ID_NOCMD){
     switch(CMD_ID){
     	case	ID_INTOFILE://进入选择文件的调用
     		     fillrect(PLETH_ENDY+2, 1, WAVE_ENDY, LEFTMAXX-1, BLACK);//菜单栏(RESP or PLETH)
     		     FILLEADSLT->value=SECLEAD->value;
     		     FILLPRTWAV->iy=SLTPAGE->iy=SLTFILE->iy=553;	FILLPRTWAV->vy=SLTPAGE->vy=SLTFILE->vy=555;
     		     FILLEADSLT->iy=FILLEXIT->iy=578;		FILLEADSLT->vy=FILLEXIT->vy=580;
     		     DisVmenu();
     		     if(SLTFILE->up){//如果有供选择的文件
     		     	SLTPAGE->low=SLTPAGE->value=1;
     		     	SLTPAGE->up=8;
     		     	if(OpenFile(SLTFILE->value)){//如果文件打开正确
     		     	    if(LEADDIS->value==V_SINGLE){//单导联处理
		    		//fillrect(ECG_ENDY-ECG_HIGH,  WAVXSTART, ECG_ENDY,  LEFTMAXX-1, BLACK);//擦除ECG波形
		    		//EwaveX=WAVXSTART;//ECG wave x is return start point;
 		    		fillrect(ECG_IENDY-ECG_HIGH, 1, ECG_IENDY, LEFTMAXX-1, BLACK);//擦除ECG+I波形
 		    		fillrect(PLETH_ENDY-PLETH_HIGH, 1, PLETH_ENDY, LEFTMAXX-1, BLACK);//擦除PLETH wave
    		    		ItemAllow=0x13;//不允许"RESP"刷新显示
    		    		ECGWavItstr=PLETHWavItstr=RESPWavItstr=NULL;
    		    		WaveCont=0x00;//参考"menu.h"中定义的WaveCont,ItemAllow变量
		    	    }else{
		    		fillrect(WAVE_STARTY,  1, PLETH_ENDY,  LEFTMAXX-1, BLACK);//擦除ECG I~~V波形
		    		drawECGScaleRule();//画心电增益
		    		ItemAllow=0x08;//允许I~V标题刷新
		    		WaveCont=0x00;//所有波形不允许
		    	    }
		    	    SLTFILE->value=FilePoint;
		    	    DisValue(SLTFILE, VM_COLOR, VM_BCOLOR);
		    	    DisFreWav(SLTPAGE->value, FILLEADSLT->value);
     		     	    DisFrzTime();//显示冻结时间日期
     		     	    DisFrzStaEnd(SLTPAGE->value);//冻结起始截止时间
		    	}else{
		    	    //SLTPAGE->value=SLTPAGE->low=SLTPAGE->up=0;
		    	    outtext(IM_TREND[0].t_y+20, IM_TREND[0].t_x, "Open File Error", LIGHTRED, BLACK, FONT16);
		    	}
     		     }else{
     		     	char *info[]={"File NO Save","没有存储文件"};
     		     	outtext(IM_TREND[0].t_y+20, IM_TREND[0].t_x, info[LANGUAGE->value], LIGHTRED, BLACK, FONT16);
     		     }
		     break;
     	case	ID_INTOTNDGRP://进入趋势图形
     		     {  
     		     	unsigned char row[]={15, 33, 51, 69, 87, 105, 122, 142};//与实际行有300的偏移量
     		     	char timescale[]={1, 2, 3, 4, 6, 12};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -