<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改处方')" />
</head>
<body>
    <div class="main-content">
        <form class="form-horizontal" id="form-server-edit" th:object="${recipe}">
            <h4 class="form-header h4">处方信息</h4>
            <input type="hidden" id="id" name="id" th:value="${id}">
                <div class="row">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-4 control-label is-required">患者姓名：</label>
                            <div class="col-sm-8">
                                <input name="patientName" placeholder="请输入患者姓名" class="form-control" type="text" maxlength="30" th:value="${patientName}" >
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-4 control-label is-required">手机号码：</label>
                            <div class="col-sm-8">
                                <div class="input-group">
                                    <input id="patientPhone" name="patientPhone" placeholder="请输入手机号码" class="form-control" type="number" maxlength="11" th:value="${patientPhone}">
                                    <span class="input-group-addon"><i class="fa fa-mobile"></i></span>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-4 control-label is-required">药品通用名：</label>
                            <div class="col-sm-8">
                                <input name="genericName" placeholder="请输入药品通用名" class="form-control" type="text" maxlength="30" th:value="${genericName}">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-4 control-label is-required">门店：</label>
                            <div class="col-sm-8">
                                <div class="input-group">
                                <input name="storeName" onclick="selectDeptTree()" id="treeName" type="text" placeholder="请选择门店" class="form-control"  th:value="${storeName}">
                                <span class="input-group-addon"><i class="fa fa-search"></i></span>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">厂家：</label>
                            <div class="col-sm-8">
                                <input id="manufacturer" name="manufacturer" placeholder="请输入厂家" class="form-control" type="text" maxlength="30" th:value="${manufacturer}">
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">登记人：</label>
                            <div class="col-sm-8">

                                <input id="registrar" name="registrar" placeholder="请输入登记人" class="form-control" type="text" maxlength="30" th:value="${registrar}">
                            </div>

                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">规格：</label>
                            <div class="col-sm-8">
                                <select name="specification" class="form-control" th:with="type=${@dict.getType('sys_select_specification')}">
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                                            th:selected="${dict.dictValue}==${specification}"></option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">数量：</label>
                            <div class="col-sm-8">
                                <input id="quantity" name="quantity" placeholder="请输入数量" class="form-control" type="number" maxlength="30" th:value="${quantity}">
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">商品名：</label>
                            <div class="col-sm-8">
                                <input id="productName" name="productName"  type="text" maxlength="100"  class="form-control" placeholder="请输入商品名" th:value="${productName}">
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">处方类型：</label>
                            <div class="col-sm-8">
                                <select name="prescriptionType" class="form-control" th:with="type=${@dict.getType('sys_select_prescription_ype')}">
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                                            th:selected="${dict.dictValue}==${prescriptionType}"></option>
                                </select>
                            </div>
                        </div>
                    </div>

                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">配送方式：</label>
                            <div class="col-sm-8">
                                <select name="deliveryMethod" class="form-control" th:with="type=${@dict.getType('sys_select_delivery_method')}">
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                                            th:selected="${dict.dictValue}==${deliveryMethod}"></option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">MDM编码：</label>

                            <div class="col-sm-8">
                                <input id="mdmCode" name="mdmCode" placeholder="请输入MDM编码" class="form-control" type="text" maxlength="50" th:value="${mdmCode}" >
                            </div>
                        </div>
                    </div>


                </div>
                <div class="row">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-4 control-label is-required">医生：</label>
                            <div class="col-sm-8">
                                <input id="doctor" name="doctor" placeholder="请输入医生" class="form-control" type="text" maxlength="30" th:value="${doctor}">
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-4 control-label is-required">医院：</label>
                            <div class="col-sm-8">
                                <input name="hospital" placeholder="请输入医院" class="form-control" type="text" maxlength="30" th:value="${hospital}">
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-sm-4 control-label ">科室：</label>
                            <div class="col-sm-8">
                                <input id="department" name="department" placeholder="请输入科室" class="form-control" type="text" maxlength="50" th:value="${department}">
                            </div>
                        </div>
                    </div>
                </div>


            <h4 class="form-header h4">其他信息</h4>
            <div class="row">
                <div class="col-sm-4">
                    <div class="form-group">
                        <label class="col-sm-6 control-label">pos会员姓名：</label>
                        <div class="col-sm-6">
                            <input id="posMemberName" name="posMemberName" placeholder="请输入pos会员姓名" class="form-control" type="text" maxlength="30" th:value="${posMemberName}">
                        </div>
                    </div>
                </div>
                <div class="col-sm-4">
                    <div class="form-group">
                        <label class="col-sm-6 control-label">pos会员手机号：</label>
                        <div class="col-sm-6">
                            <input id="posMemberPhone" name="posMemberPhone" placeholder="请输入pos会员手机号" class="form-control" type="number" maxlength="11" th:value="${posMemberPhone}">
                        </div>
                    </div>
                </div>
                <div class="col-sm-4">
                    <div class="form-group">

                    </div>
                </div>
            </div>
        </form>
    </div>
    <div class="main-content">
        <div class="col-sm-offset-5 col-sm-10">
            <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        </div>
    </div>
	<th:block th:include="include :: footer" />
</body>
</html>

<script>

    /* 用户管理-新增-选择门店树 */
    function selectDeptTree() {
        var treeId = $("#treeId").val();
        var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
        var url = ctx + "system/user/selectDeptTree/" + deptId;
        var options = {
            title: '选择门店',
            width: "380",
            url: url,
            callBack: doSubmit
        };
        $.modal.openOptions(options);
    }

    function doSubmit(index, layero){
        var body = $.modal.getChildFrame(index);
        $("#treeId").val(body.find('#treeId').val());
        $("#treeName").val(body.find('#treeName').val());
        $.modal.close(index);
    }


    function submitHandler() {
        var prefix = ctx + "dtp/recipe";
        if ($.validate.form()) {
            var data = $("#form-server-edit").serializeArray();
            /*var status = $("input[id='status']").is(':checked') == true ? 0 : 1;
            var roleIds = $.form.selectCheckeds("role");
            var postIds = $.form.selectSelects("post");
            data.push({"name": "status", "value": status});
            data.push({"name": "roleIds", "value": roleIds});
            data.push({"name": "postIds", "value": postIds});*/
            $.operate.saveTab(prefix + "/edit", data);
        }
    }
</script>
