입력 상자 검색 기능의 실현

14740 단어
먼저 입력 상자를 쓰십시오.

    

버튼 트리거 이벤트 및 function 방법 (window.open에서 새 페이지를 열기 위한 구체적인 페이지 후속):
$("#btnRDSearch").click(reserveDetail.loadReserve);

// 
reserveDetail.loadReserve = function(){
    var sUrl = "reserveAction_loadReserve";
    var objParams = { "hasLoading": false, "cvoParameter.keyWord": $("#txtRDKeyWord").val()};
        commonJs.openAjax(sUrl, objParams,function(data){
            if (!data.success) {
                commonJs.openDialog("error", data.message);
            } else {
                var lstResult = data.lstResult;
                if (typeof(lstResult) =="undefined") {
                    commonJs.openDialog("error", " !");
                } else {
                    if (lstResult.length == 1) {
                        var sId = lstResult[0].id;
                        var sMrn = lstResult[0].medicalRecordNumber;
                        var sCn = lstResult[0].clinicNumber;
                        var sOrderId = lstResult[0].orderId;
                        var sTargetId = lstResult[0].targetId;
                        window.open(BASE_PATH + "/spv2/nurse/reserve/reserve_detail.jsp?id="+sId+"&mrn="+sMrn+"&cn="+sCn+"&oid="+sOrderId+"&tid="+sTargetId);
                    } else if (lstResult.length > 1){
                        commonJs.openDialog("warning"," "+lstResult.length+", !");
                        return;
                    }
                }
            }
        });
}

commonJs에서 OpenAjax, openDialog 방법을 봉인했습니다.
// ajax ( ,  ,  ,  )
commonJs.openAjax = function(sUrl, vParams, funSuccess, funError) {
    if (sUrl == null || sUrl == '') return false;
    //  , , vParams.hasLoading false
    var hasLoading = true;
    if (vParams != null && vParams.hasLoading == false) { hasLoading = false; }
    if (hasLoading) { commonJs.openLoadDialog(); }
    $.ajax({
        url:        sUrl,
        data:       vParams,
        type:       'POST',
        dataType:   'json',// xml,html,script,json,jsonp
        timeout:    30 * 60 * 1000,
        success:    function(data) {
            if (hasLoading) { commonJs.closeLoadDialog(); }
            if (data != null && data.code == "login"){
                commonJs.openDialog("error", data.message, function(){
                    location.href = BASE_PATH + "/spv2/login.jsp?returnUrl=" + commonJs.enReturnUrl();
                });
            }else{
                funSuccess(data);
            }
        },
        error:      funError
    });
};

