angular 一个界面调用另一个界面的方式1

红色标记的hr都是顶级的module,每个路由节点都会引入hr这个module,所以这些嵌入的界面可以放在hr这个module下

angular.module(‘hr.templateCache‘).run([‘$templateCache‘, function ($templateCache) {
    $templateCache.put(‘presc-create-modal.html‘, "<div hr-draggable class=\"create-presc\" modal=\"modalShow\" options=\"prescModalOpts\" ng-controller=\"PrescCreateModalController\">\n    <header class=\"modal-header\">\n        <button type=\"button\" class=\"close\" ng-click=\"closePrescCreateModal()\">&times;</button>\n        <h5>生成处方</h5>\n    </header>\n    <div class=\"mg5505\">\n        <div class=\"form-horizontal presc-attr\">\n            <!--处方类型-->\n            <div class=\"control-group label-four drug-type\">\n                <label class=\"control-label\">处方类型:</label>\n                <div class=\"controls\">\n                        <span ng-repeat=\"prescTypeDict in prescTypeDictList\"\n                              ng-if=\"isPrescTypeShow(prescTypeDict.codeName)\">\n                            <label class=\"checkbox inline\">\n                                <input type=\"checkbox\" value=\"{{prescTypeDict.codeName}}\" ng-click=\"applyCheckEvent()\"\n                                       ng-disabled=\"isRejectOption(prescTypeDict)\" ng-checked=\"isPrescAttrChecked(prescTypeDict.codeName)\"\n                                       name=\"prescAttr\">{{prescTypeDict.codeName}}\n                            </label>\n                        </span>\n                </div>\n            </div>\n            <!--药房-->\n            <div class=\"control-group label-two drug-room\" ng-show=\"clinicInfo.groupOrder != 2\">\n                <label class=\"control-label\">药房</label>\n                <div class=\"controls\">\n                    <select ui-select2 id=\"deptInfo\"\n                            enter-loop=\"1\" enterindex=\"3\"\n                            ng-model=\"performDeptIdPrescCreate\" ng-change=\"changePerformDept(performDeptIdPrescCreate)\">\n                        <option ng-repeat=\"dept in departmentWestDispensary\"\n                                code=\"{{dept.deptCode}}\"\n                                value=\"{{dept.deptCode}}\">{{dept.deptName}}\n                        </option>\n                    </select>\n                </div>\n            </div>\n        </div>\n        <div class=\"body-content border-line-top-left-right\" ng-grid=\"prescOrdersGrid\"></div>\n    </div>\n    <div class=\"modal-footer btn-right\">\n        <button class=\"btn btn-primary\" ng-click=\"createPresc()\">生成</button>\n        <button class=\"btn btn-default\" ng-click=\"closePrescCreateModal()\">关闭</button>\n    </div>\n</div>");
}]);

