123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313 |
- //@ sourceURL=registration.js
- var $dataTableHot;
- //判断病人列表是否在加载中,防止重复加载
- var msg_list_loading = false;
- //挂号卡片列表页面下标
- var pageIndex = 0;
- var LODOP; //声明为全局变量
- //默认打印机下标
- var printIndex = -1;
- var fpVsesionNo =0;
- var hospitalName ='长沙泰和医院'
- 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 () {
- getAjaxRequst("/thmz/queryHospitalName",{},true,function (res) {
- hospitalName = res.data
- })
- initFpVersion();
- initGenderSelect();
- initResponceTypeSelect();
- initCertificateTypeSelect();
- init_daterangepicker();
- //1.初始化Table
- var oTable = new TableInit();
- oTable.Init();
- formatCheck();
- //默认光标在卡号输入框
- $("#cardNo").focus();
- //根据病人姓名输入框内容动态加载病人列表
- //initUserList();
- //卡号输入改变事件
- cardNoChange();
- //病人姓名输入改变事件
- // userNameChange();
- //数据校验
- init_validator();
- //时间区间
- initMzWorkTime();
- //初始门诊收银方式下拉选
- initChequeType("payType");
- //初始化省份
- initProvince(1);
- /**
- * 创建核酸检查处方并保存
- */
- $("#saveNucleicAcid").on("click", function (t) {
- saveNucleicAcid();
- });
- /**
- * 跳转到缴费界面
- */
- $("#chargeFeeNucleicAcid").on("click", function (t) {
- chargeFeeNucleicAcid();
- });
- /**
- * 创建核酸检查(混检)处方并保存
- */
- // $("#saveHybridTest").on("click", function (t) {
- // saveHybridTest();
- // });
- /**
- * 跳转到(混检)缴费界面
- */
- $("#chargeFeeHybridTest").on("click", function (t) {
- chargeFeeHybridTest();
- });
- /**
- * 医保电子凭证读卡
- */
- $("#siReadCard").on("click", function (t) {
- siReadCard("qrcode_01101");
- });
- /**
- * 医保刷脸
- */
- $("#siReadCardFace").on("click", function (t) {
- siReadCard("face_01101");
- });
- /**
- * 身份证读卡
- */
- $("#siReadIdCard").on("click", function (t) {
- siReadIdCard("idcard_01101",1);
- });
- /**
- * 清空
- */
- $("#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) {
- $("#saveConfirmFee").attr("disabled", true);
- var cash = $("#cash").val();
- if (cash == null || cash == "") {
- new PNotify({
- title: '错误提示',
- text: "金额不能为空!",
- type: 'error',
- hide: false,
- styling: 'bootstrap3'
- });
- $("#saveConfirmFee").attr("disabled", false);
- return;
- }
- var realMoney = parseFloat($("#realMoney").val());
- realMoney = realMoney.toFixed(2);
- if (parseFloat(cash) < realMoney) {
- $("#saveConfirmFee").attr("disabled", false);
- return;
- }
- var patientId = $("#patientId").val();
- if (patientId == null || patientId == "") {
- savePatient(1);
- } else {
- saveMzyReqrec();
- }
- });
- //每隔三秒读一次身份证
- // readIcCard();
- // setInterval(function () {
- // new Device().startFun();
- // }, 3000);
- /**
- * 患者信息修改
- */
- $("#saveEditUser").on("click", function (t) {
- modifyPatient();
- });
- /**
- * 挂号列表中的科室和医生列表初始化
- */
- initListSelect();
- // $("#editPrint").on("click", function (t) {
- // CreatePrinterList();
- // $("#editPrintModal").modal();
- // });
- // $("#birthDay").keypress(function () { // keypress:输入框每获取一个字符,就触发一次该事件。
- // var birthDay= $("#birthDay").val();
- // birthDay='19880613';
- //
- // });
- $("#birthDay").change(function (e) {
- setAge();
- $("#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)) {
- errorMesageSimaple("生日日期错误");
- }
- var arr = editUserBirthDay.split("-");
- if (!checkDate(arr[0], arr[1], arr[2])) {
- errorMesageSimaple("生日日期错误");
- }
- var returnAge = jsGetAge(editUserBirthDay);
- $("#editUserAge").val(returnAge);
- });
- $("#idCard").change(function (e) {
- queryUserInfoBySocialNo(1);
- });
- $("#editUserIdCard").change(function (e) {
- var editUserIdCard = $("#editUserIdCard").val();
- if (editUserIdCard == null || editUserIdCard == "") {
- return;
- }
- 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();
- });
- setTimeout(function () {
- getLodop();
- }, 800);
- /**
- * 刷卡/扫码
- */
- $("#consume").on("click", function (t) {
- consume();
- });
- });
- /**
- * 刷新列表,解决越来越快的问题
- */
- // function readIcCard() {
- // //clearInterval要放在方法开始,不然的话,下面的代码还没运行到clearInterval,又开始了循环了。
- // clearInterval(readIcCardTimerForRegistration);
- // new Device().startFun();
- // readIcCardTimerForRegistration = setInterval(() => {
- // readIcCard()
- // }, 3000);
- // }
- // 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');
- // }
- /**
- * 注册患者信息获取新的门诊号和卡号
- * flag 0 取消 不回显卡号 1回显卡号
- */
- function getNewPatientId(flag) {
- if (flag == 1) {
- if(!stringNotBlank($('#cardNo').val())){
- getAjaxRequst("/thmz/getNewIcdCard", {}, true, function (res) {
- if (res == '401' || res == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- if (res.code == 0) {
- $("#cardNo").val(res.data)
- $("#patientId").val(res.data)
- $("#jdFlag").val('1')
- }else {
- errorMesageSimaple(res.message)
- }
- })
- }else {
- $("#jdFlag").val('1')
- }
- }else {
- $("#jdFlag").val(null)
- }
- $('#newCardModal').modal('hide')
- }
- //初始化版本电子发票版本
- function initFpVersion() {
- getAjaxRequst("/thmz/queryFpVersion",{},true,function (res) {
- console.log('发票版本=',res.data)
- fpVsesionNo = res.data;
- })
- }
- /**
- * 初始化性别下拉选
- */
- 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 {
- errorMesage(res);
- }
- }
- });
- }
- /**
- * 初始化证件类型下拉选
- */
- function initCertificateTypeSelect() {
- $.ajax({
- type: "GET",
- url: '/thmz/listCertificateType',
- 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>';
- $('#certificateType').append(html);
- $('#editUserCertificateType').append(html);
- });
- $('#certificateType').selectpicker('refresh');
- $('#editUserCertificateType').selectpicker('refresh');
- $('#certificateType').selectpicker('val', '01');
- $('#certificateType').selectpicker('refresh');
- } else {
- errorMesage(res);
- }
- }
- });
- }
- /**
- * 初始科室下拉选
- * @param ampm 时间段区间
- * @param type
- */
- function initDeptPlus(type) {
- var ampm = $("#ampm").val();
- if (type == 1) {
- setAmTimes(ampm);
- }
- $("#deptNo").selectpicker({
- size: 10
- });
- var apTimes = $("#apTimes").val();
- //科室列表
- $.ajax({
- type: "GET",
- url: '/thmz/getUnitCodeByRequestDay?ampm=' + ampm + "&apTimes=" + apTimes,
- 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() {
- $("#doctor").selectpicker({
- size: 10
- });
- //医生列表
- $.ajax({
- type: "GET",
- url: '/thmz/getDoctorCodeByRequestDay?unitCode=' + $('#deptNo').val() + "&m=" + $("#ampm").val() + "&chargeType=" + $("#chargeType").val() + "&apTime=" + $("#apTimes").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();
- }
- }
- });
- }
- /**
- * 设置时间下拉选
- * @param ampm
- */
- function setAmTimes(ampm) {
- if (ampm == "a" || ampm == "p") {
- $("#apTimesDiv").removeClass("hide").addClass("in");
- $("#doctorDiv").css("margin-top", "10px");
- var timeHtml = null;
- var defaultTime = null;
- if (ampm == "a") {
- if (range(paseToFullTime("00:00"), paseToFullTime("08:30"))) {
- defaultTime = "a1";
- timeHtml = '<option value="a1">08:00-08:30</option><option value="a2">08:30-09:00</option><option value="a3">09:00-09:30</option><option value="a4">09:30-10:00</option><option value="a5">10:00-10:30</option><option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
- } else if (range(paseToFullTime("08:30"), paseToFullTime("09:00"))) {
- defaultTime = "a2";
- timeHtml = '<option value="a2">08:30-09:00</option><option value="a3">09:00-09:30</option><option value="a4">09:30-10:00</option><option value="a5">10:00-10:30</option><option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
- } else if (range(paseToFullTime("09:00"), paseToFullTime("09:30"))) {
- defaultTime = "a3";
- timeHtml = '<option value="a3">09:00-09:30</option><option value="a4">09:30-10:00</option><option value="a5">10:00-10:30</option><option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
- } else if (range(paseToFullTime("09:30"), paseToFullTime("10:00"))) {
- defaultTime = "a4";
- timeHtml = '<option value="a4">09:30-10:00</option><option value="a5">10:00-10:30</option><option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
- } else if (range(paseToFullTime("10:00"), paseToFullTime("10:30"))) {
- defaultTime = "a5";
- timeHtml = '<option value="a5">10:00-10:30</option><option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
- } else if (range(paseToFullTime("10:30"), paseToFullTime("11:00"))) {
- defaultTime = "a6";
- timeHtml = '<option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
- } else if (range(paseToFullTime("11:00"), paseToFullTime("11:30"))) {
- defaultTime = "a7";
- timeHtml = '<option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
- } else if (range(paseToFullTime("11:30"), paseToFullTime("12:00"))) {
- defaultTime = "a8";
- timeHtml = '<option value="a8">11:30-12:00</option>';
- }
- } else {
- if (range(paseToFullTime("00:00"), paseToFullTime("14:30"))) {
- defaultTime = "p1";
- timeHtml = '<option value="p1">14:00-14:30</option><option value="p2">14:30-15:00</option><option value="p3">15:00-15:30</option><option value="p4">15:30-16:00</option><option value="p5">16:00-16:30</option><option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
- } else if (range(paseToFullTime("14:30"), paseToFullTime("15:00"))) {
- defaultTime = "p2";
- timeHtml = '<option value="p2">14:30-15:00</option><option value="p3">15:00-15:30</option><option value="p4">15:30-16:00</option><option value="p5">16:00-16:30</option><option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
- } else if (range(paseToFullTime("15:00"), paseToFullTime("15:30"))) {
- defaultTime = "p3";
- timeHtml = '<option value="p3">15:00-15:30</option><option value="p4">15:30-16:00</option><option value="p5">16:00-16:30</option><option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
- } else if (range(paseToFullTime("15:30"), paseToFullTime("16:00"))) {
- defaultTime = "p4";
- timeHtml = '<option value="p4">15:30-16:00</option><option value="p5">16:00-16:30</option><option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
- } else if (range(paseToFullTime("16:00"), paseToFullTime("16:30"))) {
- defaultTime = "p5";
- timeHtml = '<option value="p5">16:00-16:30</option><option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
- } else if (range(paseToFullTime("16:30"), paseToFullTime("17:00"))) {
- defaultTime = "p6";
- timeHtml = '<option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
- }else if (range(paseToFullTime("17:00"), paseToFullTime("17:30"))) {
- defaultTime = "p7";
- timeHtml = '<option value="p7">17:00-17:30</option>';
- }
- }
- $('#apTimes').html(timeHtml);
- $('#apTimes').selectpicker('refresh');
- $("#apTimes").selectpicker('val', defaultTime);
- $('#apTimes').selectpicker('refresh');
- } else {
- $("#apTimes").selectpicker('val', null);
- $('#apTimes').selectpicker('refresh');
- $("#apTimesDiv").removeClass("in").addClass("hide");
- $("#doctorDiv").css("margin-top", "0px");
- }
- }
- /**
- * 初始门诊时间区间下拉选
- */
- function initMzWorkTime() {
- $("#ampm").selectpicker({
- size: 10
- });
- $.ajax({
- type: "GET",
- url: '/thmz/getMzWorkTimeCanUsed',
- 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;
- setAmTimes(ampm);
- }
- }
- });
- $('#ampm').empty(); //清空resText里面的所有内容
- $('#ampm').html(html);
- $('#ampm').selectpicker('refresh');
- $("#ampm").selectpicker('val', ampm);
- $('#ampm').selectpicker('refresh');
- initDeptPlus(1);
- }
- });
- }
- /**
- * 初始门诊号别下拉选
- */
- function initChargeType() {
- $.ajax({
- type: "GET",
- url: '/thmz/getChargeTypeByRequestDay?unitCode=' + $('#deptNo').val() + "&m=" + $("#ampm").val() + "&apTime=" + $("#apTimes").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 mzyRequestId = $('#doctor').find("option:selected").attr('data-mzyRequestId');
- var checkFee = $('#doctor').find("option:selected").attr('data-checkFee');
- if (checkFee == undefined || checkFee == null) {
- checkFee = 0;
- }else {
- checkFee=parseFloat(checkFee);
- }
- //诊疗卡是否选择
- var zlkCheckbox = $("#zlkCheckbox").prop("checked");
- //病历本是否选择
- var blbCheckbox = $("#blbCheckbox").prop("checked");
- //诊疗卡和病历本费用
- var checkBoxFee = 0;
- if (zlkCheckbox) {
- checkBoxFee = checkBoxFee + 1;
- }
- if (blbCheckbox) {
- checkBoxFee = checkBoxFee + 1;
- }
- var totalFee = checkFee + checkBoxFee;
- $("#checkFee").val(totalFee);
- $("#amountMoney").text(totalFee);
- $("#amountMoneyConfirm").text(totalFee);
- $("#realMoney").val(totalFee);
- $("#cash").val(totalFee);
- $("#changeAmount").val(0);
- $.ajax({
- type: "GET",
- url: '/thmz/getMzChargeTypeByMzyRequestId?mzyRequestId=' + mzyRequestId + "&birthDay=" + $("#birthDay").val() + "&patientId="+ $("#patientId").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;
- }
- $("#registrationFee").val(res.data.reqFee);
- $("#hospitalFee").val(res.data.clinicFee);
- $("#othFee").val(parseFloat(res.data.othFee) - parseFloat(checkFee));
- var tempFee = parseFloat(res.data.reqFee) + parseFloat(res.data.clinicFee) + parseFloat(res.data.othFee);
- totalFee = tempFee + checkBoxFee;
- $("#amountMoney").text(totalFee);
- $("#amountMoneyConfirm").text(totalFee);
- $("#realMoney").val(totalFee);
- $("#cash").val(totalFee);
- 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');
- if (res.data.length == 1) {
- $('#' + payType).selectpicker('val', 'Y');
- } else {
- $('#' + payType).selectpicker('val', 'O');
- }
- $('#' + 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 {
- errorMesage(res);
- }
- }
- });
- }
- /**
- * 打开打印内容窗口
- * @param data
- */
- function printModal(data) {
- $("#printOrPreviewModal").modal("hide");
- $("#printModal").modal();
- }
- /**
- * 打开收费窗口
- * @param data
- */
- function confirmFeeModal() {
- var validatorResult = validator.checkAll($("#regi_form"));
- if (!validatorResult) {
- return;
- }
- if( $("#jdFlag").val() == '1'){
- savePatient(4)
- }else {
- openSfWindow()
- }
- }
- function openSfWindow() {
- $.ajax({
- type: "POST",
- url: '/thmz/validFurtherVisit',
- contentType: "application/json;charset=UTF-8",
- dataType: "json",
- data: JSON.stringify({
- "patientId": $("#patientId").val(),
- "visitDept": $("#deptNo").val(),
- "chargeType": $("#chargeType").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) {
- errorMesage(res)
- }else {
- var payTypeList = $("#payType").children();
- if (payTypeList.length == 1) {
- $('#payType').selectpicker('val', 'Y');
- } else {
- $('#payType').selectpicker('val', 1);
- }
- //$('#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();
- sendPriceMessage($("#amountMoneyConfirm").text(), 0.0, 0.0, $("#patientId").val());
- }
- }
- });
- }
- /**
- * 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 && index <= 0)) {
- $("#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) {
- extracted(res);
- } else {
- $("#saveUser").show();
- $("#newCardModal").modal();
- $(document).keydown(function (event) { //监听键盘按下时的事件
- if (event.keyCode == 13) {
- //回车键
- $('#newCardModal').modal('hide');
- }
- });
- }
- } else {
- errorMesage(res);
- }
- }
- });
- }
- }
- /**
- * 卡号输入改变事件
- */
- 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) {
- errorMesageSimaple("收款金额不能少于实收金额!");
- return;
- } else if (cash > realMoney) {
- if ($("#payType").val() == 1) {
- var changeAmount = cash - realMoney;
- $("#changeAmount").val(changeAmount.toFixed(2));
- sendPriceMessage(realMoney, cash, changeAmount.toFixed(2), $("#patientId").val());
- } else {
- errorMesageSimaple("非现金收款金额不能大于实收金额!");
- return;
- }
- } else {
- $("#changeAmount").val(0.00);
- sendPriceMessage(realMoney, cash, 0.00, $("#patientId").val());
- }
- //计算和设置折扣比例
- 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 + ' ';
- html += mzPatientMi.ageString;
- 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) {
- extracted(res);
- }
- } else {
- errorMesage(res);
- }
- }
- });
- }
- function extracted(res) {
- if(stringNotBlank(res.data.patientId)){
- postAjaxJsonHttpRequst("/thmz/queryVisitTypeName",{patientId:res.data.patientId},true,function (typeRes) {
- if(typeRes.code ==0 && typeRes.data !='' && typeRes.data !=''){
- $("#visitTypeName").text(typeRes.data)
- }
- })
- }
- $("#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();
- $('#certificateType').selectpicker('val', res.data.certificateType);
- $('#certificateType').selectpicker('refresh');
- $("#idCard").val(res.data.socialNo);
- $("#idCard").attr("title", res.data.socialNo);
- $("#idCard").blur();
- $('#provinceCode').selectpicker('val', res.data.provinceCode);
- $('#provinceCode').selectpicker('refresh');
- initCity(1, res.data.cityCode);
- initDistrict(1, res.data.cityCode, res.data.districtCode);
- $("#detail").val(res.data.detail);
- $("#detail").blur();
- $("#patientId").val(res.data.patientId);
- setAge();
- $("#age").blur();
- if (res.data.icCardNo != null && res.data.icCardNo != "") {
- $("#clearIcCardNo").show();
- }
- if (res.data.patientId != null && res.data.patientId != "") {
- // $("#nucleicAcid").show();
- // $("#hybridTest").show();
- $("#editUser").show();
- }
- readonlyOrNot(true);
- $("#saveUser").hide();
- }
- /**
- * 将病人信息填入患者信息修改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();
- $('#editUserCertificateType').selectpicker('val', patinet.certificateType);
- $('#editUserCertificateType').selectpicker('refresh');
- $("#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();
- $('#editUserProvinceCode').selectpicker('val', patinet.provinceCode);
- $('#editUserProvinceCode').selectpicker('refresh');
- initCity(2, patinet.cityCode);
- initDistrict(2, patinet.cityCode, patinet.districtCode);
- $("#editUserDetail").val(patinet.detail);
- $("#editUserDetail").blur();
- $("#editUserContact").val(patinet.relName);
- $("#editUserContactPhone").val(patinet.contractName);
- }
- }
- /**
- * 将病人信息修改域置空
- * @param patinet
- */
- function clearPlusPatinet() {
- $("#editUserCode").val(null);
- $("#editUserName").val(null);
- $("#editUserAge").val(null);
- $("#editUserGender").selectpicker('val', '1');
- $("#editUserGender").selectpicker('refresh');
- $("#editUserBirthDay").val(null);
- $('#editUserCertificateType').selectpicker('val', '01');
- $('#editUserCertificateType').selectpicker('refresh');
- $("#editUserCardNo").val(null);
- $("#editUserCardNo").attr("title", null);
- $("#editUserPhoneNum").val(null);
- $("#editUserPhoneNum").attr("title", null);
- $("#editUserPatientsNature").selectpicker('val', '01');//默认选中
- $('#editUserPatientsNature').selectpicker('refresh');
- $("#editUserIdCard").val(null);
- $("#editUserIdCard").attr("title", null);
- $('#editUserProvinceCode').selectpicker('val', null);
- $('#editUserProvinceCode').selectpicker('refresh');
- $('#editCityCode').selectpicker('val', null);
- $('#editCityCode').selectpicker('refresh');
- $('#editUserDistrictCode').selectpicker('val', null);
- $('#editUserDistrictCode').selectpicker('refresh');
- $("#editUserDetail").val(null);
- $("#editUserContact").val(null);
- $("#editUserContactPhone").val(null);
- }
- /**
- * 关闭当前这个付款方式
- */
- 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() {
- $.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;
- }
- return;
- }
- });
- }
- //
- // /**
- // * 保存窗口号
- // */
- // 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 type 1 继续调用挂号接口,2,只建档不挂号 3 不清空 4保存后不清除,打开收费窗口
- */
- function savePatient(type) {
- $.ajax({
- type: "POST",
- url: '/thmz/savePatient',
- contentType: "application/json;charset=UTF-8",
- dataType: "json",
- async: false,
- data: JSON.stringify({
- "patientId":$("#patientId").val(),
- "name": $("#userName").val(),
- "age": $("#age").val(),
- "sex": $("#gender").val(),
- "birthDay": $("#birthDay").val(),
- "certificateType": $("#certificateType").val(),
- "icCardNo": $("#cardNo").val(),
- "phoneNo": $("#phoneNum").val(),
- "responseType": $("#patientsNature").val(),
- "socialNo": $("#idCard").val(),
- "provinceCode": $("#provinceCode").val(),
- "cityCode": $("#cityCode").val(),
- "districtCode": $("#districtCode").val(),
- "detail": $("#detail").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 (type == 1) {
- $("#patientId").val(res.data.patientId);
- saveMzyReqrec();
- } else if (type == 2) {
- clearRegistration();
- successMesage(res);
- } else if (type == 3) {
- $("#patientId").val(res.data.patientId);
- $("#saveUser").hide();
- }else if (type == 4) {
- $("#patientId").val(res.data.patientId);
- $("#saveUser").hide();
- openSfWindow()
- }
- } else {
- $("#saveConfirmFee").attr("disabled", false);
- 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(),
- "certificateType": $("#editUserCertificateType").val(),
- "icCardNo": $("#editUserCardNo").val(),
- "phoneNo": $("#editUserPhoneNum").val(),
- "responseType": $("#editUserPatientsNature").val(),
- "socialNo": $("#editUserIdCard").val(),
- "provinceCode": $("#editUserProvinceCode").val(),
- "cityCode": $("#editCityCode").val(),
- "districtCode": $("#editUserDistrictCode").val(),
- "detail": $("#editUserDetail").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());
- clearPlusPatinet();
- successMesage(res);
- } else {
- errorMesage(res);
- }
- }
- });
- }
- /**
- * 保存挂号信息
- */
- function saveMzyReqrec() {
- var mzyRequestId = $('#doctor').find("option:selected").attr('data-mzyRequestId');
- var patientId = $("#patientId").val();
- var totalFee = $("#realMoney").val();
- //诊疗卡是否选择
- var zlkCheckbox = $("#zlkCheckbox").prop("checked");
- //病历本是否选择
- var blbCheckbox = $("#blbCheckbox").prop("checked");
- //诊疗卡费用
- var zlkFee = 0;
- //病历本费用
- var blbFee = 0;
- if (zlkCheckbox) {
- zlkFee = 2;
- }
- if (blbCheckbox) {
- blbFee = 1;
- }
- $.ajax({
- type: "POST",
- url: '/thmz/saveMzyReqrec',
- contentType: "application/json;charset=UTF-8",
- dataType: "json",
- data: JSON.stringify({
- "mzyReqrec": {
- "patientId": patientId,
- "ampm": $("#ampm").val(),
- "apTime": $("#apTimes").val(),
- "unitCode": $("#deptNo").val(),
- "chargeType": $("#chargeType").val(),
- "paymode": $("#payType").val(),
- "zlkFee": zlkFee,
- "blbFee": blbFee,
- "psordnum": $("#refNo").val(),
- "agtordnum": $("#qrCodeParam").val(),
- "transDate": $("#transDate").val(),
- "parChannel": $("#payChannel").val(),
- "traceNo": $("#traceNo").val()
- },
- "responceType": $("#patientsNature").val(),
- "mzyRequestId": mzyRequestId,
- "totalFee": totalFee,
- "payMark": "0"
- }),
- 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) {
- successMesage(res);
- $('#confirmFeeModal').modal('hide');
- prn1Print(patientId, -1);
- // loadTableCount();
- // loadRegistrationList(true);
- clearRegistration();
- // toEvaluation(patientId);
- toNewEvaluation(patientId,res.times);
- } else {
- errorMesage(res);
- }
- $("#saveConfirmFee").attr("disabled", false);
- }
- });
- }
- /**
- * 挂号列表中的科室和医生列表初始化
- */
- 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 + '(' + comment.pyCode + ')</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'));
- }
- /**
- * 医保电子凭证读卡
- * @param params
- */
- function siReadCard(params) {
- $.ajax({
- type: "GET",
- url: 'http://localhost:8321/readcard/entry?param='+params,
- 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;
- }
- //console.log(res);
- if (res.code == 200) {
- var data = JSON.parse(res.data);
- $('#certificateType').selectpicker('val', data.data.idType);
- $('#certificateType').selectpicker('refresh');
- $("#idCard").val(data.data.idNo);
- $("#userName").val(data.data.userName);
- queryUserInfoBySocialNo(1);
- //successMesage(res);
- } else {
- errorMesage(res);
- }
- }
- });
- // window.open('ReadCard://'+prm, '_self')
- }
- /**
- * 清空挂号信息
- */
- 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);
- $('#provinceCode').selectpicker('val', null);
- $('#provinceCode').selectpicker('refresh');
- $('#cityCode').selectpicker('val', null);
- $('#cityCode').selectpicker('refresh');
- $('#districtCode').selectpicker('val', null);
- $('#districtCode').selectpicker('refresh');
- $("#detail").val(null);
- //$("#idAddress").val(null);
- $("#copyAddress").removeAttr("data-clipboard-text");
- $("#copyAddress").hide();
- $("#patientId").val(null);
- $("#jdFlag").val(null);
- $("#editUser").hide();
- $("#clearIcCardNo").hide();
- $("#nucleicAcid").hide();
- $("#hybridTest").hide();
- //默认光标在卡号输入框
- $("#cardNo").focus();
- initMzWorkTime();
- readonlyOrNot(false);
- $('#certificateType').selectpicker('val', '01');
- $('#certificateType').selectpicker('refresh');
- $("#saveUser").hide();
- var zlkCheckbox = $("#zlkCheckbox").prop("checked");
- if (zlkCheckbox) {
- $("#zlkCheckbox").parent().parent().click();//当前选中改为不选中
- }
- var blbCheckbox = $("#blbCheckbox").prop("checked");
- if (blbCheckbox) {
- $("#blbCheckbox").parent().parent().click();//当前选中改为不选中
- }
- $("#refNo").val(null);
- $("#transDate").val(null);
- $("#payChannel").val(null);
- $("#qrCodeParam").val(null);
- $("#traceNo").val(null);
- }
- /**
- * 直接打印发票
- * @param patientId
- */
- function prn1Print(patientId, times) {
- setPrint();
- var height = "93.15mm";
- var bkimgWidth = "120mm"
- if(fpVsesionNo == 1){
- height = "60mm"
- bkimgWidth = "110mm"
- }
- $.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, bkimgWidth, height, hospitalName+"门诊发票打印");
- //设置默认打印机
- LODOP.SET_PRINTER_INDEX(printIndex);
- LODOP.SET_SHOW_MODE("BKIMG_WIDTH", bkimgWidth);
- LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", height);
- LODOP.SET_PRINT_PAGESIZE(1, bkimgWidth, height, "CreateCustomPage");
- LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊发票");//对新建的纸张重命名
- LODOP.SET_PRINT_STYLE("FontSize", 11); //字体大小
- LODOP.ADD_PRINT_TEXT("6mm", "0mm", "55mm", "3mm", hospitalName);
- if(fpVsesionNo == 0){
- 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", "50mm", "3mm", temp.name);
- LODOP.ADD_PRINT_TEXT("25mm", "61mm", "27mm", "3mm", patientId);
- LODOP.ADD_PRINT_TEXT("32mm", "6mm", "50mm", "3mm", "就诊科室:" + temp.unitCode);
- LODOP.ADD_PRINT_TEXT("32mm", "56mm", "50mm", "3mm", "地点:" + res.officePos == null ? "" : res.officePos);
- LODOP.ADD_PRINT_TEXT("37mm", "6mm", "50mm", "3mm", "看诊医生:" + temp.doctorCode);
- LODOP.ADD_PRINT_TEXT("37mm", "56mm", "50mm", "3mm", "号段:" + temp.ampm);
- LODOP.ADD_PRINT_TEXT("42mm", "6mm", "50mm", "3mm", "号别:" + temp.chargeType);
- LODOP.ADD_PRINT_TEXT("42mm", "56mm", "50mm", "3mm", "挂号费:" + temp.reqFee);
- LODOP.ADD_PRINT_TEXT("47mm", "6mm", "50mm", "3mm", "诊查费:" + temp.clinicFee);
- LODOP.ADD_PRINT_TEXT("47mm", "56mm", "50mm", "3mm", "其他:" + temp.othFee);
- var blbFee = temp.blbFee;
- if (blbFee == null) {
- blbFee = 0;
- }
- if (temp.zlkFee != null) {
- blbFee = blbFee + temp.zlkFee;
- }
- LODOP.ADD_PRINT_TEXT("52mm", "6mm", "50mm", "3mm", "工本费:" + blbFee);
- 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);//收费员
- }
- else {
- LODOP.ADD_PRINT_TEXT("12mm", "3mm", "50mm", "3mm", "姓名:"+temp.name);
- LODOP.ADD_PRINT_TEXT("18mm", "3mm", "50mm", "3mm", "门诊号:"+patientId);
- LODOP.ADD_PRINT_TEXT("24mm", "3mm", "50mm", "3mm", "就诊科室:" + temp.unitCode);
- LODOP.ADD_PRINT_TEXT("30mm", "3mm", "70mm", "3mm", "地点:" + res.officePos);
- LODOP.ADD_PRINT_TEXT("36mm", "3mm", "50mm", "3mm", "看诊医生:" + temp.doctorCode);
- LODOP.ADD_PRINT_TEXT("42mm", "3mm", "50mm", "3mm", "号段:" + temp.ampm);
- LODOP.ADD_PRINT_TEXT("48mm", "3mm", "50mm", "3mm", "号别:" + temp.chargeType);
- LODOP.ADD_PRINT_TEXT("54mm", "3mm", "50mm", "3mm", "收费员:"+res.user.userName);//收费员
- }
- //LODOP.PREVIEW();
- LODOP.PRINT();
- if (times > 0) {
- loadRegistrationList(true);
- }
- } else if (res.code == -2) {
- warningMesageSimaple(res.message);
- } else if (res.code == -1) {
- errorMesage(res);
- }
- }
- });
- };
- /**
- * 销卡
- * @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);
- }
- }
- });
- }
- }
- /**
- * 设置年龄
- */
- function setAge() {
- var birthDay = $("#birthDay").val();
- var socialNo = $("#idCard").val();
- if ((birthDay == null || birthDay == "") && idCard != null && idCard != "") {
- birthDay = socialNo.substring(6, 14);
- birthDay = birthDay.substring(0, 4) + "-" + birthDay.substring(4, 6) + "-" + birthDay.substring(6);
- } else 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);
- }
- /**
- * 打开创建核酸检测(单人)处方弹窗
- */
- function nucleicAcid() {
- $("#nucleicAcidTip").html("是否要给患者【" + $("#userName").val() + "】创建核酸检查(单人单管)申请?");
- $("#saveNucleicAcid").removeClass("hide");
- $("#chargeFeeNucleicAcid").addClass("hide");
- $("#nucleicAcidModal").modal();
- }
- /**
- * 打开创建核酸检测(混检)处方弹窗
- */
- function hybridTest() {
- $("#hybridTestTip").html("是否要给患者【" + $("#userName").val() + "】创建核酸检查(混检)申请?");
- $("#saveHybridTest").removeClass("hide");
- $("#chargeFeeHybridTest").addClass("hide");
- $("#hybridTestModal").modal();
- }
- /**
- * 创建核酸检查处方并保存
- */
- function saveNucleicAcid() {
- $.ajax({
- type: "GET",
- url: '/thmz/identityCardVerification?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) {
- $.ajax({
- type: "GET",
- url: '/thmz/nucleicAcidApplication?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) {
- successMesage(res);
- $("#nucleicAcidTip").html("患者【" + $("#userName").val() + "】的核酸检查(单人单管)申请已经创建成功,是否立即缴费?");
- $("#chargeFeeNucleicAcid").removeClass("hide");
- $("#saveNucleicAcid").addClass("hide");
- //$("#nucleicAcidModal").modal("hide");
- } else {
- errorMesage(res);
- }
- }
- });
- } else {
- errorMesage(res);
- }
- }
- });
- }
- /**
- * 跳转到缴费界面
- */
- function chargeFeeNucleicAcid() {
- $("#nucleicAcidModal").modal("hide");
- //延时刷新页面,因为页面弹窗有遮掩,需要时间清除
- setTimeout(function () {
- //不按传统的路径传值设置值,这个参数会在页面跳转的时候截断
- changeContent('/thmz/toll-administration?' + $("#patientId").val());
- }, 400);
- }
- /**
- * 创建核酸检查(混检)处方并保存
- */
- function saveHybridTest() {
- $.ajax({
- type: "GET",
- url: '/thmz/identityCardVerification?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) {
- $.ajax({
- type: "GET",
- url: '/thmz/hybridTestApplication?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) {
- successMesage(res);
- $("#hybridTestTip").html("患者【" + $("#userName").val() + "】的核酸检查(混检)申请已经创建成功,是否立即缴费?");
- $("#chargeFeeHybridTest").removeClass("hide");
- $("#saveHybridTest").addClass("hide");
- } else {
- errorMesage(res);
- }
- }
- });
- } else {
- errorMesage(res);
- }
- }
- });
- }
- /**
- * 跳转到(混检)缴费界面
- */
- function chargeFeeHybridTest() {
- $("#hybridTestModal").modal("hide");
- //延时刷新页面,因为页面弹窗有遮掩,需要时间清除
- setTimeout(function () {
- //不按传统的路径传值设置值,这个参数会在页面跳转的时候截断
- changeContent('/thmz/toll-administration?' + $("#patientId").val());
- }, 400);
- }
- /**
- * 复制地址
- */
- function copyAddress() {
- if (clipboard != null) {
- clipboard.destroy();
- }
- clipboard = new ClipboardJS('#copyAddress', {
- text: function (trigger) {
- alert("复制成功!");
- return trigger.getAttribute('data-clipboard-text');
- }
- });
- }
- /**
- * 因为父元素加了点击事件,如果鼠标点击的是checkbox 本身,会触发一次,所以这里增加一个反事件
- * @param obj
- */
- function checkProChangeCancel(obj) {
- var check = $(obj).prop("checked");
- $(obj).prop("checked", !check) //如果鼠标点击选中了,执行后可以取消选中
- }
- /**
- * 附加收费点击事件
- * @param obj
- */
- function checkProChange(obj) {
- var check = !$(obj).find('label').find('input').prop("checked");
- //以下两个方法,单独调用一个可能不行
- $(obj).find('label').find('input').prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
- fitFee();
- }
- /**
- * 刷卡/扫码
- */
- function consume() {
- $("#consume").attr("disabled", true);
- $("#saveConfirmFee").attr("disabled", true);
- var patientId = $("#patientId").val();
- if (patientId == null || patientId == "") {
- savePatient(3);
- patientId = $("#patientId").val();
- }
- var chequeType = $("#payType").val();
- var amt = $("#realMoney").val();
- $.ajax({
- type: "POST",
- url: '/thmz/consume',
- contentType: "application/json;charset=UTF-8",
- dataType: "json",
- data: JSON.stringify({
- "patientId": patientId,
- "chequeType": chequeType,
- "amt": amt,
- "type": 0
- }),
- 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) {
- successMesage(res);
- $("#refNo").val(res.data.refNo);
- $("#transDate").val(res.data.transDate);
- $("#payChannel").val(res.data.payChannel);
- $("#qrCodeParam").val(res.data.wxAliPayOrderNo);
- $("#traceNo").val(res.data.traceNo);
- } else {
- errorMesage(res);
- }
- $("#saveConfirmFee").attr("disabled", false);
- $("#consume").attr("disabled", false);
- }
- });
- }
|