{% extends 'dashboard_screen/base.html' %}

{% block content %}

            <!-- ============================================================== -->
            <!-- Start right Content here -->
            <!-- ============================================================== -->
    <div class="content-page" xmlns="http://www.w3.org/1999/html">
                <!-- Start content -->
                <div class="content">
                    <div class="container">
                        <div class="row">

                            <div class="col-lg-12">
                            	<div class="card-box">
                                    <div class="panel panel-border panel-custom">
                                        <h4 class="m-t-0 header-title"><b>Order Entry Info </b></h4>
                                        <div class="panel-body">

                                    {% if Entry %}
                                        <!-- INBOX -->
                                            <div class="col-lg-4">
                                               <div class="panel panel-border panel-custom">
                                                   <div class="panel-heading">
                                                      <h3 class="panel-title"><i class="ion-beaker text-custom"></i> LAB ID: {{ Entry.created_date |date:"Ymd" }}-{{ Entry.entry_id }}</h3>
                                                   </div>
                                                    <div class="panel-body">
                                                        {% if Entry.test_in_entry.all %}
                                                                <div class="inbox-item">
                                                                    <p class="inbox-item-author">Patient: {{ Entry.patient.full_name }}</p>
                                                                    <p class="inbox-item-date">Patient ID: {{ Entry.patient.patient_id}}</p>
                                                                    <p class="inbox-item-text">Create Date: {{ Entry.created_date |date:"m/d/Y" }}</p>
                                                                    <p class="inbox-item-text">Client: {{ Entry.patient.patient_client.get_full_name }}</p>
                                                                    <p class="inbox-item-text">Physicians Name: {{ Entry.physician_name }} </p>
                                                                    <p class="inbox-item-text">Collection Date: {{ Entry.collection_date |date:"m/d/Y" }}</p>
                                                                    <p class="inbox-item-text">Age: {% if Entry.patient.age %}{{ Entry.patient.age }}{% else %}{{ Entry.patient.how_old }}{% endif %}</p>
                                                                    <p class="inbox-item-text">DOB:{{ Entry.patient.dob |date:"m/d/Y" }} </p>
                                                                    <p class="inbox-item-text">Gender: {{ Entry.patient.show_gender_name }}</p>
                                                                   {% if Entry.initial_info == 0 %}<span class="label label-warning">Waiting for Confirmation</span> {% else %} <span class="label label-success">Confirmed</span> {% endif %}
                                                                </div>
                                                        {% endif %}
                                                    </div>
                                                </div>

                                            </div> <!-- end INBOX -->
                                                            <div class="col-lg-8">
                                                                <div class="panel-heading">
                                                                      <h3 class="panel-title"></h3>
                                                                </div>
                                                                      {%  for case in Entry.test_in_entry.all %}
                                                                            <div class="inbox-item">
                                                                                    <div class="col-lg-12">
                                                                                        <div class="alert alert-success">
                                                                                             <div class="row">
                                                                                                <div class="col-lg-8">
                                                                                                    <strong>Exam Name:</strong> {{ case.exam_name }}
                                                                                                </div>
                                                                                                <div class="col-lg-4">
                                                                                                  <strong>{{ case.exam_casetype.case_type_name }}</strong>
                                                                                                </div>
                                                                                             </div>
                                                                                        </div>
                                                                                    </div>
                                                                                    <div class="col-lg-12">
                                                                                         <div class="col-lg-7">
                                                                                             <p class="inbox-item-text"><strong>Accession Number:</strong> {% for access in Entry.accession_number.all %} {% if case.exam_id == access.exam_in.exam_id %}{{ access.accession_number }} {% endif %}{% endfor %}</p>
                                                                                             <p class="inbox-item-text"><strong>BarCode Number</strong>: {% for access in Entry.accession_number.all %} {% if case.exam_id == access.exam_in.exam_id %}{{ access.barcode }} {% endif %}{% endfor %}</p>
                                                                                             <p class="inbox-item-date"><strong>CPT Code:</strong> {{ case.cpt_name }}</p>
                                                                                         </div>

                                                                                         <div class="col-lg-5">
                                                                                            {% for access in Entry.accession_number.all %}
                                                                                                 {% if case.exam_id == access.exam_in.exam_id %}
                                                                                                      <img class="img-responsive" src="/{{ access.barcode_img }}"  alt="{{ access.barcode }}" width="250px" height="70px" >
                                                                                                     <div class="col-lg-5">
                                                                                                        {% if access.exam_in.exam_casetype.case_type_id == 1 and access.GYN_completed == 1 %}<span class="label label-success">Result Confirmed: {{ access.completed_date |date:"m/d/Y" }}</span>
                                                                                                        {% elif access.exam_in.exam_casetype.case_type_id == 2 and access.Non_gyn_completed == 1 %}<span class="label label-success">Result Confirmed: {{ access.completed_date |date:"m/d/Y" }}</span>
                                                                                                        {% elif access.exam_in.exam_casetype.case_type_id == 3 and access.MP_completed == 1 %}<span class="label label-success">Result Confirmed: {{ access.completed_date |date:"m/d/Y" }}</span>
                                                                                                        {% elif access.exam_in.exam_casetype.case_type_id == 4 and access.SP_completed == 1 %}<span class="label label-success">Result Confirmed: {{ access.completed_date |date:"m/d/Y" }}</span>
                                                                                                        {% else %}<span class="label label-warning">Waiting for Results</span>
                                                                                                        {% endif %}
                                                                                                      </div>
                                                                                                 {% endif %}
                                                                                             {% endfor %}
                                                                                         </div>
                                                                                    </div>

                                                                                    {% if case.exam_casetype.case_type_id == 1 %}
                                                                                        <div class="col-lg-12">
                                                                                            <p class="inbox-item-text"><strong>Specimen Source:</strong>
                                                                                                {% if Entry.GYN_Cervix == 1 %} <i class="glyphicon glyphicon-check"> Cervix </i> {% endif %}
                                                                                                {% if Entry.GYN_Vaginal == 1 %}<i class="glyphicon glyphicon-check"> Vaginal </i> {% endif %}
                                                                                                {% if Entry.GYN_Endocervix == 1 %}<i class="glyphicon glyphicon-check"> Endocervix </i> {% endif %}
                                                                                                {% if Entry.GYN_None == 1 %} <i class="glyphicon glyphicon-check"> None given </i> {% endif %}
                                                                                            </p>
                                                                                        </div>
                                                                                        <div class="col-lg-12">
                                                                                            <p class="inbox-item-text"><strong>Menstrual Status:</strong>
                                                                                                {% if Entry.GYN_mestrual == 'Regular' %}<i class="glyphicon glyphicon-check"> Regular</i>{% endif %}
                                                                                                {% if Entry.GYN_mestrual == 'Irregular' %}<i class="glyphicon glyphicon-check"> Irregular</i>{% endif %}
                                                                                                {% if Entry.GYN_mestrual == 'Post-menopausal' %}<i class="glyphicon glyphicon-check"> Post-menopausal</i>{% endif %}
                                                                                                {% if Entry.GYN_mestrual == 'Pregnant' %}<i class="glyphicon glyphicon-check"> Pregnant</i>{% endif %}
                                                                                                {% if Entry.GYN_mestrual == 'Post-partum' %}<i class="glyphicon glyphicon-check"> Post-partum</i>{% endif %}
                                                                                            </p>
                                                                                        </div>

                                                                                        <div class="col-lg-12">
                                                                                                 {% if Entry.GYN_last_menstrual_period %}<p class="inbox-item-text"><strong>Date of last menstrual period:</strong> {{ Entry.GYN_last_menstrual_period }} </p>  {% endif %}
                                                                                                 {% if Entry.GYN_previous_biopsy %}<p class="inbox-item-text"><strong>Date of previous biopsy:</strong> {{ Entry.GYN_previous_biopsy }} </p>  {% endif %}
                                                                                                 {% if Entry.GYN_pap_smear %}<p class="inbox-item-text"><strong>Date of previous pap smear:</strong> {{ Entry.GYN_pap_smear }}</p>  {% endif %}
                                                                                                 {% if Entry.GYN_abnormal_report %}<p class="inbox-item-text"><strong>Prior abnormal report:</strong> {{ Entry.GYN_abnormal_report }}</p>  {% endif %}
                                                                                        </div>

                                                                                        <div class="col-lg-12">
                                                                                             <p class="inbox-item-text"><strong>Present complaint or physical findings:</strong></p>
                                                                                             <p class="inbox-item-text">
                                                                                                {% if Entry.GYN_routine == 1 %}<i class="glyphicon glyphicon-check"> Routine </i>{% endif %}
                                                                                                {% if Entry.GYN_vaginitis == 1 %}<i class="glyphicon glyphicon-check"> Vaginitis </i>{% endif %}
                                                                                                {% if Entry.GYN_cervicitis == 1 %}<i class="glyphicon glyphicon-check"> Cervicitis </i>{% endif %}
                                                                                                {% if Entry.GYN_condyloma == 1 %}<i class="glyphicon glyphicon-check"> HPV </i>{% endif %}
                                                                                                {% if Entry.GYN_herpes == 1 %}<i class="glyphicon glyphicon-check"> Possible Herpes </i>{% endif %}
                                                                                                {% if Entry.GYN_clinically_suspicious == 1 %}<i class="glyphicon glyphicon-check"> Clinically suspicious </i>{% endif %}
                                                                                                {% if Entry.GYN_abnormal_bleeding == 1 %}<i class="glyphicon glyphicon-check"> Abnormal Bleeding </i>{% endif %}
                                                                                                {% if Entry.GYN_cervical_lesion == 1 %}<i class="glyphicon glyphicon-check"> Cervical Lesion </i>{% endif %}
                                                                                                {% if Entry.GYN_menopausal_syndrome == 1 %}<i class="glyphicon glyphicon-check"> Menopausal Syndrome </i>{% endif %}
                                                                                                {% if Entry.GYN_bleeds_on_contact == 1 %}<i class="glyphicon glyphicon-check"> Bleeds on Contact </i>{% endif %}
                                                                                                {% if Entry.GYN_infection == 1 %}<i class="glyphicon glyphicon-check"> Infection </i>{% endif %}
                                                                                                {% if Entry.GYN_iud == 1 %}<i class="glyphicon glyphicon-check"> IUD </i>{% endif %}
                                                                                                {% if Entry.GYN_discharge == 1 %}<i class="glyphicon glyphicon-check"> Discharge </i>{% endif %}
                                                                                                 {% if Entry.GYN_hysterectomy == 1 %}<i class="glyphicon glyphicon-check"> Hysterectomy </i>{% endif %}
                                                                                                 {% if Entry.GYN_hysterectomy == 1 %}
                                                                                                         {% if Entry.GYN_discharge_info == 'Partial' %}<i class="glyphicon glyphicon-hand-right"> Partial </i>{% endif %}
                                                                                                       {% if Entry.GYN_discharge_info == 'Total' %}<i class="glyphicon glyphicon-hand-right"> Total </i>{% endif %}
                                                                                                {% endif %}
                                                                                             </p>
                                                                                             <p class="inbox-item-text">
                                                                                                 {% if Entry.GYN_hysterectomy_description %}<strong>Others:</strong> {{ Entry.GYN_hysterectomy_description }}{% endif %}
                                                                                             </p>

                                                                                        </div>
                                                                                    {% endif %}

                                                                                    {% if case.exam_casetype.case_type_id == 2 %}
                                                                                        <div class="col-lg-12">
                                                                                            <p class="inbox-item-text"><strong>Specimen Source: </strong>
                                                                                               {% if Entry.Non_GYN_specimen_source %} {% for source in no_gyn_specimen_sources %} {% if source.id == Entry.Non_GYN_specimen_source %} {{ source.name }} {% endif %}{% endfor %}{% endif %}
                                                                                            </p>
                                                                                            {% if Entry.Non_GYN_clinical_info %}
                                                                                               <p class="inbox-item-text"><strong>Clinical information: </strong>
                                                                                                {{ Entry.Non_GYN_clinical_info }}
                                                                                               </p>
                                                                                            {% endif %}
                                                                                            {% if Entry.Non_GYN_gross_description %}
                                                                                               <p class="inbox-item-text"><strong>Gross description: </strong>
                                                                                                {{ Entry.Non_GYN_gross_description }}
                                                                                               </p>
                                                                                            {% endif %}
                                                                                        </div>

                                                                                    {% endif %}

                                                                                    {% if case.exam_casetype.case_type_id == 3 %}
                                                                                        <div class="col-lg-12">
                                                                                            <p class="inbox-item-text"><strong>Specimen Source: </strong>
                                                                                                {% if Entry.MP_speciment_source == 'Vaginal' %}<i class="glyphicon glyphicon-check"> Vaginal swab </i>{% endif %} 
                                                                                                {% if Entry.MP_speciment_source == 'Urethral' %}<i class="glyphicon glyphicon-check"> Urethral swab </i>{% endif %}
                                                                                                {% if Entry.MP_speciment_source == 'Urine' %}<i class="glyphicon glyphicon-check"> Urine </i>{% endif %} 
                                                                                                {% if Entry.MP_speciment_source == 'Liquid-based' %}<i class="glyphicon glyphicon-check"> Liquid-based </i>{% endif %}
                                                                                                {% if Entry.MP_speciment_source == 'PAP' %}<i class="glyphicon glyphicon-check"> PAP </i>{% endif %}
                                                                                            </p>
                                                                                        </div>

                                                                                    {% endif %}
                                                                                    {% if case.exam_casetype.case_type_id == 4 %}
                                                                                        <div class="col-lg-12">
                                                                                           {% if Entry.SP_clinical_info %}
                                                                                             <p class="inbox-item-text"><strong>Clinical information: </strong>
                                                                                                {{ Entry.SP_clinical_info }}
                                                                                             </p>
                                                                                           {% endif %}
                                                                                            {% if Entry.test_in_entry.all %} 
                                                                                                {%  for exam in Entry.test_in_entry.all %}
                                                                                                    {% if case.exam_casetype.case_type_name  == exam.exam_casetype.case_type_name %}
                                                                                                        {% for i in exam.get_cut_range %} 
                                                                                                            <p class="inbox-item-text"><strong> Specimen Source Part #: {{ forloop.counter }}:</strong>
                                                                                                              {% if forloop.counter == 1 %}{{ Entry.SP_specimen_source_1 }}{% elif forloop.counter == 2 %}{{ Entry.SP_specimen_source_2 }}{% elif forloop.counter == 3 %}{{ Entry.SP_specimen_source_3 }}{% elif forloop.counter == 4 %}{{ Entry.SP_specimen_source_4 }}{% elif forloop.counter == 5 %}{{ Entry.SP_specimen_source_5 }}{% elif forloop.counter == 6 %}{{ Entry.SP_specimen_source_6 }}{% elif forloop.counter == 7 %}{{ Entry.SP_specimen_source_7 }}{% elif forloop.counter == 8 %}{{ Entry.SP_specimen_source_8 }}{% elif forloop.counter == 9 %}{{ Entry.SP_specimen_source_9 }}{% elif forloop.counter == 10 %}{{ Entry.SP_specimen_source_10 }}{% elif forloop.counter == 11 %}{{ Entry.SP_specimen_source_11 }}{% elif forloop.counter == 12 %}{{ Entry.SP_specimen_source_12 }}{% endif %}
                                                                                                            </p>
                                                                                                            <p class="inbox-item-text"><strong> Gross description Part #: {{ forloop.counter }}:</strong>
                                                                                                             {% if forloop.counter == 1 %}{{ Entry.SP_gross_description_1 }}{% elif forloop.counter == 2 %}{{ Entry.SP_gross_description_2 }}{% elif forloop.counter == 3 %}{{ Entry.SP_gross_description_3 }}{% elif forloop.counter == 4 %}{{ Entry.SP_gross_description_4 }}{% elif forloop.counter == 5 %}{{ Entry.SP_gross_description_5 }}{% elif forloop.counter == 6 %}{{ Entry.SP_gross_description_6 }}{% elif forloop.counter == 7 %}{{ Entry.SP_gross_description_7 }}{% elif forloop.counter == 8 %}{{ Entry.SP_gross_description_8 }}{% elif forloop.counter == 9 %}{{ Entry.SP_gross_description_9 }}{% elif forloop.counter == 10 %}{{ Entry.SP_gross_description_10 }}{% elif forloop.counter == 11 %}{{ Entry.SP_gross_description_11 }}{% elif forloop.counter == 12 %}{{ Entry.SP_gross_description_12 }}{% endif %}
                                                                                                            </p>
                                                                                                        {% endfor %}
                                                                                                    {% endif %} 
                                                                                                {% endfor %}
                                                                                             {% endif %}
                                                                                        </div>

                                                                                    {% endif %}

                                                                            </div>
                                                                      {% endfor %}

                                                            </div>

                                            <div class="form-group m-b-0">
                                                 <div class="col-sm-offset-9 col-sm-9">
                                                     <a href="/dashboard/queve/">
                                                        <button type="link" name="view_details" class="btn btn-default btn-custom waves-effect waves-light">Back</button>
                                                     </a>
                                                     <a href="/dashboard/enter_result/{{ Entry.entry_id }}/">
                                                        <button type="link" name="enter_result" class="btn btn-default btn-custom waves-effect waves-light">Enter Result</button>
                                                     </a>
                                                </div>
                                            </div>
                                    {% endif %}

                                        </div>

                            	</div>


                            <!-- End row -->

                            </div> <!-- end col -->
                        </div>

						<!-- end row -->



                    </div> <!-- container -->

                </div> <!-- content -->




{% endblock %}