From 7b3cfa97fcd4da1db28d8b686a08fbab82248e35 Mon Sep 17 00:00:00 2001 From: falcon <9504402@qq.com> Date: Tue, 5 Mar 2019 15:09:36 +0800 Subject: [PATCH] =?UTF-8?q?(#5)=E7=AE=80=E5=8D=95=E7=9A=84HIS=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E6=95=B0=E6=8D=AE=E8=AE=B0=E5=BD=95=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Cmdjy/Cmdjy/App_Start/BundleConfig.cs | 3 +- WebSiteCode/Cmdjy/Cmdjy/Cmdjy.csproj | 9 +- WebSiteCode/Cmdjy/Cmdjy/Content/Site.css | 17 ++ .../Cmdjy/Controllers/HisInfoController.cs | 39 ++++ .../Dal/Wappers/HisPrescriptyInfoWapper.cs | 1 + .../Cmdjy/Cmdjy/Models/HisInfoModels.cs | 40 ++++ .../Cmdjy/Scripts/jquery.unobtrusive-ajax.js | 205 ++++++++++++++++++ .../Scripts/jquery.unobtrusive-ajax.min.js | 16 ++ .../Cmdjy/Cmdjy/Views/HisInfo/DrugList.cshtml | 23 ++ .../Cmdjy/Cmdjy/Views/HisInfo/Index.cshtml | 16 ++ .../Cmdjy/Views/HisInfo/PreFilter.cshtml | 15 ++ .../Views/HisInfo/PrescriptionList.cshtml | 24 ++ WebSiteCode/Cmdjy/Cmdjy/Views/Web.config | 2 + WebSiteCode/Cmdjy/Cmdjy/Web.config | 6 +- WebSiteCode/Cmdjy/Cmdjy/packages.config | 1 + 15 files changed, 412 insertions(+), 5 deletions(-) create mode 100644 WebSiteCode/Cmdjy/Cmdjy/Controllers/HisInfoController.cs create mode 100644 WebSiteCode/Cmdjy/Cmdjy/Models/HisInfoModels.cs create mode 100644 WebSiteCode/Cmdjy/Cmdjy/Scripts/jquery.unobtrusive-ajax.js create mode 100644 WebSiteCode/Cmdjy/Cmdjy/Scripts/jquery.unobtrusive-ajax.min.js create mode 100644 WebSiteCode/Cmdjy/Cmdjy/Views/HisInfo/DrugList.cshtml create mode 100644 WebSiteCode/Cmdjy/Cmdjy/Views/HisInfo/Index.cshtml create mode 100644 WebSiteCode/Cmdjy/Cmdjy/Views/HisInfo/PreFilter.cshtml create mode 100644 WebSiteCode/Cmdjy/Cmdjy/Views/HisInfo/PrescriptionList.cshtml diff --git a/WebSiteCode/Cmdjy/Cmdjy/App_Start/BundleConfig.cs b/WebSiteCode/Cmdjy/Cmdjy/App_Start/BundleConfig.cs index 4b08e3a..1f5bf84 100644 --- a/WebSiteCode/Cmdjy/Cmdjy/App_Start/BundleConfig.cs +++ b/WebSiteCode/Cmdjy/Cmdjy/App_Start/BundleConfig.cs @@ -8,7 +8,8 @@ namespace Cmdjy // 有关捆绑的详细信息,请访问 https://go.microsoft.com/fwlink/?LinkId=301862 public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle("~/bundles/jquery").Include( - "~/Scripts/jquery-{version}.js")); + "~/Scripts/jquery-{version}.js", + "~/Scripts/jquery.unobtrusive-ajax.js")); bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( "~/Scripts/jquery.validate*")); diff --git a/WebSiteCode/Cmdjy/Cmdjy/Cmdjy.csproj b/WebSiteCode/Cmdjy/Cmdjy/Cmdjy.csproj index 859184e..4af261a 100644 --- a/WebSiteCode/Cmdjy/Cmdjy/Cmdjy.csproj +++ b/WebSiteCode/Cmdjy/Cmdjy/Cmdjy.csproj @@ -186,6 +186,7 @@ + @@ -200,6 +201,7 @@ Global.asax + @@ -225,6 +227,8 @@ PreserveNewest + + @@ -253,11 +257,14 @@ + + + + - diff --git a/WebSiteCode/Cmdjy/Cmdjy/Content/Site.css b/WebSiteCode/Cmdjy/Cmdjy/Content/Site.css index 0cf9143..9183fa9 100644 --- a/WebSiteCode/Cmdjy/Cmdjy/Content/Site.css +++ b/WebSiteCode/Cmdjy/Cmdjy/Content/Site.css @@ -22,3 +22,20 @@ select, textarea { max-width: 280px; } + +table { + border: 1px solid #000; +} + + table caption { + } + + table th { + border: 1px solid #000; + padding: 1px; + } + + table td { + border: 1px solid #000; + padding: 1px; + } diff --git a/WebSiteCode/Cmdjy/Cmdjy/Controllers/HisInfoController.cs b/WebSiteCode/Cmdjy/Cmdjy/Controllers/HisInfoController.cs new file mode 100644 index 0000000..4c6a734 --- /dev/null +++ b/WebSiteCode/Cmdjy/Cmdjy/Controllers/HisInfoController.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; +using Cmdjy.Models; + +namespace Cmdjy.Controllers +{ + public class HisInfoController:Controller + { + /// + /// 架构主页 + /// + public ActionResult Index() { + return PartialView(); + } + /// + /// 信息筛选页面 + /// + /// + public ActionResult PreFilter() { + var model = new PreFilter { + Start = "0",End = "10", + }; + return PartialView(model); + } + + public ActionResult PrescriptionList(PreFilter filter) { + var model = HisInfo.GetPreInfos(filter); + return PartialView(model); + } + + public ActionResult DrugList(int preId) { + var model = HisInfo.GetDrugInfos(preId); + return PartialView(model); + } + } +} \ No newline at end of file diff --git a/WebSiteCode/Cmdjy/Cmdjy/Dal/Wappers/HisPrescriptyInfoWapper.cs b/WebSiteCode/Cmdjy/Cmdjy/Dal/Wappers/HisPrescriptyInfoWapper.cs index 96ea15d..f680526 100644 --- a/WebSiteCode/Cmdjy/Cmdjy/Dal/Wappers/HisPrescriptyInfoWapper.cs +++ b/WebSiteCode/Cmdjy/Cmdjy/Dal/Wappers/HisPrescriptyInfoWapper.cs @@ -2,6 +2,7 @@ { public class HisPrescriptyInfoWapper:Dal.Tables.HisPrescriptionInfo { + public HisPrescriptyInfoWapper() { } public HisPrescriptyInfoWapper(ws.HisPrescriptionInfo s) { if(s == null) return; foreach(var p in s.GetType().GetProperties()) { diff --git a/WebSiteCode/Cmdjy/Cmdjy/Models/HisInfoModels.cs b/WebSiteCode/Cmdjy/Cmdjy/Models/HisInfoModels.cs new file mode 100644 index 0000000..9b0cdfc --- /dev/null +++ b/WebSiteCode/Cmdjy/Cmdjy/Models/HisInfoModels.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using Cmdjy.Dal.Tables; +using Cmdjy.Dal.Queryes; +using Cmdjy.Dal; + +namespace Cmdjy.Models +{ + public static class HisInfo + { + public static IEnumerable GetPreInfos(PreFilter filter) { + using(var db = new DjyDbContext()) { + var qu = db.PrescriptionInfos.AsQueryable(); + if(filter == null) return qu.ToList(); + if(!string.IsNullOrEmpty(filter.Start) && int.TryParse(filter.Start,out var s)) { + qu = qu.Where(m => m.Id >= s); + } + if(!string.IsNullOrEmpty(filter.End) && int.TryParse(filter.End,out var e)) { + qu = qu.Where(m => m.Id < e); + } + return qu.ToList(); + } + } + + public static IEnumerable GetDrugInfos(int preId) { + using(var db = new DjyDbContext()) { + var qu = db.DrugInfos.Where(m => m.PrescriptionId == preId); + return qu.ToList(); + } + } + } + + public class PreFilter + { + public string Start { get; set; } + public string End { get; set; } + } +} \ No newline at end of file diff --git a/WebSiteCode/Cmdjy/Cmdjy/Scripts/jquery.unobtrusive-ajax.js b/WebSiteCode/Cmdjy/Cmdjy/Scripts/jquery.unobtrusive-ajax.js new file mode 100644 index 0000000..85a9b1d --- /dev/null +++ b/WebSiteCode/Cmdjy/Cmdjy/Scripts/jquery.unobtrusive-ajax.js @@ -0,0 +1,205 @@ +// Unobtrusive Ajax support library for jQuery +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// @version v3.2.6 +// +// Microsoft grants you the right to use these script files for the sole +// purpose of either: (i) interacting through your browser with the Microsoft +// website or online service, subject to the applicable licensing or use +// terms; or (ii) using the files as included with a Microsoft product subject +// to that product's license terms. Microsoft reserves all other rights to the +// files not expressly granted by Microsoft, whether by implication, estoppel +// or otherwise. Insofar as a script file is dual licensed under GPL, +// Microsoft neither took the code under GPL nor distributes it thereunder but +// under the terms set out in this paragraph. All notices and licenses +// below are for informational purposes only. + +/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */ +/*global window: false, jQuery: false */ + +(function ($) { + var data_click = "unobtrusiveAjaxClick", + data_target = "unobtrusiveAjaxClickTarget", + data_validation = "unobtrusiveValidation"; + + function getFunction(code, argNames) { + var fn = window, parts = (code || "").split("."); + while (fn && parts.length) { + fn = fn[parts.shift()]; + } + if (typeof (fn) === "function") { + return fn; + } + argNames.push(code); + return Function.constructor.apply(null, argNames); + } + + function isMethodProxySafe(method) { + return method === "GET" || method === "POST"; + } + + function asyncOnBeforeSend(xhr, method) { + if (!isMethodProxySafe(method)) { + xhr.setRequestHeader("X-HTTP-Method-Override", method); + } + } + + function asyncOnSuccess(element, data, contentType) { + var mode; + + if (contentType.indexOf("application/x-javascript") !== -1) { // jQuery already executes JavaScript for us + return; + } + + mode = (element.getAttribute("data-ajax-mode") || "").toUpperCase(); + $(element.getAttribute("data-ajax-update")).each(function (i, update) { + var top; + + switch (mode) { + case "BEFORE": + $(update).prepend(data); + break; + case "AFTER": + $(update).append(data); + break; + case "REPLACE-WITH": + $(update).replaceWith(data); + break; + default: + $(update).html(data); + break; + } + }); + } + + function asyncRequest(element, options) { + var confirm, loading, method, duration; + + confirm = element.getAttribute("data-ajax-confirm"); + if (confirm && !window.confirm(confirm)) { + return; + } + + loading = $(element.getAttribute("data-ajax-loading")); + duration = parseInt(element.getAttribute("data-ajax-loading-duration"), 10) || 0; + + $.extend(options, { + type: element.getAttribute("data-ajax-method") || undefined, + url: element.getAttribute("data-ajax-url") || undefined, + cache: (element.getAttribute("data-ajax-cache") || "").toLowerCase() === "true", + beforeSend: function (xhr) { + var result; + asyncOnBeforeSend(xhr, method); + result = getFunction(element.getAttribute("data-ajax-begin"), ["xhr"]).apply(element, arguments); + if (result !== false) { + loading.show(duration); + } + return result; + }, + complete: function () { + loading.hide(duration); + getFunction(element.getAttribute("data-ajax-complete"), ["xhr", "status"]).apply(element, arguments); + }, + success: function (data, status, xhr) { + asyncOnSuccess(element, data, xhr.getResponseHeader("Content-Type") || "text/html"); + getFunction(element.getAttribute("data-ajax-success"), ["data", "status", "xhr"]).apply(element, arguments); + }, + error: function () { + getFunction(element.getAttribute("data-ajax-failure"), ["xhr", "status", "error"]).apply(element, arguments); + } + }); + + options.data.push({ name: "X-Requested-With", value: "XMLHttpRequest" }); + + method = options.type.toUpperCase(); + if (!isMethodProxySafe(method)) { + options.type = "POST"; + options.data.push({ name: "X-HTTP-Method-Override", value: method }); + } + + // change here: + // Check for a Form POST with enctype=multipart/form-data + // add the input file that were not previously included in the serializeArray() + // set processData and contentType to false + var $element = $(element); + if ($element.is("form") && $element.attr("enctype") == "multipart/form-data") { + var formdata = new FormData(); + $.each(options.data, function (i, v) { + formdata.append(v.name, v.value); + }); + $("input[type=file]", $element).each(function () { + var file = this; + $.each(file.files, function (n, v) { + formdata.append(file.name, v); + }); + }); + $.extend(options, { + processData: false, + contentType: false, + data: formdata + }); + } + // end change + + $.ajax(options); + } + + function validate(form) { + var validationInfo = $(form).data(data_validation); + return !validationInfo || !validationInfo.validate || validationInfo.validate(); + } + + $(document).on("click", "a[data-ajax=true]", function (evt) { + evt.preventDefault(); + asyncRequest(this, { + url: this.href, + type: "GET", + data: [] + }); + }); + + $(document).on("click", "form[data-ajax=true] input[type=image]", function (evt) { + var name = evt.target.name, + target = $(evt.target), + form = $(target.parents("form")[0]), + offset = target.offset(); + + form.data(data_click, [ + { name: name + ".x", value: Math.round(evt.pageX - offset.left) }, + { name: name + ".y", value: Math.round(evt.pageY - offset.top) } + ]); + + setTimeout(function () { + form.removeData(data_click); + }, 0); + }); + + $(document).on("click", "form[data-ajax=true] :submit", function (evt) { + var name = evt.currentTarget.name, + target = $(evt.target), + form = $(target.parents("form")[0]); + + form.data(data_click, name ? [{ name: name, value: evt.currentTarget.value }] : []); + form.data(data_target, target); + + setTimeout(function () { + form.removeData(data_click); + form.removeData(data_target); + }, 0); + }); + + $(document).on("submit", "form[data-ajax=true]", function (evt) { + var clickInfo = $(this).data(data_click) || [], + clickTarget = $(this).data(data_target), + isCancel = clickTarget && (clickTarget.hasClass("cancel") || clickTarget.attr('formnovalidate') !== undefined); + evt.preventDefault(); + if (!isCancel && !validate(this)) { + return; + } + asyncRequest(this, { + url: this.action, + type: this.method || "GET", + data: clickInfo.concat($(this).serializeArray()) + }); + }); +}(jQuery)); diff --git a/WebSiteCode/Cmdjy/Cmdjy/Scripts/jquery.unobtrusive-ajax.min.js b/WebSiteCode/Cmdjy/Cmdjy/Scripts/jquery.unobtrusive-ajax.min.js new file mode 100644 index 0000000..bccd1f7 --- /dev/null +++ b/WebSiteCode/Cmdjy/Cmdjy/Scripts/jquery.unobtrusive-ajax.min.js @@ -0,0 +1,16 @@ +// Unobtrusive Ajax support library for jQuery +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// @version v3.2.6 +// +// Microsoft grants you the right to use these script files for the sole +// purpose of either: (i) interacting through your browser with the Microsoft +// website or online service, subject to the applicable licensing or use +// terms; or (ii) using the files as included with a Microsoft product subject +// to that product's license terms. Microsoft reserves all other rights to the +// files not expressly granted by Microsoft, whether by implication, estoppel +// or otherwise. Insofar as a script file is dual licensed under GPL, +// Microsoft neither took the code under GPL nor distributes it thereunder but +// under the terms set out in this paragraph. All notices and licenses +// below are for informational purposes only. +!function(t){function a(t,a){for(var e=window,r=(t||"").split(".");e&&r.length;)e=e[r.shift()];return"function"==typeof e?e:(a.push(t),Function.constructor.apply(null,a))}function e(t){return"GET"===t||"POST"===t}function r(t,a){e(a)||t.setRequestHeader("X-HTTP-Method-Override",a)}function n(a,e,r){var n;r.indexOf("application/x-javascript")===-1&&(n=(a.getAttribute("data-ajax-mode")||"").toUpperCase(),t(a.getAttribute("data-ajax-update")).each(function(a,r){switch(n){case"BEFORE":t(r).prepend(e);break;case"AFTER":t(r).append(e);break;case"REPLACE-WITH":t(r).replaceWith(e);break;default:t(r).html(e)}}))}function i(i,u){var o,c,d,s;if(o=i.getAttribute("data-ajax-confirm"),!o||window.confirm(o)){c=t(i.getAttribute("data-ajax-loading")),s=parseInt(i.getAttribute("data-ajax-loading-duration"),10)||0,t.extend(u,{type:i.getAttribute("data-ajax-method")||void 0,url:i.getAttribute("data-ajax-url")||void 0,cache:"true"===(i.getAttribute("data-ajax-cache")||"").toLowerCase(),beforeSend:function(t){var e;return r(t,d),e=a(i.getAttribute("data-ajax-begin"),["xhr"]).apply(i,arguments),e!==!1&&c.show(s),e},complete:function(){c.hide(s),a(i.getAttribute("data-ajax-complete"),["xhr","status"]).apply(i,arguments)},success:function(t,e,r){n(i,t,r.getResponseHeader("Content-Type")||"text/html"),a(i.getAttribute("data-ajax-success"),["data","status","xhr"]).apply(i,arguments)},error:function(){a(i.getAttribute("data-ajax-failure"),["xhr","status","error"]).apply(i,arguments)}}),u.data.push({name:"X-Requested-With",value:"XMLHttpRequest"}),d=u.type.toUpperCase(),e(d)||(u.type="POST",u.data.push({name:"X-HTTP-Method-Override",value:d}));var p=t(i);if(p.is("form")&&"multipart/form-data"==p.attr("enctype")){var f=new FormData;t.each(u.data,function(t,a){f.append(a.name,a.value)}),t("input[type=file]",p).each(function(){var a=this;t.each(a.files,function(t,e){f.append(a.name,e)})}),t.extend(u,{processData:!1,contentType:!1,data:f})}t.ajax(u)}}function u(a){var e=t(a).data(d);return!e||!e.validate||e.validate()}var o="unobtrusiveAjaxClick",c="unobtrusiveAjaxClickTarget",d="unobtrusiveValidation";t(document).on("click","a[data-ajax=true]",function(t){t.preventDefault(),i(this,{url:this.href,type:"GET",data:[]})}),t(document).on("click","form[data-ajax=true] input[type=image]",function(a){var e=a.target.name,r=t(a.target),n=t(r.parents("form")[0]),i=r.offset();n.data(o,[{name:e+".x",value:Math.round(a.pageX-i.left)},{name:e+".y",value:Math.round(a.pageY-i.top)}]),setTimeout(function(){n.removeData(o)},0)}),t(document).on("click","form[data-ajax=true] :submit",function(a){var e=a.currentTarget.name,r=t(a.target),n=t(r.parents("form")[0]);n.data(o,e?[{name:e,value:a.currentTarget.value}]:[]),n.data(c,r),setTimeout(function(){n.removeData(o),n.removeData(c)},0)}),t(document).on("submit","form[data-ajax=true]",function(a){var e=t(this).data(o)||[],r=t(this).data(c),n=r&&(r.hasClass("cancel")||void 0!==r.attr("formnovalidate"));a.preventDefault(),(n||u(this))&&i(this,{url:this.action,type:this.method||"GET",data:e.concat(t(this).serializeArray())})})}(jQuery); \ No newline at end of file diff --git a/WebSiteCode/Cmdjy/Cmdjy/Views/HisInfo/DrugList.cshtml b/WebSiteCode/Cmdjy/Cmdjy/Views/HisInfo/DrugList.cshtml new file mode 100644 index 0000000..14fc411 --- /dev/null +++ b/WebSiteCode/Cmdjy/Cmdjy/Views/HisInfo/DrugList.cshtml @@ -0,0 +1,23 @@ +@model IEnumerable + + + + + + + + + + + + + @foreach(var item in Model) { + + + + + + + } + +
药品信息表
流水号处方号药品医保编码药品名称
@item.Id@item.PrescriptionId@item.DrugNo@item.DrugName
diff --git a/WebSiteCode/Cmdjy/Cmdjy/Views/HisInfo/Index.cshtml b/WebSiteCode/Cmdjy/Cmdjy/Views/HisInfo/Index.cshtml new file mode 100644 index 0000000..b22d4d5 --- /dev/null +++ b/WebSiteCode/Cmdjy/Cmdjy/Views/HisInfo/Index.cshtml @@ -0,0 +1,16 @@ + + + + + + + @ViewBag.Title - 我的 ASP.NET 应用程序 + @Styles.Render("~/Content/css") + @Scripts.Render("~/bundles/modernizr") + + + @Html.Action("PreFilter") + @Scripts.Render("~/bundles/jquery") + @Scripts.Render("~/bundles/bootstrap") + + diff --git a/WebSiteCode/Cmdjy/Cmdjy/Views/HisInfo/PreFilter.cshtml b/WebSiteCode/Cmdjy/Cmdjy/Views/HisInfo/PreFilter.cshtml new file mode 100644 index 0000000..0165d37 --- /dev/null +++ b/WebSiteCode/Cmdjy/Cmdjy/Views/HisInfo/PreFilter.cshtml @@ -0,0 +1,15 @@ +@model PreFilter + +
+ 处方筛选 +
+ @using(Ajax.BeginForm("PrescriptionList",new AjaxOptions { + UpdateTargetId = "preList", + })) { + + + + } +
+
+
\ No newline at end of file diff --git a/WebSiteCode/Cmdjy/Cmdjy/Views/HisInfo/PrescriptionList.cshtml b/WebSiteCode/Cmdjy/Cmdjy/Views/HisInfo/PrescriptionList.cshtml new file mode 100644 index 0000000..d73ed80 --- /dev/null +++ b/WebSiteCode/Cmdjy/Cmdjy/Views/HisInfo/PrescriptionList.cshtml @@ -0,0 +1,24 @@ +@model IEnumerable + + + + + + + + + + + + + @foreach(var item in Model) { + + + + + + + } + +
处方信息表
流水号处方号处方类型药品列表
@item.Id@item.PrescriptionNo@item.Type.ToString()@Ajax.ActionLink("药品","DrugList",new { preId = item.Id },new AjaxOptions { UpdateTargetId = "drugList",})
+
\ No newline at end of file diff --git a/WebSiteCode/Cmdjy/Cmdjy/Views/Web.config b/WebSiteCode/Cmdjy/Cmdjy/Views/Web.config index 1aea980..8dde875 100644 --- a/WebSiteCode/Cmdjy/Cmdjy/Views/Web.config +++ b/WebSiteCode/Cmdjy/Cmdjy/Views/Web.config @@ -18,6 +18,8 @@ + + diff --git a/WebSiteCode/Cmdjy/Cmdjy/Web.config b/WebSiteCode/Cmdjy/Cmdjy/Web.config index 474f0ca..05bdb02 100644 --- a/WebSiteCode/Cmdjy/Cmdjy/Web.config +++ b/WebSiteCode/Cmdjy/Cmdjy/Web.config @@ -14,15 +14,15 @@ - + - + - + diff --git a/WebSiteCode/Cmdjy/Cmdjy/packages.config b/WebSiteCode/Cmdjy/Cmdjy/packages.config index 850dd99..d2653ea 100644 --- a/WebSiteCode/Cmdjy/Cmdjy/packages.config +++ b/WebSiteCode/Cmdjy/Cmdjy/packages.config @@ -22,6 +22,7 @@ +