📄 epp.c.txt
字号:
GUI
void PutHz16_Print(int x, int y, unsigned char qm, unsigned char wm, U8 m)
function: write a Chinese characters to the raster image
x,y: corrdinate of the dot
qm: 区码
wm: 位码
m: multiple
****************************************************/
void PutHz16_Print(int x, int y, unsigned char qm, unsigned char wm, U8 m)
{
volatile U16 i,j,k,c1,c2;
volatile INT32U ulOffset;
volatile U8 *put_hz;
ulOffset = (INT32U)(qm * 94 + wm) * 32;
put_hz=HZK+ulOffset;
for (j=0;j<=15;j++)
{
k=128;
for (i=0;i<=7;i++) { c1=((*put_hz) & k); c2 = ( c1 == 0 ? 0: 250 ); k = k >> 1; PutPixel_Print(x+i,y+j, c2, m);}
put_hz++;
k=128;
for (i=0;i<=7;i++)
{ c1=((*put_hz) & k); c2 = ( c1 == 0 ? 0: 250); k = k >> 1; PutPixel_Print(x+8+i,y+j, c2,m); }
put_hz++;
}
}
/***************************************************
GUI
void PutString_Print ( int x, int y, volatile unsigned char a[], U8 m)
function: write a Chinese characters to the raster image
x,y: corrdinate of the dot
a: an array of string
m: multiple
****************************************************/
void PutString_Print ( int x, int y, volatile unsigned char a[], U8 m)
{
volatile unsigned char *p;
INT8U qm,wm;
int x1;
p=a; x1=x;
while (*(p)!=0)// whether it is at the end of the array
if (*(p)>=161) { qm = *(p) - 161; wm = *(p+1) - 161; PutHz16_Print(x1, y, qm, wm, m); p+=2; x1+=16; }
else { Putchar_Print( x1, y, *(p), m); p++; x1+=8; }
}
/************************************************
void HeadInfo(void)
function: edit the basic content of the report
department: 0-obstetrics; 1-gynecolocy; 2-urology; 3-cardiology
parameter region: refer to report HeadInfo(100~(imagey+imageh))
*************************************************/
void HeadInfo(unsigned char department)
{
int x0= 0, x_title = REPORTWIDTH/6, i, j;
int x4_1 = REPORTWIDTH/4, x4_2 = REPORTWIDTH/2, x4_3 = REPORTWIDTH*3/4;
int y0= 0, y1, y2, y3, y4, y5;
U8 p = 1;
unsigned char temp = department;
volatile unsigned char *ptrSrc, *ptrDst;
unsigned char ReportName[2][20] = {{"Ultrasound Report"},{"B 型超声报告单"}};
unsigned char Name[2][20] = {{"Name:"},{"姓名:"}};
unsigned char Sex[2][20] = {{"Sex:"},{"性别:"}};
unsigned char Age[2][20] = {{"Age:"},{"年龄:"}};
unsigned char section[2][20] = {{"Section:"},{"科别:"}};
unsigned char obstetrics[2][20] = {{"Obstetrics"},{"产科"}};
unsigned char gynecology[2][20] = {{"Gynecology"},{"妇科"}};
unsigned char urology[2][20] = {{"Urology"},{"泌尿科"}};
unsigned char cardiology[2][20] = {{"Cardiology"},{"心脏科"}};
unsigned char chaoshenghao[2][20] = {{"No.:"},{"超声号:"}};
unsigned char chuanghao[2][20] = {{"Bed Number:"},{"床号:"}};
unsigned char zhuyuanhao[2][20] = {{"Hospital No.:"},{"住院号:"}};
unsigned char menzhenhao[2][20] = {{"Clinic Number:"},{"门诊号:"}};
unsigned char Position[2][20] = {{"Pars:"},{"检查部位:"}};
unsigned char DeviceType[2][20] = {{"Device Type:"},{"仪器型号:"}};
unsigned char CheckTime[2][20] = {{"Check Time:"},{"检查时间:"}};
unsigned char ReportTime[2][20] = {{"Report Time:"},{"报告时间:"}};
unsigned char Parameter[2][20] = {{"Measurements:"},{"测量参数:"}};
unsigned char UltrasoundDiagnosis[2][25] = {{"Ultrasound Diagnosis:"},{"超声提示:"}};
unsigned char HospitalName[2][20] = {{"Hospital Name:"},{"医院名称:"}};
unsigned char ReportDoctor[2][20] = {{"Report Doctor:"},{"报告医师:"}};
unsigned char CheckDoctor[2][20] = {{"Check Doctor:"},{"审核医师:"}};
unsigned char StringFetus1[2][20] = {{"Fetus 1"},{"胎儿1"}};
unsigned char StringFetus2[2][20] = {{"Fetus 2"},{"胎儿2"}};
unsigned char Seperator[REPORTWIDTH];
extern volatile unsigned char Date_Type;
// padded the basic information
for(i=0; i<REPORTWIDTH/8; i++) {Seperator[i] = '-';}
p = 2;
PutString_Print(x_title, y0, ReportName[Language], p);
p = 1; //in this version, p must be 1
y1 = 70;
if ((department==0) && (twins==1)) //obstetrics
{
if (PrintFetus==0)
PutString_Print(x4_3+70, y1-40, StringFetus1[Language], p);
else
PutString_Print(x4_3+70, y1-40, StringFetus2[Language], p);
}
if(EnglishOnly != 1)
{
PutString_Print(x0, y1-20, Seperator, p);
//name
PutString_Print(x0, y1, Name[Language], p);
PutString_Print(x0+70, y1, PatientName, p);
//sex
PutString_Print(x4_1, y1, Sex[Language], p);
PutString_Print(x4_1+70, y1, (unsigned char *)StringSexType[Language][PatientSexType], p);
//age
PutString_Print(x4_2, y1, Age[Language], p);
PutString_Print(x4_2+70, y1, PatientAge, p);
//section
PutString_Print(x4_3, y1, section[Language], p);
if(temp == 0) PutString_Print(x4_3+70, y1, obstetrics[Language], p);
else if(temp == 1) PutString_Print(x4_3+70, y1, gynecology[Language], p);
else if(temp == 2) PutString_Print(x4_3+70, y1, urology[Language], p);
else if(temp == 3) PutString_Print(x4_3+70, y1, cardiology[Language], p);
//chaoshenghao
PutString_Print(x0, y1+20, chaoshenghao[Language], p);
if(Date_Type == 1)
{
Putchar_Print( x0+70, y1+20, (RTC_Buffer[4]>>4 )+48, p);
Putchar_Print ( x0+70+8, y1+20, (RTC_Buffer[4]&0x0f)+48, p);
Putchar_Print ( x0+70+16, y1+20, (RTC_Buffer[5]>>4 )+48, p);
Putchar_Print ( x0+70+24, y1+20, (RTC_Buffer[5]&0x0f)+48, p);
Putchar_Print ( x0+70+32, y1+20, (RTC_Buffer[6]>>4 )+48, p);
Putchar_Print ( x0+70+40, y1+20, (RTC_Buffer[6]&0x0f )+48, p);
Putchar_Print ( x0+70+48, y1+20, (RTC_Buffer[2]>>4 )+48, p);
Putchar_Print ( x0+70+56, y1+20, (RTC_Buffer[2]&0x0f)+48, p);
Putchar_Print ( x0+70+64, y1+20, (RTC_Buffer[1]>>4 )+48, p);
Putchar_Print ( x0+70+72, y1+20, (RTC_Buffer[1]&0x0f)+48, p);
}
else
{
Putchar_Print( x0+70, y1+20, (RTC_Buffer[6]>>4 )+48, p);
Putchar_Print ( x0+70+8, y1+20, (RTC_Buffer[6]&0x0f)+48, p);
Putchar_Print ( x0+70+16, y1+20, (RTC_Buffer[5]>>4 )+48, p);
Putchar_Print ( x0+70+24, y1+20, (RTC_Buffer[5]&0x0f)+48, p);
Putchar_Print ( x0+70+32, y1+20, (RTC_Buffer[4]>>4 )+48, p);
Putchar_Print ( x0+70+40, y1+20, (RTC_Buffer[4]&0x0f )+48, p);
Putchar_Print ( x0+70+48, y1+20, (RTC_Buffer[2]>>4 )+48, p);
Putchar_Print ( x0+70+56, y1+20, (RTC_Buffer[2]&0x0f)+48, p);
Putchar_Print ( x0+70+64, y1+20, (RTC_Buffer[1]>>4 )+48, p);
Putchar_Print ( x0+70+72, y1+20, (RTC_Buffer[1]&0x0f)+48, p);
}
//chuanghao
PutString_Print(x4_1, y1+20, chuanghao[Language], p);
PutString_Print(x4_2, y1+20, zhuyuanhao[Language], p);
PutString_Print(x4_3, y1+20, menzhenhao[Language], p);
}
else
{
PutString_Print(x0, y1-20, Seperator, p);
//name
PutString_Print(x0, y1, Name[0], p);
PutString_Print(x0+70, y1, PatientName, p);
//sex
PutString_Print(x4_2, y1, Sex[0], p);
PutString_Print(x4_2+70, y1, (unsigned char *)StringSexType[Language][PatientSexType], p);
//age
PutString_Print(x4_3, y1, Age[0], p);
PutString_Print(x4_3+70, y1, PatientAge, p);
//chaoshenghao
PutString_Print(x0, y1+20, chaoshenghao[0], p);
if(Date_Type == 1)
{
Putchar_Print( x0+70, y1+20, (RTC_Buffer[4]>>4 )+48, p);
Putchar_Print ( x0+70+8, y1+20, (RTC_Buffer[4]&0x0f)+48, p);
Putchar_Print ( x0+70+16, y1+20, (RTC_Buffer[5]>>4 )+48, p);
Putchar_Print ( x0+70+24, y1+20, (RTC_Buffer[5]&0x0f)+48, p);
Putchar_Print ( x0+70+32, y1+20, (RTC_Buffer[6]>>4 )+48, p);
Putchar_Print ( x0+70+40, y1+20, (RTC_Buffer[6]&0x0f )+48, p);
Putchar_Print ( x0+70+48, y1+20, (RTC_Buffer[2]>>4 )+48, p);
Putchar_Print ( x0+70+56, y1+20, (RTC_Buffer[2]&0x0f)+48, p);
Putchar_Print ( x0+70+64, y1+20, (RTC_Buffer[1]>>4 )+48, p);
Putchar_Print ( x0+70+72, y1+20, (RTC_Buffer[1]&0x0f)+48, p);
}
else
{
Putchar_Print( x0+70, y1+20, (RTC_Buffer[6]>>4 )+48, p);
Putchar_Print ( x0+70+8, y1+20, (RTC_Buffer[6]&0x0f)+48, p);
Putchar_Print ( x0+70+16, y1+20, (RTC_Buffer[5]>>4 )+48, p);
Putchar_Print ( x0+70+24, y1+20, (RTC_Buffer[5]&0x0f)+48, p);
Putchar_Print ( x0+70+32, y1+20, (RTC_Buffer[4]>>4 )+48, p);
Putchar_Print ( x0+70+40, y1+20, (RTC_Buffer[4]&0x0f )+48, p);
Putchar_Print ( x0+70+48, y1+20, (RTC_Buffer[2]>>4 )+48, p);
Putchar_Print ( x0+70+56, y1+20, (RTC_Buffer[2]&0x0f)+48, p);
Putchar_Print ( x0+70+64, y1+20, (RTC_Buffer[1]>>4 )+48, p);
Putchar_Print ( x0+70+72, y1+20, (RTC_Buffer[1]&0x0f)+48, p);
}
//section
PutString_Print(x4_2, y1+20, section[0], p);
if(temp == 0) PutString_Print(x4_2+70, y1+20, obstetrics[0], p);
else if(temp == 1) PutString_Print(x4_2+70, y1+20, gynecology[0], p);
else if(temp == 2) PutString_Print(x4_2+70, y1+20, urology[0], p);
else if(temp == 3) PutString_Print(x4_2+70, y1+20, cardiology[0], p);
}
PutString_Print(x0, y1+60, Position[Language], p);
// device type
PutString_Print(x4_2, y1+60, DeviceType[Language], p);
if( (EmperorOEM != 1) && (AbroadOEM != 1))
{
PutString_Print(x4_2+100, y1+60, StringMachineVersion[Language], p);
}
// check time
PutString_Print(x0, y1+80, CheckTime[Language], p);
//report time
PutString_Print(x4_2, y1+80, ReportTime[Language], p);
if(Date_Type == 1)
{
Putchar_Print( x4_2+100, y1+80, (RTC_Buffer[4]>>4 )+48, p);
Putchar_Print ( x4_2+108, y1+80, (RTC_Buffer[4]&0x0f)+48, p);
Putchar_Print ( x4_2+118, y1+80, '-', p);
Putchar_Print ( x4_2+128, y1+80, (RTC_Buffer[5]>>4 )+48, p);
Putchar_Print ( x4_2+136, y1+80, (RTC_Buffer[5]&0x0f)+48, p);
Putchar_Print ( x4_2+146, y1+80, '-', p);
Putchar_Print ( x4_2+156, y1+80, (RTC_Buffer[6]>>4 )+48, p);
Putchar_Print ( x4_2+164, y1+80, (RTC_Buffer[6]&0x0f )+48, p);
}
else
{
Putchar_Print( x4_2+100, y1+80, (RTC_Buffer[6]>>4 )+48, p);
Putchar_Print ( x4_2+108, y1+80, (RTC_Buffer[6]&0x0f)+48, p);
Putchar_Print ( x4_2+118, y1+80, '-', p);
Putchar_Print ( x4_2+128, y1+80, (RTC_Buffer[5]>>4 )+48, p);
Putchar_Print ( x4_2+136, y1+80, (RTC_Buffer[5]&0x0f)+48, p);
Putchar_Print ( x4_2+146, y1+80, '-', p);
Putchar_Print ( x4_2+156, y1+80, (RTC_Buffer[4]>>4 )+48, p);
Putchar_Print ( x4_2+164, y1+80, (RTC_Buffer[4]&0x0f )+48, p);
}
y2 = 200, y3 = 710;//770; //200(y2)+500(height of parameter)+40(seperator)+30(space);
y4 = 900, y5 = 980;//1000;
p = 1;
PutString_Print(x0, y2*p-20, Seperator, 1);
PutString_Print(x0, y2, Parameter[Language], p);
PutString_Print(x0, y3*p-20, Seperator, 1);
PutString_Print(x0, y3, UltrasoundDiagnosis[Language], p);
//PutString_Print(x0, y4*p-20, Seperator, 1);
//PutString_Print(x0, y4, Suggestion[Language], p);
PutString_Print(x0, y5*p-20, Seperator, 1);
// hospital name
PutString_Print(x0, y5, HospitalName[Language], p);
PutString_Print( x0+140, y5, Hospital, p);
PutString_Print(x4_2, y5, ReportDoctor[Language], p);
PutString_Print(x4_2, y5+20, CheckDoctor[Language], p);
// padded the measurement information (x4-2, y+20)
//position of paremeter refer to Obstetrics_Report: 100+paremeter=imagey+imageh =518
ptrSrc = (unsigned char *)DISPLAY_BUFFER + 90 * SCR_XSIZE_TFT_800600; // report
ptrDst = ReportBuffer + (y2+35)*REPORTWIDTH + x0-20;
for (j=0; j<(SCREENH-158); j++) // 158 = screenh-(imagey+imageh)+100只 取 报告中的测量参数部分
{
for (i=0; i<SCREENW; i+=2)
{
*ptrDst = ( ((*ptrSrc)&0x0f)<<5 );
if( *ptrDst < REPORT_CLOURBASIC) *ptrDst = 0; // clear the gray of background
ptrDst ++;
*ptrDst = ( (*ptrSrc)&0xf0 ) << 1;
if( *ptrDst < REPORT_CLOURBASIC) *ptrDst = 0;
ptrDst ++;
ptrSrc++;
}
ptrDst += REPORTWIDTH - SCREENW;
ptrSrc += (SCR_XSIZE_TFT_800600-DISPLAY_WIDTH);
}
}
/************************************************
void paremeterInfo(void)
function: edit the measurent report content of the report
*************************************************/
/****************************************************
void Print_I(void)
print black and white image
****************************************************/
void EPP_Print_I(unsigned char type)
{
int i;
unsigned char StringFreeze[2][30] = {{"Please freeze the image!"},{"请冻结图像!"}};
unsigned char StringExit[2][30] = {{"Press any key to exit!"},{"按任意键退出!"}};
unsigned char StringPrinting[2][30] = {{"Printing......!"},{"正在打印......"}};
unsigned char PrinterCommand_END[15] = {
esc,'*','r','C',
esc,'E',
esc,'%','-','1','2','3','4','5','X'
};
Clear_HintRegion();
if(RebuildMode != 'f')
{
PutString(HINTX, HINTY, StringFreeze[Language], 0);
PutString(HINTX+200, HINTY, StringExit[Language], 0);
while(Key_Done==0) Display_Rtc(Date_Type);
Key_Done = 0;
Clear_HintRegion();
return;
}
/**** set the transfer direction of the register ****/
Set_SingalBit();
if( Check_Printer() == 1 )
{
InitialPort();
Send_Command(0); // send printer command
Read_Pixel(type); // processing the data of display buffer and output to the printer
PutString(HINTX, HINTY, StringPrinting[Language], 0);
SendData_I();
for( i = 0; i < 6; i ++ ) { SppWrite( PrinterCommand_END[i] ); } // ending the print and eject the paper
rGPDCON &= 0x0000ffff; // disable the data line output
Clear_HintRegion();
}
}
/************************************************
void HeadInfo(void)
function: edit the basic content of the report
department: 0-obstetrics; 1-gynecolocy; 2-urology; 3-cardiology
parameter region: refer to report HeadInfo(100~(imagey+imageh))
*************************************************/
/****************************************************
void Print_R(void)
print report
department: 0-obstetrics; 1-gynecolocy; 2-urology; 3-cardiology
****************************************************/
void EPP_print_R(unsigned char department)
{
int i;
unsigned char StringPrinting[2][30] = {{"Printing......!"},{"正在打印......"}};
unsigned char PrinterCommand_END[15] = {
esc,'*','r','C',
esc,'E',
esc,'%','-','1','2','3','4','5','X'
};
Clear_HintRegion();
/**** set the transfer direction of the register ****/
Set_SingalBit();
if( Check_Printer() == 1 )
{
InitialPort();
Send_Command(1); // send printer command
HeadInfo(department); // processing the data of display buffer and output to the printer
PutString(HINTX, HINTY, StringPrinting[Language], 1);
SendData_R();
for( i = 0; i < 6; i ++ ) { SppWrite( PrinterCommand_END[i] ); } // ending the print and eject the paper
rGPDCON &= 0x0000ffff; // disable the data line output
Clear_HintRegion();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -