Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function postReqMedReview()
- {
- global $current_user;
- // Define variables for every $_POST variable to avoid undefined indexes
- if (!empty($_POST['DateOfBirth'])) {
- $DateOfBirth = $_POST['DateOfBirth'];
- $jsonData['BirthYear'] = $DateOfBirth;
- }
- if (!empty($_POST['FirstDayOfLastMenses'])) {
- $FirstDayOfLastMenses = $_POST['FirstDayOfLastMenses'];
- $jsonData['FirstDayOfLastMenses'] = $FirstDayOfLastMenses;
- }
- if (!empty($_POST['DateGaveBirth'])) {
- $DateGaveBirth = $_POST['DateGaveBirth'];
- $jsonData['DateGaveBirth'] = $DateGaveBirth;
- }
- if ( isset($_POST['IfCigarettesExceed15Daily']) ) {
- $jsonData['IfCigarettesExceed15Daily'] = $_POST['IfCigarettesExceed15Daily'];
- }
- if (isset($_POST['IfUsed_Which'])) {
- switch ($_POST['IfUsed_Which']) {
- case "Pills":
- $IfUsed_Pills = true;
- $IfUsed_Patch = false;
- $IfUsed_Ring = false;
- $IfUsed_Injection = false;
- $IfUsed_IUD = false;
- $IfUsed_Implant = false;
- break;
- case "Patch":
- $IfUsed_Pills = false;
- $IfUsed_Patch = true;
- $IfUsed_Ring = false;
- $IfUsed_Injection = false;
- $IfUsed_IUD = false;
- $IfUsed_Implant = false;
- break;
- case "Ring":
- $IfUsed_Pills = false;
- $IfUsed_Patch = false;
- $IfUsed_Ring = true;
- $IfUsed_Injection = false;
- $IfUsed_IUD = false;
- $IfUsed_Implant = false;
- break;
- case "Injection":
- $IfUsed_Pills = false;
- $IfUsed_Patch = false;
- $IfUsed_Ring = false;
- $IfUsed_Injection = true;
- $IfUsed_IUD = false;
- $IfUsed_Implant = false;
- break;
- case "IUD":
- $IfUsed_Pills = false;
- $IfUsed_Patch = false;
- $IfUsed_Ring = false;
- $IfUsed_Injection = false;
- $IfUsed_IUD = true;
- $IfUsed_Implant = false;
- break;
- case "Implant":
- $IfUsed_Pills = false;
- $IfUsed_Patch = false;
- $IfUsed_Ring = false;
- $IfUsed_Injection = false;
- $IfUsed_IUD = false;
- $IfUsed_Implant = true;
- break;
- case "Other":
- $IfUsed_Pills = false;
- $IfUsed_Patch = false;
- $IfUsed_Ring = false;
- $IfUsed_Injection = false;
- $IfUsed_IUD = false;
- $IfUsed_Implant = false;
- if (isset($_POST['IfUsed_OtherText'])) {
- $IfUsed_OtherText = $_POST['IfUsed_OtherText'];
- $jsonData['IfUsed_OtherText'] = $IfUsed_OtherText;
- }
- }
- $jsonData['IfUsed_Pills'] = $IfUsed_Pills;
- $jsonData['IfUsed_Patch'] = $IfUsed_Patch;
- $jsonData['IfUsed_Ring'] = $IfUsed_Ring;
- $jsonData['IfUsed_Injection'] = $IfUsed_Injection;
- $jsonData['IfUsed_IUD'] = $IfUsed_IUD;
- $jsonData['IfUsed_Implant'] = $IfUsed_Implant;
- }
- if (isset($_POST['IfCurrent_Which'])) {
- switch ($_POST['IfCurrent_Which']) {
- case "Pills":
- $IfCurrent_Pills = true;
- $IfCurrent_Patch = false;
- $IfCurrent_Ring = false;
- $IfCurrent_Injection = false;
- $IfCurrent_IUD = false;
- $IfCurrent_Implant = false;
- break;
- case "Patch":
- $IfCurrent_Pills = false;
- $IfCurrent_Patch = true;
- $IfCurrent_Ring = false;
- $IfCurrent_Injection = false;
- $IfCurrent_IUD = false;
- $IfCurrent_Implant = false;
- break;
- case "Ring":
- $IfCurrent_Pills = false;
- $IfCurrent_Patch = false;
- $IfCurrent_Ring = true;
- $IfCurrent_Injection = false;
- $IfCurrent_IUD = false;
- $IfCurrent_Implant = false;
- break;
- case "Injection":
- $IfCurrent_Pills = false;
- $IfCurrent_Patch = false;
- $IfCurrent_Ring = false;
- $IfCurrent_Injection = true;
- $IfCurrent_IUD = false;
- $IfCurrent_Implant = false;
- break;
- case "IUD":
- $IfCurrent_Pills = false;
- $IfCurrent_Patch = false;
- $IfCurrent_Ring = false;
- $IfCurrent_Injection = false;
- $IfCurrent_IUD = true;
- $IfCurrent_Implant = false;
- break;
- case "Implant":
- $IfCurrent_Pills = false;
- $IfCurrent_Patch = false;
- $IfCurrent_Ring = false;
- $IfCurrent_Injection = false;
- $IfCurrent_IUD = false;
- $IfCurrent_Implant = true;
- break;
- case "Other":
- $IfCurrent_Pills = false;
- $IfCurrent_Patch = false;
- $IfCurrent_Ring = false;
- $IfCurrent_Injection = false;
- $IfCurrent_IUD = false;
- $IfCurrent_Implant = false;
- if (isset($_POST['IfCurrent_OtherText'])) {
- $IfCurrent_OtherText = $_POST['IfCurrent_OtherText'];
- $jsonData['IfCurrent_OtherText'] = $IfCurrent_OtherText;
- }
- }
- $jsonData['IfCurrent_Pills'] = $IfCurrent_Pills;
- $jsonData['IfCurrent_Patch'] = $IfCurrent_Patch;
- $jsonData['IfCurrent_Ring'] = $IfCurrent_Ring;
- $jsonData['IfCurrent_Injection'] = $IfCurrent_Injection;
- $jsonData['IfCurrent_IUD'] = $IfCurrent_IUD;
- $jsonData['IfCurrent_Implant'] = $IfCurrent_Implant;
- }
- if (isset($_POST['IfDiabetesWhich'])) {
- switch ($_POST['IfDiabetesWhich']) {
- case "nephropathy":
- $IfDiabetes_Nephropathy = true;
- $IfDiabetes_Retinopathy = false;
- $IfDiabetes_Neuropathy = false;
- $IfDiabetes_Over20Years = false;
- $IfDiabetes_OtherVascularDisease = false;
- break;
- case "retinopathy":
- $IfDiabetes_Nephropathy = false;
- $IfDiabetes_Retinopathy = true;
- $IfDiabetes_Neuropathy = false;
- $IfDiabetes_Over20Years = false;
- $IfDiabetes_OtherVascularDisease = false;
- break;
- case "neuropathy":
- $IfDiabetes_Nephropathy = false;
- $IfDiabetes_Retinopathy = false;
- $IfDiabetes_Neuropathy = true;
- $IfDiabetes_Over20Years = false;
- $IfDiabetes_OtherVascularDisease = false;
- break;
- case "longerthan20years":
- $IfDiabetes_Nephropathy = false;
- $IfDiabetes_Retinopathy = false;
- $IfDiabetes_Neuropathy = false;
- $IfDiabetes_Over20Years = true;
- $IfDiabetes_OtherVascularDisease = false;
- break;
- case "vasculardisease":
- $IfDiabetes_Nephropathy = false;
- $IfDiabetes_Retinopathy = false;
- $IfDiabetes_Neuropathy = false;
- $IfDiabetes_Over20Years = false;
- $IfDiabetes_OtherVascularDisease = true;
- break;
- case "none":
- $IfDiabetes_Nephropathy = false;
- $IfDiabetes_Retinopathy = false;
- $IfDiabetes_Neuropathy = false;
- $IfDiabetes_Over20Years = false;
- $IfDiabetes_OtherVascularDisease = false;
- break;
- }
- $jsonData['IfDiabetes_Nephropathy'] = $IfDiabetes_Nephropathy;
- $jsonData['IfDiabetes_Retinopathy'] = $IfDiabetes_Retinopathy;
- $jsonData['IfDiabetes_Neuropathy'] = $IfDiabetes_Neuropathy;
- $jsonData['IfDiabetes_Over20Years'] = $IfDiabetes_Over20Years;
- $jsonData['IfDiabetes_OtherVascularDisease'] = $IfDiabetes_OtherVascularDisease;
- }
- if (isset($_POST['IfAnyMed'])) {
- switch ($_POST['IfAnyMed']) {
- case "Fosamprenavir":
- $IfAnyMed_Fosamprenavir = true;
- $IfAnyMed_Lamotrigine = false;
- $IfAnyMed_RifampinOrRifabutin = false;
- $IfAnyMed_CertainAnticonvulsants = false;
- break;
- case "Lamotrigine":
- $IfAnyMed_Fosamprenavir = false;
- $IfAnyMed_Lamotrigine = true;
- $IfAnyMed_RifampinOrRifabutin = false;
- $IfAnyMed_CertainAnticonvulsants = false;
- break;
- case "RifampinRifabutin":
- $IfAnyMed_Fosamprenavir = false;
- $IfAnyMed_Lamotrigine = false;
- $IfAnyMed_RifampinOrRifabutin = true;
- $IfAnyMed_CertainAnticonvulsants = false;
- break;
- case "CertainAnticonvulsants":
- $IfAnyMed_Fosamprenavir = false;
- $IfAnyMed_Lamotrigine = false;
- $IfAnyMed_RifampinOrRifabutin = false;
- $IfAnyMed_CertainAnticonvulsants = true;
- break;
- }
- $jsonData['IfAnyMed_Fosamprenavir'] = $IfAnyMed_Fosamprenavir;
- $jsonData['IfAnyMed_Lamotrigine'] = $IfAnyMed_Lamotrigine;
- $jsonData['IfAnyMed_RifampinOrRifabutin'] = $IfAnyMed_RifampinOrRifabutin;
- $jsonData['IfAnyMed_CertainAnticonvulsants'] = $IfAnyMed_CertainAnticonvulsants;
- }
- if (!empty($_POST['Height_Ft'])) {
- $Height_Ft = $_POST['Height_Ft'];
- $jsonData['Height_Ft'] = $Height_Ft;
- }
- if (!empty($_POST['Height_In'])) {
- $Height_In = $_POST['Height_In'];
- $jsonData['Height_In'] = $Height_In;
- }
- if (!empty($_POST['Weight_Lb'])) {
- $Weight_Lb = $_POST['Weight_Lb'];
- $jsonData['Weight_Lb'] = $Weight_Lb;
- }
- if (isset($_POST['IfAllergiesToMedicines'])) {
- $IfAllergiesToMedicines = $_POST['IfAllergiesToMedicines'];
- $jsonData['IfAllergiesToMedicines'] = $IfAllergiesToMedicines;
- }
- if (!empty($_POST['AllergicToMedicinesList'])) {
- $AllergicToMedicinesList = $_POST['AllergicToMedicinesList'];
- $jsonData['AllergicToMedicinesList'] = $AllergicToMedicinesList;
- }
- if (!empty($_POST['AgeFirstMenses'])) {
- $AgeFirstMenses = $_POST['AgeFirstMenses'];
- $jsonData['AgeFirstMenses'] = $AgeFirstMenses;
- }
- if (isset($_POST['IfRegularMenses'])) {
- $IfRegularMenses = $_POST['IfRegularMenses'];
- $jsonData['IfRegularMenses'] = $IfRegularMenses;
- }
- if (isset($_POST['FK_MensesDuration'])) {
- $FK_MensesDuration = $_POST['FK_MensesDuration'];
- $jsonData['FK_MensesDuration'] = $FK_MensesDuration;
- }
- if (isset($_POST['IfCigarettes'])) {
- $IfCigarettes = $_POST['IfCigarettes'];
- $jsonData['IfCigarettes'] = $IfCigarettes;
- }
- if (isset($_POST['IfHighBloodPressure'])) {
- $IfHighBloodPressure = $_POST['IfHighBloodPressure'];
- $jsonData['IfHighBloodPressure'] = $IfHighBloodPressure;
- }
- if (!empty($_POST['SystolicBloodPressure'])) {
- $SystolicBloodPressure = $_POST['SystolicBloodPressure'];
- $jsonData['SystolicBloodPressure'] = $SystolicBloodPressure;
- }
- if (!empty($_POST['DiastolicBloodPressure'])) {
- $DiastolicBloodPressure = $_POST['DiastolicBloodPressure'];
- $jsonData['DiastolicBloodPressure'] = $DiastolicBloodPressure;
- }
- if (isset($_POST['IfPastWeek_ExtremeThirst'])) {
- $IfPastWeek_ExtremeThirst = $_POST['IfPastWeek_ExtremeThirst'];
- $jsonData['IfPastWeek_ExtremeThirst'] = $IfPastWeek_ExtremeThirst;
- }
- if (isset($_POST['IfPastWeek_ExcessiveUrination'])) {
- $IfPastWeek_ExcessiveUrination = $_POST['IfPastWeek_ExcessiveUrination'];
- $jsonData['IfPastWeek_ExcessiveUrination'] = $IfPastWeek_ExcessiveUrination;
- }
- if (isset($_POST['IfPastWeek_AlarmingChestPain'])) {
- $IfPastWeek_AlarmingChestPain = $_POST['IfPastWeek_AlarmingChestPain'];
- $jsonData['IfPastWeek_AlarmingChestPain'] = $IfPastWeek_AlarmingChestPain;
- }
- if (isset($_POST['IfPastWeek_YellowingOfSkinOrEyes'])) {
- $IfPastWeek_YellowingOfSkinOrEyes = $_POST['IfPastWeek_YellowingOfSkinOrEyes'];
- $jsonData['IfPastWeek_YellowingOfSkinOrEyes'] = $IfPastWeek_YellowingOfSkinOrEyes;
- }
- if (isset($_POST['IfPastWeek_RapidVisualChanges'])) {
- $IfPastWeek_RapidVisualChanges = $_POST['IfPastWeek_RapidVisualChanges'];
- $jsonData['IfPastWeek_RapidVisualChanges'] = $IfPastWeek_RapidVisualChanges;
- }
- if (isset($_POST['IfPastWeek_ShortnessOfBreath'])) {
- $IfPastWeek_ShortnessOfBreath = $_POST['IfPastWeek_ShortnessOfBreath'];
- $jsonData['IfPastWeek_ShortnessOfBreath'] = $IfPastWeek_ShortnessOfBreath;
- }
- if (isset($_POST['IfPastWeek_UnexpectedSwellingOfLeg'])) {
- $IfPastWeek_UnexpectedSwellingOfLeg = $_POST['IfPastWeek_ExcessiveUrination'];
- $jsonData['IfPastWeek_ExcessiveUrination'] = $IfPastWeek_ExcessiveUrination;
- }
- if (isset($_POST['IfPastWeek_LostConsciousness'])) {
- $IfPastWeek_LostConsciousness = $_POST['IfPastWeek_LostConsciousness'];
- $jsonData['IfPastWeek_LostConsciousness'] = $IfPastWeek_LostConsciousness;
- }
- if (isset($_POST['IfPastWeek_ConsistentVomitingOrDiarrhea'])) {
- $IfPastWeek_ConsistentVomitingOrDiarrhea = $_POST['IfPastWeek_ConsistentVomitingOrDiarrhea'];
- $jsonData['IfPastWeek_ConsistentVomitingOrDiarrhea'] = $IfPastWeek_ConsistentVomitingOrDiarrhea;
- }
- if (isset($_POST['IfPastWeek_SevereAbdominalSwelling'])) {
- $IfPastWeek_SevereAbdominalSwelling = $_POST['IfPastWeek_SevereAbdominalSwelling'];
- $jsonData['IfPastWeek_SevereAbdominalSwelling'] = $IfPastWeek_SevereAbdominalSwelling;
- }
- if (isset($_POST['IfPastWeek_ThoughtsOfSuicide'])) {
- $IfPastWeek_ThoughtsOfSuicide = $_POST['IfPastWeek_ThoughtsOfSuicide'];
- $jsonData['IfPastWeek_ThoughtsOfSuicide'] = $IfPastWeek_ThoughtsOfSuicide;
- }
- if (isset($_POST['IfPastWeekIfPastWeek_OtherText_ExtremeThirst'])) {
- $IfPastWeekIfPastWeek_OtherText_ExtremeThirst = $_POST['IfPastWeekIfPastWeek_OtherText_ExtremeThirst'];
- $jsonData['IfPastWeekIfPastWeek_OtherText_ExtremeThirst'] = $IfPastWeekIfPastWeek_OtherText_ExtremeThirst;
- }
- if (isset($_POST['PossiblyPregnant'])) {
- $PossiblyPregnant = $_POST['PossiblyPregnant'];
- $jsonData['PossiblyPregnant'] = $PossiblyPregnant;
- }
- if (isset($_POST['IfGaveBirthPast42Days'])) {
- $IfGaveBirthPast42Days = $_POST['IfGaveBirthPast42Days'];
- $jsonData['IfGaveBirthPast42Days'] = $IfGaveBirthPast42Days;
- }
- if (isset($_POST['IfBreastfeeding'])) {
- $IfBreastfeeding = $_POST['IfBreastfeeding'];
- $jsonData['IfBreastfeeding'] = $IfBreastfeeding;
- }
- if (isset($_POST['IfMigraines'])) {
- $IfMigraines = $_POST['IfMigraines'];
- $jsonData['IfMigraines'] = $IfMigraines;
- }
- if (isset($_POST['IfMigraines_Aura'])) {
- $IfMigraines_Aura = $_POST['IfMigraines_Aura'];
- $jsonData['IfMigraines_Aura'] = $IfMigraines_Aura;
- }
- if (isset($_POST['IfDiabetes'])) {
- $IfDiabetes = $_POST['IfDiabetes'];
- $jsonData['IfDiabetes'] = $IfDiabetes;
- }
- if (isset($_POST['IfTraumaSurgeryOrImmobilePastThreeMonths'])) {
- $IfTraumaSurgeryOrImmobilePastThreeMonths = $_POST['IfTraumaSurgeryOrImmobilePastThreeMonths'];
- $jsonData['IfTraumaSurgeryOrImmobilePastThreeMonths'] = $IfTraumaSurgeryOrImmobilePastThreeMonths;
- }
- if (isset($_POST['IfPeripartumCardiomyopathy'])) {
- $IfPeripartumCardiomyopathy = $_POST['IfPeripartumCardiomyopathy'];
- $jsonData['IfPeripartumCardiomyopathy'] = $IfPeripartumCardiomyopathy;
- }
- if (isset($_POST['IfIschemicHeartDisease'])) {
- $IfIschemicHeartDisease = $_POST['IfIschemicHeartDisease'];
- $jsonData['IfIschemicHeartDisease'] = $_POST['IfIschemicHeartDisease'];
- }
- if (isset($_POST['IfHighCholesterol'])) {
- $IfHighCholesterol = $_POST['IfHighCholesterol'];
- $jsonData['IfHighCholesterol'] = $IfHighCholesterol;
- }
- if (isset($_POST['IfHighDensityLipoprotein'])) {
- $IfHighDensityLipoprotein = $_POST['IfHighDensityLipoprotein'];
- $jsonData['IfHighDensityLipoprotein'] = $IfHighDensityLipoprotein;
- }
- if (isset($_POST['IfValvularHeartDisease'])) {
- $IfValvularHeartDisease = $_POST['IfValvularHeartDisease'];
- $jsonData['IfValvularHeartDisease'] = $IfValvularHeartDisease;
- }
- if (isset($_POST['IfPulmonaryHypertension'])) {
- $IfPulmonaryHypertension = $_POST['IfPulmonaryHypertension'];
- $jsonData['IfPulmonaryHypertension'] = $IfPulmonaryHypertension;
- }
- if (isset($_POST['IfAtrialFibrillation'])) {
- $IfAtrialFibrillation = $_POST['IfAtrialFibrillation'];
- $jsonData['IfAtrialFibrillation'] = $IfAtrialFibrillation;
- }
- if (isset($_POST['IfSubacuteBacterialEndocarditis'])) {
- $IfSubacuteBacterialEndocarditis = $_POST['IfSubacuteBacterialEndocarditis'];
- $jsonData['IfSubacuteBacterialEndocarditis'] = $IfSubacuteBacterialEndocarditis;
- }
- if (isset($_POST['IfActiveCancerExcludingNonMelanomaSkinCancer'])) {
- $IfActiveCancerExcludingNonMelanomaSkinCancer = $_POST['IfActiveCancerExcludingNonMelanomaSkinCancer'];
- $jsonData['IfActiveCancerExcludingNonMelanomaSkinCancer'] = $IfActiveCancerExcludingNonMelanomaSkinCancer;
- }
- if (isset($_POST['IfStroke'])) {
- $IfStroke = $_POST['IfStroke'];
- $jsonData['IfStroke'] = $IfStroke;
- }
- if (isset($_POST['IfBloodClottingDisease'])) {
- $IfBloodClottingDisease = $_POST['IfBloodClottingDisease'];
- $jsonData['IfBloodClottingDisease'] = $IfBloodClottingDisease;
- }
- if (isset($_POST['IfSuperficialVenousThrombosis'])) {
- $IfSuperficialVenousThrombosis = $_POST['IfSuperficialVenousThrombosis'];
- $jsonData['IfSuperficialVenousThrombosis'] = $IfSuperficialVenousThrombosis;
- }
- if (isset($_POST['IfDeepVenousThrombosis'])) {
- $IfDeepVenousThrombosis = $_POST['IfDeepVenousThrombosis'];
- $jsonData['IfDeepVenousThrombosis'] = $IfDeepVenousThrombosis;
- }
- if (isset($_POST['IfReceivedSolidOrganTransplant'])) {
- $IfReceivedSolidOrganTransplant = $_POST['IfReceivedSolidOrganTransplant'];
- $jsonData['IfReceivedSolidOrganTransplant'] = $IfReceivedSolidOrganTransplant;
- }
- if (isset($_POST['IfBariatricOrStomachReductionSurgery'])) {
- $IfBariatricOrStomachReductionSurgery = $_POST['IfBariatricOrStomachReductionSurgery'];
- $jsonData['IfBariatricOrStomachReductionSurgery'] = $IfBariatricOrStomachReductionSurgery;
- }
- if (isset($_POST['IfLiverDiseaseOrTumor_BenignAdenoma'])) {
- $IfLiverDiseaseOrTumor_BenignAdenoma = $_POST['IfLiverDiseaseOrTumor_BenignAdenoma'];
- $jsonData['IfLiverDiseaseOrTumor_BenignAdenoma'] = $IfLiverDiseaseOrTumor_BenignAdenoma;
- }
- if (isset($_POST['IfLiverDiseaseOrTumor_Malignant'])) {
- $IfLiverDiseaseOrTumor_Malignant = $_POST['IfLiverDiseaseOrTumor_Malignant'];
- $jsonData['IfLiverDiseaseOrTumor_Malignant'] = $IfLiverDiseaseOrTumor_Malignant;
- }
- if (isset($_POST['IfLiverDiseaseOrTumor_CirrhosisSevere'])) {
- $IfLiverDiseaseOrTumor_CirrhosisSevere = $_POST['IfLiverDiseaseOrTumor_CirrhosisSevere'];
- $jsonData['IfLiverDiseaseOrTumor_CirrhosisSevere'] = $IfLiverDiseaseOrTumor_CirrhosisSevere;
- }
- if (isset($_POST['IfViralHepatitis_CarrierOrChronic'])) {
- $IfViralHepatitis_CarrierOrChronic = $_POST['IfViralHepatitis_CarrierOrChronic'];
- $jsonData['IfViralHepatitis_CarrierOrChronic'] = $IfViralHepatitis_CarrierOrChronic;
- }
- if (isset($_POST['IfViralHepatitis_AcuteOrFlare'])) {
- $IfViralHepatitis_AcuteOrFlare = $_POST['IfViralHepatitis_AcuteOrFlare'];
- $jsonData['IfViralHepatitis_AcuteOrFlare'] = $IfViralHepatitis_AcuteOrFlare;
- }
- if (isset($_POST['IfCholestasis_PregnancyRelated'])) {
- $IfCholestasis_PregnancyRelated = $_POST['IfCholestasis_PregnancyRelated'];
- $jsonData['IfCholestasis_PregnancyRelated'] = $IfCholestasis_PregnancyRelated;
- }
- if (isset($_POST['IfCholestasis_PregnancyRelated'])) {
- $IfCholestasis_PregnancyRelated = $_POST['IfCholestasis_PregnancyRelated'];
- $jsonData['IfCholestasis_PregnancyRelated'] = $IfCholestasis_PregnancyRelated;
- }
- if (isset($_POST['IfCholestasis_OralContraceptiveRelated'])) {
- $IfCholestasis_OralContraceptiveRelated = $_POST['IfCholestasis_OralContraceptiveRelated'];
- $jsonData['IfCholestasis_OralContraceptiveRelated'] = $IfCholestasis_OralContraceptiveRelated;
- }
- if (isset($_POST['IfInflammatoryBowelDisease'])) {
- $IfInflammatoryBowelDisease = $_POST['IfInflammatoryBowelDisease'];
- $jsonData['IfInflammatoryBowelDisease'] = $IfInflammatoryBowelDisease;
- }
- if (isset($_POST['IfLupus'])) {
- $IfLupus = $_POST['IfLupus'];
- $jsonData['IfLupus'] = $IfLupus;
- }
- if (isset($_POST['IfMultipleScerosis'])) {
- $IfMultipleScerosis = $_POST['IfMultipleScerosis'];
- $jsonData['IfMultipleScerosis'] = $IfMultipleScerosis;
- }
- if (isset($_POST['IfBreastCancer_PastFiveYears'])) {
- $IfBreastCancer_PastFiveYears = $_POST['IfBreastCancer_PastFiveYears'];
- $jsonData['IfBreastCancer_PastFiveYears'] = $IfBreastCancer_PastFiveYears;
- }
- if (isset($_POST['IfHysterectomyOrTubalLigation'])) {
- $IfHysterectomyOrTubalLigation = $_POST['IfHysterectomyOrTubalLigation'];
- $jsonData['IfHysterectomyOrTubalLigation'] = $IfHysterectomyOrTubalLigation;
- }
- if (isset($_POST['IfHIV'])) {
- $IfHIV = $_POST['IfHIV'];
- $jsonData['IfHIV'] = $IfHIV;
- }
- if (isset($_POST['GallbladderDisease'])) {
- if ($_POST['GallbladderDisease'] == 'false') {
- $FK_GallbladderDisease = null;
- } else {
- $FK_GallbladderDisease = true;
- }
- $jsonData['FK_GallbladderDisease'] = $FK_GallbladderDisease;
- }
- if (isset($_POST['FK_GallbladderDisease'])) {
- $FK_GallbladderDisease = $_POST['FK_GallbladderDisease'];
- $jsonData['FK_GallbladderDisease'] = $FK_GallbladderDisease;
- }
- if (isset($_POST['IfIncludeFemaleCondom'])) {
- $IfIncludeFemaleCondom = $_POST['IfIncludeFemaleCondom'];
- $jsonData['IfIncludeFemaleCondom'] = $IfIncludeFemaleCondom;
- }
- if (isset($_POST['IfIncludeEmergencyContraception'])) {
- $IfIncludeEmergencyContraception = $_POST['IfIncludeEmergencyContraception'];
- $jsonData['IfIncludeEmergencyContraception'] = $IfIncludeEmergencyContraception;
- }
- if (isset($_POST['IfIncludeGenericOptions'])) {
- $IfIncludeGenericOptions = $_POST['IfIncludeGenericOptions'];
- $jsonData['IfIncludeGenericOptions'] = $IfIncludeGenericOptions;
- }
- if (isset($_POST['IfIncludeRingAndPatchOptions'])) {
- $IfIncludeRingAndPatchOptions = $_POST['IfIncludeRingAndPatchOptions'];
- $jsonData['IfIncludeRingAndPatchOptions'] = $IfIncludeRingAndPatchOptions;
- }
- if (isset($_POST['FK_SelfDescribedRace'])) {
- $FK_SelfDescribedRace = $_POST['FK_SelfDescribedRace'];
- $jsonData['FK_SelfDescribedRace'] = $FK_SelfDescribedRace;
- }
- if (isset($_POST['IfDesiredBenefit_Acne'])) {
- $IfDesiredBenefit_Acne = $_POST['IfDesiredBenefit_Acne'];
- $jsonD['IfDesiredBenefit_Acne'] = $IfDesiredBenefit_Acne;
- }
- if (isset($_POST['IfDesiredBenefit_SkipPeriods'])) {
- $IfDesiredBenefit_SkipPeriods = $_POST['IfDesiredBenefit_SkipPeriods'];
- $jsonData['IfDesiredBenefit_SkipPeriods'] = $IfDesiredBenefit_SkipPeriods;
- }
- if (isset($_POST['IfDesiredBenefit_RegulateCrampsAndPeriod'])) {
- $IfDesiredBenefit_RegulateCrampsAndPeriod = $_POST['IfDesiredBenefit_RegulateCrampsAndPeriod'];
- $jsonData['IfDesiredBenefit_RegulateCrampsAndPeriod'] = $IfDesiredBenefit_RegulateCrampsAndPeriod;
- }
- if (isset($_POST['IfDesiredBenefit_RegulatePMS'])) {
- $IfDesiredBenefit_RegulatePMS = $_POST['IfDesiredBenefit_RegulatePMS'];
- $jsonData['IfDesiredBenefit_RegulatePMS'] = $IfDesiredBenefit_RegulatePMS;
- }
- if (isset($_POST['IfDesiredBenefit_MinimalSideEffects'])) {
- $IfDesiredBenefit_MinimalSideEffects = $_POST['IfDesiredBenefit_MinimalSideEffects'];
- $jsonData['IfDesiredBenefit_MinimalSideEffects'] = $IfDesiredBenefit_MinimalSideEffects;
- }
- if (isset($_POST['Name'])) {
- $Name = $_POST['Name'];
- }
- if (isset($_POST['Phone'])) {
- $Phone = $_POST['Phone'];
- }
- if (isset($_POST['Address'])) {
- $Address = $_POST['Address'];
- }
- if (isset($_POST['City'])) {
- $City = $_POST['City'];
- }
- if (isset($_POST['ZIP'])) {
- $ZIP = $_POST['ZIP'];
- }
- if (isset($_POST['Email'])) {
- $Email = $_POST['Email'];
- }
- if (isset($_POST['Company'])) {
- $Company = $_POST['Company'];
- }
- if (isset($_POST['Address2'])) {
- $Address2 = $_POST['Address2'];
- }
- if (isset($_POST['State'])) {
- $State = $_POST['State'];
- }
- if (isset($_POST['Country'])) {
- $Country = $_POST['Country'];
- }
- if ( isset( $_POST['IfSendPrescriptionInfo'] ) ) {
- $jsonData['Physician'] = array(
- 'IfSendPrescriptionInfo' => $_POST['IfSendPrescriptionInfo']
- );
- if ( $_POST['IfSendPrescriptionInfo'] == 'true' ) {
- $jsonData['Physician'] = array(
- 'IfSendPrescriptionInfo' => $_POST['IfSendPrescriptionInfo'],
- 'Name' => $Name,
- 'Address' => $Address,
- 'City' => $City,
- 'ZIP' => $ZIP,
- 'Email' => $Email,
- 'Company' => $Company,
- 'Address2' => $Address2,
- 'State' => $State,
- 'Country' => $Country,
- 'Phone' => $Phone
- );
- }
- }
- // if (!empty($_POST['Name'])) {
- // $Name = $_POST['Name'];
- // $jsonData['MedicalBackground_PrimaryCarePhysician'] = array(
- // 'Name' => $Name,
- // 'Address' => $Address,
- // 'City' => $City,
- // 'ZIP' => $ZIP,
- // 'Email' => $Email,
- // 'Company' => $Company,
- // 'Address2' => $Address2,
- // 'State' => $State,
- // 'Country' => $Country,
- // 'Phone' => $Phone,
- // );
- // }
- if (isset($_POST['FK_BirthControlUseDuration'])) {
- $jsonData['FK_BirthControlUseDuration'] = $_POST['FK_BirthControlUseDuration'];
- }
- if (isset($_POST['IfIncludeFemaleCondom'])) {
- $jsonData['IfIncludeFemaleCondom'] = $_POST['IfIncludeFemaleCondom'];
- }
- if (isset($_POST['IfIncludeEmergencyContraception'])) {
- $jsonData['IfIncludeEmergencyContraception'] = $_POST['IfIncludeEmergencyContraception'];
- }
- if (isset($_POST['IfIncludeGenericOptions'])) {
- $jsonData['IfIncludeGenericOptions'] = $_POST['IfIncludeGenericOptions'];
- }
- if (isset($_POST['IfIncludeRingAndPatchOptions'])) {
- $jsonData['IfIncludeRingAndPatchOptions'] = $_POST['IfIncludeRingAndPatchOptions'];
- }
- if (isset($_POST['FK_SelfDescribedRace'])) {
- $jsonData['FK_SelfDescribedRace'] = $_POST['FK_SelfDescribedRace'];
- }
- //API Url
- if ( is_user_logged_in() ) {
- $url = 'https://oitdataservicedev.azurewebsites.net/api/Patient/' . $_SESSION['patientGuid'] . '/MedicalBackground?returnMeds=true';
- // $url = 'http://httpbin.org/post';
- } else {
- $url = 'https://oitdataservicedev.azurewebsites.net/api/Patient?returnMeds=true';
- }
- if ( isset( $_SESSION['MedicalBackground'] -> Id ) ) {
- $url = 'https://oitdataservicedev.azurewebsites.net/api/Patient/' . $_SESSION['patientGuid'] . '/MedicalBackground/' . $_SESSION['MedicalBackground'] -> Id . '/?returnMeds=true';
- // Set MedicalBackground ID in json Body
- $jsonData['Id'] = $_SESSION['MedicalBackground'] -> Id;
- }
- // $url = 'http://httpbin.org/post';
- //Initiate cURL.
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_URL, $url);
- //Encode the array into JSON.
- if ( is_user_logged_in() ) {
- $jsonDataEncoded = json_encode($jsonData, JSON_NUMERIC_CHECK);
- $jsonData['SurveyResponseDate'] = date('Y-m-dTh:iZ');
- } else {
- $jsonNoPatient['SurveyResponseDate'] = date('Y-m-dTh:iZ');
- $jsonNoPatient['Background'] = $jsonData;
- $jsonDataEncoded = json_encode($jsonNoPatient, JSON_NUMERIC_CHECK);
- }
- //Tell cURL that we want to send a POST or PUT request.
- if ( isset( $_SESSION['MedicalBackground'] -> Id ) ) {
- curl_setopt($ch, CURLOPT_POST, false);
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
- } else {
- curl_setopt($ch, CURLOPT_POST, true);
- }
- //Attach our encoded JSON string to the POST fields.
- curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- // Check if user is logged in and set HTTP HEADERS
- if ( is_user_logged_in()) {
- $header = 'Secret:'.$_SESSION['accessToken'];
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
- 'Content-Type: application/json',
- $header
- ));
- } else {
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
- 'Content-Type: application/json'
- ));
- }
- // Execute the request
- if ( !is_user_logged_in() ) {
- $_SESSION['Patient'] = json_decode(curl_exec($ch));
- curl_close($ch);
- // wp_redirect('/results-and-recommendations');
- $_SESSION['patientGuid'] = $_SESSION['Patient'] -> id;
- $_SESSION['accessToken'] = $_SESSION['Patient'] -> accessToken;
- $_SESSION['accessTokenExpires'] = $_SESSION['Patient'] -> accessTokenExpires;
- wp_redirect('/results-and-recommendations');
- exit;
- } else {
- $_SESSION['insertMB'] = json_decode(curl_exec($ch));
- // $_SESSION['updateresponse']= curl_exec($ch);
- curl_close($ch);
- wp_redirect('/results-and-recommendations');
- exit;
- }
- // For testing the output
- // echo $jsonDataEncoded;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement