mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-08 04:00:44 +00:00
Report HTML cleanup
This commit is contained in:
parent
26c8261232
commit
9f8d663ad9
@ -37,6 +37,7 @@ void SummaryChart::SetDay(Day * nullday)
|
|||||||
Layer::SetDay(day);
|
Layer::SetDay(day);
|
||||||
|
|
||||||
m_values.clear();
|
m_values.clear();
|
||||||
|
m_days.clear();
|
||||||
m_miny=9999999;
|
m_miny=9999999;
|
||||||
m_maxy=-9999999;
|
m_maxy=-9999999;
|
||||||
m_minx=0;
|
m_minx=0;
|
||||||
@ -68,6 +69,7 @@ void SummaryChart::SetDay(Day * nullday)
|
|||||||
for (int i=0;i<d.value().size();i++) {
|
for (int i=0;i<d.value().size();i++) {
|
||||||
day=d.value()[i];
|
day=d.value()[i];
|
||||||
if (type==ST_HOURS || day->channelExists(code)) { // too many lookups happening here.. stop the crap..
|
if (type==ST_HOURS || day->channelExists(code)) { // too many lookups happening here.. stop the crap..
|
||||||
|
m_days[dn]=day;
|
||||||
switch(m_type[j]) {
|
switch(m_type[j]) {
|
||||||
case ST_AVG: tmp=day->avg(code); break;
|
case ST_AVG: tmp=day->avg(code); break;
|
||||||
case ST_SUM: tmp=day->sum(code); break;
|
case ST_SUM: tmp=day->sum(code); break;
|
||||||
@ -223,12 +225,16 @@ void SummaryChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
lastY[i]=top+height-1-h;
|
lastY[i]=top+height-1-h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Day * day;
|
||||||
for (qint64 Q=minx;Q<=maxx+86400000L;Q+=86400000L) {
|
for (qint64 Q=minx;Q<=maxx+86400000L;Q+=86400000L) {
|
||||||
zd=Q/86400000L;
|
zd=Q/86400000L;
|
||||||
d=m_values.find(zd);
|
d=m_values.find(zd);
|
||||||
|
|
||||||
qint64 extra=86400000;
|
qint64 extra=86400000;
|
||||||
if (Q<minx) continue;
|
if (Q<minx) continue;
|
||||||
if (d!=m_values.end()) {
|
if (d!=m_values.end()) {
|
||||||
|
day=m_days[zd];
|
||||||
|
|
||||||
int x1=px,x2=px+barw;
|
int x1=px,x2=px+barw;
|
||||||
|
|
||||||
if (x1<left) x1=left;
|
if (x1<left) x1=left;
|
||||||
@ -359,47 +365,32 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event)
|
|||||||
qint64 mx=ceil(xmult*double(x-offset));
|
qint64 mx=ceil(xmult*double(x-offset));
|
||||||
mx+=l_minx;
|
mx+=l_minx;
|
||||||
mx=mx+l_offset;//-86400000L;
|
mx=mx+l_offset;//-86400000L;
|
||||||
// if (m_graphtype==GT_LINE) mx+=86400000L;
|
|
||||||
int zd=mx/86400000L;
|
int zd=mx/86400000L;
|
||||||
//if (hl_day!=zd)
|
|
||||||
|
//if (hl_day!=zd) // This line is an optimization
|
||||||
|
|
||||||
{
|
{
|
||||||
hl_day=zd;
|
hl_day=zd;
|
||||||
QHash<int,QHash<short,EventDataType> >::iterator d=m_values.find(hl_day);
|
QHash<int,QHash<short,EventDataType> >::iterator d=m_values.find(hl_day);
|
||||||
if (d!=m_values.end()) {
|
if (d!=m_values.end()) {
|
||||||
|
|
||||||
//int yy=y;
|
|
||||||
//int x=event->x()+graph->left+gGraphView::titleWidth;
|
|
||||||
;
|
|
||||||
//int x=event->x()+gYAxis::Margin-gGraphView::titleWidth;
|
|
||||||
//if (x>l_width-45) x=l_width-45;
|
|
||||||
x+=gYAxis::Margin+gGraphView::titleWidth; //graph->m_marginleft+
|
x+=gYAxis::Margin+gGraphView::titleWidth; //graph->m_marginleft+
|
||||||
int y=event->y()+rtop-10;
|
int y=event->y()+rtop-10;
|
||||||
/*int w=90;
|
|
||||||
int h=32;
|
|
||||||
if (x<41+w/2) x=41+w/2;
|
|
||||||
if (y<1) y=1;
|
|
||||||
if (y>l_height-h+1) y=l_height-h+1; */
|
|
||||||
|
|
||||||
|
|
||||||
//y+=rtop;
|
|
||||||
//TODO: Convert this to a ToolTip class
|
|
||||||
|
|
||||||
|
|
||||||
QDateTime dt=QDateTime::fromTime_t(hl_day*86400);
|
QDateTime dt=QDateTime::fromTime_t(hl_day*86400);
|
||||||
|
|
||||||
|
// Day * day=m_days[hl_day];
|
||||||
EventDataType val;
|
EventDataType val;
|
||||||
if (m_graphtype==GT_BAR) {
|
if (m_graphtype==GT_BAR) {
|
||||||
val=d.value()[0];
|
val=d.value()[0];
|
||||||
} else {
|
} else {
|
||||||
val=d.value()[1];
|
val=d.value()[1];
|
||||||
}
|
}
|
||||||
QString z=dt.date().toString(Qt::SystemLocaleShortDate)+"\n"+m_label+"="+QString::number(val,'f',2);;
|
QString z=dt.date().toString(Qt::SystemLocaleShortDate)+"\n"+m_label+"="+QString::number(val,'f',2);//+"\nAHI="+QString::number(day->cph(CPAP_AHI));
|
||||||
graph->ToolTip(z,x,y,1500);
|
graph->ToolTip(z,x,y,1500);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//graph->redraw();
|
|
||||||
}
|
}
|
||||||
//qDebug() << l_left << x << hl_day << y << offset << barw;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,8 @@ class SummaryChart:public Layer
|
|||||||
QVector<ChannelID> m_codes;
|
QVector<ChannelID> m_codes;
|
||||||
QVector<SummaryType> m_type;
|
QVector<SummaryType> m_type;
|
||||||
QHash<int,QHash<short,EventDataType> > m_values;
|
QHash<int,QHash<short,EventDataType> > m_values;
|
||||||
|
QHash<int,Day *> m_days;
|
||||||
|
|
||||||
Profile * m_profile;
|
Profile * m_profile;
|
||||||
GLBuffer *quads,*lines;
|
GLBuffer *quads,*lines;
|
||||||
bool m_empty;
|
bool m_empty;
|
||||||
|
@ -302,11 +302,11 @@ EventDataType Day::cph(ChannelID code)
|
|||||||
EventDataType sum=0;
|
EventDataType sum=0;
|
||||||
EventDataType h=0;
|
EventDataType h=0;
|
||||||
for (int i=0;i<sessions.size();i++) {
|
for (int i=0;i<sessions.size();i++) {
|
||||||
if (!sessions[i]->m_sum.contains(code)) continue;
|
if (!sessions[i]->m_cph.contains(code)) continue;
|
||||||
sum+=sessions[i]->count(code);
|
sum+=sessions[i]->cph(code)*sessions[i]->hours();
|
||||||
//h+=sessions[i]->hours();
|
//h+=sessions[i]->hours();
|
||||||
}
|
}
|
||||||
sum/=hours();;
|
sum/=hours();
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,8 +315,8 @@ EventDataType Day::sph(ChannelID code)
|
|||||||
EventDataType sum=0;
|
EventDataType sum=0;
|
||||||
EventDataType h=0;
|
EventDataType h=0;
|
||||||
for (int i=0;i<sessions.size();i++) {
|
for (int i=0;i<sessions.size();i++) {
|
||||||
if (!sessions[i]->m_sum.contains(code)) continue;
|
if (!sessions[i]->m_sph.contains(code)) continue;
|
||||||
sum+=sessions[i]->sum(code)/3600.0;
|
sum+=sessions[i]->sph(code)*sessions[i]->hours();
|
||||||
//h+=sessions[i]->hours();
|
//h+=sessions[i]->hours();
|
||||||
}
|
}
|
||||||
h=hours();
|
h=hours();
|
||||||
|
@ -327,8 +327,6 @@ int PRS1Loader::OpenMachine(Machine *m,QString path,Profile *profile)
|
|||||||
sess->cph(e[i]);
|
sess->cph(e[i]);
|
||||||
sess->sph(e[i]);
|
sess->sph(e[i]);
|
||||||
}*/
|
}*/
|
||||||
sess->setCph(CPAP_AHI,sess->cph(CPAP_Obstructive)+sess->cph(CPAP_Hypopnea)+sess->cph(CPAP_ClearAirway));
|
|
||||||
sess->setSph(CPAP_AHI,sess->sph(CPAP_Obstructive)+sess->sph(CPAP_Hypopnea)+sess->sph(CPAP_ClearAirway));
|
|
||||||
|
|
||||||
ChannelID a[]={
|
ChannelID a[]={
|
||||||
CPAP_FlowRate, CPAP_MaskPressure, CPAP_Leak, CPAP_Snore, CPAP_EPAP,
|
CPAP_FlowRate, CPAP_MaskPressure, CPAP_Leak, CPAP_Snore, CPAP_EPAP,
|
||||||
|
@ -427,6 +427,11 @@ void Session::UpdateSummaries()
|
|||||||
first(id);
|
first(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (channelExists(CPAP_Obstructive)) {
|
||||||
|
setCph(CPAP_AHI,cph(CPAP_Obstructive)+cph(CPAP_Hypopnea)+cph(CPAP_ClearAirway));
|
||||||
|
setSph(CPAP_AHI,sph(CPAP_Obstructive)+sph(CPAP_Hypopnea)+sph(CPAP_ClearAirway));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EventDataType Session::min(ChannelID id)
|
EventDataType Session::min(ChannelID id)
|
||||||
|
@ -117,7 +117,7 @@ void Report::GenerateReport(QDate start, QDate end)
|
|||||||
"<div align=center><table width='100%' cellpadding=0 cellspacing=0>"
|
"<div align=center><table width='100%' cellpadding=0 cellspacing=0>"
|
||||||
"<tr><td valign=top>";
|
"<tr><td valign=top>";
|
||||||
html+="<h2>CPAP Overview</h2>";
|
html+="<h2>CPAP Overview</h2>";
|
||||||
html+="<table border='1px'><tr><td valign=top><table border=0>";
|
html+="<table cell_padding=0 cell_spacing=0 rules=cols border=1><tr><td valign=top width='33%'><table rules=none border=0 cell_padding=0 cell_spacing=0 width=100%>";
|
||||||
|
|
||||||
//html+="<i>This is a temporary scratch pad tab so I can see what's going on while designing printing code. These graphs are images, and not controllable.</i>";
|
//html+="<i>This is a temporary scratch pad tab so I can see what's going on while designing printing code. These graphs are images, and not controllable.</i>";
|
||||||
if (!((*profile).Exists("FirstName") && (*profile).Exists("LastName"))) html+="<h1>Please edit your profile</h1>"; else {
|
if (!((*profile).Exists("FirstName") && (*profile).Exists("LastName"))) html+="<h1>Please edit your profile</h1>"; else {
|
||||||
@ -133,7 +133,7 @@ void Report::GenerateReport(QDate start, QDate end)
|
|||||||
if ((*profile).Exists("EmailAddress") && !(*profile)["EmailAddress"].toString().isEmpty()) {
|
if ((*profile).Exists("EmailAddress") && !(*profile)["EmailAddress"].toString().isEmpty()) {
|
||||||
html+="<tr><td>Email:</td><td>"+(*profile)["EmailAddress"].toString()+"</td></tr>";
|
html+="<tr><td>Email:</td><td>"+(*profile)["EmailAddress"].toString()+"</td></tr>";
|
||||||
}
|
}
|
||||||
html+="</table></td><td valign=top><table>";
|
html+="</table></td><td valign=top width='33%'><table width=100% height=100% rules=none border=0>";
|
||||||
if ((*profile).Exists("Gender")) {
|
if ((*profile).Exists("Gender")) {
|
||||||
QString gender=(*profile)["Gender"].toBool() ? "Male" : "Female";
|
QString gender=(*profile)["Gender"].toBool() ? "Male" : "Female";
|
||||||
html+="<tr><td>Gender:</td><td>"+gender+"</td></tr>";
|
html+="<tr><td>Gender:</td><td>"+gender+"</td></tr>";
|
||||||
@ -157,7 +157,7 @@ void Report::GenerateReport(QDate start, QDate end)
|
|||||||
}
|
}
|
||||||
|
|
||||||
html+="</table></td></tr></table>";
|
html+="</table></td></tr></table>";
|
||||||
html+="<td valign=center align=right><img src='qrc:/docs/sheep.png' width=100 height=100'><br/>SleepyHead v"+pref["VersionString"].toString()+"</td></tr>"
|
html+="<td valign=center align=center width='180px'><img src='qrc:/docs/sheep.png' width=100 height=100'><br/>SleepyHead v"+pref["VersionString"].toString()+"</td></tr>"
|
||||||
"<tr><td colspan=2>"
|
"<tr><td colspan=2>"
|
||||||
"Reporting from <b>"+startDate.toString()+"</b> to <b>"+endDate.toString()+"</b>"
|
"Reporting from <b>"+startDate.toString()+"</b> to <b>"+endDate.toString()+"</b>"
|
||||||
"<hr width=1270px>"
|
"<hr width=1270px>"
|
||||||
|
Loading…
Reference in New Issue
Block a user