angular.module(‘hr‘).controller(‘PrescCreateModalController‘, [‘$scope‘, ‘$http‘, ‘$timeout‘, ‘hrDialog‘, ‘HrDrugBillingAttr‘, ‘hrProgress‘,
    function ($scope, $http, $timeout, hrDialog, HrDrugBillingAttr, hrProgress) {
    $scope.modalShow = true;
    //医嘱生成处方药房
    $scope.performDeptIdPrescCreate = null;
    //可生成处方医嘱List(药疗,不摆药,已执行)
    $scope.ordersDrugWestListPrescCreate = [];
    //页面显示可生成处方医嘱List
    $scope.orderDetailListPrescCreate = [];
    //医嘱最后发药信息List
    $scope.drugPrescDetailList = [];
    $scope.prescModalOpts = {
        dialogClass: "modal create-presc-modal",
        backdropFade: false,
        dialogFade: false,
        keyboard: true,
        backdrop: true,
        backdropClick: false
    };
    $scope.closePrescCreateModal = function () {
        $scope.modalShow = false;
        $scope.modal.close();
        $timeout(function () {
            $scope.$destroy();
        })
    };

    function initPrescCreate() {
        $scope.ordersDrugWestListPrescCreate = angular.copy($scope.ordersDrugWestOtherList.filter(function (doctorOrder) {
            return isOrderForPrescCreate(doctorOrder);
        }));
        for (var i = 0; i < $scope.ordersDrugWestListPrescCreate.length; i++) {
            var orderDetail = convertDrugWestToDetail($scope.ordersDrugWestListPrescCreate[i]);
            orderDetail.packageUnits = $scope.ordersDrugWestListPrescCreate[i].drugOrderDetail.packageUnits;
            orderDetail.totalAmount = null;
            orderDetail.days = null;
            $scope.orderDetailListPrescCreate.push(orderDetail);
        }
        $scope.performDeptIdPrescCreate = getDefaultDispensary($scope.departmentWestDispensary, $scope.defaultWestDispensary);
        setOrderDetailShow();
    }

    function getOrderFilterShow(rowIndex) {
        if (rowIndex > 0) {
            var orderDetail = $scope.orderDetailListPrescCreate[rowIndex];
            var orderDetailPre = $scope.orderDetailListPrescCreate[rowIndex - 1];
            var orderClass = orderDetail.orderClass;
            var orderClassPre = orderDetailPre.orderClass;
            if (orderClass === orderClassPre && orderDetail.groupNo === orderDetailPre.groupNo) {
                return false;
            }
        }
        return true;
    }

    function getOrderTxtExtendDrugWestShow(rowIndex) {
        var orderDetailList = $scope.orderDetailListPrescCreate;
        if (orderDetailList.length <= rowIndex) {
            return true;
        }

        var totalLen = orderDetailList.length - 1;
        var pre = 0;
        var next = 0;

        if (rowIndex === totalLen) {
            next = rowIndex;
        } else {
            next = rowIndex + 1;
        }
        if (rowIndex > 0) {
            pre = rowIndex - 1;
        }
        var currentGroupNo = orderDetailList[rowIndex].groupNo;
        var preGroupNo = orderDetailList[pre].groupNo;
        var nextGroupNo = orderDetailList[next].groupNo;

        if (rowIndex === 0) {
            if (next > rowIndex && currentGroupNo === nextGroupNo) {
                return true;
            }
        } else if (rowIndex === totalLen) {
            if (pre < rowIndex && currentGroupNo === preGroupNo) {
                return false;
            }
        } else {
            if (currentGroupNo === preGroupNo) {
                if (currentGroupNo === nextGroupNo) {
                    return false;
                } else {
                    return false;
                }
            } else {
                if (currentGroupNo === nextGroupNo) {
                    return true;
                } else {
                    return true;
                }
            }
        }
        return true;
    }

    $scope.changePerformDept = function(performDeptIdPrescCreate){
        angular.forEach($scope.ordersDrugWestListPrescCreate, function(item){
            item.performDeptId = performDeptIdPrescCreate;
        })
    };

    function setOrderDetailShow() {
        $scope.orderDetailListPrescCreate.forEach(function (item, index) {
            item.detailShow = getOrderFilterShow(index);
            item.orderTxtExtendShow = getOrderTxtExtendDrugWestShow(index);
            item.orderStatusCodeName = $scope.getOrderStatusByCode(item, "order");
            item.firmId = $scope.getDrugFirmIdByOrderId(item.orderId);
        });
    }

    function isOrderForPrescCreate(doctorOrder) {
        if (doctorOrder.orderClass === orderClassEnum.orderDrugWest && doctorOrder.drugBillingAttr === HrDrugBillingAttr.NONE && doctorOrder.orderStatus === orderStatusEnum.EXECUTE) {
            var index = $scope.getSelectedRowNumOther(doctorOrder.orderId);
            if (index !== -1) {//停止医嘱 护士站未回写doctorOrders状态 需要检查performStatus
                if ($scope.orderDetailOtherList[index].performStatus === orderStatusEnum.EXECUTE) {
                    return true;
                }
            }
        }
        return false;
    }

    function getDrugPrescDetailByOrderId(orderId) {
        var filter = $scope.drugPrescDetailList.filter(function (item) {
            return item.itemNo === orderId;
        });
        if (filter.length > 0) {
            return filter[0];
        }
        return null;
    }

    function calculateDays(drugOrderDetail,orderDetail) {
        /*var drugPrescDetail = getDrugPrescDetailByOrderId(drugOrderDetail.orderId);
        if (drugPrescDetail == null) {
            return null;
        }*/
        var amountPerPackage = drugOrderDetail.amountPerPackage || 0;  //包装数量
        var dosage = drugOrderDetail.dosage || 0;   //药品默认一次使用剂量 0.25
        var usageUnits = drugOrderDetail.usageUnits || "";   //使用单位
        var dosePerUnit = drugOrderDetail.dosePerUnit || 0;    //最小单位剂量 0.25
        var doseUnits = drugOrderDetail.doseUnits || "";     //剂量单位 mg
        var units = drugOrderDetail.units || "";     //单位 片
        var freqCounter = drugOrderDetail.freqCounter || 0;     //默认频率次数 3
        var freqInterval = drugOrderDetail.freqInterval || 0;   //默认频率间隔 1
        var freqIntervalUnit = drugOrderDetail.freqIntervalUnit || "";   //默认频率间隔单位 日
        var totalAmount = drugOrderDetail.quantity || 0;     //数量
        var dosageForUnits = 0;
        var countPerDay = 0;
        var countPerWeek = 0;

        if (usageUnits !== units) {
            dosageForUnits = dosage / dosePerUnit;
        } else {
            dosageForUnits = dosage;
        }
        if (freqIntervalUnit === "小时") {
            countPerDay = (24 / freqInterval) * freqCounter;
        } else if (freqIntervalUnit === "分钟" || freqIntervalUnit === "分") {
            countPerDay = (24 * 60 / freqInterval) * freqCounter;
        } else if (freqIntervalUnit === "日") {
            countPerDay = (freqCounter / freqInterval);
        } else if (freqIntervalUnit === "周") {
            countPerWeek = freqCounter / freqInterval;
        }
        var days = orderDetail.days;
        if (freqIntervalUnit === "周") {
            orderDetail.totalAmount = Math.ceil(Math.ceil(days / 7) * countPerWeek * dosageForUnits / amountPerPackage);
        } else {
            orderDetail.totalAmount = Math.ceil(days * countPerDay * dosageForUnits / amountPerPackage);
        }
        orderDetail.totalAmount = isNaN(orderDetail.totalAmount==0?null:orderDetail.totalAmount)==true?null:orderDetail.totalAmount;
    }

    //查询最后发药天数
    function getLastPerformDays(callback) {
        var orderIdList = $scope.ordersDrugWestListPrescCreate.map(function (item) {
            return item.orderId;
        });
        var successCallback = function (data) {
            $scope.drugPrescDetailList = data;
            callback();
        };
        var errorCallback = function (data) {
            hrDialog.dialog(hrDialog.typeEnum.WARN, {
                message: "查询发药信息失败!",
                detail: data.message
            });
            callback();
        };
        HrUtils.httpRequest($http, Path.getUri("api/inp-orders/presc-last-perform-days"), successCallback, errorCallback, hrDialog, HrUtils.httpMethod.POST, orderIdList);
    }

    //小包装大包装的转换
    function getPackageUnits(index) {
        var drugOrderDetail = $scope.ordersDrugWestListPrescCreate[index].drugOrderDetail;
        var successCallback = function (data) {
            data = data.filter(function (item) {
                return item.amountPerPackage > 1;
            });
            if (data.length > 0) {
                drugOrderDetail.packageSpec = data[0].packageSpec;
                drugOrderDetail.packageUnits = data[0].packageUnits;
                drugOrderDetail.amountPerPackage = data[0].amountPerPackage;
                $scope.orderDetailListPrescCreate[index].packageUnits = data[0].packageUnits;
                $scope.orderDetailListPrescCreate[index].orderTxt = $scope.getOrderTxtDrugWest(drugOrderDetail);
            }
            calculateDays(drugOrderDetail,$scope.orderDetailListPrescCreate[index]);
            if (index < $scope.ordersDrugWestListPrescCreate.length - 1) {
                getPackageUnits(++index);
            }
        };
        if (drugOrderDetail.amountPerPackage === 1) {
            HrUtils.httpRequest($http, Path.getUri("api/drug-info-list/special-drug-price-list"), successCallback, null, hrDialog, HrUtils.httpMethod.POST, drugOrderDetail);
        } else {
            calculateDays(drugOrderDetail,$scope.orderDetailListPrescCreate[index]);
            if (index < $scope.ordersDrugWestListPrescCreate.length - 1) {
                getPackageUnits(++index);
            }
        }
    }

    function convertDrugWestToDetail(inpOrders, prescSpecType) {
        var orderDetail = {};
        var drugOrderDetailTemp = inpOrders.drugOrderDetail;
        if (drugOrderDetailTemp.deleteStatus !== 1) {
            orderDetail = $scope.getOrderDetailDrug(inpOrders, drugOrderDetailTemp, true, 0, prescSpecType);
        }
        return orderDetail;
    }

    function getDrugPrescAttrDetail(data){
        if(Strings.isNullOrEmpty(data)){
            return "普通";
        }
        var prescAttr = "";
        switch (data.toxiCode) {
            case "2":
                prescAttr = "精1";
                break;
            case "7":
                prescAttr = "精2";
                break;
            case "6":
                prescAttr = "毒";
                break;
            case "5":
                prescAttr = "麻";
                break;
            default :
                prescAttr = "普通";
        }
        return prescAttr;
    }

    //获取药品属性
    function getDrugPrescAttr(ordersDrugWestListPresc, index, callback){
        var doctorOrders = ordersDrugWestListPresc[index];
        var successCallback = function (data) {
            doctorOrders.prescAttr = getDrugPrescAttrDetail(data);
            if (index < ordersDrugWestListPresc.length - 1) {
                getDrugPrescAttr(ordersDrugWestListPresc, ++index, callback);
            } else {
                callback();
            }
        };
        HrUtils.httpRequest($http, Path.getUri("api/inp-orders/get-drug-prescAttr?drugCode=" + doctorOrders.drugOrderDetail.drugCode), successCallback, null, hrDialog, HrUtils.httpMethod.POST, null);
    }

    //生成orderDrugInfo
    function getOrderDrugInfo(doctorOrders, drugOrderDetail, callback){
        var orderDrugInfo = new OrderDrugInfo();
        orderDrugInfo.operationStatus = doctorOrders.operationStatus;//
        orderDrugInfo.administration = drugOrderDetail.administration;
        orderDrugInfo.amountPerPackage = drugOrderDetail.amountPerPackage;
        orderDrugInfo.amountPerPackage = drugOrderDetail.amountPerPackage;
        orderDrugInfo.babyNo = doctorOrders.babyNo;
        orderDrugInfo.billingAttr = doctorOrders.billingAttr;
        orderDrugInfo.charge = drugOrderDetail.totalAmount * drugOrderDetail.price;
        orderDrugInfo.costs = drugOrderDetail.totalAmount * drugOrderDetail.price;
        orderDrugInfo.days = drugOrderDetail.days;
        orderDrugInfo.dosage = drugOrderDetail.dosage;
        orderDrugInfo.dosePerUnit = drugOrderDetail.dosePerUnit;
        orderDrugInfo.doseUnits = drugOrderDetail.doseUnits;
        orderDrugInfo.drugCode = drugOrderDetail.drugCode;
        orderDrugInfo.drugName = drugOrderDetail.drugName;
        orderDrugInfo.drugSpec = drugOrderDetail.drugSpec;
        orderDrugInfo.drugTradeCode = drugOrderDetail.drugTradeCode;
        orderDrugInfo.drugTradeName = drugOrderDetail.drugTradeName;
        orderDrugInfo.duration = drugOrderDetail.duration;
        orderDrugInfo.durationUnits = drugOrderDetail.durationUnits;
        orderDrugInfo.encounterNo = doctorOrders.encounterNo;
        orderDrugInfo.firmId = drugOrderDetail.firmId;
        orderDrugInfo.focusSelfPay = doctorOrders.focusSelfPay;
        orderDrugInfo.freqCounter = drugOrderDetail.freqCounter;
        orderDrugInfo.freqInterval = drugOrderDetail.freqInterval;
        orderDrugInfo.freqIntervalUnit = drugOrderDetail.freqIntervalUnit;
        orderDrugInfo.frequency = drugOrderDetail.frequency;
        orderDrugInfo.groupGraph = doctorOrders.groupGraph;
        orderDrugInfo.isGroup = doctorOrders.isGroup;//
        orderDrugInfo.memo = doctorOrders.memo;
        orderDrugInfo.menstruumIndicator = drugOrderDetail.menstruumIndicator;
        orderDrugInfo.packageSpec = drugOrderDetail.packageSpec;
        orderDrugInfo.packageUnits = drugOrderDetail.packageUnits;
        orderDrugInfo.performDeptId = doctorOrders.performDeptId;
        orderDrugInfo.prescAttr = doctorOrders.prescAttr;
        orderDrugInfo.price = drugOrderDetail.price;
        orderDrugInfo.stIndicator = drugOrderDetail.stIndicator;
        orderDrugInfo.totalAmount = drugOrderDetail.totalAmount;
        orderDrugInfo.units = drugOrderDetail.units;
        orderDrugInfo.usageUnits = drugOrderDetail.usageUnits;
        orderDrugInfo.userDescription = drugOrderDetail.userDescription;
        orderDrugInfo.visitNo = doctorOrders.visitNo;
        callback(orderDrugInfo);
    }

    //校验是否数量为空
    function checkTotalAmountOrDays(orderDetailListPresc, ordersDrugWestListPresc, callback){
        var filter = orderDetailListPresc.filter(function(item){
            if(Strings.isNullOrEmpty(item.totalAmount) || item.totalAmount == 0 || Strings.isNullOrEmpty(item.days) || item.days == 0){
                return item;
            }
        });
        if(filter.length > 0){
            for(var i=0; i< ordersDrugWestListPresc.length;){
                if(ordersDrugWestListPresc[i].orderId == filter[0].orderId){
                    hrDialog.dialog(hrDialog.typeEnum.WARN, {message: "请检查" + ordersDrugWestListPresc[i].drugOrderDetail.drugName + "药品天数或者数量"})
                        .close(function(){
                        });
                    return false;
                }
                ++i;
            }
        } else {
            callback();
        }
    }

    /*function checkDrugFirm(orderDrugInfo, callback) {
        var queryInfo = {
            "drugCode": orderDrugInfo.drugCode,
            "drugTradeName": "",
            "deptCode": $scope.performDeptIdPrescCreate,
            "chargeType": $scope.patientInfo.chargeType,
            "constrainedDoctorLevel": $scope.doctorInfo.constrainedDoctorLevel,
            "packageUnitsFlag": 1,
            "displayFlag": true
        };
        var drugInfoSuccessCallback = function (data) {
            if (data && data.length > 0) {
                var list = data.filter(function (item) {
                    if (item.drugCode === orderDrugInfo.drugCode && item.drugSpec === orderDrugInfo.drugSpec && item.firmId === orderDrugInfo.firmId && item.packageSpec === orderDrugInfo.packageSpec) {
                        return true;
                    }
                });
                if (list.length > 0) {
                    orderDrugInfo.price = data[0].price;
                    callback(orderDrugInfo);
                } else {
                    hrDialog.dialog(hrDialog.typeEnum.WARN, {message: orderDrugInfo.drugName + "(" + orderDrugInfo.packageSpec + ")" + "‘药品不可供!"});
                }
            } else {
                hrDialog.dialog(hrDialog.typeEnum.WARN, {message: orderDrugInfo.drugName + "(" + orderDrugInfo.packageSpec + ")" + "‘药品不可供!"});
            }
        };
        HrUtils.httpRequest($http, Path.getUri("api/drug-name-dict/drug-trade-price-info"), drugInfoSuccessCallback, null, hrDialog, HrUtils.httpMethod.POST, queryInfo);
    }*/

    //检验是否选中要生成处方的医嘱
    function checkOrdersQuantity(callback) {
        var orderDetailListPresc = [];
        var ordersDrugWestListPresc = [];
        angular.forEach($scope.orderDetailListPrescCreate, function(item,index){
            if(item.checked){
                orderDetailListPresc.push(item);
                ordersDrugWestListPresc.push($scope.ordersDrugWestListPrescCreate[index]);
            }
        });
        if(orderDetailListPresc.length == 0){
            hrDialog.dialog(hrDialog.typeEnum.WARN, {message: "请选择要生成的处方的医嘱!"});
            return false;
        } else {
            callback(orderDetailListPresc, ordersDrugWestListPresc);
        }
    }

    function getPrescAttr() {
        var prescAttrList = [];
        var checkBoxs = $(‘input[name="prescAttr"]‘);
        for (var i = 0; i < checkBoxs.length; i++) {
            var checkBox = checkBoxs.get(i);
            if (checkBox.checked && !angular.equals(checkBox.value, prescAttrEnum.PT)) {
                prescAttrList.push(checkBox.value)
            }
        }
        var prescAttr = prescAttrList.join(";");
        if (angular.equals(prescAttr, "")) {
            prescAttr = prescAttrEnum.PT;
        }
        return prescAttr;
    }

    $scope.columnDefsPrescOrders = [
        {
            field: ‘‘, displayName: ‘选择‘, width: "5%", cellClass: "text-center", cellTemplate: ‘‘ +
        ‘<div class="ngCellText">\n    <input type="checkbox" ng-model="row.entity.checked" ng-show="row.entity.groupSubNo == 1" ng-true-value="1" ng-false-value="0" ng-click="preventCheck(row.rowIndex)"/>\n</div>‘
        },
        {
            field: ‘startDateTime‘, displayName: ‘下达时间‘, width: "9%", cellClass: "text-center", cellTemplate: ‘‘ +
        ‘<div class="ngCellText" ng-show="row.entity.detailShow">{{::getOrderDateTime(row.getProperty(col.field))}}</div>‘
        },
        {
            field: ‘repeatIndicator‘, displayName: ‘长/临‘, width: "5%", cellTemplate: ‘‘ +
        ‘<div class="ngCellText" ng-show="row.entity.detailShow">{{::getOrderRepeatIndicator(row.getProperty(col.field))}}</div>‘
        },
        {
            field: ‘days‘,
            displayName: ‘天数‘,
            width: ‘5%‘,
            cellClass: "text-center",
            cellTemplate: ‘‘ +
            ‘    <div class="input-append">\n        <input class="input-mini drug-amount-presc text-right" type="text" ng-model="row.entity.days" ng-change="changeOrdersDays(row.rowIndex)"\n               number-only-by-condition number-type="+" decimal-type="integer"/>\n    </div>\n‘

        },
        {
            field: ‘totalAmount‘,
            displayName: ‘数量‘,
            width: "11%",
            cellTemplate: ‘‘ +
        ‘    <div class="input-append">\n        <input class="input-mini drug-amount-presc text-right" type="text" ng-model="row.entity.totalAmount" ng-disabled="true"/>\n        <span class="add-on">{{row.entity.packageUnits}}</span>\n    </div>\n‘
        },
        {
            field: ‘orderTxt‘, displayName: ‘医嘱‘, cellTemplate: ‘‘ +
        ‘<div class="ngCellText" title="{{::row.entity.firmId}}"> ‘ +
        ‘<span ng-bind-html="deliberatelyTrustDangerousSnippet(row.getProperty(col.field))"></span> ‘ +
        ‘<span class="drug-order-detail-flag">{{::row.entity.groupGraph}}</span> ‘ +
        ‘<span ng-show="row.entity.orderTxtExtendShow" ng-bind-html="deliberatelyTrustDangerousSnippet(row.getProperty(\‘orderTxtExtend\‘))"></span>‘ +
        ‘</div>‘
        },
        {
            field: ‘doctor‘, displayName: ‘医师‘, width: ‘8%‘, cellTemplate: ‘‘ +
        ‘<div class="ngCellText" ng-show="row.entity.detailShow">{{::row.getProperty(col.field)}}</div> ‘
        },
        {
            field: ‘orderStatus‘, displayName: ‘状态‘, width: ‘7.5%‘, cellTemplate: ‘‘ +
        ‘<div class="ngCellText" title="{{::row.entity.orderStatusCodeName}}">‘ +
        ‘{{::row.entity.orderStatusCodeName}}‘ +
        ‘</div>‘
        }
        /*,
        {
            field: ‘prescDate‘,
            displayName: ‘最后发药时间‘,
            width: ‘10%‘,
            cellClass: "text-center",
            cellTemplate: ‘‘ +
            ‘<div class="ngCellText" title="{{::getOrderDateTime(row.getProperty(col.field))}}">‘ +
            ‘{{::getOrderDateTime(row.getProperty(col.field))}}‘ +
            ‘</div>‘
        }*/
    ];

    var rowTemplatePrescOrders = "<div ng-style=\"{ \‘cursor\‘: row.cursor}\" ng-repeat=\"col in renderedColumns\"\n    ng-class=\"col.colIndex()\" class=\"ngCell {{col.cellClass}} {{changeClassState(row.entity)}}\">\n    <div class=\"ngVerticalBar\" ng-style=\"{height: rowHeight}\" ng-class=\"{ ngVerticalBarVisible: !$last }\">&nbsp;</div>\n    <div ng-cell></div>\n</div>";

    $scope.prescOrdersGrid = {
        data: ‘orderDetailListPrescCreate‘,
        columnDefs: ‘columnDefsPrescOrders‘,
        rowTemplate: rowTemplatePrescOrders,
        enableColumnResize: false,
        multiSelect: false,
        enableSorting: false
    };

    $scope.preventCheck = function (index) {
        var orderDetail = $scope.orderDetailListPrescCreate[index];
        if(orderDetail.groupSubNo == 1){
            angular.forEach($scope.orderDetailListPrescCreate, function(item){
                if(item.groupNo == orderDetail.groupNo)
                item.checked = orderDetail.checked;
            })
        }
        event.stopPropagation();//已在rowTemplate 添加点击行选择
    };

    $scope.changeOrdersDays = function (index) {
        var orderDetail = $scope.orderDetailListPrescCreate[index];
        var days = orderDetail.days;
        angular.forEach($scope.orderDetailListPrescCreate,function(item,index){
            if(item.groupNo == orderDetail.groupNo){
                item.days = days;
                calculateDays($scope.ordersDrugWestListPrescCreate[index].drugOrderDetail,$scope.orderDetailListPrescCreate[index]);
            }
        });
    };

    $scope.isPrescTypeShow = function (codeName) {
        if (codeName === prescAttrEnum.PT) {
            return false;
        } else if (codeName === prescAttrEnum.ET && !$scope.isChildAvaliable) {
            return false;
        }
        return true;
    };

    $scope.isPrescAttrChecked = function (codeName) {
        if (codeName === prescAttrEnum.YB && $scope.prescInsuranceSign === "1") {
            return true;
        }
        if ($scope.clinicInfo.clinicSource === clinicSourceEnum.ER_ORDER_INP && codeName === prescAttrEnum.JZ) {
            return true;
        }
        return false;
    };

    $scope.isRejectOption = function (prescTypeDict) {
        if (!$scope.prescTypeDictList) {
            return false;
        }
        if (prescTypeDict.codeName === prescAttrEnum.YB && $scope.prescInsuranceSign === "0") {
            return true;//非医保患者,禁用医保
        }
        //急诊红区 默认勾选禁用
        if ($scope.clinicInfo.clinicSource === clinicSourceEnum.ER_ORDER_INP && prescTypeDict.codeName === prescAttrEnum.JZ) {
            return true;
        }
        var prescAttr = getPrescAttr();
        if (angular.equals(prescAttr, prescAttrEnum.PT)) {//普通处方,均可用
            return false;
        }
        var prescAttrList = $scope.prescTypeDictList.filter(function (e) {
            return prescAttr.split(";").some(function (codeName) {
                return e.codeName === codeName;
            })
        });
        var isReject = prescAttrList.some(function (e) {
            if (!e.ctrvalue1) {
                return false;
            } else {
                return e.ctrvalue1.split(";").some(function (rejectCodeId) {
                    return rejectCodeId === prescTypeDict.codeId;
                });
            }
        });
        var isReverseReject = prescAttrList.some(function (e) {
            if (!prescTypeDict.ctrvalue1) {
                return false;
            } else {
                return prescTypeDict.ctrvalue1.split(";").some(function (rejectCodeId) {
                    return rejectCodeId === e.codeId;
                })
            }
        });
        return isReject || isReverseReject;
    };

    $scope.applyCheckEvent = function () {
        if (!$scope.$$phase) {
            $scope.$apply();
        }
    };

    $scope.createPresc = function () {
        //检查是否选中
        checkOrdersQuantity(function(orderDetailListPresc, ordersDrugWestListPresc){//选中的要生成的处方的医嘱
            checkTotalAmountOrDays(orderDetailListPresc, ordersDrugWestListPresc, function(){
                getDrugPrescAttr(ordersDrugWestListPresc, 0, function(){
                    var groupNo = ordersDrugWestListPresc[0].groupNo;
                    for(var i=0; i<ordersDrugWestListPresc.length; ){
                        var doctorOrders = ordersDrugWestListPresc[i];
                        if(ordersDrugWestListPresc[i].groupNo == groupNo){
                            if(ordersDrugWestListPresc[i].groupSubNo == 1){
                                doctorOrders.operationStatus = "1";
                                doctorOrders.isGroup = "0";
                            } else {
                                doctorOrders.operationStatus = "0";
                                doctorOrders.isGroup = "1";
                            }
                        } else {
                            groupNo = doctorOrders.groupNo;
                            doctorOrders.operationStatus = "1";
                            doctorOrders.isGroup = "0";
                        }
                        var drugOrderDetail = doctorOrders.drugOrderDetail;
                        drugOrderDetail.totalAmount = orderDetailListPresc[i].totalAmount;
                        drugOrderDetail.days = orderDetailListPresc[i].days;
                        //封装new InpOrderDrugInfo();
                        getOrderDrugInfo(doctorOrders, drugOrderDetail, function(orderDrugInfo){
                            $scope.addDrugInfoDetailForOrder(orderDrugInfo);
                            i++;
                        })
                    }
                })
                $scope.closePrescCreateModal();
            });
        })
    };

    (function () {
        initPrescCreate();
        getLastPerformDays(function () {
            //getPackageUnits(0);
        });
    })();
}]);

