void giveVacation(){ int i,k; int patientCount = getPatientCount(); loadPatient(); for(i=0;i<doctorCount;i++){ if(strcmp(doctor[i].lastName,doctorMessage.doctorLastName)==0){ printf("jest lekarz\n"); doctor[i].vacationDate.tm_mday = doctorMessage.day; doctor[i].vacationDate.tm_mon = doctorMessage.month - 1; doctor[i].vacationDate.tm_year = doctorMessage.year - 1900; for(k=0;k<patientCount;k++){ int visitDay = patient[k].visitDate.tm_mday; int visitMonth = patient[k].visitDate.tm_mon; int visitYear =patient[k].visitDate.tm_year; printf("ten tok lekarza %d\n", visitYear); if(strcmp(patient[k].doctorLastName,doctor[i].lastName) == 0 && visitDay == doctorMessage.day && (doctorMessage.month-1) == visitMonth && (doctorMessage.year-1900) == visitYear){ printf("kasujemy wizyte\n"); strcpy(patient[k].doctorLastName, "\n"); strcpy(patient[k].doctorName, "\n"); patient[k].visitDate.tm_year = 0; } } strcpy(doctorMessage.information,"Udzielono urlopu"); doctorMessage.mtype = doctorMessage.type; msgsnd(msgid,&doctorMessage,sizeof(doctorMessage),0); savePatient(); saveDoctors(); break; } } }
void loginUser(){ printf("login\n"); char* login = loginMessage.login; char* password = loginMessage.password; int i; loginMessage.mtype = loginMessage.type; patientCount = getPatientCount(); loadPatient(); for(i=0;i<patientCount;i++){ int sameLogin = strcmp(patient[i].login, login); int samePassword = strcmp(patient[i].password, password); printf("%d %d\n",sameLogin, samePassword); if(sameLogin == 0 ){ if(samePassword == 0){ loginMessage.ok = 1; break; } else{ patient[i].loginAttempt++; } } else{ loginMessage.ok = 0; } } savePatient(); msgsnd(msgid,&loginMessage,sizeof(loginMessage),0); }
void cancelVisit(){ printf("start cancelVisit\n"); char buffer[100]; int i,k; int day = informationMessage.day; int month = informationMessage.month -1; int year = informationMessage.year -1900; int term = informationMessage.term; int patientCount = getPatientCount(); strcpy(informationMessage.information, "Cos poszlo nie tak\n"); for(i=0;i<patientCount;i++){ if(strcmp(patient[i].login, informationMessage.login)==0){ strcpy(patient[i].doctorLastName, "\n"); strcpy(patient[i].doctorName, "\n"); patient[i].visitDate.tm_year = 0; strcpy(informationMessage.information, "Odwolano\n"); break; } } savePatient(); loadVisits(); //printf("mtype %d\n",informationMessage.mtype); informationMessage.mtype = informationMessage.type; msgsnd(msgid,&informationMessage,sizeof(informationMessage),0); printf("koniec cancelVisit\n"); }
void addVisit(){ printf("start addVisit\n"); loadVisits(); // aktualizacja wizyt char buffer[100]; int i,k; int day = informationMessage.day; int month = informationMessage.month -1; int year = informationMessage.year -1900; int term = informationMessage.term; if(term < 9 || term > 11){ strcpy(informationMessage.information, "Podales zla godzine\n"); informationMessage.mtype = informationMessage.type; msgsnd(msgid,&informationMessage,sizeof(informationMessage),0); return; } //sprawdzanie terminu if(checkFreeTerm(informationMessage.doctorLastName,day,month,year,term) == 1 ){ //dopisywanei wizyty pacjentowi for(i=0;i<doctorCount;i++){ if(strcmp(doctor[i].lastName, informationMessage.doctorLastName) == 0){ // znajdz lekarza o wybranym nazwisku for(k=0;k<patientCount;k++){ if(strcmp(patient[k].login,informationMessage.login)==0){ // znajdz pacjenta o danym loginie strcpy(patient[k].doctorName,doctor[i].name); strcpy(patient[k].doctorLastName,doctor[i].lastName); // TODO terminy patient[k].visitDate.tm_mday = day; patient[k].visitDate.tm_mon = month; patient[k].visitDate.tm_year = year; patient[k].visitDate.tm_hour = term; } } } } strcpy(informationMessage.information, "Zarejestrowano wizyte\n"); printPatients(); // zapisanie wizyty w pliku savePatient(); // zapisanie wizyty w pliku loadVisits(); // aktualizacja wizyt } else if(checkVacation(day,month,year, informationMessage.doctorLastName) == 1){ strcpy(informationMessage.information, "Lekarz ma urlop tego dnia!\n\n"); } else{ // nie ma wolnego strcpy(informationMessage.information, "Podany termin jest zajety!\n\n"); } informationMessage.mtype = informationMessage.type; msgsnd(msgid,&informationMessage,sizeof(informationMessage),0); printf("koniec addVisit\n"); }
void DicomPatientWriterService::updating() throw(::fwTools::Failed) { SLM_TRACE_FUNC(); if( this->hasLocationDefined() ) { // Retrieve dataStruct associated with this service ::fwData::Patient::sptr associatedPatient = this->getObject< ::fwData::Patient >(); SLM_ASSERT("associatedPatient not instanced", associatedPatient); ::fwGui::Cursor cursor; cursor.setCursor(::fwGui::ICursor::BUSY); savePatient( this->getFolder(), associatedPatient ); cursor.setDefaultCursor(); } }