void PatientSearchForm::searchButtonSlot() { /* show the "loading form" */ loadingImage->setVisible(true); this->repaint(); QByteArray ba; /* get the patient info from textboxes */ QString patientName = nameTextBox->getValue(); QString patientSurname = surnameTextBox->getValue(); QString patientCity = cityTextBox->getValue(); QString patientCode = codeTextBox->getValue(); /* invoke the web method to search patients */ MobiBinding server; ns1__searchPatientResponse responce; int err = server.ns1__searchPatient(patientName.toLocal8Bit().data(), patientSurname.toLocal8Bit().data(), patientCity.toLocal8Bit().data(), patientCode.toLocal8Bit().data(), responce); if(err == SOAP_OK) { SimplePatientArray *simplePatientArray = responce.searchPatientReturn; ns1__SimplePatient **patientArray = simplePatientArray->__ptr; int arraySize = simplePatientArray->__size; /* initialize the field resultsForm creating the PatientSearchResultsForm, passing che SimplePatient array returned */ resultsForm = new PatientSearchResultForm(patientArray, arraySize, this); resultsForm->setAttribute(Qt::WA_DeleteOnClose, true); resultsForm->showFullScreen(); } else // web service error! { ErrorForm *error = new ErrorForm(err); error->setAttribute(Qt::WA_DeleteOnClose, true); error->showFullScreen(); } /* close the "loading form" */ loadingImage->setVisible(false); }
/* select patient button slot implementation */ void PatientItemWidget::selectPatientButtonSlot() { /* get the patient object (calling web method) */ MobiBinding server; ns1__getPatientByIdResponse response; /* show the "loading form" LoadingForm *loadingForm = new LoadingForm(); loadingForm->setAttribute(Qt::WA_DeleteOnClose, true); loadingForm->showFullScreen();*/ /* get the patient object from server */ int err = server.ns1__getPatientById(id.toLocal8Bit().data(), response); if (err == SOAP_OK) // no web service error { ns1__Patient *patient = response.getPatientByIdReturn; /* construct the patient object */ Patient *myPatient = new Patient(); myPatient->patintId = id; /* construct the patient anagrafica object */ myPatient->anagrafica->patientId = QString(patient->anagrafica->patientId); myPatient->anagrafica->patientCode = QString(patient->anagrafica->patientCode); myPatient->anagrafica->name = QString(patient->anagrafica->name); myPatient->anagrafica->lastName = QString(patient->anagrafica->lastName); myPatient->anagrafica->address = QString(patient->anagrafica->address); myPatient->anagrafica->cap = QString(patient->anagrafica->cap); myPatient->anagrafica->city = QString(patient->anagrafica->city); myPatient->anagrafica->province = QString(patient->anagrafica->province); myPatient->anagrafica->birthDate = QString(patient->anagrafica->birthDate); myPatient->anagrafica->GP = QString(patient->anagrafica->GP); myPatient->anagrafica->CF = QString(patient->anagrafica->CF); myPatient->anagrafica->profession = QString(patient->anagrafica->profession); myPatient->anagrafica->birthLocation = QString(patient->anagrafica->birthLocation); myPatient->anagrafica->marital = QString(patient->anagrafica->marital); /* construct the contacts map */ ns1__KeyValueObject **contactsArray = patient->contacts->__ptr; int contactsArraySize = patient->contacts->__size; /* for each contact add it in the patient contacts map */ for (int i=0; i<contactsArraySize; i++) { myPatient->contacts->insert(QString(contactsArray[i]->key), QString(contactsArray[i]->value)); } /* construct the images vector */ ns1__ImageItem **imagesArray = patient->images->__ptr; int imagesArraySize = patient->images->__size; for (int i=0; i<imagesArraySize; i++) { ImageItem *image = new ImageItem(); image->imageId = QString(imagesArray[i]->imageId); //QString patientId; image->base64Preview = QString(imagesArray[i]->base64Preview); image->name = QString(imagesArray[i]->name); image->imageNote = QString(imagesArray[i]->imageNote); myPatient->images.push_back(image); } /* construct the pathologies map */ ns1__KeyValueObject **pathologiesArray = patient->pathologies->__ptr; int pathologiesArraySize = patient->pathologies->__size; /* for each pathologies add it in the patient pathologies map */ for (int i=0; i<pathologiesArraySize; i++) { myPatient->pathologies->insert(QString(pathologiesArray[i]->key), QString(pathologiesArray[i]->value)); } /* construct the visits history map */ ns1__KeyValueObject **visitHistoryArray = patient->visitHistory->__ptr; int visitHistoryArraySize = patient->visitHistory->__size; /* for each visit add it in the patient visit history map */ for (int i=0; i<visitHistoryArraySize; i++) { myPatient->visitsHistory->insert(QString(visitHistoryArray[i]->key), QString(visitHistoryArray[i]->value)); } /* update the current patient */ MobiState::getInstance()->changeCurrentPatient(myPatient); /* close the form */ //loadingForm->close(); parent->close(); } else // web service error { /* show the error form */ ErrorForm *error = new ErrorForm(err); error->setAttribute(Qt::WA_DeleteOnClose, true); error->showFullScreen(); //loadingForm->close(); } }