angular.module(‘hr.service‘).factory(‘PrescCreate‘, [‘$templateCache‘, ‘$document‘, ‘$compile‘, ‘$rootScope‘, ‘$timeout‘,
    function ($templateCache, $document, $compile, $rootScope, $timeout) {

        /**
         * 打开modal
         * @param scope 父级$scope
         */
        function _openPrescCreateModal(scope) {
            new PrescCreateModal(scope).open();

        }

        function PrescCreateModal(scope) {
            this._scope = scope;
            this._activeElement = null;
            this._element = angular.element($templateCache.get(‘presc-create-modal.html‘));
        }

        PrescCreateModal.prototype.open = function () {
            if (event) {
                event.stopPropagation();
                event.preventDefault();
            }
            this._activeElement = $(document.activeElement);
            this._activeElement.blur();
            var scope = this._scope.$new();
            scope.modal = this;
            $document.find(‘body‘).append(this._element);
            $compile(this._element)(scope);
            $timeout(function () {
                Mousetrap.reset();
            });
        };

        PrescCreateModal.prototype.close = function () {
            this._element.remove();
            this._activeElement.focus();
        };

        return {
            openPrescCreateModal: _openPrescCreateModal
        }
    }
]);

使用方式:

var InpOrdersController = ["$scope", "$q", "$http", "$filter", "hrDialog", "$timeout", "PluginManager", "$window", "HrOrderStatus", "hrProgress", "HrDrugBillingAttr", "HrBillingAttr", "PrescCreate", "MainTreatGroupVerify", "CpVariationCheck", "HrOrder", "$rootScope", "HrChargeType", "$debounce", function ($scope, $q, $http, $filter, hrDialog, $timeout, PluginManager, $window, HrOrderStatus, hrProgress, HrDrugBillingAttr, HrBillingAttr, PrescCreate, MainTreatGroupVerify, CpVariationCheck, HrOrder, $rootScope, HrChargeType, $debounce) {
    //生成处方调用
    $scope.openCreatePrescModal = function () {
        if ($scope.operButtonDisabled.create) {
            return false;
        }
        findPerformOrders(function () {
            PrescCreate.openPrescCreateModal($scope);
        });
    };
}];

