jc_jy_zd_item.js 62 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706
  1. //@ sourceURL=jc_jy_zd_item.js
  2. var chargeItemMap = null;
  3. var chargeItemObj = null;
  4. $(function () {
  5. $("#btn_add").click(function (t) {
  6. var sourceGroup = getIndex("source_group");
  7. if (sourceGroup == 0) {
  8. $("#editJcModal").modal();
  9. $("#classJcTitle").text("新增");
  10. clearJcInput();
  11. } else {
  12. $("#editJyModal").modal();
  13. $("#classJyTitle").text("新增");
  14. clearJyInput()
  15. }
  16. });
  17. $("#btn_save").click(function (t) {
  18. $("#messageModal").modal();
  19. $("#editJcModal").modal("hide");
  20. $("#messageContent").html("确认要保存当前检查项目吗?");
  21. $("#messageButton").off("click").on("click", function (t) {
  22. $("#messageModal").modal("hide");
  23. saveJcZdItem();
  24. });
  25. $("#cancelButton").off("click").on("click", function (t) {
  26. $("#editJcModal").modal();
  27. });
  28. });
  29. $("#btn_jy_save").click(function (t) {
  30. $("#messageModal").modal();
  31. $("#editJyModal").modal("hide");
  32. $("#messageContent").html("确认要保存当前检验项目吗?");
  33. $("#messageButton").off("click").on("click", function (t) {
  34. $("#messageModal").modal("hide");
  35. saveJyZdItem();
  36. });
  37. $("#cancelButton").off("click").on("click", function (t) {
  38. $("#editJyModal").modal();
  39. });
  40. });
  41. $("#btn_saveJcCharge").click(function (t) {
  42. $("#messageModal").modal();
  43. $("#messageContent").html("确认要保存当前明细项目吗?");
  44. $("#messageButton").off("click").on("click", function (t) {
  45. $("#messageModal").modal("hide");
  46. saveJcCharge();
  47. });
  48. });
  49. $("#btn_saveJyCharge").click(function (t) {
  50. $("#messageModal").modal();
  51. $("#messageContent").html("确认要保存当前明细项目吗?");
  52. $("#messageButton").off("click").on("click", function (t) {
  53. $("#messageModal").modal("hide");
  54. saveJyCharge();
  55. });
  56. });
  57. initJcZdItemList();
  58. $("#btn_query").click(function (t) {
  59. var sourceGroup = getIndex("source_group");
  60. if (sourceGroup == 0) {
  61. initJcZdItemList()
  62. } else {
  63. initJyZdItemList();
  64. }
  65. });
  66. initSelect();
  67. initExecUnit();
  68. initBwCode();
  69. $('#btn_clean').click(function () {
  70. $("#jcClassParams").selectpicker('val', null);//默认选中
  71. $("#jcClassParams").selectpicker('refresh');
  72. $("#bwParams").selectpicker('val', null);//默认选中
  73. $("#bwParams").selectpicker('refresh');
  74. $("#jyClassParams").selectpicker('val', null);//默认选中
  75. $("#jyClassParams").selectpicker('refresh');
  76. $("#sampleCodeParams").selectpicker('val', null);//默认选中
  77. $("#sampleCodeParams").selectpicker('refresh');
  78. $("#vesselParams").selectpicker('val', null);//默认选中
  79. $("#vesselParams").selectpicker('refresh');
  80. $("#execUnitParams").selectpicker('val', null);//默认选中
  81. $("#execUnitParams").selectpicker('refresh');
  82. $("#nameParam").val(null);
  83. $("#delFlagParams").selectpicker('val', null);//默认选中
  84. $("#delFlagParams").selectpicker('refresh');
  85. });
  86. });
  87. /**
  88. * 号表类型切换事件
  89. * @param object
  90. */
  91. function sourceChange(object) {
  92. $("#source_group").find("button").each(function (index, element) {
  93. if ($(element).hasClass("btn-primary")) {
  94. $(element).removeClass("btn-primary").addClass("btn-default");
  95. }
  96. });
  97. $(object).removeClass("btn-default").addClass("btn-primary");
  98. var sourceGroup = getIndex("source_group");
  99. if (sourceGroup == 0) {
  100. $("#jcParams").removeClass("hide").addClass("in");
  101. $("#jyParams").removeClass("in").addClass("hide");
  102. initJcZdItemList();
  103. } else {
  104. $("#jyParams").removeClass("hide").addClass("in");
  105. $("#jcParams").removeClass("in").addClass("hide");
  106. initJyZdItemList();
  107. }
  108. $('#tb_table_mx').bootstrapTable("destroy");
  109. }
  110. /**
  111. * 获取按钮组选择的下标
  112. * @param id
  113. * @returns {number}
  114. */
  115. function getIndex(id) {
  116. var index = 0;
  117. var item = $("#" + id).find("button");
  118. for (var i = 0; i <= item.length; i++) {
  119. if ($(item[i]).hasClass("btn-primary")) {
  120. index = i;
  121. break;
  122. }
  123. }
  124. return index;
  125. }
  126. /**
  127. * 保存檢查项目
  128. */
  129. function saveJcZdItem() {
  130. var code = $("#code").val();
  131. var data = null;
  132. let min = $("#minAgeRestriction").val();
  133. let max = $("#maxAgeRestriction").val();
  134. let s;
  135. if(min){
  136. s = callJcJyAgeFormat(min)
  137. if(s === '-1'){
  138. return false;
  139. }
  140. }
  141. if(max){
  142. s = callJcJyAgeFormat(max)
  143. if(s === '-1'){
  144. return false;
  145. }
  146. }
  147. //修改檢查
  148. if (code != null) {
  149. data = JSON.stringify({
  150. code: code,
  151. name: $("#name").val(),
  152. classCode: $("#classCode").val(),
  153. execUnit: $("#execUnit").val(),
  154. bwCode: $("#bwCode").val(),
  155. delFlag: $("#delFlag").val(),
  156. zyFlag: $("#zyFlag").val(),
  157. mzFlag: $("#mzFlag").val(),
  158. execAddress:$("#execAddress").val(),
  159. genderRestriction:$("#genderRestriction").val(),
  160. minAgeRestriction:$("#minAgeRestriction").val(),
  161. maxAgeRestriction:$("#maxAgeRestriction").val(),
  162. timeLimit:$("#timeLimit").val()
  163. });
  164. } else {
  165. //新增檢查
  166. data = JSON.stringify({
  167. name: $("#name").val(),
  168. classCode: $("#classCode").val(),
  169. execUnit: $("#execUnit").val(),
  170. bwCode: $("#bwCode").val(),
  171. delFlag: $("#delFlag").val(),
  172. zyFlag: $("#zyFlag").val(),
  173. mzFlag: $("#mzFlag").val(),
  174. execAddress:$("#execAddress").val(),
  175. genderRestriction:$("#genderRestriction").val(),
  176. minAgeRestriction:$("#minAgeRestriction").val(),
  177. maxAgeRestriction:$("#maxAgeRestriction").val(),
  178. timeLimit:$("#timeLimit").val()
  179. });
  180. }
  181. $.ajax({
  182. type: "POST",
  183. url: '/thmz/saveJcZdItem',
  184. contentType: "application/json;charset=UTF-8",
  185. dataType: "json",
  186. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  187. data: data,
  188. success: function (res) {
  189. if (res == '401' || res == 401) {
  190. window.location.href = '/thmz/login/view'
  191. return;
  192. }
  193. if (res.code == 0) {
  194. $("#editJcModal").modal("hide");
  195. clearJcInput();
  196. $('#tb_table').bootstrapTable('refresh');
  197. successMesage(res);
  198. } else {
  199. $("#editJcModal").modal();
  200. errorMesage(res);
  201. }
  202. }
  203. });
  204. }
  205. /**
  206. * 保存檢查项目明细
  207. */
  208. function saveJcCharge() {
  209. $.ajax({
  210. type: "POST",
  211. url: '/thmz/saveJcChargeItem',
  212. contentType: "application/json;charset=UTF-8",
  213. dataType: "json",
  214. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  215. data: JSON.stringify({
  216. code: $("#jcItemCode").val(),
  217. chargeCode: $("#chargeItem").val(),
  218. amount: $("#amount").val(),
  219. zyFlag: $("#zyFlagJcCharge").val(),
  220. mzFlag: $("#mzFlagJcCharge").val()
  221. }),
  222. success: function (res) {
  223. if (res == '401' || res == 401) {
  224. window.location.href = '/thmz/login/view'
  225. return;
  226. }
  227. if (res.code == 0) {
  228. $("#editJcChargeItemModal").modal("hide");
  229. getJcItemChargesByItemCode($("#jcItemCode").val());
  230. clearJcChargeItemInput();
  231. successMesage(res);
  232. } else {
  233. errorMesage(res);
  234. }
  235. }
  236. });
  237. }
  238. /**
  239. * 保存檢验项目明细
  240. */
  241. function saveJyCharge() {
  242. $.ajax({
  243. type: "POST",
  244. url: '/thmz/saveJyChargeItem',
  245. contentType: "application/json;charset=UTF-8",
  246. dataType: "json",
  247. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  248. data: JSON.stringify({
  249. code: $("#jyItemCode").val(),
  250. chargeCode: $("#chargeItemJy").val(),
  251. amount: $("#amountJy").val(),
  252. zyFlag: $("#zyFlagJyCharge").val(),
  253. mzFlag: $("#mzFlagJyCharge").val()
  254. }),
  255. success: function (res) {
  256. if (res == '401' || res == 401) {
  257. window.location.href = '/thmz/login/view'
  258. return;
  259. }
  260. if (res.code == 0) {
  261. $("#editJyChargeItemModal").modal("hide");
  262. getJyItemChargesByItemCode($("#jyItemCode").val());
  263. clearJyChargeItemInput();
  264. successMesage(res);
  265. } else {
  266. errorMesage(res);
  267. }
  268. }
  269. });
  270. }
  271. /**
  272. * 保存檢验项目
  273. */
  274. function saveJyZdItem() {
  275. var code = $("#codeJy").val();
  276. var data = null;
  277. let min = $("#minAgeRestrictionJy").val();
  278. let max = $("#maxAgeRestrictionJy").val();
  279. let s;
  280. if(min){
  281. s = callJcJyAgeFormat(min)
  282. if(s === '-1'){
  283. return false;
  284. }
  285. }
  286. if(max){
  287. s = callJcJyAgeFormat(max)
  288. if(s === '-1'){
  289. return false;
  290. }
  291. }
  292. //修改檢验
  293. if (code != null) {
  294. data = JSON.stringify({
  295. code: code,
  296. name: $("#nameJy").val(),
  297. classCode: $("#classCodeJy").val(),
  298. execUnit: $("#execUnitJy").val(),
  299. sampleCode: $("#sampleCode").val(),
  300. vessel: $("#vessel").val(),
  301. delFlag: $("#delFlagJy").val(),
  302. zyFlag: $("#zyFlagJy").val(),
  303. mzFlag: $("#mzFlagJy").val(),
  304. execAddress:$("#jyExecAddress").val(),
  305. genderRestriction:$("#genderRestrictionJy").val(),
  306. minAgeRestriction:$("#minAgeRestrictionJy").val(),
  307. maxAgeRestriction:$("#maxAgeRestrictionJy").val(),
  308. timeLimit:$("#timeLimitJy").val()
  309. });
  310. } else {
  311. //新增檢验
  312. data = JSON.stringify({
  313. name: $("#nameJy").val(),
  314. classCode: $("#classCodeJy").val(),
  315. execUnit: $("#execUnitJy").val(),
  316. sampleCode: $("#sampleCode").val(),
  317. vessel: $("#vessel").val(),
  318. delFlag: $("#delFlagJy").val(),
  319. zyFlag: $("#zyFlagJy").val(),
  320. mzFlag: $("#mzFlagJy").val(),
  321. execAddress:$("#jyExecAddress").val(),
  322. genderRestriction:$("#genderRestrictionJy").val(),
  323. minAgeRestriction:$("#minAgeRestrictionJy").val(),
  324. maxAgeRestriction:$("#maxAgeRestrictionJy").val(),
  325. timeLimit:$("#timeLimitJy").val(),
  326. });
  327. }
  328. $.ajax({
  329. type: "POST",
  330. url: '/thmz/saveJyZdItem',
  331. contentType: "application/json;charset=UTF-8",
  332. dataType: "json",
  333. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  334. data: data,
  335. success: function (res) {
  336. if (res == '401' || res == 401) {
  337. window.location.href = '/thmz/login/view'
  338. return;
  339. }
  340. if (res.code == 0) {
  341. $("#editJyModal").modal("hide");
  342. clearJyInput();
  343. $('#tb_table').bootstrapTable('refresh');
  344. successMesage(res);
  345. } else {
  346. $("#editJyModal").modal();
  347. errorMesage(res);
  348. }
  349. }
  350. });
  351. }
  352. /**
  353. * 清空输入框
  354. */
  355. function clearJcInput() {
  356. $("#code").val(null);
  357. $("#name").val(null);
  358. $("#classCode").selectpicker('val', null);//默认不选中
  359. $("#classCode").selectpicker('refresh');
  360. $("#execUnit").selectpicker('val', null);//默认不选中
  361. $("#execUnit").selectpicker('refresh');
  362. $("#bwCode").selectpicker('val', null);//默认不选中
  363. $("#bwCode").selectpicker('refresh');
  364. $("#delFlag").selectpicker('val', 0);//默认不选中
  365. $("#delFlag").selectpicker('refresh');
  366. $("#zyFlag").selectpicker('val', 0);//默认不选中
  367. $("#zyFlag").selectpicker('refresh');
  368. $("#mzFlag").selectpicker('val', 0);//默认不选中
  369. $("#mzFlag").selectpicker('refresh');
  370. $("#execAddress").val(null);
  371. $("#genderRestriction").selectpicker('val', '');//默认不选中
  372. $("#genderRestriction").selectpicker('refresh');
  373. $("#minAgeRestriction").val(null);
  374. $("#maxAgeRestriction").val(null);
  375. $("#timeLimit").val(null);
  376. }
  377. /**
  378. * 清空输入框
  379. */
  380. function clearJcChargeItemInput() {
  381. $("#jcItemCode").val(null);
  382. $("#amount").val(null);
  383. $("#chargeAmount").val(null);
  384. $("#chargeItem").selectpicker('val', null);//默认不选中
  385. $("#chargeItem").selectpicker('refresh');
  386. $("#zyFlagJcCharge").selectpicker('val', 0);//默认不选中
  387. $("#zyFlagJcCharge").selectpicker('refresh');
  388. $("#mzFlagJcCharge").selectpicker('val', 0);//默认不选中
  389. $("#mzFlagJcCharge").selectpicker('refresh');
  390. }
  391. /**
  392. * 清空输入框
  393. */
  394. function clearJyChargeItemInput() {
  395. $("#jyItemCode").val(null);
  396. $("#amountJy").val(null);
  397. $("#chargeAmountJy").val(null);
  398. $("#chargeItemJy").selectpicker('val', null);//默认不选中
  399. $("#chargeItemJy").selectpicker('refresh');
  400. $("#zyFlagJyCharge").selectpicker('val', 0);//默认不选中
  401. $("#zyFlagJyCharge").selectpicker('refresh');
  402. $("#mzFlagJyCharge").selectpicker('val', 0);//默认不选中
  403. $("#mzFlagJyCharge").selectpicker('refresh');
  404. }
  405. /**
  406. * 清空输入框
  407. */
  408. function clearJyInput() {
  409. $("#codeJy").val(null);
  410. $("#nameJy").val(null);
  411. $("#classCodeJy").selectpicker('val', null);//默认不选中
  412. $("#classCodeJy").selectpicker('refresh');
  413. $("#execUnitJy").selectpicker('val', null);//默认不选中
  414. $("#execUnitJy").selectpicker('refresh');
  415. $("#sampleCode").selectpicker('val', null);//默认不选中
  416. $("#sampleCode").selectpicker('refresh');
  417. $("#vessel").selectpicker('val', null);//默认不选中
  418. $("#vessel").selectpicker('refresh');
  419. $("#delFlagJy").selectpicker('val', 0);//默认不选中
  420. $("#delFlagJy").selectpicker('refresh');
  421. $("#zyFlagJy").selectpicker('val', 0);//默认不选中
  422. $("#zyFlagJy").selectpicker('refresh');
  423. $("#mzFlagJy").selectpicker('val', 0);//默认不选中
  424. $("#mzFlagJy").selectpicker('refresh');
  425. $("#jyExecAddress").val(null);
  426. $("#genderRestrictionJy").selectpicker('val', '');//默认不选中
  427. $("#genderRestrictionJy").selectpicker('refresh');
  428. $("#minAgeRestrictionJy").val(null);
  429. $("#maxAgeRestrictionJy").val(null);
  430. $("#timeLimitJy").val(null);
  431. }
  432. /**
  433. * 查询检查项目列表
  434. */
  435. function initJcZdItemList() {
  436. $('#tb_table').bootstrapTable("destroy");
  437. $('#tb_table').bootstrapTable({
  438. url: '/thmz/listJcZdItem', //请求后台的URL(*)
  439. method: 'post', //请求方式(*)
  440. toolbar: '#toolbar', //工具按钮用哪个容器
  441. striped: true, //是否显示行间隔色
  442. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  443. pagination: true, //是否显示分页(*)
  444. sortable: true, //是否启用排序
  445. sortOrder: "asc", //排序方式
  446. queryParams: queryParams, //传递参数(*)
  447. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  448. pageNumber: 1, //初始化加载第一页,默认第一页
  449. pageSize: 5, //每页的记录行数(*)
  450. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  451. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  452. strictSearch: true,
  453. showColumns: false, //是否显示所有的列
  454. showRefresh: false, //是否显示刷新按钮
  455. minimumCountColumns: 2, //最少允许的列数
  456. clickToSelect: true, //是否启用点击选中行
  457. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  458. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  459. cardView: false, //是否显示详细视图
  460. detailView: false,
  461. //rowStyle:rowStyle,//通过自定义函数设置行样式
  462. ajaxOptions: {
  463. headers: {
  464. 'Accept': 'application/json',
  465. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  466. }
  467. },
  468. columns: [
  469. {
  470. title: '操作',
  471. align: "center",
  472. valign: 'middle',
  473. formatter: function (value, row, index) {
  474. var str;
  475. if (row.delFlag == 1) {
  476. str = '<button type="button" class="btn btn-success btn-sm" onclick="updateDeleteJcZdItem(\'' + row.code + '\',\'' + row.name + '\',\'' + row.delFlag + '\')">启用</button>';
  477. } else {
  478. str = '<button type="button" class="btn btn-warning btn-sm" onclick="updateDeleteJcZdItem(\'' + row.code + '\',\'' + row.name + '\',\'' + row.delFlag + '\')">停用</button>';
  479. }
  480. str += '<button type="button" class="btn btn-primary btn-sm" onclick="editJcZdItem(\'' + row.code + '\')">编辑</button>';
  481. str += '<button type="button" class="btn btn-default btn-sm" onclick="addChargeZdItem(\'' + row.code + '\')">添加细目</button>';
  482. return [str].join('');
  483. }
  484. },
  485. {
  486. field: 'name',
  487. title: '项目名称',
  488. align: "center",
  489. valign: 'middle'
  490. }, {
  491. field: 'classCode',
  492. title: '分类',
  493. align: "center",
  494. valign: 'middle',
  495. }, {
  496. field: 'execUnit',
  497. title: '执行科室',
  498. align: "center",
  499. valign: 'middle',
  500. }, {
  501. field: 'bwCode',
  502. title: '部位',
  503. align: "center",
  504. valign: 'middle'
  505. }
  506. ],
  507. onClickRow: function (row) {
  508. getJcItemChargesByItemCode(row.code);
  509. },
  510. responseHandler: function (res) {
  511. if (res == '401' || res == 401) {
  512. window.location.href = '/thmz/login/view'
  513. return;
  514. }
  515. var ress = eval(res);
  516. if (ress.code == -1) {
  517. if (ress.message != null && ress.message != '') {
  518. errorMesage(res);
  519. }
  520. return {
  521. "total": 0,//总页数
  522. "rows": {} //数据
  523. };
  524. }
  525. return {
  526. "total": ress.total,//总页数
  527. "rows": ress.data //数据
  528. };
  529. },
  530. });
  531. }
  532. /**
  533. * 根据检查项目查询对应的明细列表
  534. * @param code
  535. */
  536. function getJcItemChargesByItemCode(code) {
  537. $('#tb_table_mx').bootstrapTable("destroy");
  538. $('#tb_table_mx').bootstrapTable({
  539. url: '/thmz/getJcItemChargesByItemCode?code=' + code, //请求后台的URL(*)
  540. method: 'get', //请求方式(*)
  541. toolbar: '#toolbar', //工具按钮用哪个容器
  542. striped: true, //是否显示行间隔色
  543. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  544. pagination: true, //是否显示分页(*)
  545. sortable: true, //是否启用排序
  546. sortOrder: "asc", //排序方式
  547. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  548. pageNumber: 1, //初始化加载第一页,默认第一页
  549. pageSize: 5, //每页的记录行数(*)
  550. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  551. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  552. strictSearch: true,
  553. showColumns: false, //是否显示所有的列
  554. showRefresh: false, //是否显示刷新按钮
  555. minimumCountColumns: 2, //最少允许的列数
  556. clickToSelect: true, //是否启用点击选中行
  557. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  558. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  559. cardView: false, //是否显示详细视图
  560. detailView: false,
  561. //rowStyle:rowStyle,//通过自定义函数设置行样式
  562. ajaxOptions: {
  563. headers: {
  564. 'Accept': 'application/json',
  565. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  566. }
  567. },
  568. columns: [
  569. {
  570. title: '操作',
  571. align: "center",
  572. valign: 'middle',
  573. formatter: function (value, row, index) {
  574. if (row.code == null || row.code == "") {
  575. return "";
  576. }
  577. var str = '<button type="button" class="btn btn-primary btn-sm" onclick="editJcChargeItem(\'' + row.code + '\',\'' + row.charge_code + '\')">编辑</button>';
  578. str += '<button type="button" class="btn btn-danger btn-sm" onclick="deleteJcChargeItem(\'' + row.code + '\',\'' + row.charge_code + '\')">删除</button>';
  579. return [str].join('');
  580. }
  581. },
  582. {
  583. field: 'code',
  584. title: '项目编码',
  585. align: "center",
  586. valign: 'middle'
  587. },
  588. {
  589. field: 'charge_code',
  590. title: '收费编码',
  591. align: "center",
  592. valign: 'middle'
  593. },
  594. {
  595. field: 'name',
  596. title: '收费项目名称',
  597. align: "center",
  598. valign: 'middle'
  599. },
  600. {
  601. field: 'amount',
  602. title: '数量',
  603. align: "center",
  604. valign: 'middle'
  605. },
  606. {
  607. field: 'charge_amount',
  608. title: '单价',
  609. align: "center",
  610. valign: 'middle',
  611. formatter: function (value, row, index) {
  612. if (value != null) {
  613. return Math.abs(value).toFixed(2);
  614. }
  615. }
  616. },
  617. {
  618. field: 'hnsyb_code',
  619. title: '省医保编码',
  620. align: "center",
  621. valign: 'middle'
  622. },
  623. {
  624. field: 'national_code',
  625. title: '国家医保编码',
  626. align: "center",
  627. valign: 'middle'
  628. },
  629. {
  630. field: 'national_name',
  631. title: '国家医保名称',
  632. align: "center",
  633. valign: 'middle'
  634. },
  635. {
  636. field: 'zy_flag',
  637. title: '住院停用',
  638. align: "center",
  639. valign: 'middle',
  640. formatter: function (value, row, index) {
  641. if (row.code == null || row.code == "") {
  642. return "";
  643. }
  644. if (value == 1 || value == "1") {
  645. return "是";
  646. }
  647. return "否";
  648. }
  649. },
  650. {
  651. field: 'mz_flag',
  652. title: '门诊停用',
  653. align: "center",
  654. valign: 'middle',
  655. formatter: function (value, row, index) {
  656. if (row.code == null || row.code == "") {
  657. return "";
  658. }
  659. if (value == 1 || value == "1") {
  660. return "是";
  661. }
  662. return "否";
  663. }
  664. }
  665. ],
  666. responseHandler: function (res) {
  667. if (res == '401' || res == 401) {
  668. window.location.href = '/thmz/login/view'
  669. return;
  670. }
  671. var ress = eval(res);
  672. if (ress.code == -1) {
  673. if (ress.message != null && ress.message != '') {
  674. errorMesage(res);
  675. }
  676. return {
  677. "total": 0,//总页数
  678. "rows": {} //数据
  679. };
  680. }
  681. return {
  682. "total": ress.data.length,//总页数
  683. "rows": ress.data //数据
  684. };
  685. },
  686. });
  687. }
  688. /**
  689. * 查询检验列表
  690. */
  691. function initJyZdItemList() {
  692. $('#tb_table').bootstrapTable("destroy");
  693. $('#tb_table').bootstrapTable({
  694. url: '/thmz/listJyZdItem', //请求后台的URL(*)
  695. method: 'post', //请求方式(*)
  696. toolbar: '#toolbar', //工具按钮用哪个容器
  697. striped: true, //是否显示行间隔色
  698. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  699. pagination: true, //是否显示分页(*)
  700. sortable: true, //是否启用排序
  701. sortOrder: "asc", //排序方式
  702. queryParams: queryParams, //传递参数(*)
  703. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  704. pageNumber: 1, //初始化加载第一页,默认第一页
  705. pageSize: 5, //每页的记录行数(*)
  706. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  707. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  708. strictSearch: true,
  709. showColumns: false, //是否显示所有的列
  710. showRefresh: false, //是否显示刷新按钮
  711. minimumCountColumns: 2, //最少允许的列数
  712. clickToSelect: true, //是否启用点击选中行
  713. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  714. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  715. cardView: false, //是否显示详细视图
  716. detailView: false,
  717. //rowStyle:rowStyle,//通过自定义函数设置行样式
  718. ajaxOptions: {
  719. headers: {
  720. 'Accept': 'application/json',
  721. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  722. }
  723. },
  724. columns: [
  725. {
  726. title: '操作',
  727. align: "center",
  728. valign: 'middle',
  729. formatter: function (value, row, index) {
  730. var str;
  731. if (row.delFlag == 1) {
  732. str = '<button type="button" class="btn btn-success btn-sm" onclick="updateDeleteJyZdItem(\'' + row.code + '\',\'' + row.name + '\',\'' + row.delFlag + '\')">启用</button>';
  733. } else {
  734. str = '<button type="button" class="btn btn-warning btn-sm" onclick="updateDeleteJyZdItem(\'' + row.code + '\',\'' + row.name + '\',\'' + row.delFlag + '\')">停用</button>';
  735. }
  736. str += '<button type="button" class="btn btn-primary btn-sm" onclick="editJyZdItem(\'' + row.code + '\')">编辑</button>';
  737. str += '<button type="button" class="btn btn-default btn-sm" onclick="addChargeJyZdItem(\'' + row.code + '\')">添加细目</button>';
  738. return [str].join('');
  739. }
  740. },
  741. {
  742. field: 'name',
  743. title: '项目名称',
  744. align: "center",
  745. valign: 'middle'
  746. },
  747. {
  748. field: 'classCode',
  749. title: '分类',
  750. align: "center",
  751. valign: 'middle'
  752. },
  753. {
  754. field: 'sampleCode',
  755. title: '标本',
  756. align: "center",
  757. valign: 'middle'
  758. },
  759. {
  760. field: 'vessel',
  761. title: '容器类型',
  762. align: "center",
  763. valign: 'middle'
  764. }, {
  765. field: 'execUnit',
  766. title: '执行科室',
  767. align: "center",
  768. valign: 'middle',
  769. }
  770. ],
  771. onClickRow: function (row) {
  772. getJyItemChargesByItemCode(row.code);
  773. },
  774. responseHandler: function (res) {
  775. if (res == '401' || res == 401) {
  776. window.location.href = '/thmz/login/view'
  777. return;
  778. }
  779. var ress = eval(res);
  780. if (ress.code == -1) {
  781. if (ress.message != null && ress.message != '') {
  782. errorMesage(res);
  783. }
  784. return {
  785. "total": 0,//总页数
  786. "rows": {} //数据
  787. };
  788. }
  789. return {
  790. "total": ress.total,//总页数
  791. "rows": ress.data //数据
  792. };
  793. },
  794. });
  795. }
  796. /**
  797. * 构建列表查询参数
  798. * @param params
  799. * @returns {{mzChargeDetail: {patientId: string | number | string[] | undefined | jQuery, warnDept: string | number | string[] | undefined | jQuery, doctorCode: string | number | string[] | undefined | jQuery, name: string | number | string[] | undefined | jQuery, payMark: number}, beginTime: Date, endTime: Date, pageSize: *, pageIndex: number}}
  800. */
  801. function queryParams(params) {
  802. var sourceGroup = getIndex("source_group");
  803. if (sourceGroup == 0) {
  804. var temp = {
  805. code: $('#nameParam').val(),
  806. execUnit: $('#execUnitParams').val(),
  807. classCode: $('#jcClassParams').val(),
  808. bwCode: $('#bwParams').val(),
  809. delFlag: $('#delFlagParams').val(),
  810. pageSize: params.limit, //页面大小
  811. pageIndex: params.offset / params.limit, //页码
  812. };
  813. } else {
  814. var temp = {
  815. code: $('#nameParam').val(),
  816. execUnit: $('#execUnitParams').val(),
  817. classCode: $('#jyClassParams').val(),
  818. sampleCode: $('#sampleCodeParams').val(),
  819. vessel: $('#vesselParams').val(),
  820. delFlag: $('#delFlagParams').val(),
  821. pageSize: params.limit, //页面大小
  822. pageIndex: params.offset / params.limit, //页码
  823. };
  824. }
  825. return temp;
  826. };
  827. /**
  828. * 根据检验项目查询对应的明细列表
  829. * @param code
  830. */
  831. function getJyItemChargesByItemCode(code) {
  832. $('#tb_table_mx').bootstrapTable("destroy");
  833. $('#tb_table_mx').bootstrapTable({
  834. url: '/thmz/getJyItemChargesByItemCode?code=' + code, //请求后台的URL(*)
  835. method: 'get', //请求方式(*)
  836. toolbar: '#toolbar', //工具按钮用哪个容器
  837. striped: true, //是否显示行间隔色
  838. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  839. pagination: true, //是否显示分页(*)
  840. sortable: true, //是否启用排序
  841. sortOrder: "asc", //排序方式
  842. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  843. pageNumber: 1, //初始化加载第一页,默认第一页
  844. pageSize: 5, //每页的记录行数(*)
  845. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  846. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  847. strictSearch: true,
  848. showColumns: false, //是否显示所有的列
  849. showRefresh: false, //是否显示刷新按钮
  850. minimumCountColumns: 2, //最少允许的列数
  851. clickToSelect: true, //是否启用点击选中行
  852. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  853. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  854. cardView: false, //是否显示详细视图
  855. detailView: false,
  856. //rowStyle:rowStyle,//通过自定义函数设置行样式
  857. ajaxOptions: {
  858. headers: {
  859. 'Accept': 'application/json',
  860. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  861. }
  862. },
  863. columns: [
  864. {
  865. title: '操作',
  866. align: "center",
  867. valign: 'middle',
  868. formatter: function (value, row, index) {
  869. if (row.code == null || row.code == "") {
  870. return "";
  871. }
  872. var str = '<button type="button" class="btn btn-primary btn-sm" onclick="editJyChargeItem(\'' + row.code + '\',\'' + row.charge_code + '\')">编辑</button>';
  873. str += '<button type="button" class="btn btn-warning btn-sm" onclick="deleteJyChargeItem(\'' + row.code + '\',\'' + row.charge_code + '\')">删除</button>';
  874. return [str].join('');
  875. }
  876. },
  877. {
  878. field: 'code',
  879. title: '项目编码',
  880. align: "center",
  881. valign: 'middle'
  882. },
  883. {
  884. field: 'charge_code',
  885. title: '收费编码',
  886. align: "center",
  887. valign: 'middle'
  888. },
  889. {
  890. field: 'name',
  891. title: '收费项目名称',
  892. align: "center",
  893. valign: 'middle'
  894. },
  895. {
  896. field: 'amount',
  897. title: '数量',
  898. align: "center",
  899. valign: 'middle'
  900. },
  901. {
  902. field: 'charge_amount',
  903. title: '单价',
  904. align: "center",
  905. valign: 'middle',
  906. formatter: function (value, row, index) {
  907. if (value != null) {
  908. return Math.abs(value).toFixed(2);
  909. }
  910. }
  911. },
  912. {
  913. field: 'hnsyb_code',
  914. title: '省医保编码',
  915. align: "center",
  916. valign: 'middle'
  917. },
  918. {
  919. field: 'national_code',
  920. title: '国家医保编码',
  921. align: "center",
  922. valign: 'middle'
  923. },
  924. {
  925. field: 'national_name',
  926. title: '国家医保名称',
  927. align: "center",
  928. valign: 'middle'
  929. },
  930. {
  931. field: 'zy_flag',
  932. title: '住院停用',
  933. align: "center",
  934. valign: 'middle',
  935. formatter: function (value, row, index) {
  936. if (row.code == null || row.code == "") {
  937. return "";
  938. }
  939. if (value == 1 || value == "1") {
  940. return "是";
  941. }
  942. return "否";
  943. }
  944. },
  945. {
  946. field: 'mz_flag',
  947. title: '门诊停用',
  948. align: "center",
  949. valign: 'middle',
  950. formatter: function (value, row, index) {
  951. if (row.code == null || row.code == "") {
  952. return "";
  953. }
  954. if (value == 1 || value == "1") {
  955. return "是";
  956. }
  957. return "否";
  958. }
  959. }
  960. ],
  961. responseHandler: function (res) {
  962. if (res == '401' || res == 401) {
  963. window.location.href = '/thmz/login/view'
  964. return;
  965. }
  966. var ress = eval(res);
  967. if (ress.code == -1) {
  968. if (ress.message != null && ress.message != '') {
  969. errorMesage(res);
  970. }
  971. return {
  972. "total": 0,//总页数
  973. "rows": {} //数据
  974. };
  975. }
  976. return {
  977. "total": ress.data.length,//总页数
  978. "rows": ress.data //数据
  979. };
  980. },
  981. });
  982. }
  983. /**
  984. * 删除记录 (停用)
  985. * @param code
  986. */
  987. function updateDeleteJcZdItem(code, name, delFlag) {
  988. var message = null;
  989. if (delFlag == 1) {
  990. message = "您确认要启用【" + name + "】项目吗?";
  991. delFlag = 0;
  992. } else {
  993. message = "您确认要停用【" + name + "】项目吗?";
  994. delFlag = 1;
  995. }
  996. $("#messageModal").modal();
  997. $("#messageContent").html(message);
  998. $("#messageButton").off("click").on("click", function (t) {
  999. $("#messageModal").modal("hide");
  1000. $.ajax({
  1001. type: "POST",
  1002. url: '/thmz/saveJcZdItem',
  1003. contentType: "application/json;charset=UTF-8",
  1004. dataType: "json",
  1005. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1006. data: JSON.stringify({
  1007. code: code,
  1008. delFlag: delFlag,
  1009. }),
  1010. success: function (res) {
  1011. if (res == '401' || res == 401) {
  1012. window.location.href = '/thmz/login/view'
  1013. return;
  1014. }
  1015. if (res.code == 0) {
  1016. $('#tb_table').bootstrapTable('refresh');
  1017. successMesage(res);
  1018. } else {
  1019. errorMesage(res);
  1020. }
  1021. }
  1022. });
  1023. });
  1024. }
  1025. /**
  1026. * 删除记录 (停用) 检验
  1027. * @param code
  1028. */
  1029. function updateDeleteJyZdItem(code, name, delFlag) {
  1030. var message = null;
  1031. if (delFlag == 1) {
  1032. message = "您确认要启用【" + name + "】项目吗?";
  1033. delFlag = 0;
  1034. } else {
  1035. message = "您确认要停用【" + name + "】项目吗?";
  1036. delFlag = 1;
  1037. }
  1038. $("#messageModal").modal();
  1039. $("#messageContent").html(message);
  1040. $("#messageButton").off("click").on("click", function (t) {
  1041. $("#messageModal").modal("hide");
  1042. $.ajax({
  1043. type: "POST",
  1044. url: '/thmz/saveJyZdItem',
  1045. contentType: "application/json;charset=UTF-8",
  1046. dataType: "json",
  1047. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1048. data: JSON.stringify({
  1049. code: code,
  1050. delFlag: delFlag,
  1051. }),
  1052. success: function (res) {
  1053. if (res == '401' || res == 401) {
  1054. window.location.href = '/thmz/login/view'
  1055. return;
  1056. }
  1057. if (res.code == 0) {
  1058. $('#tb_table').bootstrapTable('refresh');
  1059. successMesage(res);
  1060. } else {
  1061. errorMesage(res);
  1062. }
  1063. }
  1064. });
  1065. });
  1066. }
  1067. /**
  1068. * 打开编辑检查窗口
  1069. * @param code
  1070. */
  1071. function editJcZdItem(code) {
  1072. $("#classJcTitle").text("修改");
  1073. $.ajax({
  1074. type: "GET",
  1075. url: '/thmz/getJcZdItemByCode?code=' + code,
  1076. dataType: "json",
  1077. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1078. success: function (res) {
  1079. if (res == '401' || res == 401) {
  1080. window.location.href = '/thmz/login/view'
  1081. return;
  1082. }
  1083. if (res.code == 0) {
  1084. $("#code").val(res.data.code);
  1085. $("#name").val(res.data.name);
  1086. $("#classCode").selectpicker('val', res.data.classCode);//默认不选中
  1087. $("#classCode").selectpicker('refresh');
  1088. $("#execUnit").selectpicker('val', res.data.execUnit);//默认不选中
  1089. $("#execUnit").selectpicker('refresh');
  1090. $("#bwCode").selectpicker('val', res.data.bwCode);//默认不选中
  1091. $("#bwCode").selectpicker('refresh');
  1092. $("#delFlag").selectpicker('val', res.data.delFlag);//默认不选中
  1093. $("#delFlag").selectpicker('refresh');
  1094. $("#zyFlag").selectpicker('val', res.data.zyFlag);//默认不选中
  1095. $("#zyFlag").selectpicker('refresh');
  1096. $("#mzFlag").selectpicker('val', res.data.mzFlag);//默认不选中
  1097. $("#mzFlag").selectpicker('refresh');
  1098. $("#execAddress").val(res.data.execAddress);
  1099. $("#genderRestriction").selectpicker('val', res.data.genderRestriction);//默认不选中
  1100. $("#genderRestriction").selectpicker('refresh');
  1101. $("#minAgeRestriction").val(res.data.minAgeRestriction);
  1102. $("#maxAgeRestriction").val(res.data.maxAgeRestriction);
  1103. $("#timeLimit").val(res.data.timeLimit);
  1104. $("#editJcModal").modal();
  1105. } else {
  1106. errorMesage(res);
  1107. }
  1108. }
  1109. });
  1110. }
  1111. /**
  1112. * 打开编辑检验窗口
  1113. * @param code
  1114. */
  1115. function editJyZdItem(code) {
  1116. $("#classJyTitle").text("修改");
  1117. $.ajax({
  1118. type: "GET",
  1119. url: '/thmz/getJyZdItemByCode?code=' + code,
  1120. dataType: "json",
  1121. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1122. success: function (res) {
  1123. if (res == '401' || res == 401) {
  1124. window.location.href = '/thmz/login/view'
  1125. return;
  1126. }
  1127. if (res.code == 0) {
  1128. $("#codeJy").val(res.data.code);
  1129. $("#nameJy").val(res.data.name);
  1130. $("#classCodeJy").selectpicker('val', res.data.classCode);//默认不选中
  1131. $("#classCodeJy").selectpicker('refresh');
  1132. $("#execUnitJy").selectpicker('val', res.data.execUnit);//默认不选中
  1133. $("#execUnitJy").selectpicker('refresh');
  1134. $("#sampleCode").selectpicker('val', res.data.sampleCode);//默认不选中
  1135. $("#sampleCode").selectpicker('refresh');
  1136. $("#vessel").selectpicker('val', res.data.vessel);//默认不选中
  1137. $("#vessel").selectpicker('refresh');
  1138. $("#delFlagJy").selectpicker('val', res.data.delFlag);//默认不选中
  1139. $("#delFlagJy").selectpicker('refresh');
  1140. $("#zyFlagJy").selectpicker('val', res.data.zyFlag);//默认不选中
  1141. $("#zyFlagJy").selectpicker('refresh');
  1142. $("#mzFlagJy").selectpicker('val', res.data.mzFlag);//默认不选中
  1143. $("#mzFlagJy").selectpicker('refresh');
  1144. $("#jyExecAddress").val(res.data.execAddress);
  1145. $("#genderRestrictionJy").selectpicker('val', res.data.genderRestriction);//默认不选中
  1146. $("#genderRestrictionJy").selectpicker('refresh');
  1147. $("#minAgeRestrictionJy").val(res.data.minAgeRestriction);
  1148. $("#maxAgeRestrictionJy").val(res.data.maxAgeRestriction);
  1149. $("#timeLimitJy").val(res.data.timeLimit);
  1150. $("#editJyModal").modal();
  1151. } else {
  1152. errorMesage(res);
  1153. }
  1154. }
  1155. });
  1156. }
  1157. /**
  1158. * 打开编辑检查收费明细弹窗
  1159. * @param code
  1160. * @param chargeCode
  1161. */
  1162. function editJcChargeItem(code, chargeCode) {
  1163. $.ajax({
  1164. type: "POST",
  1165. url: '/thmz/getJcItemCharge',
  1166. contentType: "application/json;charset=UTF-8",
  1167. dataType: "json",
  1168. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1169. data: JSON.stringify({
  1170. code: code,
  1171. chargeCode: chargeCode
  1172. }),
  1173. success: function (res) {
  1174. if (res == '401' || res == 401) {
  1175. window.location.href = '/thmz/login/view'
  1176. return;
  1177. }
  1178. if (res.code == 0) {
  1179. $("#chargeJcTitle").text("编辑");
  1180. $("#jcItemCode").val(res.data.code);
  1181. $("#amount").val(res.data.amount);
  1182. $("#chargeItem").selectpicker('val', res.data.chargeCode);//默认不选中
  1183. $("#chargeItem").selectpicker('refresh');
  1184. $("#zyFlagJcCharge").selectpicker('val', res.data.zyFlag);//默认不选中
  1185. $("#zyFlagJcCharge").selectpicker('refresh');
  1186. $("#mzFlagJcCharge").selectpicker('val', res.data.mzFlag);//默认不选中
  1187. $("#mzFlagJcCharge").selectpicker('refresh');
  1188. setChargeAmount();
  1189. $("#editJcChargeItemModal").modal();
  1190. } else {
  1191. errorMesage(res);
  1192. }
  1193. }
  1194. });
  1195. }
  1196. /**
  1197. * 删除检查收费明细
  1198. * @param code
  1199. * @param chargeCode
  1200. */
  1201. function deleteJcChargeItem(code, chargeCode) {
  1202. $("#messageModal").modal();
  1203. $("#messageContent").html("确认删除当前检查项目的该条明细项目吗?");
  1204. $("#messageButton").off("click").on("click", function (t) {
  1205. $("#messageModal").modal("hide");
  1206. $.ajax({
  1207. type: "POST",
  1208. url: '/thmz/removeJcItemCharge',
  1209. contentType: "application/json;charset=UTF-8",
  1210. dataType: "json",
  1211. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1212. data: JSON.stringify({
  1213. code: code,
  1214. chargeCode: chargeCode
  1215. }),
  1216. success: function (res) {
  1217. if (res == '401' || res == 401) {
  1218. window.location.href = '/thmz/login/view'
  1219. return;
  1220. }
  1221. if (res.code == 0) {
  1222. $('#tb_table_mx').bootstrapTable('refresh');
  1223. successMesage(res);
  1224. } else {
  1225. errorMesage(res);
  1226. }
  1227. }
  1228. });
  1229. });
  1230. }
  1231. /**
  1232. * 打开编辑检验收费明细弹窗
  1233. * @param code
  1234. * @param chargeCode
  1235. */
  1236. function editJyChargeItem(code, chargeCode) {
  1237. $.ajax({
  1238. type: "POST",
  1239. url: '/thmz/getJyItemCharge',
  1240. contentType: "application/json;charset=UTF-8",
  1241. dataType: "json",
  1242. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1243. data: JSON.stringify({
  1244. code: code,
  1245. chargeCode: chargeCode
  1246. }),
  1247. success: function (res) {
  1248. if (res == '401' || res == 401) {
  1249. window.location.href = '/thmz/login/view'
  1250. return;
  1251. }
  1252. if (res.code == 0) {
  1253. $("#chargeJyTitle").text("编辑");
  1254. $("#jyItemCode").val(res.data.code);
  1255. $("#amountJy").val(res.data.amount);
  1256. $("#chargeItemJy").selectpicker('val', res.data.chargeCode);//默认不选中
  1257. $("#chargeItemJy").selectpicker('refresh');
  1258. $("#zyFlagJyCharge").selectpicker('val', res.data.zyFlag);//默认不选中
  1259. $("#zyFlagJyCharge").selectpicker('refresh');
  1260. $("#mzFlagJyCharge").selectpicker('val', res.data.mzFlag);//默认不选中
  1261. $("#mzFlagJyCharge").selectpicker('refresh');
  1262. setChargeAmountJy();
  1263. $("#editJyChargeItemModal").modal();
  1264. } else {
  1265. errorMesage(res);
  1266. }
  1267. }
  1268. });
  1269. }
  1270. /**
  1271. * 删除检验收费明细
  1272. * @param code
  1273. * @param chargeCode
  1274. */
  1275. function deleteJyChargeItem(code, chargeCode) {
  1276. $("#messageModal").modal();
  1277. $("#messageContent").html("确认删除当前检查项目的该条明细项目吗?");
  1278. $("#messageButton").off("click").on("click", function (t) {
  1279. $("#messageModal").modal("hide");
  1280. $.ajax({
  1281. type: "POST",
  1282. url: '/thmz/removeJyItemCharge',
  1283. contentType: "application/json;charset=UTF-8",
  1284. dataType: "json",
  1285. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1286. data: JSON.stringify({
  1287. code: code,
  1288. chargeCode: chargeCode
  1289. }),
  1290. success: function (res) {
  1291. if (res == '401' || res == 401) {
  1292. window.location.href = '/thmz/login/view'
  1293. return;
  1294. }
  1295. if (res.code == 0) {
  1296. $('#tb_table_mx').bootstrapTable('refresh');
  1297. successMesage(res);
  1298. } else {
  1299. errorMesage(res);
  1300. }
  1301. }
  1302. });
  1303. });
  1304. }
  1305. /**
  1306. * 初始化科室下拉选
  1307. */
  1308. function initExecUnit() {
  1309. //父科室列表
  1310. $.ajax({
  1311. type: "GET",
  1312. url: '/thmz/allUnitCode',
  1313. dataType: "json",
  1314. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1315. success: function (data) {
  1316. if (data == '401' || data == 401) {
  1317. window.location.href = '/thmz/login/view'
  1318. return;
  1319. }
  1320. $('#execUnit').empty(); //清空resText里面的所有内容
  1321. var html = '<option value="-1"></option>';
  1322. $.each(data.data, function (commentIndex, comment) {
  1323. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + '-' + comment.code + ')</option>';
  1324. });
  1325. $('#execUnit').html(html);
  1326. $('#execUnit').selectpicker('refresh');
  1327. $('#execUnitJy').empty();
  1328. $('#execUnitJy').html(html);
  1329. $('#execUnitJy').selectpicker('refresh');
  1330. $('#execUnitParams').empty();
  1331. $('#execUnitParams').html(html);
  1332. $('#execUnitParams').selectpicker('refresh');
  1333. }
  1334. });
  1335. }
  1336. /**
  1337. * 初始化部位下拉选
  1338. */
  1339. function initBwCode() {
  1340. $.ajax({
  1341. type: "GET",
  1342. url: '/thmz/getYshZdPartCode',
  1343. dataType: "json",
  1344. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1345. success: function (data) {
  1346. if (data == '401' || data == 401) {
  1347. window.location.href = '/thmz/login/view'
  1348. return;
  1349. }
  1350. var html = '';
  1351. $.each(data.data, function (commentIndex, comment) {
  1352. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + '-' + comment.code + ')</option>';
  1353. });
  1354. $('#bwCode').empty(); //清空resText里面的所有内容
  1355. $('#bwCode').html(html);
  1356. $('#bwCode').selectpicker('refresh');
  1357. $('#bwParams').empty(); //清空resText里面的所有内容
  1358. $('#bwParams').html(html);
  1359. $('#bwParams').selectpicker('refresh');
  1360. }
  1361. });
  1362. }
  1363. /**
  1364. * 初始化下拉选
  1365. */
  1366. function initSelect() {
  1367. //启动Bootsrap-Select
  1368. $(".selectpicker").selectpicker({
  1369. dropuAuto: false
  1370. });
  1371. var yesNo = '<option value="1">是</option><option value="0">否</option>';
  1372. var optionSex = '<option value="">不限</option><option value="1">限男性</option><option value="2">限女性</option>';
  1373. $('#genderRestriction').html(optionSex);
  1374. $('#genderRestriction').selectpicker('refresh');
  1375. $("#genderRestriction").selectpicker('val', '');
  1376. $("#genderRestriction").selectpicker('refresh');
  1377. $('#delFlag').html(yesNo);
  1378. $('#delFlag').selectpicker('refresh');
  1379. $("#delFlag").selectpicker('val', 0);
  1380. $("#delFlag").selectpicker('refresh');
  1381. $('#zyFlag').html(yesNo);
  1382. $('#zyFlag').selectpicker('refresh');
  1383. $("#zyFlag").selectpicker('val', 0);
  1384. $("#delFlag").selectpicker('refresh');
  1385. $('#mzFlag').html(yesNo);
  1386. $('#mzFlag').selectpicker('refresh');
  1387. $("#mzFlag").selectpicker('val', 0);
  1388. $("#mzFlag").selectpicker('refresh');
  1389. $('#zyFlagJcCharge').html(yesNo);
  1390. $('#zyFlagJcCharge').selectpicker('refresh');
  1391. $("#zyFlagJcCharge").selectpicker('val', 0);
  1392. $("#zyFlagJcCharge").selectpicker('refresh');
  1393. $('#mzFlagJcCharge').html(yesNo);
  1394. $('#mzFlagJcCharge').selectpicker('refresh');
  1395. $("#mzFlagJcCharge").selectpicker('val', 0);
  1396. $("#mzFlagJcCharge").selectpicker('refresh');
  1397. $('#genderRestrictionJy').html(optionSex);
  1398. $('#genderRestrictionJy').selectpicker('refresh');
  1399. $("#genderRestrictionJy").selectpicker('val', '');
  1400. $("#genderRestrictionJy").selectpicker('refresh');
  1401. $('#delFlagJy').html(yesNo);
  1402. $('#delFlagJy').selectpicker('refresh');
  1403. $("#delFlagJy").selectpicker('val', 0);
  1404. $("#delFlagJy").selectpicker('refresh');
  1405. $('#zyFlagJy').html(yesNo);
  1406. $('#zyFlagJy').selectpicker('refresh');
  1407. $("#zyFlagJy").selectpicker('val', 0);
  1408. $("#zyFlagJy").selectpicker('refresh');
  1409. $('#mzFlagJy').html(yesNo);
  1410. $('#mzFlagJy').selectpicker('refresh');
  1411. $("#mzFlagJy").selectpicker('val', 0);
  1412. $("#mzFlagJy").selectpicker('refresh');
  1413. $('#zyFlagJyCharge').html(yesNo);
  1414. $('#zyFlagJyCharge').selectpicker('refresh');
  1415. $("#zyFlagJyCharge").selectpicker('val', 0);
  1416. $("#zyFlagJyCharge").selectpicker('refresh');
  1417. $('#mzFlagJyCharge').html(yesNo);
  1418. $('#mzFlagJyCharge').selectpicker('refresh');
  1419. $("#mzFlagJyCharge").selectpicker('val', 0);
  1420. $("#mzFlagJyCharge").selectpicker('refresh');
  1421. $('#delFlagParams').html(yesNo);
  1422. $('#delFlagParams').selectpicker('refresh');
  1423. $.ajax({
  1424. type: "GET",
  1425. url: '/thmz/getAllJcZdClass',
  1426. dataType: "json",
  1427. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1428. success: function (data) {
  1429. if (data == '401' || data == 401) {
  1430. window.location.href = '/thmz/login/view'
  1431. return;
  1432. }
  1433. var html = '';
  1434. $.each(data.data, function (commentIndex, comment) {
  1435. var pyCode=comment.pyCode;
  1436. if(pyCode==null || pyCode=="null"){
  1437. pyCode="";
  1438. }
  1439. if(comment.code!=null && comment.code!="null"){
  1440. pyCode=pyCode+"-"+comment.code;
  1441. }
  1442. html += '<option value="' + comment.code + '">' + comment.name + '(' + pyCode + ')</option>';
  1443. });
  1444. $('#classCode').empty(); //清空resText里面的所有内容
  1445. $('#classCode').html(html);
  1446. $('#classCode').selectpicker('refresh');
  1447. $('#jcClassParams').empty(); //清空resText里面的所有内容
  1448. $('#jcClassParams').html(html);
  1449. $('#jcClassParams').selectpicker('refresh');
  1450. }
  1451. });
  1452. $.ajax({
  1453. type: "post",
  1454. url: '/thmz/listJyZdClass',
  1455. contentType: "application/json;charset=UTF-8",
  1456. dataType: "json",
  1457. data: JSON.stringify({}),
  1458. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1459. success: function (data) {
  1460. if (data == '401' || data == 401) {
  1461. window.location.href = '/thmz/login/view'
  1462. return;
  1463. }
  1464. var html = '';
  1465. $.each(data.data, function (commentIndex, comment) {
  1466. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + '-' + comment.code + ')</option>';
  1467. });
  1468. $('#classCodeJy').empty(); //清空resText里面的所有内容
  1469. $('#classCodeJy').html(html);
  1470. $('#classCodeJy').selectpicker('refresh');
  1471. $('#jyClassParams').empty(); //清空resText里面的所有内容
  1472. $('#jyClassParams').html(html);
  1473. $('#jyClassParams').selectpicker('refresh');
  1474. }
  1475. });
  1476. /**
  1477. * 初始化验物下拉选
  1478. */
  1479. $.ajax({
  1480. type: "GET",
  1481. url: '/thmz/getJyZdSample',
  1482. dataType: "json",
  1483. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1484. success: function (res) {
  1485. if (res == '401' || res == 401) {
  1486. window.location.href = '/thmz/login/view'
  1487. return;
  1488. }
  1489. var html = '';
  1490. $.each(res.data, function (commentIndex, comment) {
  1491. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  1492. });
  1493. $('#sampleCode').empty();
  1494. $('#sampleCode').html(html);
  1495. $('#sampleCode').selectpicker('refresh');
  1496. $('#sampleCodeParams').empty();
  1497. $('#sampleCodeParams').html(html);
  1498. $('#sampleCodeParams').selectpicker('refresh');
  1499. }
  1500. });
  1501. /**
  1502. * 查询所有容器
  1503. */
  1504. $.ajax({
  1505. type: "GET",
  1506. url: '/thmz/getAllJyZdTube',
  1507. dataType: "json",
  1508. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1509. success: function (res) {
  1510. if (res == '401' || res == 401) {
  1511. window.location.href = '/thmz/login/view'
  1512. return;
  1513. }
  1514. var html = '';
  1515. $.each(res.data, function (commentIndex, comment) {
  1516. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  1517. });
  1518. $('#vessel').empty();
  1519. $('#vessel').html(html);
  1520. $('#vessel').selectpicker('refresh');
  1521. $('#vesselParams').empty();
  1522. $('#vesselParams').html(html);
  1523. $('#vesselParams').selectpicker('refresh');
  1524. }
  1525. });
  1526. initZdChargeSelect();
  1527. }
  1528. /**
  1529. * 使用中的收费项目列表
  1530. */
  1531. function initZdChargeSelect() {
  1532. //科室列表
  1533. $.ajax({
  1534. type: "GET",
  1535. url: '/thmz/getAllZdCharge',
  1536. dataType: "json",
  1537. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1538. // async: false,
  1539. success: function (data) {
  1540. if (data == '401' || data == 401) {
  1541. window.location.href = '/thmz/login/view'
  1542. return;
  1543. }
  1544. var html = '';
  1545. // if (chargeItemObj == null) {
  1546. // chargeItemObj = []
  1547. // }
  1548. $.each(data.data, function (commentIndex, comment) {
  1549. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.code + ')</option>';
  1550. if (chargeItemMap == null) {
  1551. chargeItemMap = new MyMap()
  1552. }
  1553. if (chargeItemObj == null) {
  1554. chargeItemObj = new MyMap()
  1555. }
  1556. chargeItemMap.put(comment.code, comment.chargeAmount);
  1557. let obj = {
  1558. code: comment.code,
  1559. hnsybCode: comment.hnsybCode,
  1560. nationalCode: comment.nationalCode,
  1561. nationalName: comment.nationalName
  1562. }
  1563. chargeItemObj.put(comment.code,obj)
  1564. });
  1565. $('#chargeItem').empty();
  1566. $('#chargeItem').html(html);
  1567. $('#chargeItem').selectpicker('refresh');
  1568. $('#chargeItemJy').empty();
  1569. $('#chargeItemJy').html(html);
  1570. $('#chargeItemJy').selectpicker('refresh');
  1571. }
  1572. });
  1573. }
  1574. /**
  1575. * 设置单价
  1576. */
  1577. function setChargeAmount() {
  1578. var chargeAmount = chargeItemMap.get($('#chargeItem').val());
  1579. var chargeObj = chargeItemObj.get($('#chargeItem').val());
  1580. if (chargeAmount != null) {
  1581. $("#chargeAmount").val(chargeAmount.toFixed(2));
  1582. }
  1583. if (chargeObj != null) {
  1584. $("#hnsybCode").val(chargeObj.hnsybCode);
  1585. $("#nationalCode").val(chargeObj.nationalCode);
  1586. $("#nationalName").val(chargeObj.nationalName);
  1587. }
  1588. }
  1589. /**
  1590. * 设置单价
  1591. */
  1592. function setChargeAmountJy() {
  1593. var chargeAmount = chargeItemMap.get($('#chargeItemJy').val());
  1594. var chargeObj = chargeItemObj.get($('#chargeItemJy').val());
  1595. if (chargeAmount != null) {
  1596. $("#chargeAmountJy").val(chargeAmount.toFixed(2));
  1597. }
  1598. if (chargeObj != null) {
  1599. $("#hnsybCodeJy").val(chargeObj.hnsybCode);
  1600. $("#nationalCodeJy").val(chargeObj.nationalCode);
  1601. $("#nationalNameJy").val(chargeObj.nationalName);
  1602. }
  1603. }
  1604. /**
  1605. * 增加检查项目的细目
  1606. * @param code
  1607. */
  1608. function addChargeZdItem(code) {
  1609. $("#editJcChargeItemModal").modal();
  1610. $("#jcItemCode").val(code);
  1611. $("#chargeJcTitle").text("新增");
  1612. }
  1613. /**
  1614. * 增加检验项目的细目
  1615. * @param code
  1616. */
  1617. function addChargeJyZdItem(code) {
  1618. $("#editJyChargeItemModal").modal();
  1619. $("#jyItemCode").val(code);
  1620. $("#chargeJyTitle").text("新增");
  1621. }
  1622. function callJcJyAgeFormat(number){
  1623. if (/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/.test(number) === false) {
  1624. let r = {
  1625. message: '年龄填写不合法,请检查!'
  1626. }
  1627. errorMesage(r);
  1628. return "-1";
  1629. } else {
  1630. return "0";
  1631. }
  1632. }