123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020 |
- //@ sourceURL=west_pharmacy_send.js
- var LODOP; //声明为全局变量
- var zsdPrintIndex;
- var bqPrintIndex;
- $(function () {
- init_daterangepicker();
- initTbTable();
- //重置查询参数
- $('#btn_clean').click(function () {
- cleanParams();
- });
- $("#btn_query").click(function (t) {
- initTbTable();
- });
- $("#btn_ty").click(function (t) {
- saveRefundMedicine();
- });
- $(".selectpicker").selectpicker({
- dropuAuto: false
- });
- });
- /**
- * 获取按钮组选择的下标
- * @param id
- * @returns {number}
- */
- function getIndex(id) {
- var index = 0;
- var item = $("#" + id).find("button");
- for (var i = 0; i <= item.length; i++) {
- if ($(item[i]).hasClass("btn-primary")) {
- index = i;
- break;
- }
- }
- return index;
- }
- /**
- * 设置病人id
- */
- function setPatientId() {
- var patientId_or_cardNo = $("#patientId_or_cardNo").val();
- if (patientId_or_cardNo == '') {
- return $("#patientId").val("");
- }
- $.ajax({
- type: "GET",
- url: '/thmz/getByIcCardNo?icCardNo=' + patientId_or_cardNo,
- contentType: "application/json;charset=UTF-8",
- dataType: "json",
- headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
- success: function (res) {
- if (res == '401' || res == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- if (res.code == 0) {
- if (res.data != null) {
- $("#patientId").val(res.data.patientId);
- } else {
- $("#patientId").val(patientId_or_cardNo);
- }
- }
- }
- });
- }
- /**
- * 列表类型按钮切换事件
- * @param object
- * @param realIndex 下标
- */
- function sendRefundButtonChange(object, realIndex) {
- $("#send_refund_group").find("button").each(function (index, element) {
- if ($(element).hasClass("btn-primary")) {
- $(element).removeClass("btn-primary").addClass("btn-default");
- }
- });
- if (realIndex == 0) {
- $("#confirmFlagSearch").empty();
- $("#confirmFlagSearch").append("<option value='0' selected>未发药</option>");
- $("#confirmFlagSearch").append("<option value='1'>已发药</option>");
- $("#confirmFlagSearch").selectpicker('refresh');
- $("#tb_table_right_ty").css("display", "none");
- $("#btn_ty").addClass("hidden");
- } else {
- $("#confirmFlagSearch").empty();
- $("#confirmFlagSearch").append("<option value='2' selected>待退药</option>");
- $("#confirmFlagSearch").append("<option value='3'>已退药</option>");
- $("#confirmFlagSearch").selectpicker('refresh');
- $("#tb_table_right_ty").css("display", "");
- $("#btn_ty").removeClass("hidden");
- }
- $(object).removeClass("btn-default").addClass("btn-primary");
- initTbTable();
- }
- /**
- * 发药处理
- */
- function sendMedicineProcessing(realNo, groupNo, orderNo, receiptNo, times, patientId, name) {
- var temp = {
- groupNo: groupNo,
- realNo: realNo,
- orderNo: orderNo,
- receiptNo: receiptNo,
- times: times,
- patientId: patientId,
- windowsNoYf: '04'
- };
- toMedicineWebSocket.send(JSON.stringify({patient_id: patientId, name: name, type: 'fy'}));
- /*$.ajax({
- type: "POST",
- url: '/thmz/sendMedicineProcessing',
- contentType: "application/json;charset=UTF-8",
- dataType: "json",
- headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
- data: JSON.stringify(temp),
- success: function (res) {
- if (res == '401' || res == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- if (res.code == 0) {
- successMesage(res);
- initTbTable();
- toMedicineWebSocket.send(JSON.stringify({patient_id:patientId,name:name,type:'fy'}));
- } else {
- errorMesage(res);
- }
- }
- });*/
- }
- /**
- * 查询处方信息
- */
- function initTbTable() {
- var sendRefundGroup = getIndex("send_refund_group");
- var visible = false;
- var url = "/thmz/getSendMedicinePrescription";
- if (sendRefundGroup == 1) {
- visible = true;
- url = "/thmz/getYfRefundMedicine";
- $("#tb_table_div").attr("class", "col-md-7 col-sm-7 col-xs-12");
- } else {
- $("#tb_table_div").attr("class", "");
- }
- $('#tb_table').bootstrapTable("destroy");
- $('#tb_table').bootstrapTable({
- url: url, //请求后台的URL(*)
- method: 'post', //请求方式(*)
- striped: true, //是否显示行间隔色
- cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
- pagination: true, //是否显示分页(*)
- sortable: true, //是否启用排序
- sortOrder: "asc", //排序方式
- queryParams: queryParams, //传递参数(*)
- sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
- pageNumber: 1, //初始化加载第一页,默认第一页
- pageSize: 10, //每页的记录行数(*)
- pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
- search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
- singleSelect: true, // 单选checkbox
- strictSearch: true,
- showColumns: false, //是否显示所有的列
- showRefresh: false, //是否显示刷新按钮
- minimumCountColumns: 2, //最少允许的列数
- clickToSelect: true, //是否启用点击选中行
- uniqueId: "ID", //每一行的唯一标识,一般为主键列
- showToggle: false, //是否显示详细视图和列表视图的切换按钮
- cardView: false, //是否显示详细视图
- detailView: false,
- //rowStyle:rowStyle,//通过自定义函数设置行样式
- ajaxOptions: {
- headers: {
- 'Accept': 'application/json',
- 'Authorization': 'Bearer ' + localStorage.getItem("token")
- }
- },
- columns: [
- {
- field: 'checked',
- checkbox: true,
- align: "center",
- valign: 'middle',
- visible: visible,
- formatter: function (value, row, index) {
- if (index == 0 && sendRefundGroup == 1) {
- fitfymx(row.patientId, row.times, row.receiptNo, row.orderNo, row.groupNo);
- return {
- checked: true//设置选中
- };
- }
- }
- }, {
- field: 'patientId',
- title: '病人ID',
- align: "center",
- valign: 'middle'
- }, {
- field: 'name',
- title: '姓名',
- align: "center",
- valign: 'middle'
- }, {
- field: 'orderNo',
- title: '处方号',
- align: "center",
- valign: 'middle'
- }, {
- field: 'warnDeptName',
- title: '申请科室',
- align: "center",
- valign: 'middle',
- }, {
- field: 'employeeName',
- title: '医生',
- align: "center",
- valign: 'middle',
- formatter: function (value, row, index) {
- if (value == null) {
- return row.doctorName;
- }
- return value;
- }
- }, {
- field: 'chargeDate',
- title: '缴费日期',
- align: "center",
- valign: 'middle',
- formatter: function (value, row, index) {
- if (value != null && value != "") {
- return format(value, "yyyy-MM-dd HH:mm:ss");
- }
- return "";
- }
- }, {
- field: 'realNo',
- title: '流水号',
- align: "center",
- valign: 'middle',
- }, {
- field: 'confirmTime',
- title: '确认日期',
- align: "center",
- valign: 'middle',
- visible: visible,
- formatter: function (value, row, index) {
- if (value != null && value != "") {
- return format(value, "yyyy-MM-dd HH:mm:ss");
- }
- return "";
- }
- }
- /*, {
- field: 'doctorFlag',
- title: '医生处方',
- align: "center",
- valign: 'middle',
- formatter: function (value, row, index) {
- return value == 1 ? "是" : "否";
- }
- }*/
- , {
- title: '操作',
- align: "center",
- valign: 'middle',
- visible: !visible,
- formatter: function (value, row, index) {
- var str = "";
- if (sendRefundGroup == 0) {
- str = '<button type="button" class="registration-no-color-foot-button" title="打印" onclick="printInjectionOralMedicine(\'' + row.patientId + '\',\'' + row.orderNo + '\',\'' + row.realNo + '\',\'' + row.times + '\',\'' + row.receiptNo + '\');" style="color: #35D082;"><i class="fa fa-print"></i></button>';
- str += '<button type="button" class="registration-no-color-foot-button" title="叫号" onclick="callNumber(\'' + row.patientId + '\',\'' + row.name + '\')"><i class="glyphicon glyphicon-bullhorn"></i></button>';
- str += '<button type="button" class="registration-no-color-foot-button" title="发药" onclick="sendMedicineProcessing(\'' + row.realNo + '\',\'' + 71 + '\',\'' + row.orderNo + '\',\'' + row.receiptNo + '\',\'' + row.times + '\',\'' + row.patientId + '\',\'' + row.name + '\')"><i class="glyphicon glyphicon-send"></i></button>';
- str += '<button type="button" class="registration-no-color-foot-button" title="详细" onclick="prescriptionDetail(\'' + row.realNo + '\',\'' + 71 + '\',\'' + row.orderNo + '\',\'' + row.receiptNo + '\',\'' + row.times + '\',\'' + row.patientId + '\')"><i class="fa fa-plus"></i></button>';
- }
- return str;
- }
- }
- ],
- onClickRow: function (row) {
- if (sendRefundGroup == 1) {
- fitfymx(row.patientId, row.times, row.receiptNo, row.orderNo, row.groupNo);
- }
- },
- responseHandler: function (res) {
- if (res == '401' || res == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- var ress = eval(res);
- if (ress.code == -1) {
- if (ress.message != null && ress.message != '') {
- new PNotify({
- title: '错误提示',
- text: ress.message,
- type: 'error',
- hide: true,
- styling: 'bootstrap3'
- });
- }
- return {
- "total": 0,//总页数
- "rows": {} //数据
- };
- }
- return {
- "total": ress.total,//总页数
- "rows": ress.data //数据
- };
- },
- });
- }
- /**
- * 打印注射卡口服药品
- */
- function printInjectionOralMedicine(patientId, orderNo, realNo, times, receiptNo) {
- var tem = {
- patientId: patientId,
- orderNo: orderNo,
- realNo: realNo,
- times: times,
- receiptNo: receiptNo,
- groupNo: 71
- };
- $.ajax({
- type: "POST",
- url: '/thmz/getPrintInjectionData',
- contentType: "application/json;charset=UTF-8",
- dataType: "json",
- headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
- data: JSON.stringify(tem),
- success: function (res) {
- if (res == '401' || res == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- if (res.code == 0) {
- var injections = new Array();//注射液
- var drugs = new Array();//普通药品
- for (let i = 0; i < res.data.length; i++) {
- if (res.data[i].classCode == 2 || res.data[i].classCode == 7 ) {
- injections[injections.length] = res.data[i];
- } else if(res.data[i].classCode != 6 && res.data[i].classCode != 9){
- drugs[drugs.length] = res.data[i];
- }
- }
- if(injections.length == 0 && drugs.length == 0){
- return new PNotify({
- title: '操作成功',
- text: '当前处方,无需打印注射单和标签',
- type: 'success',
- hide: true,
- styling: 'bootstrap3'
- });
- }
- setPrint();
- if (injections.length > 0) {
- $(".zsd_two_tr").remove();
- $(".zsd_one_tr").remove();
- $(".zsd_yp_tr").remove();
- $("#dateTime").html(format(new Date(), "yyyy-MM-dd HH:mm:ss"));
- var sex = '';
- if (res.data[0].sex == 1) {
- sex = '男';
- } else if (res.data[0].sex == 2) {
- sex = '女';
- } else {
- sex = '未知';
- }
- var patientInfoHtm = '<tr class="zsd_one_tr">\n' +
- ' <td style="vertical-align: middle !important;width: 35px;text-align: center;"\n' +
- ' valign="top">姓名\n' +
- ' </td>\n' +
- ' <td style="vertical-align: middle !important;width: 75px;">\n' + res.data[0].name +
- ' </td>\n' +
- ' <td style="vertical-align: middle !important;width: 55px;text-align: center;">\n' +
- ' 性别\n' +
- ' </td>\n' +
- ' <td style="vertical-align: middle !important;width: 45px;text-align: left;">\n' + sex +
- ' </td>\n' +
- ' <td style="vertical-align: middle !important;width: 55px;text-align: center;">\n' +
- ' 年龄\n' +
- ' </td>\n' +
- ' <td style="vertical-align: middle !important;width: 55px;text-align: left;">\n' + res.data[0].age +
- ' </td>\n' +
- ' <td style="vertical-align: middle !important;width: 65px;text-align: center;">\n' +
- ' ID号\n' +
- ' </td>\n' +
- ' <td style="vertical-align: middle !important;width: 55px;text-align: left;">\n' + res.data[0].patientId +
- ' </td>\n' +
- ' <td style="vertical-align: middle !important;width: 55px;text-align: center;">\n' +
- ' 诊断\n' +
- ' </td>\n' +
- ' <td style="vertical-align: middle !important;width: 135px;text-align: left;">\n' + res.data[0].icdText +
- ' </td>\n' +
- ' <td style="vertical-align: middle !important;width: 55px;text-align: center;">\n' +
- ' 医生\n' +
- ' </td>\n' +
- ' <td style="vertical-align: middle !important;width: 55px;text-align: left;">\n' + res.data[0].employeeName +
- ' </td>\n' +
- ' </tr>';
- $('#zsd_one').prepend(patientInfoHtm);
- var zsdYpHtm = '';
- for (let i = 0; i < injections.length; i++) {
- let data = injections[i];
- let manufactoryName = (data.manufactoryName == null || data.manufactoryName == '') ? '' : '(' + data.manufactoryName + ')';
- let groupOrder = (data.groupOrder == '' || data.groupOrder == null) ? data.chargeItemCode : data.groupOrder;
- zsdYpHtm += '<tr class="zsd_yp_tr">\n' +
- ' <td> </td>\n' +
- ' <td style="vertical-align: middle !important;width: 10px;text-align: center;">\n' + groupOrder +
- ' </td>\n' +
- ' <td style="vertical-align: middle !important;width: 200px;text-align: center;">\n' + data.drugname + manufactoryName +
- ' </td>\n' +
- ' <td style="vertical-align: middle !important;width: 60px;text-align: center;">\n' + data.drugQuan +
- ' </td>\n' +
- ' <td style="vertical-align: middle !important;width: 60px;text-align: center;">\n' + data.drugUnitName +
- ' </td>\n' +
- ' <td style="vertical-align: middle !important;width: 120px;text-align: center;">\n' + data.printName +
- ' </td>\n' +
- ' <td style="vertical-align: middle !important;width: 60px;text-align: center;">\n' + data.frequency +
- ' </td>\n' +
- ' <td style="vertical-align: middle !important;width: 60px;text-align: center;">\n' + data.orderDays +
- ' </td>\n' +
- ' <td style="vertical-align: middle !important;width: 120px;text-align: center;">\n' + data.specification +
- ' </td>\n' +
- ' </tr>';
- }
- $('#zsd_yp').append(zsdYpHtm);
- var htm = '';
- for (let i = 0; i < 10; i++) {
- htm += '<tr class="zsd_two_tr">\n' +
- ' <td style="vertical-align: middle !important;width: 30px;text-align: center;"> 月 日</td>\n' +
- ' <td style="vertical-align: middle !important;width: 30px;text-align: right;"></td>\n' +
- ' <td style="vertical-align: middle !important;width: 30px;text-align: right;"></td>\n' +
- ' <td style="vertical-align: middle !important;width: 30px;text-align: right;"></td>\n' +
- ' <td style="vertical-align: middle !important;width: 30px;text-align: right;"></td>\n' +
- ' <td style="vertical-align: middle !important;width: 30px;text-align: center;"> 月 日</td>\n' +
- ' <td style="vertical-align: middle !important;width: 30px;text-align: right;"></td>\n' +
- ' <td style="vertical-align: middle !important;width: 30px;text-align: right;"></td>\n' +
- ' <td style="vertical-align: middle !important;width: 30px;text-align: right;"></td>\n' +
- ' <td style="vertical-align: middle !important;width: 30px;text-align: right;"></td>\n' +
- ' </tr>';
- }
- $('#zsd_two').append(htm);
- LODOP = getLodop();
- LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "泰和医院门、急诊注射单");
- LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
- //设置默认打印机
- LODOP.SET_PRINTER_INDEX(zsdPrintIndex);
- LODOP.SET_PRINT_PAGESIZE(2, '148mm', '210mm', "CreateCustomPage");
- LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
- LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
- LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "泰和医院门、急诊注射单");//对新建的纸张重命名
- LODOP.ADD_PRINT_HTM("10mm", "5mm", "148mm", "210mm", $("div[id='print_view_zsd']").html());
- LODOP.PRINT();
- //LODOP.PREVIEW();
- }
- if(drugs.length > 0){
- LODOP = getLodop();
- LODOP.PRINT_INITA(6, 0, "60mm", "80mm", "患者药品标签");
- LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
- //设置默认打印机
- LODOP.SET_PRINTER_INDEX(bqPrintIndex);
- LODOP.SET_PRINT_PAGESIZE(2, '60mm', '80mm', "CreateCustomPage");
- LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "60mm");
- LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "80mm");
- LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "患者药品标签");//对新建的纸张重命名
- for (let j = 0; j < drugs.length; j++) {
- for (var key in drugs[j]) {
- $("#ypbq_" + key + "").attr("value", drugs[j][key]);
- }
- $("#dataTime").attr("value",format(new Date(), "yyyy-MM-dd HH:mm"));
- $("#ypbq_sex").attr("value",getSex(drugs[0].sex));
- $("#ypbq_age").attr("value",drugs[0].age);
- $("#NO").attr("value",j+1+"/"+drugs.length);
- //每次用量计算 通过一次剂量单位截取同单位的最小药品规格
- //drugs[j].specification.slice();
- let weight = (drugs[j].weight==''|| drugs[j].weight==null)?drugs[j].volum:drugs[j].weight;
- $("#ypbq_comm").attr("value",drugs[j].comm+',每次'+drugs[j].drugQuan/weight+drugs[j].miniUnitName);
- LODOP.ADD_PRINT_HTM("5mm", "5mm", "RightMargin:5mm","BottomMargin:5mm", $("div[id='print_view_bq']").html());
- LODOP.NewPage();//下一页
- }
- LODOP.PRINT();
- //LODOP.PREVIEW();
- }
- } else {
- errorMesage(res);
- }
- }
- });
- }
- /**
- * 返回性别
- */
- function getSex(code) {
- var sex = '';
- if (code == 1) {
- sex = '男';
- } else if (code == 2) {
- sex = '女';
- } else {
- sex = '未知';
- }
- return sex;
- }
- /**
- * 构建列表查询参数
- * @param params
- * @returns {{mzChargeDetail: {patientId: string | number | string[] | undefined | jQuery, warnDept: string | number | string[] | undefined | jQuery, doctorCode: string | number | string[] | undefined | jQuery, name: string | number | string[] | undefined | jQuery, payMark: number}, beginTime: Date, endTime: Date, pageSize: *, pageIndex: number}}
- */
- function queryParams(params) {
- var rePortRangeArr = getRePortRangeArr();
- var temp = {
- pageSize: params.limit, //页面大小
- pageIndex: params.offset / params.limit, //页码
- beginDate: rePortRangeArr[0],
- endDate: rePortRangeArr[1],
- name: $("#nameSearch").val() == "" ? null : $("#nameSearch").val(),
- patientId: $("#patientId").val() == "" ? null : $("#patientId").val(),
- confirmFlag: $("#confirmFlagSearch").val(),
- realNo: $("#realNoSearch").val() == "" ? null : $("#realNoSearch").val(),
- groupNoOut: '71'
- };
- return temp;
- };
- /**
- * 获取时间选择器的时间数组
- * @returns {string[]}
- */
- function getRePortRangeArr() {
- var rePortRange = $('#reportrange span').html();
- var rePortRangeArr = rePortRange.split(" - ");
- rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00"
- rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59"
- return rePortRangeArr;
- }
- /**
- * 清空查询条件
- */
- function cleanParams() {
- $('#reportrange span').html(moment().format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD'));
- $("#nameSearch").val(null);
- $("#patientId_or_cardNo").val(null);
- $("#patientIdSearch").val(null);
- $("#realNoSearch").val(null);
- var sendRefundGroup = getIndex("send_refund_group");
- sendRefundGroup == 0 ? $("#confirmFlagSearch").selectpicker('val', 0) : $("#confirmFlagSearch").selectpicker('val', 2);
- $("#confirmFlagSearch").selectpicker('refresh');
- $("#patientId_or_cardNo").focus();
- }
- /**
- * 查询病人处方明细
- */
- var $table;
- function prescriptionDetail(realNo, groupNo, orderNo, receiptNo, times, patientId) {
- var temp = {
- groupNo: groupNo,
- realNo: realNo,
- orderNo: orderNo,
- receiptNo: receiptNo,
- times: times,
- patientId: patientId
- };
- $('#tb_table_right').bootstrapTable("destroy");
- $table = $('#tb_table_right').bootstrapTable({
- url: '/thmz/getFyclPrescriptionDetail', //请求后台的URL(*)
- method: 'POST', //请求方式(*)
- striped: true, //是否显示行间隔色
- cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
- pagination: true, //是否显示分页(*)
- sortable: true, //是否启用排序
- sortOrder: "asc", //排序方式
- queryParams: JSON.stringify(temp), //传递参数(*)
- sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
- pageNumber: 1, //初始化加载第一页,默认第一页
- pageSize: 10, //每页的记录行数(*)
- pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
- search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
- strictSearch: true,
- showColumns: false, //是否显示所有的列
- showRefresh: false, //是否显示刷新按钮
- minimumCountColumns: 2, //最少允许的列数
- clickToSelect: true, //是否启用点击选中行
- uniqueId: "ID", //每一行的唯一标识,一般为主键列
- showToggle: false, //是否显示详细视图和列表视图的切换按钮
- cardView: false, //是否显示详细视图
- detailView: false,
- //rowStyle:rowStyle,//通过自定义函数设置行样式
- ajaxOptions: {
- headers: {
- 'Accept': 'application/json',
- 'Authorization': 'Bearer ' + localStorage.getItem("token")
- }
- },
- columns: [
- {
- field: 'location',
- title: '货位号',
- align: "center",
- valign: 'middle'
- }, {
- field: 'drugname',
- title: '品名',
- align: "center",
- valign: 'middle',
- }, {
- field: 'specification',
- title: '规格',
- align: "center",
- valign: 'middle',
- }, {
- field: 'quantity',
- title: '<span style="color: green">数量</span>',
- align: "center",
- valign: 'middle',
- formatter: function (value, row, index) {
- return '<span style="color: green">' + value + '</span>'
- }
- }, {
- field: 'ypUnitName',
- title: '单位',
- align: "center",
- valign: 'middle',
- }, {
- field: 'abbrName',
- title: '生产厂家',
- align: "center",
- valign: 'middle',
- }, {
- field: 'drugQuan',
- title: '一次剂量',
- align: "center",
- valign: 'middle',
- }, {
- field: 'drugUnitName',
- title: '单位',
- align: "center",
- valign: 'middle',
- }, {
- field: 'frequency',
- title: '频率',
- align: "center",
- valign: 'middle',
- }, {
- field: 'decAmount',
- title: '<span style="color: red">退药量</span>',
- align: "center",
- valign: 'middle',
- formatter: function (value, row, index) {
- return value == null ? '<span style="color: red">-</span>' : '<span style="color: red">' + value + '</span>'
- }
- }, {
- field: 'printName',
- title: '给药方式',
- align: "center",
- valign: 'middle',
- }, {
- field: 'unitPrice',
- title: '单价',
- align: "center",
- valign: 'middle',
- }
- /* , {
- field: 'drug_flag',//毒麻标志:1:毒;2:麻;3:精神1;4:精神2
- title: '<span style="color: red">毒麻</span>',
- align: "center",
- valign: 'middle',
- formatter: function (value, row, index) {
- if(value == 1){
- return '<span style="color: red">毒</span>'
- }else if(value == 2){
- return '<span style="color: red">麻</span>'
- }else if(value == 3){
- return '<span style="color: red">精神1</span>'
- }else if(value == 3){
- return '<span style="color: red">精神2</span>'
- }else{
- return '<span style="color: red">-</span>'
- }
- }
- }*/
- , {
- field: 'stockAmount',
- title: '当前库存',
- align: "center",
- valign: 'middle',
- }
- ],
- responseHandler: function (res) {
- if (res == '401' || res == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- var ress = eval(res);
- if (ress.data.length > 0) {
- $("#employeeNameLabel").val(ress.data[0].employeeName);
- $("#warnDeptNameLabel").val(ress.data[0].warnDeptName);
- $("#chargeDateLabel").val(format(ress.data[0].chargeDate, "yyyy-MM-dd HH:mm:ss"));
- $("#icdTextLabel").val(ress.data[0].icdText);
- }
- if (ress.code == -1) {
- if (ress.message != null && ress.message != '') {
- new PNotify({
- title: '错误提示',
- text: ress.message,
- type: 'error',
- hide: true,
- styling: 'bootstrap3'
- });
- }
- return {
- "total": 0,//总页数
- "rows": {} //数据
- };
- }
- return {
- "total": ress.data.length,//总页数
- "rows": ress.data //数据
- };
- },
- });
- $("#cfxxModal").modal();
- }
- /**
- * 查询病人处方药品明细
- */
- function fitfymx(patientId, times, receiptNo, orderNo, groupNoOut) {
- var temp = {
- patientId: patientId,
- times: times,
- receiptNo: receiptNo,
- orderNo: orderNo,
- groupNoOut: groupNoOut,
- confirmFlag: $("#confirmFlagSearch").val()
- };
- $('#tb_table_right_ty').bootstrapTable("destroy");
- $table = $('#tb_table_right_ty').bootstrapTable({
- url: '/thmz/getRefundYpMx', //请求后台的URL(*)
- method: 'post', //请求方式(*)
- striped: true, //是否显示行间隔色
- cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
- pagination: true, //是否显示分页(*)
- sortable: true, //是否启用排序
- sortOrder: "asc", //排序方式
- queryParams: temp, //传递参数(*)
- sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
- pageNumber: 1, //初始化加载第一页,默认第一页
- pageSize: 10, //每页的记录行数(*)
- pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
- search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
- strictSearch: true,
- showColumns: false, //是否显示所有的列
- showRefresh: false, //是否显示刷新按钮
- minimumCountColumns: 2, //最少允许的列数
- clickToSelect: true, //是否启用点击选中行
- uniqueId: "ID", //每一行的唯一标识,一般为主键列
- showToggle: false, //是否显示详细视图和列表视图的切换按钮
- cardView: false, //是否显示详细视图
- detailView: false,
- //rowStyle:rowStyle,//通过自定义函数设置行样式
- ajaxOptions: {
- headers: {
- 'Accept': 'application/json',
- 'Authorization': 'Bearer ' + localStorage.getItem("token")
- }
- },
- columns: [
- {
- field: 'drugname',
- title: '品名',
- align: "center",
- valign: 'middle',
- formatter: function (value, row, index) {
- if (value != null && value != "") {
- return value.replace("()", "");
- }
- return "";
- }
- }, {
- field: 'specification',
- title: '规格',
- align: "center",
- valign: 'middle',
- }, {
- field: 'quantity',
- title: '数量',
- align: "center",
- valign: 'middle',
- }, {
- field: 'unit_price',
- title: '单价',
- align: "center",
- valign: 'middle',
- }, {
- field: 'dec_amount',
- title: '<span style="color: red">退药量</span>',
- align: "center",
- valign: 'middle',
- formatter: function (value, row, index) {
- return '<span style="color: red">' + value + '</span>'
- }
- }
- ],
- responseHandler: function (res) {
- if (res == '401' || res == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- var ress = eval(res);
- if (ress.code == -1) {
- if (ress.message != null && ress.message != '') {
- new PNotify({
- title: '错误提示',
- text: ress.message,
- type: 'error',
- hide: true,
- styling: 'bootstrap3'
- });
- }
- return {
- "total": 0,//总页数
- "rows": {} //数据
- };
- }
- return {
- "total": ress.data.length,//总页数
- "rows": ress.data //数据
- };
- },
- });
- }
- /**
- * 退药处理
- */
- function saveRefundMedicine() {
- if (!confirm("确定要对当前处方的药品进行退药处理吗?")) {
- return;
- }
- var data = $table.bootstrapTable('getData');
- var datas = [];
- var i = 0;
- data.forEach(function (item, index, arr) {
- if (item.dec_amount != 0) {
- var tem = {
- "patientId": item.patient_id,
- "times": item.times,
- "receiptNo": item.receipt_no,
- "orderNo": item.order_no,
- "realNo": item.real_no,
- "decAmount": item.dec_amount,
- "unitPrice": item.unit_price,
- "chargeCode": item.charge_item_code,
- "serial": item.serial,
- "groupNo": item.group_no,
- "itemNo": item.item_no,
- "serialNo": item.serial_no
- }
- datas[i] = tem;
- i++;
- }
- })
- if (datas.length == 0) {
- return;
- }
- $.ajax({
- type: "POST",
- url: '/thmz/refundMedicineProcessing',
- contentType: "application/json;charset=UTF-8",
- dataType: "json",
- headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
- data: JSON.stringify(datas),
- success: function (res) {
- if (res == '401' || res == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- if (res.code == 0) {
- successMesage(res);
- initTbTable();
- } else {
- errorMesage(res);
- }
- }
- });
- }
- /**
- * 叫号
- * @param patientId
- * @param name
- */
- function callNumber(patientId, name) {
- toMedicineWebSocket.send(JSON.stringify({patient_id: patientId, name: name, type: 'jh'}));
- }
- /**
- * 查询默认打印机
- */
- function setPrint() {
- if (zsdPrintIndex >= 0 && bqPrintIndex >= 0) {
- return;
- }
- $.ajax({
- type: "GET",
- url: '/thmz/getLastDispensingWindowsByCurrentUser',
- contentType: "application/json;charset=UTF-8",
- dataType: "json",
- headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
- async: false,
- success: function (res) {
- if (res == '401' || res == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- if (res.code == 0) {
- zsdPrintIndex = res.data.zsdPrintIndex;
- bqPrintIndex = res.data.bqPrintIndex;
- } else {
- zsdPrintIndex = -1;
- bqPrintIndex = -1;
- }
- }
- });
- }
- var prescriptionPrintWebSocket = null;
- var toMedicineWebSocket = null;
- //判断当前浏览器是否支持WebSocket, 主要此处要更换为自己的地址
- if ('WebSocket' in window) {
- prescriptionPrintWebSocket = new WebSocket("ws://" + window.location.host + "/thmz/prescriptionPrintSocket");
- toMedicineWebSocket = new WebSocket("ws://" + window.location.host + "/thmz/toMedicineSocket/sender");
- } else {
- alert('Not support websocket')
- }
- //---------prescriptionPrintWebSocket start
- //连接发生错误的回调方法
- prescriptionPrintWebSocket.onerror = function () {
- console.log("发药连接prescriptionPrintWebSocket发生错误")
- };
- //连接成功建立的回调方法
- prescriptionPrintWebSocket.onopen = function (event) {
- console.log("发药连接prescriptionPrintWebSocket连接成功");
- }
- //接收到消息的回调方法
- prescriptionPrintWebSocket.onmessage = function (event) {
- var confirmFlag = $("#confirmFlagSearch").val();
- var data = JSON.parse(event.data);
- if (data.type == 'py' && data.content == 1 && confirmFlag == 0) {//来自配药处理成功后的消息
- initTbTable();
- }
- }
- //连接关闭的回调方法
- prescriptionPrintWebSocket.onclose = function () {
- console.log("发药连接prescriptionPrintWebSocket连接关闭");
- }
- //-----------prescriptionPrintWebSocket end
- //---------toMedicineWebSocket start
- //连接发生错误的回调方法
- toMedicineWebSocket.onerror = function () {
- console.log("发药连接toMedicineWebSocket发生错误")
- };
- //连接成功建立的回调方法
- toMedicineWebSocket.onopen = function (event) {
- console.log("发药连接toMedicineWebSocket连接成功");
- }
- //接收到消息的回调方法
- toMedicineWebSocket.onmessage = function (event) {
- }
- //连接关闭的回调方法
- toMedicineWebSocket.onclose = function () {
- console.log("发药连接toMedicineWebSocket连接关闭");
- }
- //-----------toMedicineWebSocket end
- //监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常。
- window.onbeforeunload = function () {
- prescriptionPrintWebSocket.close();
- toMedicineWebSocket.close();
- }
- //关闭连接
- function closeWebSocket() {
- prescriptionPrintWebSocket.close();
- toMedicineWebSocket.close();
- }
|