因为绑定InpOrdersControllr的module注入了hr所以在InpOrdersController可以注入hr下的PrescCreate

原文地址:https://www.cnblogs.com/ms-grf/p/8940700.html

时间: 2024-10-10 01:10:23

angular 一个界面调用另一个界面的方式1的相关文章

一个Activity调用另一个Activity的非静态方法

注意:前提是界面二被打开过未关闭,则用此方法即可实现在界面一中调用界面二的方法! 界面一: public class OneActivity extends Activity { @Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_one); callTwoActivityMethod(); } /

从一个应用调用另一个应用的Activity(已知包名)

最近要用到从一个应用调用另一个应用的Activity,我封装了一个方法,直接调用这个方法就可以,前提是要知道要调用应用的包名. 以下是实现方法的代码: 1 2 /** 3 * 根据包名调用app 4 * @param packageName 5 */ 6 public void openApp(String packageName) { 7 PackageInfo pi; 8 try { 9 pi = getPackageManager().getPackageInfo(packageName,

在同一个类中,一个方法调用另外一个有注解(比如@Async,@Transational)的方法,注解失效的原因和解决方法

在同一个类中,一个方法调用另外一个有注解(比如@Async,@Transational)的方法,注解是不会生效的. 比如,下面代码例子中,有两方法,一个有@Transational注解,一个没有.如果调用了有注解的addPerson()方法,会启动一个Transaction:如果调用updatePersonByPhoneNo(),因为它内部调用了有注解的addPerson(),如果你以为系统也会为它启动一个Transaction,那就错了,实际上是没有的. @Service public cla

Qt一个工程调用另一个工程的类成员变量

一句两句话已经不能表达现在的激动情绪了,唯有感叹知识的博大精深,并把感叹转变为文字. 同一个工程调用其他类成员变量非常简单. 如: 定义 Test1.h中申明成员变量 class A { public: double m_fTest; }; Test1.cpp中改变成员变量的值. m_fTest = 265.78; 然后再类B中调用类A的成员变量m_fTest,并需求类A中改变该值时,类B中也要随之改变: 调用方法:包涵类A的头文件 #include "test1.h" 然后在调用处声

关于一个解决方案中两个项目,一个项目调用另一个项目的文件

在看一个比较大的项目时, 一个解决方案中有多个项目,比如一个是写好的项目,一个是测试项目,那么怎么从测试项目调用另一个项目的文件呢? 具体解决方案如下: 打开测试项目的属性页:附加包含目录 然后填入你上一个项目源文件所在路径(如果项目须移动时前面加上..\) 接下来就可以调用上一个项目的文件了

09_Android中ContentProvider和Sqllite混合操作,一个项目调用另外一个项目的ContentProvider

1.  编写ContentPrivider提供者的Android应用 清单文件 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.itheima28.sqlitedemo" android:versionCode=&qu

Eclipse中一个项目调用另一个项目的资源

如果一个项目A想要引用另一个项目B的资源的话,按照一下步骤进行设置: 右键点击项目A---->>>Build Path--->>>Configure Build Path...--->>>在弹出的对话框中选择Projects选项卡--->>>点击Add--->>>选择项目B进行添加. 备注: 如果项目A关联了项目B,再使用项目B关联项目A,那么项目A和项目B上就会显示红色的感叹号表示警告.

Unity 一个脚本调用另一个脚本的函数

假设两个分别为A和B,分别挂有脚本AScript和BScript,现在想让BScript调用(A的脚本)AScript中的FollowMe()函数. using UnityEngine;using System.Collections; public class BScript : MonoBehaviour{ AScript AComponent; void Function() { AComponent.FollowMe(); } } 注:在编辑器里把A拖到B对象的BScript的AComp

vue中methods一个方法调用另外一个方法