function StandardDiagnosis()
{
this.Server = new ServerConnector();
this.Timer = new Timer();
this.Errors = Array();
}
StandardDiagnosis.prototype.SearchSignSymptom = function(text, div, className)
{
if(text.length > 3)
{
requestPacket = Array();
requestPacket['Action'] = "SEARCH_SS";
requestPacket['Text'] = text;
requestPacket['Format'] = "JAVASCRIPT";
requestPacket['ReturnDiv'] = div;
requestPacket['Class'] = className;
this.Server.Request("http://www.everyonehealthy.com/ServiceEndPoints/Diagnosis.sep", requestPacket, className+".SearchResponse");
}
}
StandardDiagnosis.prototype.SearchCondition = function(text, div, className)
{
if(text.length > 2)
{
requestPacket = Array();
requestPacket['Action'] = "SEARCH_CONDITION";
requestPacket['Text'] = text;
requestPacket['Format'] = "JAVASCRIPT";
requestPacket['ReturnDiv'] = div;
requestPacket['Class'] = className;
this.Server.Request("http://www.everyonehealthy.com/ServiceEndPoints/Diagnosis.sep", requestPacket, className+".SearchConditionResponse");
}
}
StandardDiagnosis.prototype.Validate = function()
{
this.Errors = Array();
//check for a gender...
valid = true;
if(this.Server.CheckInternal('Gender'))
{
valid = valid && true;
}
else
{
valid = false;
error = Array();
error['Name'] = "Gender";
error['Description'] = "No gender selected";
this.Errors.push(error);
}
if(this.Server.CheckInternal('Age'))
{
valid = valid && true;
}
else
{
valid = false;
error = Array();
error['Name'] = "Age";
error['Description'] = "No age selected";
this.Errors.push(error);
}
if(this.Server.CheckInternal('SS_SELECTED') || this.Server.CheckInternal('CONDITION_SELECTED'))
{
valid = valid && true;
}
else
{
valid = false;
error = Array();
error['Name'] = "Signs & Symptoms";
error['Description'] = "There are no signs and symptoms selected";
this.Errors.push(error);
}
return valid;
}
StandardDiagnosis.prototype.SearchResponse = function(responseObj)
{
responseData = responseObj.endPointResponse['Data'];
returnDiv = responseData[0]['ReturnDiv'];
className = responseData[1]['Class'];
divHTML = "";
if(responseData.length > 1)
{
data = responseData;
var i = 0;
divHTML += '
';
for(i = 2; i < data.length; i++)
{
divHTML += '| '+data[i]['name']+' |
';
}
divHTML += '
';
document.getElementById(returnDiv).innerHTML = divHTML;
}
else
{
document.getElementById(returnDiv).innerHTML = "No Sign/Symptoms";
}
}
StandardDiagnosis.prototype.SearchConditionResponse = function(responseObj)
{
responseData = responseObj.endPointResponse['Data'];
returnDiv = responseData[0]['ReturnDiv'];
className = responseData[1]['Class'];
divHTML = "";
if(responseData.length > 1)
{
data = responseData;
var i = 0;
divHTML += '';
for(i = 2; i < data.length; i++)
{
divHTML += '| '+data[i]['condition']+' |
';
}
divHTML += '
';
document.getElementById(returnDiv).innerHTML = divHTML;
}
else
{
document.getElementById(returnDiv).innerHTML = "No Conditions";
}
}
StandardDiagnosis.prototype.AddSignSymptom = function(ss_id, name)
{
document.getElementById('SSList').innerHTML += ''+name+'
';
this.Server.AddItem('SS_SELECTED', ss_id, 'true', '');
}
StandardDiagnosis.prototype.AddCondition = function(c_id, name)
{
document.getElementById('ConditionList').innerHTML += ''+name+'
';
this.Server.AddItem('CONDITION_SELECTED', c_id, 'true', '');
}
StandardDiagnosis.prototype.UpdateBasicInfo = function (info_item, item_value, allowArray)
{
this.Server.AddItem(info_item, item_value, allowArray, '');
}