//  
commonJs.openPageDialog = function(par) {
    if (par != null && par.closable == null) { par.closable = false; }
    if (par != null && par.lg != null && par.lg == true) {
        par.lg = BootstrapDialog.SIZE_WIDE;
    } else {
        par.lg = BootstrapDialog.SIZE_NORMAL;
    }
    var dialog = new BootstrapDialog({
        id:     par.id,//  id
        title:  par.title,//  
        size:   par.lg,//  
        closable: par.closable,//  ( )
        closeByKeyboard: par.closable,//  Esc ( closable )
        message: function(dialog) {
            var $message = $('
  , ...
'); setTimeout(function() { if (par.url == null || par.url == '') return; if (par.url.indexOf('?') > -1) { // par.url += '&ran=' + Math.random(); } else { // par.url += '?ran=' + Math.random(); } $message.load(par.url, par.data, function() { }); }, 500); return $message; }, buttons: par.buttons }).open(); return dialog; }

작업 작성 방법:
    IReserve funReserve = FunFactory.getReserve();
    /**
     *  
     * @return
     */
    @IAccess(competenceNumber = { GlobalCache.UserRole.SPD }, returnFormat = GlobalCache.JSON)
    public void loadReserve() {
        MessageVo mvoResult = new MessageVo();
        CommonVo cvoParams = getCvoParameter();
        if ("".equals(cvoParams.getKeyWord()) || cvoParams.getKeyWord() == null) {
            mvoResult.setSuccess(false);
            mvoResult.setMessage(" !");
        } else {
            mvoResult = funReserve.pageListReserve(cvoParams);
        }
        this.outJson(mvoResult);
    }

commonVo는 공통 값 대상, MessageVo는 반환 값 대상, 입면은 전송할 값 대상을 포함합니다.funReserve는 FunFactory의 개체입니다.pageListReserve 방법:
/**
     *  
     */
    public MessageVo pageListReserve(CommonVo cvoParams) {
        String sSql = "";
        cvoParams.setIsPay("1");//  
        sSql += CommonBean.getRangeCondition(cvoParams.getRange(), "reserve_date", "4");
        if (!"".equals(cvoParams.getKeyWord()) && cvoParams.getKeyWord() != null) {
            sSql += " and (CLINIC_NUMBER LIKE '%" + cvoParams.getKeyWord() + "%' OR MEDICAL_RECORD_NUMBER LIKE '%" + cvoParams.getKeyWord() + "%' OR TARGET_NAME LIKE '%" + cvoParams.getKeyWord()
                    + "%')";
            sSql += " and (DOCTOR_ID = '" + cvoParams.getDoctorId() + "' OR DOCTOR_ID IS NULL)";
        }
        cvoParams.setSql(sSql);
        cvoParams.setOrderBy("order by DOCTOR_ID,RESERVE_DATE,QUEUE_ID");
        return tdoReserveOrder.getList(cvoParams);
    }

봉인된 dao 패키지 (이 파일을 최대한 수정하지 마십시오):
@Repository("VReserveOrderViewDao")
public class VReserveOrderViewDao extends DaoSupport implements IViewDao {
    private static String TABLE_NAME = "VReserveOrder";

    public MessageVo getList(CommonVo cvoSelect) {
        String sHql = "from " + TABLE_NAME + " where 1=1 ";//  
        String sCount = "select count(*) from " + TABLE_NAME + " where 1=1 ";//  
        MessageVo mvoResult = new MessageVo();
        try {
            Object[] objParameter = null;
            ArrayList arrParameter = new ArrayList();
            //  
            objParameter = new Object[] { " and id = ? ", cvoSelect.getId() };
            arrParameter.add(objParameter);//  
            objParameter = new Object[] { " and order_number like ? ", "%" + cvoSelect.getOrderNumber() + "%" };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and medical_record_number like ? ", "%" + cvoSelect.getMedicalRecordNumber() + "%" };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and target_id = ? ", cvoSelect.getTargetId() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and customer_id = ? ", cvoSelect.getCustomerId() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and target_name like ? ", "%" + cvoSelect.getTargetName() + "%" };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and room_id = ? ", cvoSelect.getRoomId() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and room_name like ? ", "%" + cvoSelect.getRoomName() + "%" };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and doctor_name like ? ", "%" + cvoSelect.getDoctorName() + "%" };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and reserve_type = ? ", cvoSelect.getReserveType() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and order_status = ? ", cvoSelect.getOrderStatus() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and evaluate_status = ? ", cvoSelect.getEvaluateStatus() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and is_pay = ? ", cvoSelect.getIsPay() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and reserve_mode = ? ", cvoSelect.getReserveMode() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and create_time >= ? ", cvoSelect.getBeginTime() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and create_time <= ? ", cvoSelect.getEndTime() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and sp_id = ? ", cvoSelect.getSpId() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and service_mode = ? ", cvoSelect.getServiceMode() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and is_book_time = ? ", cvoSelect.getIsBookTime() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and is_deduct = ? ", cvoSelect.getIsDeduct() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and clinic_type = ? ", cvoSelect.getClinicType() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and create_name like ? ", "%" + cvoSelect.getCreateName() + "%" };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and is_delete = ? ", cvoSelect.getIsDelete() };
            arrParameter.add(objParameter);//  

            //  Bean 
            String[] sHqlArr = { sHql, sCount, cvoSelect.getSql(), cvoSelect.getOrderBy() };
            int[] iInfoArr = { cvoSelect.getPageNum(), cvoSelect.getLimitNum(), cvoSelect.getForUpdateWait() };
            SpringPageBean spbQuery = new SpringPageBean(sHqlArr, iInfoArr, arrParameter, getCustomSession());;
            List> lstResult = (List>) getHibernateTemplate().execute(spbQuery);
            mvoResult.setSuccess(true);
            mvoResult.setLstResult(lstResult);
            mvoResult.setTotalPage(spbQuery.getTotalPage());
            mvoResult.setTotalSize(spbQuery.getTotalNum());
        } catch (Exception e) {
            e.printStackTrace();
        }
        //  
        return mvoResult;
    }

    public CommonVo getOne(CommonVo cvoSelect) {
        String sHql = "from " + TABLE_NAME + " where 1=1 ";//  
        CommonVo cvoResult = null;
        try {
            Object[] objParameter = null;
            ArrayList arrParameter = new ArrayList();
            //  
            if (cvoSelect.getOrderBy() == null || "".equals(cvoSelect.getOrderBy())) {
                cvoSelect.setOrderBy(" order by id desc");
            }
            //  
            objParameter = new Object[] { " and id = ? ", cvoSelect.getId() };
            arrParameter.add(objParameter);//  
            objParameter = new Object[] { " and order_number = ? ", cvoSelect.getOrderNumber() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and medical_record_number = ? ", cvoSelect.getMedicalRecordNumber() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and target_id = ? ", cvoSelect.getTargetId() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and room_id = ? ", cvoSelect.getRoomId() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and sp_id = ? ", cvoSelect.getSpId() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and doctor_id = ? ", cvoSelect.getDoctorId() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and doctor_name like ? ", "%" + cvoSelect.getDoctorName() + "%" };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and reserve_type = ? ", cvoSelect.getReserveType() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and order_status = ? ", cvoSelect.getOrderStatus() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and customer_id = ? ", cvoSelect.getCustomerId() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and service_mode = ? ", cvoSelect.getServiceMode() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and clinic_type = ? ", cvoSelect.getClinicType() };
            arrParameter.add(objParameter);//
            objParameter = new Object[] { " and is_delete = ? ", cvoSelect.getIsDelete() };
            arrParameter.add(objParameter);//  
            //  Bean 
            String[] sHqlArr = { sHql, null, cvoSelect.getSql(), cvoSelect.getOrderBy() };
            int[] iInfoArr = { 1, 1 };
            SpringPageBean spbQuery = new SpringPageBean(sHqlArr, iInfoArr, arrParameter, getCustomSession());;
            //  
            List> lstResult = (List>) getHibernateTemplate().execute(spbQuery);
            if (lstResult != null && lstResult.size() > 0) {
                cvoResult = (CommonVo) lstResult.get(0);
                getHibernateTemplate().evict(cvoResult);//  
                lstResult.clear();
            }
            //  
            lstResult = null;
            arrParameter.clear();
            arrParameter = null;
            objParameter = null;
        } catch (Exception e) {
            e.printStackTrace();
        }
        //  
        return cvoResult;
    }

}

좋은 웹페이지 즐겨찾기