                                 hepb_dose2_date::TIMESTAMPTZ,
                                 hepb_comvax1_date::TIMESTAMPTZ,
                                 hepb_comvax2_date::TIMESTAMPTZ,
+                                dose1_recvd, dose2_recvd, dose3_recvd,
+                                dose4_recvd, dose5_recvd, dose6_recvd,
+                                dose7_recvd, dose8_recvd,
                                 CASE
                                     WHEN dce.birth_date IS NOT NULL THEN
                                         CASE

                                WHEN fdd_act_code = 3 THEN 'Needs Hepatitis B Dose 1'
                                WHEN fdd_act_code = 4 THEN 'Needs Hepatitis B Dose 2'
                                WHEN fdd_act_code = 5 THEN 'Needs Hepatitis B Dose 3'
                                WHEN fdd_act_code = 6 THEN 'Needs Serology 3 months after Hepatitis B Dose 3 / Hepatitis B – Comvax Dose 4'
                                WHEN fdd_act_code = 7 THEN 'Check vaccination history; Test or Vaccinate'
                                WHEN fdd_act_code = 8 THEN 'Enter Infant''s Date of Birth'
                                WHEN fdd_act_code = 9 THEN 'Close Contact'
                            END AS action
                        FROM (
                            SELECT

                                WHEN fdd_act_code = 1 THEN birth_date
                                WHEN fdd_act_code = 2 THEN birth_date
                                WHEN fdd_act_code = 3 THEN birth_date
                                WHEN fdd_act_code = 4 THEN dose1_recvd + INTERVAL '6 months'
                                WHEN fdd_act_code = 5 THEN dose2_recvd + INTERVAL '6 months'
                                WHEN fdd_act_code = 6 THEN birth_date + INTERVAL '9 months'
                                WHEN fdd_act_code = 7 THEN NULL
                                WHEN fdd_act_code = 8 THEN NULL
                                WHEN fdd_act_code = 9 THEN NULL
                                WHEN fdd_act_code = 10 THEN dose4_recvd + INTERVAL '1 month'
                                WHEN fdd_act_code = 11 THEN dose4_recvd + INTERVAL '6 months'
                                WHEN fdd_act_code = 12 THEN COALESCE(dose8_recvd, COALESCE(dose7_recvd, dose6_recvd)) + INTERVAL '1 month'
                                WHEN fdd_act_code = 13 THEN NULL
                                WHEN fdd_act_code = 14 THEN NULL
                            END AS first_due_date,
                            CASE
                                WHEN fdd_act_code = 1 THEN 'Needs HBIG and Hepatitis B Dose 1'
