12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820 |
- //@ sourceURL=registration.js
- var $dataTableHot;
- //病人下拉选当前页记录
- var pageIndex = 0;
- //判断病人列表是否在加载中,防止重复加载
- var msg_list_loading = false;
- //挂号卡片列表页面下标
- var pageIndex = 0;
- var LODOP; //声明为全局变量
- //默认打印机下标
- var printIndex = -1;
- var TableInit = function () {
- var oTableInit = new Object();
- //初始化Table
- oTableInit.Init = function () {
- $dataTableHot = $('#tb_fee_info').bootstrapTable({
- url: '', //请求后台的URL(*)
- method: 'post', //请求方式(*)
- toolbar: '#toolbar', //工具按钮用哪个容器
- striped: true, //是否显示行间隔色
- cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
- pagination: false, //是否显示分页(*)
- sortable: true, //是否启用排序
- sortOrder: "asc", //排序方式
- //queryParams: oTableInit.queryParams,//传递参数(*)
- sidePagination: "server", //分页方式: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,
- ajaxOptions: {
- headers: {
- 'Accept': 'application/json',
- 'Authorization': 'Bearer ' + localStorage.getItem("token")
- }
- },
- columns: [
- // {
- // checkbox: true
- // },
- {
- field: 'name',
- title: '名称',
- align: "center",
- valign: 'middle',
- //sortable: true
- }, {
- field: 'money',
- title: '金额(元)',
- align: "center",
- valign: 'middle',
- //sortable: true
- }, {
- field: 'moneyReceived',
- title: '实收金额(元)',
- align: "center",
- valign: 'middle',
- // sortable: true
- }],
- responseHandler: function (res) {
- if (res == '401' || res == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- var ress = eval(res);
- if (ress.code == -1) {
- new PNotify({
- title: '错误提示',
- text: ress.message,
- type: 'error',
- hide: true,
- styling: 'bootstrap3'
- });
- return {
- "total": 0,//总页数
- "rows": {} //数据
- };
- }
- return {
- "total": ress.pageViewVO.total,//总页数
- "rows": ress.pageViewVO.data //数据
- };
- },
- });
- };
- return oTableInit;
- };
- $(function () {
- initGenderSelect();
- initResponceTypeSelect();
- // var birthDay = $('#birthDayGroup').datetimepicker({
- // format: 'yyyy-mm-dd',
- // language: 'zh-CN',
- // minView: "month",
- // }).on('changeDate', changeDate);
- // var editUserBirthDay = $('#editUserBirthDayGroup').datetimepicker({
- // format: 'yyyy-mm-dd',
- // language: 'zh-CN',
- // minView: "month",
- // });
- //设置挂号窗口的高度
- var width = $('#confirmFee').css("width");
- var widthNum = parseInt(width);
- widthNum -= 24;
- $("#confirmFee").css("width", widthNum + "px");
- init_daterangepicker();
- //1.初始化Table
- var oTable = new TableInit();
- oTable.Init();
- formatCheck();
- //默认光标在卡号输入框
- $("#cardNo").focus();
- //根据病人姓名输入框内容动态加载病人列表
- //initUserList();
- //卡号输入改变事件
- cardNoChange();
- //病人姓名输入改变事件
- // userNameChange();
- //数据校验
- init_validator();
- //时间区间
- initMzWorkTime();
- //初始门诊收银方式下拉选
- initChequeType("payType");
- /**
- * 清空
- */
- $("#clearRegistration").on("click", function (t) {
- clearRegistration();
- });
- /**
- * 增加收款方式按钮事件
- */
- $("#addPayType").on("click", function (t) {
- var payTypeIndex = $("#payTypeIndex").val();
- var payTypeId = "payType_" + payTypeIndex;
- var html = '<div class="item form-group"><div class="col-md-12 col-sm-12 col-xs-12"><div class="col-md-2 col-sm-2 col-xs-12"></div><label class="col-md-3 col-sm-3 col-xs-12"><select class="form-control selectpicker show-tick" required="true" id="' + payTypeId + '"></select></label><div class="col-md-3 col-sm-3 col-xs-12"><input class="form-control col-md-5 col-xs-12" type="number" data-placement="bottom-right" min="0"></div><a style="line-height: 34px;cursor: pointer;" onclick="closeThisParent(this)"><i class="fa fa-close"></i></a></div></div>';
- $("#changeAmountParent").before(html);
- initChequeType(payTypeId)
- payTypeIndex = payTypeIndex + 1;
- $("#payTypeIndex").val(payTypeIndex);
- });
- // //当ic卡号输入框失去光标后,重置光标到卡号输入框
- // $("#cardNo").blur(function () {
- // var focus = !($("#userName").is(":focus") || $("#age").is(":focus") || $("#birthDay").is(":focus") || $("#phoneNum").is(":focus") || $("#idCard").is(":focus") || $("#address").is(":focus"));
- // if (focus && $("#cardNo").val() == null || $("#cardNo").val() == "") {
- // //默认光标在卡号输入框
- // $("#cardNo").focus();
- // }
- // });
- /**
- * 保存挂号信息
- */
- $("#saveConfirmFee").on("click", function (t) {
- var cash=$("#cash").val();
- if(cash==null || cash ==""){
- new PNotify({
- title: '错误提示',
- text: "金额不能为空!",
- type: 'error',
- hide: false,
- styling: 'bootstrap3'
- });
- return;
- }
- var realMoney = parseFloat($("#realMoney").val());
- realMoney = realMoney.toFixed(2);
- if (parseFloat(cash) < realMoney) {
- return;
- }
- var patientId = $("#patientId").val();
- if (patientId == null || patientId == "") {
- savePatient(true);
- } else {
- saveMzyReqrec();
- }
- });
- // /**
- // * 设置窗口号
- // */
- // $("#editWindows").on("click", function (t) {
- // $.ajax({
- // type: "GET",
- // url: '/thmz/getLastWindowsByCurrentUser',
- // 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) {
- // $("#windowsNum").val(res.data.windowsNo)
- // } else {
- // new PNotify({
- // title: '错误提示',
- // text: res.message,
- // type: 'error',
- // hide: true,
- // styling: 'bootstrap3'
- // });
- // }
- // }
- // });
- // $("#editWindowsModal").modal();
- // });
- /**
- * 患者信息修改
- */
- $("#saveEditUser").on("click", function (t) {
- modifyPatient();
- });
- /**
- * 挂号列表中的科室和医生列表初始化
- */
- initListSelect();
- // $("#editPrint").on("click", function (t) {
- // CreatePrinterList();
- // $("#editPrintModal").modal();
- // });
- //每隔三秒读一次身份证
- setInterval(function () {
- new Device().startFun();
- }, 3000);
- // $("#birthDay").keypress(function () { // keypress:输入框每获取一个字符,就触发一次该事件。
- // var birthDay= $("#birthDay").val();
- // birthDay='19880613';
- //
- // });
- $("#birthDay").change(function (e) {
- var birthDay = $("#birthDay").val();
- if (birthDay.length == 8 && birthDay.indexOf("-") <= 0) {
- birthDay = birthDay.substring(0, 4) + "-" + birthDay.substring(4, 6) + "-" + birthDay.substring(6);
- $("#birthDay").val(birthDay);
- }
- var dateFormat = /^(\d{4})-(\d{2})-(\d{2})$/;
- if (!dateFormat.test(birthDay)) {
- new PNotify({
- title: '错误提示',
- text: '生日日期错误',
- type: 'error',
- hide: true,
- styling: 'bootstrap3'
- });
- }
- var arr = birthDay.split("-");
- if (!checkDate(arr[0], arr[1], arr[2])) {
- new PNotify({
- title: '错误提示',
- text: '生日日期错误',
- type: 'error',
- hide: true,
- styling: 'bootstrap3'
- });
- }
- var returnAge = jsGetAge(birthDay);
- $("#age").val(returnAge);
- $("#age").blur();
- });
- $("#editUserBirthDay").change(function (e) {
- var editUserBirthDay = $("#editUserBirthDay").val();
- if (editUserBirthDay.length == 8 && editUserBirthDay.indexOf("-") <= 0) {
- editUserBirthDay = editUserBirthDay.substring(0, 4) + "-" + editUserBirthDay.substring(4, 6) + "-" + editUserBirthDay.substring(6);
- $("#editUserBirthDay").val(editUserBirthDay);
- }
- var dateFormat = /^(\d{4})-(\d{2})-(\d{2})$/;
- if (!dateFormat.test(editUserBirthDay)) {
- new PNotify({
- title: '错误提示',
- text: '生日日期错误',
- type: 'error',
- hide: true,
- styling: 'bootstrap3'
- });
- }
- var arr = editUserBirthDay.split("-");
- if (!checkDate(arr[0], arr[1], arr[2])) {
- new PNotify({
- title: '错误提示',
- text: '生日日期错误',
- type: 'error',
- hide: true,
- styling: 'bootstrap3'
- });
- }
- var returnAge = jsGetAge(editUserBirthDay);
- $("#editUserAge").val(returnAge);
- });
- $("#idCard").change(function (e) {
- queryUserInfoBySocialNo();
- });
- $("#editUserIdCard").change(function (e) {
- var editUserIdCard = $("#editUserIdCard").val();
- var birthday = editUserIdCard.substring(6, 14);
- birthday = birthday.substring(0, 4) + "-" + birthday.substring(4, 6) + "-" + birthday.substring(6);
- $("#editUserBirthDay").val(birthday);
- var returnAge = jsGetAge(birthday);
- $("#editUserAge").val(returnAge);
- var gender = editUserIdCard.substring(16, 17);
- if (gender % 2 == 0) {
- $("#editUserGender").val(2);
- } else {
- $("#editUserGender").val(1);
- }
- $('#editUserGender').selectpicker('refresh');
- });
- $("#phoneNum").change(function (e) {
- queryUserInfoByphoneNo();
- });
- $("#userName").change(function (e) {
- queryUserInfoByName();
- });
- });
- //判断给定日期是否合法
- function checkDate(year, month, date) {
- var now = new Date(year, month - 1, date);
- if (now.getDate() == date && now.getFullYear() == year && now.getMonth() == (month - 1)) {
- return true;
- }
- return false;
- }
- // function CreatePageList() {
- // LODOP = getLodop();
- // LODOP.PRINT_INITA(6, 0, "92mm", "120mm", "泰和门诊发票打印");
- // //获取纸张大小数,用于进行遍历
- // var strPageSizeList = LODOP.GET_PAGESIZES_LIST($('#printSelect').val(), "\n");
- // var html = "";
- // var arr = strPageSizeList.split("\n");
- // for (var i = 0; i < arr.length; i++) {
- // html += "<option value='" + arr[i] + "'>" + arr[i] + "</option>";
- // }
- // $('#pageSelect').html(html);
- // $('#pageSelect').selectpicker('refresh');
- // }
- /**
- * 初始化性别下拉选
- */
- function initGenderSelect() {
- $(".selectpicker").selectpicker({
- dropuAuto: false
- });
- var gender = '<option value="1">男</option><option value="2">女</option><option value="0">未知</option>';
- $('#gender').html(gender);
- $('#gender').selectpicker('refresh');
- $('#editUserGender').html(gender);
- $('#editUserGender').selectpicker('refresh');
- }
- /**
- * 初始化病人身份类别下拉选
- */
- function initResponceTypeSelect() {
- $(".selectpicker").selectpicker({
- dropuAuto: false
- });
- $.ajax({
- type: "GET",
- url: '/thmz/getMzResponceType',
- 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) {
- res.data.forEach(function (item, index) {
- var html = '<option value="' + item.code + '">' + item.name + '</option>';
- $('#patientsNature').append(html);
- $('#editUserPatientsNature').append(html);
- });
- $('#patientsNature').selectpicker('refresh');
- $('#editUserPatientsNature').selectpicker('refresh');
- } else {
- new PNotify({
- title: '错误提示',
- text: res.message,
- type: 'error',
- hide: true,
- styling: 'bootstrap3'
- });
- }
- }
- });
- }
- /**
- * 初始科室下拉选
- * @param ampm 时间段区间
- */
- function initDeptPlus() {
- //科室列表
- $.ajax({
- type: "GET",
- url: '/thmz/getUnitCodeByRequestDay?ampm=' + $("#ampm").val(),
- dataType: "json",
- headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
- success: function (data) {
- if (data == '401' || data == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- var html = '';
- $.each(data.data, function (commentIndex, comment) {
- html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
- });
- $('#deptNo').empty();
- $('#deptNo').html(html);
- $('#deptNo').selectpicker('refresh');
- $('#chargeType').empty();
- $('#chargeType').selectpicker('refresh');
- emptyInput();
- }
- });
- }
- /**
- * 初始医生下拉选
- * @param ampm 时间段区间
- */
- function initEmployee() {
- //医生列表
- $.ajax({
- type: "GET",
- url: '/thmz/getDoctorCodeByRequestDay?unitCode=' + $('#deptNo').val() + "&m=" + $("#ampm").val() + "&chargeType=" + $("#chargeType").val(),
- 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;
- }
- var html = '';
- var defaultCode = null;
- $.each(res.data, function (commentIndex, comment) {
- var employeeName =comment.employee.employeeName;
- if(comment.leftNum!=null){
- employeeName=employeeName+" 余号("+comment.leftNum+")"
- }
- html += '<option value="' + comment.employee.employeeCode + '" data-chargeType="' + comment.chargeType + '" data-checkFee="' + comment.checkFee + '" data-mzyRequestId="' + comment.mzyRequestId + '">' + employeeName + '</option>';
- if (res.data.length == 1) {
- //如果只有一个号别,默认选中
- defaultCode = comment.employee.employeeCode;
- }
- });
- $('#doctor').empty();
- $('#doctor').html(html);
- $('#doctor').selectpicker('refresh');
- //validator.checkAll($("#regi_form"));
- if (defaultCode != null) {
- //如果有无需选择医生的选项,默认选择
- $('#doctor').selectpicker('val', defaultCode);
- $('#doctor').selectpicker('refresh');
- fitFee();
- }
- }
- });
- }
- /**
- * 初始门诊时间区间下拉选
- */
- function initMzWorkTime() {
- $.ajax({
- type: "GET",
- url: '/thmz/getMzWorkTime',
- 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;
- }
- var html = '';
- var ampm = null;
- $.each(res.data, function (commentIndex, comment) {
- html += '<option value="' + comment.code + '">' + comment.name + '</option>';
- if (ampm == null || (ampm != "a" && ampm != "p")) {
- var startTime = paseToFullTime(comment.startTime);
- var endTime = paseToFullTime(comment.endTime);
- if (range(startTime, endTime)) {
- ampm = comment.code;
- }
- }
- });
- $('#ampm').empty(); //清空resText里面的所有内容
- $('#ampm').html(html);
- $('#ampm').selectpicker('refresh');
- $("#ampm").selectpicker('val', ampm);
- $('#ampm').selectpicker('refresh');
- initDeptPlus();
- }
- });
- }
- /**
- * 初始门诊号别下拉选
- */
- function initChargeType() {
- $.ajax({
- type: "GET",
- url: '/thmz/getChargeTypeByRequestDay?unitCode=' + $('#deptNo').val() + "&m=" + $("#ampm").val(),
- 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;
- }
- var html = '';
- var defaultCode = null;
- $.each(res.data, function (commentIndex, comment) {
- if (res.data.length == 1) {
- //如果只有一个号别,默认选中
- defaultCode = comment.code;
- }
- html += '<option value="' + comment.code + '">' + comment.name + '</option>';
- });
- $('#chargeType').empty(); //清空resText里面的所有内容
- $('#chargeType').html(html);
- $('#chargeType').selectpicker('refresh');
- if (defaultCode != null) {
- //如果有默认选项,默认选择
- $('#chargeType').selectpicker('val', defaultCode);
- $('#chargeType').selectpicker('refresh');
- initEmployee();
- }
- validator.checkAll($("#regi_form"));
- emptyInput();
- }
- });
- }
- /**
- * 设置挂号费等费用
- */
- function fitFee() {
- var chargeType = $('#doctor').find("option:selected").attr('data-chargeType');
- var checkFee = $('#doctor').find("option:selected").attr('data-checkFee');
- $("#checkFee").val(checkFee);
- $("#amountMoney").text(checkFee);
- $("#amountMoneyConfirm").text(checkFee);
- $("#realMoney").val(checkFee);
- $("#cash").val(checkFee);
- $("#changeAmount").val(0);
- $.ajax({
- type: "GET",
- url: '/thmz/getMzChargeTypeByCode?code=' + chargeType,
- 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;
- }
- $("#registrationFee").val(res.data.reqFee);
- $("#hospitalFee").val(res.data.clinicFee);
- checkFee = parseFloat(checkFee) + parseFloat(res.data.reqFee) + parseFloat(res.data.clinicFee);
- $("#amountMoney").text(checkFee);
- $("#amountMoneyConfirm").text(checkFee);
- $("#realMoney").val(checkFee);
- $("#cash").val(checkFee);
- validator.checkAll($("#regi_form"));
- }
- });
- }
- /**
- * 初始门诊收银方式下拉选
- */
- function initChequeType(payType) {
- $.ajax({
- type: "GET",
- url: '/thmz/getAllZdChequeTypeForMz',
- 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;
- }
- var html = '';
- $.each(res.data, function (commentIndex, comment) {
- html += '<option value="' + comment.code + '">' + comment.name + '</option>';
- });
- $('#' + payType).empty();
- $('#' + payType).html(html);
- $('#' + payType).selectpicker('refresh');
- $('#' + payType).selectpicker('val', 1);
- $('#' + payType).selectpicker('refresh');
- }
- });
- }
- /**
- * 日期值改变修改年龄字段
- * @param ev
- */
- function changeDate(ev) {
- }
- /**
- * 列表类型按钮切换事件
- * @param object
- */
- function titleButtonChange(object) {
- $("#regi_List_btn_group").find("button").each(function (index, element) {
- if ($(element).hasClass("btn-primary")) {
- $(element).removeClass("btn-primary").addClass("btn-default");
- }
- });
- $(object).removeClass("btn-default").addClass("btn-primary");
- loadRegistrationList(true);
- }
- /**
- * 表格类型切换事件 卡片展示或者列表形式
- */
- function listTypeChange(object) {
- //var indexNum = 0;
- $("#regi_List_type").find("button").each(function (index, element) {
- if ($(element).hasClass("btn-primary")) {
- $(element).removeClass("btn-primary").addClass("btn-default");
- }
- // if (object == element) {
- // indexNum = index;
- // }
- });
- $(object).removeClass("btn-default").addClass("btn-primary");
- loadRegistrationList(true);
- }
- /**
- * 打开编辑用户信息窗口
- * @param data
- */
- function editUserModal(data) {
- $("#editUserModal").modal();
- if (data == null) {
- data = $("#patientId").val();
- }
- $.ajax({
- type: "GET",
- url: '/thmz/getByPatientId?patientId=' + data,
- 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) {
- //延时调用,因为当前弹框还没有加载出来,校验规则无法获取光标与模拟光标丢失事件,延时可以等弹框加载出来后模拟事件
- setTimeout(function () {
- fillPlusPatinet(res.data);
- }, 400);
- }
- } else {
- new PNotify({
- title: '错误提示',
- text: res.message,
- type: 'error',
- hide: true,
- styling: 'bootstrap3'
- });
- }
- }
- });
- }
- /**
- * 打开打印内容窗口
- * @param data
- */
- function printModal(data) {
- $("#printOrPreviewModal").modal("hide");
- $("#printModal").modal();
- }
- /**
- * 打开收费窗口
- * @param data
- */
- function confirmFeeModal() {
- var validatorResult = validator.checkAll($("#regi_form"));
- if (!validatorResult) {
- return;
- }
- $('#payType').selectpicker('val', 1);
- $('#payType').selectpicker('refresh');
- var prevAll = $("#changeAmountParent").prevAll();
- while (prevAll.length > 2) {
- $("#changeAmountParent").prev().remove();
- prevAll = $("#changeAmountParent").prevAll();
- }
- $("#realMoney").val($("#amountMoneyConfirm").text());
- $("#cash").val($("#amountMoneyConfirm").text());
- //$("#cash").val(null);
- $("#confirmFeeModal").modal();
- }
- /**
- * checkBox样式
- */
- function formatCheck() {
- if ($("input.flat")[0]) {
- $(document).ready(function () {
- $('input.flat').iCheck({
- checkboxClass: 'icheckbox_flat-blue',
- radioClass: 'iradio_flat-blue'
- });
- });
- }
- }
- /**
- * 卡号有变化后查询病人信息
- */
- function queryUserInfoByCardNo() {
- var cardNo = $("#cardNo").val();
- var index =cardNo.indexOf("-");
- if ((index > 0 && index==cardNo.length-2) || cardNo.length == 8) {
- $("#cardNo").attr("title", cardNo);
- $.ajax({
- type: "GET",
- url: '/thmz/getByIcCardNo?icCardNo=' + 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) {
- $("#cardNo").blur();
- $("#userName").val(res.data.name);
- $("#userName").blur();
- $("#userNameReadOnly").val(res.data.name);
- $("#age").val(res.data.age);
- $("#age").blur();
- $("#gender").selectpicker('val', res.data.sex);
- $("#gender").selectpicker('refresh');
- $("#gender").blur();
- $("#birthDayReadonly").val(res.data.birthDayStr);
- $("#birthDayReadonly").attr("title", res.data.birthDayStr);
- $("#birthDay").val(res.data.birthDayStr);
- $("#birthDay").blur();
- $("#phoneNum").val(res.data.phoneNo);
- $("#phoneNum").attr("title", res.data.phoneNo);
- $("#phoneNum").blur();
- $("#patientsNature").selectpicker('val', res.data.responseType);//默认选中
- $('#patientsNature').selectpicker('refresh');
- $("#patientsNature").blur();
- $("#idCard").val(res.data.socialNo);
- $("#idCard").attr("title", res.data.socialNo);
- $("#idCard").blur();
- $("#address").val(res.data.address);
- $("#address").blur();
- $("#patientId").val(res.data.patientId);
- if (res.data.name != null && res.data.name != "") {
- $("#editUser").show();
- $("#clearIcCardNo").show();
- }
- readonlyOrNot(true);
- $("#saveUser").hide();
- } else {
- $("#saveUser").show();
- $("#newCardModal").modal();
- $(document).keydown(function (event) { //监听键盘按下时的事件
- if (event.keyCode == 13) {
- //回车键
- $('#newCardModal').modal('hide');
- }
- });
- }
- } else {
- new PNotify({
- title: '错误提示',
- text: res.message,
- type: 'error',
- hide: true,
- styling: 'bootstrap3'
- });
- }
- }
- });
- }
- }
- /**
- * 卡号输入改变事件
- */
- function cardNoChange() {
- if (window.ActiveXObject || "ActiveXObject" in window) {
- $("#cardNo").on('input propertychange', function () {
- queryUserInfoByCardNo();
- });
- } else {
- $("#cardNo").on('input οninput', function () {
- queryUserInfoByCardNo();
- });
- }
- }
- /**
- * 病人姓名输入改变事件
- */
- function userNameChange() {
- if (window.ActiveXObject || "ActiveXObject" in window) {
- $("#userName").on('input propertychange', function () {
- refeshPatinetList(true);
- });
- } else {
- $("#userName").on('input οninput', function () {
- refeshPatinetList(true);
- });
- }
- }
- /**
- * 校验收款金额
- */
- function checkFee() {
- var cash = parseFloat($("#cash").val());
- var realMoney = parseFloat($("#realMoney").val());
- realMoney = realMoney.toFixed(2);
- $("#realMoney").val(realMoney)
- if (cash < realMoney) {
- new PNotify({
- title: '错误提示',
- text: "收款金额不能少于实收金额!",
- type: 'error',
- hide: true,
- styling: 'bootstrap3'
- });
- return;
- } else if (cash > realMoney) {
- if ($("#payType").val() == 1) {
- var changeAmount = cash - realMoney;
- $("#changeAmount").val(changeAmount.toFixed(2));
- } else {
- new PNotify({
- title: '错误提示',
- text: "非现金收款金额不能大于实收金额!",
- type: 'error',
- hide: true,
- styling: 'bootstrap3'
- });
- return;
- }
- }
- //计算和设置折扣比例
- var amountMoneyConfirm = parseFloat($("#amountMoneyConfirm").text());
- var discount = 100;
- if (realMoney < amountMoneyConfirm) {
- discount = realMoney / amountMoneyConfirm * 100;
- }
- $("#discount").text(discount.toFixed(2))
- }
- /**
- * 根据病人姓名输入框内容动态加载病人列表
- */
- function initUserList() {
- //var width=$("#userName").css("width");
- var settings = {
- trigger: 'click',
- content: '',
- width: 170,
- multi: true,
- closeable: false,
- style: '',
- delay: 300,
- padding: true,
- height: 300
- };
- var webuiPopover = $('#userName').webuiPopover('destroy').webuiPopover(settings);
- //用户姓名选中事件
- $("#userName").on("click", function (t) {
- if ($(webuiPopover).css("display") == "block") {
- refeshPatinetList(true);
- }
- });
- }
- /**
- * 刷新病人列表
- */
- function refeshPatinetList(flag) {
- //如果是重新加载病人列表,需要重置下标
- if (flag) {
- //重置下标
- pageIndex = 0;
- msg_list_loading = true;
- }
- var userName = $('#userName').val();
- if (!(userName == null || userName == "" || isChinese(userName))) {
- return;
- }
- $.ajax({
- type: "GET",
- url: '/thmz/getPatientMiByName?name=' + userName + "&pageIndex=" + pageIndex,
- 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 && res.data.length > 0) {
- $("#webuiPopover0").css("display", "block");
- var html = '<div class="list-group">';
- for (var i = 0; i < res.data.length; i++) {
- var mzPatientMi = res.data[i];
- html += '<a href="#" class="list-group-item list-group-item-action" onclick="fillPatinet(\'' + mzPatientMi.patientId + '\')">';
- var sex = "未知";
- if (mzPatientMi.sex == 1) {
- html += '<img src="/thmz/images/boy.png"/>'
- sex = "男";
- } else if (mzPatientMi.sex == 2) {
- html += '<img src="/thmz/images/girl.png"/>'
- sex = "女";
- } else if (mzPatientMi.sex == 0 || mzPatientMi.sex == null) {
- html += '<img src="/thmz/images/girl_or_boy.png"/>'
- sex = "未知";
- }
- html += '<div>' + mzPatientMi.name + ' ' + sex + ' ';
- if (mzPatientMi.age != null && mzPatientMi.age != "") {
- html += mzPatientMi.age + '岁';
- } else {
- html += '**岁';
- }
- if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != "") {
- html += '<span>' + mzPatientMi.phoneNo + '</span>';
- }
- html += '</div></a>';
- }
- html += '</div>';
- if (flag) {
- $("div.webui-popover-content").html("");
- }
- $("div.webui-popover-content").append(html);
- $("div.arrow").css("left", "23px");
- refeshPatinetListScrollEvent();
- } else {
- $("#webuiPopover0").css("display", "none");
- }
- }
- //查询完成,设置加载完成
- msg_list_loading = false;
- }
- });
- }
- /**
- * 病人下拉列表滚动条滚动到底部时继续加载新纪录
- */
- function refeshPatinetListScrollEvent() {
- $('.webui-popover-content').scroll(function (event) {
- var top = $(this).scrollTop();
- var height = $(this).height();
- var scrollHeight = $(this).get(0).scrollHeight;
- if (scrollHeight <= top + height) {
- if (!msg_list_loading) {
- msg_list_loading = true;
- pageIndex = pageIndex + 1;
- refeshPatinetList(false);
- }
- }
- });
- }
- /**
- * 按照病人id查询病人信息
- * @param patientId
- */
- function fillPatinet(patientId) {
- if (patientId == null || patientId == "") {
- return;
- }
- $.ajax({
- type: "GET",
- url: '/thmz/getByPatientId?patientId=' + patientId,
- 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) {
- $("#cardNo").val(res.data.icCardNo);
- $("#cardNo").attr("title", res.data.icCardNo);
- $("#cardNo").blur();
- $("#userName").val(res.data.name);
- $("#userName").blur();
- $("#userNameReadOnly").val(res.data.name);
- $("#age").val(res.data.age);
- $("#age").blur();
- $("#gender").selectpicker('val', res.data.sex);
- $("#gender").selectpicker('refresh');
- $("#gender").blur();
- $("#birthDayReadonly").val(res.data.birthDayStr);
- $("#birthDayReadonly").attr("title", res.data.birthDayStr);
- $("#birthDayReadonly").blur();
- $("#birthDay").val(res.data.birthDayStr);
- $("#birthDay").blur();
- $("#phoneNum").val(res.data.phoneNo);
- $("#phoneNum").attr("title", res.data.phoneNo);
- $("#phoneNum").blur();
- $("#patientsNature").selectpicker('val', res.data.responseType);//默认选中
- $('#patientsNature').selectpicker('refresh');
- $("#patientsNature").blur();
- $("#idCard").val(res.data.socialNo);
- $("#idCard").attr("title", res.data.socialNo);
- $("#idCard").blur();
- $("#address").val(res.data.address);
- $("#address").blur();
- $("#patientId").val(res.data.patientId);
- if (res.data.name != null && res.data.name != "") {
- $("#editUser").show();
- }
- readonlyOrNot(true);
- }
- } else {
- new PNotify({
- title: '错误提示',
- text: res.message,
- type: 'error',
- hide: true,
- styling: 'bootstrap3'
- });
- }
- }
- });
- }
- /**
- * 将病人信息填入患者信息修改form
- * @param patinet
- */
- function fillPlusPatinet(patinet) {
- if (patinet != null) {
- $("#editUserCode").val(patinet.patientId);
- $("#editUserName").val(patinet.name);
- $("#editUserName").blur();
- $("#editUserAge").val(patinet.age);
- $("#editUserAge").blur();
- $("#editUserGender").selectpicker('val', patinet.sex);
- $("#editUserGender").selectpicker('refresh');
- $("#editUserGender").blur();
- $("#editUserBirthDay").val(patinet.birthDayStr);
- $("#editUserBirthDay").blur();
- $("#editUserCardNo").val(patinet.icCardNo);
- $("#editUserCardNo").attr("title", patinet.icCardNo);
- $("#editUserCardNo").blur();
- $("#editUserPhoneNum").val(patinet.phoneNo);
- $("#editUserPhoneNum").attr("title", patinet.phoneNo);
- $("#editUserPhoneNum").blur();
- $("#editUserPatientsNature").selectpicker('val', patinet.responseType);//默认选中
- $('#editUserPatientsNature').selectpicker('refresh');
- $("#editUserPatientsNature").blur();
- $("#editUserIdCard").val(patinet.socialNo);
- $("#editUserIdCard").attr("title", patinet.socialNo);
- $("#editUserIdCard").blur();
- $("#editUserAddress").val(patinet.address);
- $("#editUserAddress").blur();
- $("#editUserContact").val(patinet.relName);
- $("#editUserContactPhone").val(patinet.contractName);
- }
- }
- /**
- * 关闭当前这个付款方式
- */
- function closeThisParent(obj) {
- $(obj).parent().parent().remove();
- }
- /**
- * 科室与时间区间下拉选改变时清空输入框内容
- */
- function emptyInput() {
- $('#doctor').empty();
- $('#doctor').selectpicker('refresh');
- $("#registrationFee").val(0.00);
- $("#hospitalFee").val(0.00);
- $("#checkFee").val(0.00);
- $("#amountMoney").text(0.00);
- $("#amountMoneyConfirm").text(0.00);
- $("#realMoney").val(0.00);
- }
- /**
- * 给某些域增加title或者清除title
- * @param obj
- */
- function clearTextOrTitle(obj) {
- if ($(obj).val() == null || $(obj).val().length == 0) {
- $(obj).attr("title", null);
- } else {
- $(obj).attr("title", $(obj).val());
- if ($(obj).attr("id") == "birthDay") {
- $(obj).blur()
- }
- }
- }
- /**
- * 当按照卡号查询时,病人信息输入框不可编辑,当清空输入框时可编辑
- * @param flag
- */
- function readonlyOrNot(flag) {
- if (flag) {
- $("#cardNo").attr("readonly", "readonly");
- $("#userName").attr("readonly", "readonly");
- $("#age").attr("readonly", "readonly");
- $("#gender").attr("disabled", "disabled");
- $("#phoneNum").attr("readonly", "readonly");
- $("#patientsNature").attr("disabled", "disabled");
- $("#idCard").attr("readonly", "readonly");
- $("#address").attr("readonly", "readonly");
- $("#birthDayReadonly").removeClass("hide").addClass("in");
- $("#birthDayGroup").removeClass("in").addClass("hide");
- $("#userName").removeClass("in").addClass("hide");
- $("#userNameReadOnly").removeClass("hide").addClass("in");
- $("#webuiPopover0").css("display", "none");
- } else {
- $("#cardNo").removeAttr("readonly");
- $("#userName").removeAttr("readonly");
- $("#age").removeAttr("readonly");
- $("#gender").removeAttr("disabled");
- $("#gender").next().removeClass("disabled");
- $("#phoneNum").removeAttr("readonly");
- $("#patientsNature").removeAttr("disabled");
- $("#patientsNature").next().removeClass("disabled");
- $("#idCard").removeAttr("readonly");
- $("#address").removeAttr("readonly");
- $("#birthDayReadonly").removeClass("in").addClass("hide");
- $("#birthDayGroup").removeClass("hide").addClass("in");
- $("#userName").removeClass("hide").addClass("in");
- $("#userNameReadOnly").removeClass("in").addClass("hide");
- //$("#webuiPopover0").css("display", "block");
- }
- }
- /**
- * 查询默认打印机
- */
- function setPrint() {
- if (printIndex >= 0) {
- return;
- }
- $.ajax({
- type: "GET",
- url: '/thmz/getLastWindowsByCurrentUser',
- 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) {
- printIndex = res.data.printIndex;
- } else {
- printIndex = -1;
- }
- }
- });
- }
- //
- // /**
- // * 保存窗口号
- // */
- // function saveWindows() {
- // $.ajax({
- // type: "POST",
- // url: '/thmz/saveWindows',
- // contentType: "application/json;charset=UTF-8",
- // dataType: "json",
- // data: JSON.stringify({"windowsNo": $("#windowsNum").val()}),
- // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
- // success: function (res) {
- // if (res == '401' || res == 401) {
- // window.location.href = '/thmz/login/view'
- // return;
- // }
- // $('#editWindowsModal').modal('hide');
- // if (res.code == 0) {
- // new PNotify({
- // title: '操作提示',
- // text: res.message,
- // type: 'success',
- // hide: true,
- // styling: 'bootstrap3'
- // });
- // } else {
- // new PNotify({
- // title: '错误提示',
- // text: res.message,
- // type: 'error',
- // hide: true,
- // styling: 'bootstrap3'
- // });
- // }
- // }
- // });
- // }
- //
- // /**
- // * 保存打印机
- // */
- // function savePrint() {
- // $.ajax({
- // type: "POST",
- // url: '/thmz/savePrintIndex',
- // contentType: "application/json;charset=UTF-8",
- // dataType: "json",
- // data: JSON.stringify({"printIndex": $("#printSelect").val()}),
- // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
- // success: function (res) {
- // if (res == '401' || res == 401) {
- // window.location.href = '/thmz/login/view'
- // return;
- // }
- // LODOP = getLodop();
- // LODOP.PRINT_INITA(6, 0, "92mm", "120mm", "泰和门诊发票打印");
- // LODOP.SET_PRINTER_INDEX($("#printSelect").val());
- // printIndex=$("#printSelect").val();
- // $('#editPrintModal').modal('hide');
- // if (res.code == 0) {
- // new PNotify({
- // title: '操作提示',
- // text: res.message,
- // type: 'success',
- // hide: true,
- // styling: 'bootstrap3'
- // });
- // } else {
- // new PNotify({
- // title: '错误提示',
- // text: res.message,
- // type: 'error',
- // hide: true,
- // styling: 'bootstrap3'
- // });
- // }
- // }
- // });
- // }
- /**
- * 保存病人信息
- * @param flag true 继续调用挂号接口,false,只建档不挂号
- */
- function savePatient(flag) {
- $.ajax({
- type: "POST",
- url: '/thmz/savePatient',
- contentType: "application/json;charset=UTF-8",
- dataType: "json",
- data: JSON.stringify({
- "name": $("#userName").val(),
- "age": $("#age").val(),
- "sex": $("#gender").val(),
- "birthDay": $("#birthDay").val(),
- "icCardNo": $("#cardNo").val(),
- "phoneNo": $("#phoneNum").val(),
- "responseType": $("#patientsNature").val(),
- "socialNo": $("#idCard").val(),
- "address": $("#address").val()
- }),
- 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 (flag) {
- $("#patientId").val(res.data.patientId);
- saveMzyReqrec();
- } else {
- clearRegistration();
- successMesage(res);
- }
- } else {
- errorMesage(res);
- }
- }
- });
- }
- // /**
- // * 修改病人信息诊疗卡信息
- // */
- // function modifyPatientIcCardNo() {
- // $.ajax({
- // type: "POST",
- // url: '/thmz/modifyPatient',
- // contentType: "application/json;charset=UTF-8",
- // dataType: "json",
- // data: JSON.stringify({
- // //"age": jsGetAge($("#birthDayReadonly").val()),
- // "icCardNo": $("#cardNo").val(),
- // "patientId": $("#patientId").val(),
- // }),
- // 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) {
- // editIcCardNo=false;
- // saveMzyReqrec();
- // successMesage(res)
- // } else {
- // errorMesage(res);
- // }
- // }
- // });
- // }
- /**
- * 修改病人信息
- */
- function modifyPatient() {
- $.ajax({
- type: "POST",
- url: '/thmz/modifyPatient',
- contentType: "application/json;charset=UTF-8",
- dataType: "json",
- data: JSON.stringify({
- "name": $("#editUserName").val(),
- "age": $("#editUserAge").val(),
- "sex": $("#editUserGender").val(),
- "birthDay": $("#editUserBirthDay").val(),
- "icCardNo": $("#editUserCardNo").val(),
- "phoneNo": $("#editUserPhoneNum").val(),
- "responseType": $("#editUserPatientsNature").val(),
- "socialNo": $("#editUserIdCard").val(),
- "address": $("#editUserAddress").val(),
- "patientId": $("#editUserCode").val(),
- "relName": $("#editUserContact").val(),
- "contractName": $("#editUserContactPhone").val()
- }),
- 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) {
- $('#editUserModal').modal('hide');
- fillPatinet($("#patientId").val());
- successMesage(res);
- } else {
- new PNotify({
- title: '错误提示',
- text: res.message,
- type: 'error',
- hide: true,
- styling: 'bootstrap3'
- });
- }
- }
- });
- }
- /**
- * 保存挂号信息
- */
- function saveMzyReqrec() {
- var mzyRequestId = $('#doctor').find("option:selected").attr('data-mzyRequestId');
- var patientId = $("#patientId").val();
- $.ajax({
- type: "POST",
- url: '/thmz/saveMzyReqrec',
- contentType: "application/json;charset=UTF-8",
- dataType: "json",
- data: JSON.stringify({
- "mzyReqrec": {
- "patientId": patientId,
- "ampm": $("#ampm").val(),
- "unitCode": $("#deptNo").val(),
- "chargeType": $("#chargeType").val(),
- "paymode": $("#payType").val()
- }, "responceType": $("#patientsNature").val(), "mzyRequestId": mzyRequestId
- }),
- 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) {
- new PNotify({
- title: '操作提示',
- text: res.message,
- type: 'success',
- hide: true,
- styling: 'bootstrap3'
- });
- $('#confirmFeeModal').modal('hide');
- prn1Print(patientId, -1);
- // loadTableCount();
- // loadRegistrationList(true);
- clearRegistration();
- } else {
- new PNotify({
- title: '错误提示',
- text: res.message,
- type: 'error',
- hide: true,
- styling: 'bootstrap3'
- });
- }
- }
- });
- }
- /**
- * 挂号列表中的科室和医生列表初始化
- */
- function initListSelect() {
- initListDeptSelect();
- initListDoctorSelect();
- }
- /**
- * 挂号列表中的科室列表
- */
- function initListDeptSelect() {
- //科室列表
- $.ajax({
- type: "GET",
- url: '/thmz/allMzUnitCode',
- dataType: "json",
- headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
- success: function (data) {
- if (data == '401' || data == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- var html = '';
- $.each(data.data, function (commentIndex, comment) {
- html += '<option value="' + comment.code + '">' + comment.name + '</option>';
- });
- $('#deptNoParam').empty();
- $('#deptNoParam').html(html);
- $('#deptNoParam').selectpicker('refresh');
- }
- });
- }
- /**
- * 挂号列表中的医生列表初始化
- */
- function initListDoctorSelect() {
- //医生列表
- $.ajax({
- type: "GET",
- url: '/thmz/listEmployeeByDepts?depts=' + $('#deptNoParam').val(),
- 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;
- }
- var html = '';
- $.each(res.data, function (commentIndex, comment) {
- html += '<option value="' + comment.employeeCode + '">' + comment.employeeName + '</option>';
- });
- $('#doctorParam').empty();
- $('#doctorParam').html(html);
- // $("#doctorParam").selectpicker({
- // size: 10
- // });
- $('#doctorParam').selectpicker('destroy').selectpicker('refresh');
- }
- });
- }
- /**
- * 清空搜索参数
- */
- function clearParams() {
- $("#deptNoParam").selectpicker('val', null);
- $("#deptNoParam").selectpicker('refresh');
- $("#doctorParam").selectpicker('val', null);
- $("#deptNoParam").selectpicker('refresh');
- $("#userNameParam").val(null);
- $("#phoneParam").val(null);
- $('#reportrange span').html(moment().format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD'));
- }
- /**
- * 保存退号信息
- */
- function saveBackNo() {
- $.ajax({
- type: "POST",
- url: '/thmz/updateReqrec',
- contentType: "application/json;charset=UTF-8",
- dataType: "json",
- data: JSON.stringify({
- "patientId": $("#backNoPatientId").val(),
- "times": $("#backNoTimes").val(),
- "cancelMark": 1
- }),
- 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) {
- new PNotify({
- title: '操作提示',
- text: res.message,
- type: 'success',
- hide: true,
- styling: 'bootstrap3'
- });
- loadTableCount();
- loadRegistrationList(true);
- $("#backNoModal").modal("hide");
- } else {
- new PNotify({
- title: '错误提示',
- text: res.message,
- type: 'error',
- hide: true,
- styling: 'bootstrap3'
- });
- }
- }
- });
- }
- /**
- * 清空挂号信息
- */
- function clearRegistration() {
- $("#cardNo").val(null);
- $("#cardNo").attr("title", null);
- $("#userName").val(null);
- $("#age").val(null);
- $("#gender").selectpicker('val', 1);
- $("#gender").selectpicker('refresh');
- $("#birthDay").val(null);
- $("#birthDay").attr("title", null);
- $("#phoneNum").val(null);
- $("#phoneNum").attr("title", null);
- $("#patientsNature").selectpicker('val', '01');//默认选中
- $('#patientsNature').selectpicker('refresh');
- $("#idCard").val(null);
- $("#idCard").attr("title", null);
- $("#address").val(null);
- $("#patientId").val(null);
- $("#editUser").hide();
- $("#clearIcCardNo").hide();
- //默认光标在卡号输入框
- $("#cardNo").focus();
- initMzWorkTime();
- readonlyOrNot(false);
- $("#saveUser").hide();
- }
- /**
- * 直接打印发票
- * @param patientId
- */
- function prn1Print(patientId, times) {
- setPrint();
- var height ="93.09mm";
- // if(countReceiot%2==0){
- // height ="93.2mm";
- // }
- $.ajax({
- type: "GET",
- url: '/thmz/printMzyReqrecRecept?patientId=' + patientId + "×=" + times,
- 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 || res.data.length == 0) {
- return;
- }
- // countReceiot++;
- LODOP = getLodop();
- var temp = res.data;
- LODOP.PRINT_INITA(6, 0, "120mm", height, "泰和门诊发票打印");
- //设置默认打印机
- LODOP.SET_PRINTER_INDEX(printIndex);
- LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "120mm");
- LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", height);
- LODOP.SET_PRINT_PAGESIZE(1, "120mm", height, "CreateCustomPage");
- LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊发票");//对新建的纸张重命名
- LODOP.SET_PRINT_STYLE("FontSize", 11); //字体大小
- LODOP.ADD_PRINT_TEXT("6mm", "0mm", "45mm", "3mm", "湖南泰和医院管理有限公司");
- LODOP.ADD_PRINT_TEXT("6mm", "59mm", "30mm", "3mm", "流水号:");
- LODOP.ADD_PRINT_TEXT("6mm", "72mm", "20mm", "3mm", temp.serialNo);
- LODOP.ADD_PRINT_TEXT("19mm", "0mm", "35mm", "3mm", temp.receiptBill);
- LODOP.ADD_PRINT_TEXT("25mm", "7mm", "40mm", "3mm", temp.name);
- LODOP.ADD_PRINT_TEXT("25mm", "61mm", "27mm", "3mm", patientId);
- LODOP.ADD_PRINT_TEXT("32mm", "6mm", "40mm", "3mm", "就诊科室:" + temp.unitCode);
- LODOP.ADD_PRINT_TEXT("32mm", "46mm", "40mm", "3mm", "地点:" + res.officePos==null?"":res.officePos);
- LODOP.ADD_PRINT_TEXT("37mm", "6mm", "40mm", "3mm", "看诊医生:" + temp.doctorCode);
- LODOP.ADD_PRINT_TEXT("37mm", "46mm", "40mm", "3mm", "号段:" + temp.ampm);
- LODOP.ADD_PRINT_TEXT("42mm", "6mm", "40mm", "3mm", "号别:" + temp.chargeType);
- LODOP.ADD_PRINT_TEXT("42mm", "46mm", "40mm", "3mm", "就诊号:" + temp.reqOrder);
- LODOP.ADD_PRINT_TEXT("47mm", "6mm", "40mm", "3mm", "挂号费:" + temp.reqFee);
- LODOP.ADD_PRINT_TEXT("47mm", "46mm", "40mm", "3mm", "诊查费:" + temp.clinicFee);
- LODOP.ADD_PRINT_TEXT("52mm", "6mm", "40mm", "3mm", "其他:" + temp.othFee);
- LODOP.ADD_PRINT_TEXT("52mm", "46mm", "40mm", "3mm", "工本费:" + temp.brochureFee);
- LODOP.ADD_PRINT_TEXT("65mm", "21mm", "60mm", "3mm", res.totalFee + " 元");
- LODOP.ADD_PRINT_TEXT("72mm", "19mm", "60mm", "3mm", res.totalFeeStr);
- LODOP.ADD_PRINT_TEXT("79mm", "0mm", "15mm", "3mm", res.year);//年
- LODOP.ADD_PRINT_TEXT("79mm", "13mm", "10mm", "3mm", res.month);//月
- LODOP.ADD_PRINT_TEXT("79mm", "25mm", "10mm", "3mm", res.day);//日
- LODOP.ADD_PRINT_TEXT("79mm", "53mm", "23mm", "3mm", res.user.userName);//收费员
- //LODOP.PREVIEW();
- LODOP.PRINT();
- if (times > 0) {
- loadRegistrationList(true);
- }
- }else if(res.code == -2){
- new PNotify({
- title: '操作提示',
- text: res.message,
- type: 'success',
- hide: true,
- styling: 'bootstrap3'
- });
- }else if (res.code == -1) {
- new PNotify({
- title: '错误提示',
- text: res.message,
- type: 'error',
- hide: true,
- styling: 'bootstrap3'
- });
- }
- }
- });
- };
- /**
- * 销卡
- * @param data
- */
- function clearIcCardNo() {
- $.ajax({
- type: "GET",
- url: '/thmz/clearIcCardNo?patientId=' + $("#patientId").val(),
- 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) {
- clearRegistration();
- successMesage(res);
- } else {
- errorMesage(res);
- }
- }
- });
- }
- /**
- * 根据手机号码查询病人信息
- */
- function queryUserInfoByphoneNo() {
- var phoneNo = $("#phoneNum").val();
- if (phoneNo.length == 11) {
- $.ajax({
- type: "GET",
- url: '/thmz/getByPhoneNo?phoneNo=' + phoneNo,
- 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) {
- fitPatient(res);
- }
- }
- });
- }
- }
- /**
- * 根据手机号码查询病人信息
- */
- function queryUserInfoByName() {
- var userName = $('#userName').val();
- // var cardNo=$("#cardNo").val();
- if (userName == null || userName == "") {
- return;
- }
- if (userName.length > 0) {
- $.ajax({
- type: "GET",
- url: '/thmz/getPatientMiByName?name=' + userName,
- 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) {
- fitPatient(res);
- }
- }
- });
- }
- }
|