
var patienthistoryData = function () {


    var patientId = $('#patientid').val();
    var hosturl = $('#hosturl').val();



    $('.gothislinkagnew').click(function (e) {
        e.preventDefault();
        var linkto = $(this).attr('data-link');
        var pageto = $(this).attr('data-go');
        var secondto = $(this).attr('data-second-go');
        var thirdto = $(this).attr('data-third-go');
        var tabpatientidr = $('#patientid').val();
        var key = 'selectedTabFor#rowTab' + tabpatientidr;
        function set(key, value) {
            if (!localStorage)
                location.hash = value;
            else
                localStorage.setItem(key, value);
        }

        set(key, pageto);

        if (secondto !== '') {
            var keys = 'selectedTabFor#rowTab2' + tabpatientidr;
            function set(keys, values) {
                if (!localStorage)
                    location.hash = values;
                else
                    localStorage.setItem(keys, values);
            }

            set(keys, secondto);
        }

        if (thirdto !== '') {
            var key5 = 'selectedTabFor#rowTab3' + tabpatientidr;
            function set(key5, value5) {
                if (!localStorage)
                    location.hash = value5;
                else
                    localStorage.setItem(key5, value5);
            }

            set(key5, thirdto);
        }


        window.location.href = linkto;
    });


    /*========================ph menstrual ===================================*/

    $('#mensturaldata_btn').on("click", function () {

        $.post(hosturl + '/controllers/_phmain.php?ac=mensturaldetail&id=' + patientId, function (data) {

            $("#alldetails").html(data);
            $("#phdetail_model").modal('show');
        });


    });


    /*========================ph  contract ===================================*/


    $('#contractdata_btn').on("click", function () {

        $.post(hosturl + '/controllers/_phmain.php?ac=contractdetail&id=' + patientId, function (data) {

            $("#alldetails").html(data);
            $("#phdetail_model").modal('show');
        });


    });



    /*========================ph  obsertic ===================================*/
    $('#obstetricdata_btn').on("click", function () {

        $.post(hosturl + '/controllers/_phmain.php?ac=obstetricdetail&id=' + patientId, function (data) {

            $("#alldetails").html(data);
            $("#phdetail_model").modal('show');
        });


    });

    $('#examdata_btn').on("click", function () {

        $.post(hosturl + '/controllers/_phmain.php?ac=examdetail&id=' + patientId, function (data) {

            $("#alldetails").html(data);
            $("#phdetail_model").modal('show');
        });


    });



    /*========================ph  past medical ===================================*/
    $('.pastmedicaldata_btn').on("click", function () {

        $.post(hosturl + '/controllers/_phmain.php?ac=pastmedicaldetail&id=' + patientId, function (data) {

            $("#alldetails").html(data);
            $("#phdetail_model").modal('show');
        });


    });




    /*========================ph  past surgical ===================================*/
    $('.phpastsurgical_btn').on("click", function () {

        $.post(hosturl + '/controllers/_phmain.php?ac=pastsurgicaldetail&id=' + patientId, function (data) {

            $("#alldetails").html(data);
            $("#phdetail_model").modal('show');
        });


    });


    /*========================ph  past gynecological ===================================*/
    $('#phpastgynecological_btn').on("click", function () {

        $.post(hosturl + '/controllers/_phmain.php?ac=pastgynecologicaldetail&id=' + patientId, function (data) {

            $("#alldetails").html(data);
            $("#phdetail_model").modal('show');
        });


    });


    /*========================ph  past art ===================================*/
    $('#phpastart_btn').on("click", function () {

        $.post(hosturl + '/controllers/_phmain.php?ac=pastartdetail&id=' + patientId, function (data) {

            $("#alldetails").html(data);
            $("#phdetail_model").modal('show');
        });


    });

    /*========================ph  past internal art ===================================*/
    $('#internalpastart_btn').on("click", function () {

        $.post(hosturl + '/controllers/_phmain.php?ac=pastartinternaldetail&id=' + patientId, function (data) {

            $("#alldetails").html(data);
            $("#phdetail_model").modal('show');
        });


    });


    /*========================ph family===================================*/
    $('#phfamily_btn').on("click", function () {

        $.post(hosturl + '/controllers/_phmain.php?ac=familydetail&id=' + patientId, function (data) {

            $("#alldetails").html(data);
            $("#phdetail_model").modal('show');
        });


    });




    return {
        //main function to initiate the theme
        init: function () {

        }
    };
}();