patientInfoDialogJs.jsp 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
  2. <%@include file="/WEB-INF/ehr/commons/jsp/commonInclude.jsp" %>
  3. <script>
  4. (function ($, win) {
  5. /* ************************** 变量定义 ******************************** */
  6. // 通用工具类库
  7. var Util = $.Util;
  8. // 页面主模块,对应于用户信息表区域
  9. var patientInfo = null;
  10. var dialog = frameElement.dialog;
  11. var dataModel = $.DataModel.init();
  12. /* ************************** 变量定义结束 ******************************** */
  13. /* *************************** 函数定义 ******************************* */
  14. function pageInit() {
  15. patientInfo.init();
  16. }
  17. /* *************************** 函数定义结束******************************* */
  18. /* *************************** 模块初始化 ***************************** */
  19. patientInfo = {
  20. $form: $("#div_patient_info_form"),
  21. $realName: $("#inp_realName"),
  22. $idCardNo: $("#inp_idCardNo"),
  23. $gender: $('input[name="gender"]', this.$form),
  24. $patientNation: $("#inp_patientNation"),
  25. $patientNativePlace: $("#inp_patientNativePlace"),
  26. $patientMartialStatus: $("#inp_select_patientMartialStatus"),
  27. $patientBirthday: $("#inp_patientBirthday"),
  28. $birthPlace: $("#inp_birthPlace"),
  29. $homeAddress: $("#inp_homeAddress"),
  30. $workAddress: $("#inp_workAddress"),
  31. $residenceType: $('input[name="residenceType"]', this.$form),
  32. $patientTel: $("#inp_patientTel"),
  33. $patientEmail: $("#inp_patientEmail"),
  34. $updateBtn: $("#div_update_btn"),
  35. $cancelBtn: $("#div_cancel_btn"),
  36. $resetPassword: $("#div_resetPassword"),
  37. $patientImgUpload: $("#div_patient_img_upload"),
  38. $password: $("#inp_password"),
  39. $div_password: $("#div_password"),
  40. init: function () {
  41. this.initForm();
  42. this.bindEvents();
  43. this.$patientImgUpload.instance = this.$patientImgUpload.webupload({
  44. server: '${contextRoot}/fileUpload/uploadPicByte',
  45. auto: true
  46. });
  47. this.$patientImgUpload.instance.on( 'uploadSuccess', function( file, resp ) {
  48. debugger
  49. $('#inp_img_url').val(resp.url);
  50. $( '#'+file.id ).addClass('upload-state-done');
  51. });
  52. },
  53. initForm: function () {
  54. var self = this;
  55. this.$realName.ligerTextBox({width: 240});
  56. this.$idCardNo.ligerTextBox({width: 240});
  57. this.$gender.ligerRadio();
  58. this.initDDL(5, this.$patientNation);
  59. this.$patientNation.ligerTextBox({width: 240});
  60. this.$patientNativePlace.ligerTextBox({width: 240});
  61. this.$patientBirthday.ligerDateEditor({format: "yyyy-MM-dd"});
  62. this.$birthPlace.addressDropdown({tabsData:[
  63. {name: '省份', url: '${contextRoot}/address/getParent', params: {level:'1'}},
  64. {name: '城市', url: '${contextRoot}/address/getChildByParent'},
  65. {name: '县区', url: '${contextRoot}/address/getChildByParent'},
  66. {name: '街道'}
  67. ]});
  68. this.$homeAddress.addressDropdown({tabsData:[
  69. {name: '省份', url: '${contextRoot}/address/getParent', params: {level:'1'}},
  70. {name: '城市', url: '${contextRoot}/address/getChildByParent'},
  71. {name: '县区', url: '${contextRoot}/address/getChildByParent'},
  72. {name: '街道'}
  73. ]});
  74. this.$workAddress.addressDropdown({tabsData:[
  75. {name: '省份', url: '${contextRoot}/address/getParent', params: {level:'1'}},
  76. {name: '城市', url: '${contextRoot}/address/getChildByParent'},
  77. {name: '县区', url: '${contextRoot}/address/getChildByParent'},
  78. {name: '街道'}
  79. ]});
  80. this.$residenceType.ligerRadio();
  81. this.$patientTel.ligerTextBox({width: 240});
  82. this.$patientEmail.ligerTextBox({width: 240});
  83. this.$password.ligerTextBox({width: 240});
  84. this.$patientMartialStatus.ligerComboBox(
  85. {
  86. url: '${contextRoot}/dict/searchDictEntryList',
  87. valueField: 'code',
  88. textField: 'value',
  89. dataParmName: 'detailModelList',
  90. urlParms: {
  91. dictId: 4
  92. },
  93. onSuccess: function () {
  94. self.$form.Fields.fillValues({martialStatus: '${patientModel.martialStatus}'});
  95. },
  96. autocomplete: true
  97. });
  98. this.$resetPassword.hide();
  99. this.$form.attrScan();
  100. if (!(Util.isStrEquals('${patientDialogType}', 'addPanient'))) {
  101. this.$div_password.hide();
  102. this.$resetPassword.show();
  103. this.$form.Fields.fillValues({
  104. name: '${patientModel.name}',
  105. idCardNo: '${patientModel.idCardNo}',
  106. gender: '${patientModel.gender}',
  107. nation: '${patientModel.nation}',
  108. nativePlace: '${patientModel.nativePlace}',
  109. birthday: '${patientModel.birthday}',
  110. birthPlace: '${patientModel.birthPlaceFull}',
  111. homeAddress: '${patientModel.homeAddressFull}',
  112. workAddress: '${patientModel.workAddressFull}',
  113. residenceType: '${patientModel.residenceType}',
  114. tel: '${patientModel.tel}',
  115. email: '${patientModel.email}'
  116. });
  117. }
  118. },
  119. initDDL: function (dictId, target) {
  120. target.ligerComboBox({
  121. url: "${contextRoot}/dict/searchDictEntryList",
  122. dataParmName: 'detailModelList',
  123. urlParms: {dictId: dictId},
  124. valueField: 'code',
  125. textField: 'value'
  126. });
  127. },
  128. bindEvents: function () {
  129. var self = this;
  130. //修改人口信息
  131. patientInfo.$updateBtn.click(function () {
  132. debugger;
  133. var addressList = self.$form.Fields.birthPlace.getValue();
  134. var homeAddressList = self.$form.Fields.homeAddress.getValue();
  135. var workAddressList = self.$form.Fields.workAddress.getValue();
  136. var values = $.extend({},self.$form.Fields.getValues(),{
  137. birthPlace: {
  138. province: addressList.names[0],
  139. city: addressList.names[1],
  140. district: addressList.names[2],
  141. street: addressList.names[3]
  142. },
  143. homeAddress:{
  144. province: homeAddressList.names[0],
  145. city: homeAddressList.names[1],
  146. district: homeAddressList.names[2],
  147. street: homeAddressList.names[3]
  148. },
  149. workAddress:{
  150. province: workAddressList.names[0],
  151. city: workAddressList.names[1],
  152. district: workAddressList.names[2],
  153. street: workAddressList.names[3]
  154. }
  155. });
  156. dataModel.updateRemote("${contextRoot}/patient/updatePatient", {
  157. data: {patientJsonData: JSON.stringify(values) },
  158. success: function (data) {
  159. if(data.successFlg){
  160. win.parent.$.ligerDialog.success('修改成功');
  161. }else{
  162. win.parent.$.ligerDialog.error('修改失败');
  163. }
  164. win.parent.patientDialogRefresh();
  165. dialog.close();
  166. }
  167. })
  168. });
  169. //重置密码
  170. patientInfo.$resetPassword.click(function () {
  171. var patientIdCardNo = self.$form.Fields.idCardNo.getValue();
  172. $.ligerDialog.confirm('确认重置密码?<br>如果是请点击确认按钮,否则请点击取消。', function (yes) {
  173. if (yes) {
  174. var dataModel = $.DataModel.init();
  175. dataModel.updateRemote("${contextRoot}/patient/resetPass", {
  176. data: {idCardNo: patientIdCardNo},
  177. success: function (data) {
  178. if (data.successFlg) {
  179. win.parent.$.ligerDialog.success('密码修改成功');
  180. } else {
  181. win.parent.$.ligerDialog.error('密码修改失败');
  182. }
  183. dialog.close();
  184. }
  185. })
  186. }
  187. });
  188. });
  189. //关闭dailog的方法
  190. patientInfo.$cancelBtn.click(function(){
  191. dialog.close();
  192. })
  193. }
  194. };
  195. /* *************************** 模块初始化结束 ***************************** */
  196. /* *************************** 页面初始化 **************************** */
  197. pageInit();
  198. /* *************************** 页面初始化结束 **************************** */
  199. })(jQuery, window);
  200. </script>