mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-22 04:29:22 +01:00
add convert method between Medicine and Prescription
This commit is contained in:
parent
decb45978f
commit
69a20e60b6
1 changed files with 23 additions and 0 deletions
|
@ -1,5 +1,11 @@
|
|||
package net.foucry.pilldroid;
|
||||
|
||||
import androidx.room.Database;
|
||||
|
||||
import net.foucry.pilldroid.models.Medicine;
|
||||
import net.foucry.pilldroid.models.Prescription;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -24,4 +30,21 @@ public class Utils {
|
|||
else
|
||||
return String.format("%s",d);
|
||||
}
|
||||
|
||||
public static Prescription medicine2prescription(Medicine aMedicine) {
|
||||
Prescription aPrescription = new Prescription();
|
||||
|
||||
aPrescription.setName(aMedicine.getName());
|
||||
aPrescription.setCis(aMedicine.getCis());
|
||||
aPrescription.setCip13(aMedicine.getCip13());
|
||||
aPrescription.setPresentation(aMedicine.getPresentation());
|
||||
aPrescription.setAdministration_mode(aMedicine.getAdministration_mode());
|
||||
aPrescription.setStock(0F);
|
||||
aPrescription.setAlert(7);
|
||||
aPrescription.setTake(0F);
|
||||
aPrescription.setWarning(14);
|
||||
aPrescription.setLast_update(UtilDate.dateAtNoon(new Date()).getTime());
|
||||
|
||||
return aPrescription;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue