Hello everyone,
Need help in the following scenario
Everyday we get blood donations, i need to check the test_results for that donations and needs to update status.
JAN 09 statusA (Here, we dont have result) A (Here, we dont have result)
A1 ( got result change A - A1)
on JAN 21 GOT result ofjan 15 donation, change status A toA1.
my question is how can we write a code, to check the previous donation's and after donation's of that particular donor and check the results of that donations and update the statuses
Note: If the 2<sup>nd</sup> unit get the test_result first, then 2<sup>nd</sup> unit should be set to A1, until 1<sup>st</sup> unit get test_results, and once the 1<sup>st</sup> unit get the test_results , then 2<sup>nd</sup> unit status should change to A2 and 1<sup>st</sup> unit status should be A1.
donation_number,donor_number,donation_date,status column's,days_since_last_donation are indonation table.
donation_number,donor_number,donation_date,test_result_date,test_code column's are inTest_Results table.
- IF days_since_last_donation =0 in donation_table for this donation. Set this status to A1.
- IF days_since_last_donation between 1 - 180 in donation_table for this donation. CHECK for the previous donation of that particular donor, if PPTA_status = A. Set this status to A1.
- if we get test results of the 1st donation later to 2nd donation, then 1st donation should set status to A1 and 2nd donation statuschange A1 to A2.
days_since_last_donation 0 means first time donation. (donor donating 1st time).
days_since_last_donation between 1 and 180 means second time donation. (donor donating 2nd time).