test.js 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. /**
  2. * admin/test
  3. */
  4. var mcare_admin_test = function( language_code ){
  5. //상속
  6. mcare_admin.call(this);
  7. var self = this;
  8. //변수
  9. var $wrapper = $(".main-wrapper #wrapper"),
  10. $saveAgreementItem = $("#save-agreement-item"),
  11. $selectAllAgreementItem = $("#select-all-agreement-item"),
  12. $updateAgreementItem = $("#update-agreement-item"),
  13. $deleteAgreementItem = $("#delete-agreement-item"),
  14. $saveTelNoItem = $("#save-telNo-item"),
  15. $selectAllTelNoItem = $("#select-all-talNo-item"),
  16. $updateTelNoItem = $("#update-telNo-item"),
  17. $deleteTelNoItem = $("#delete-telNo-item"),
  18. $apiReqTest = $("#api-req-test"),
  19. $getAppointmentList = $("#appointment-list");
  20. $getGetoutpatientlistList = $("#getoutpatientlist-list");
  21. $getInpatientlistList = $("#inpatientlist-list");
  22. $getHealthchecklistList = $("#healthchecklist-list");
  23. $crudServiceBaseUrl = contextPath + "/admin/test";
  24. /**
  25. * 객체 초기화
  26. */
  27. this.init = function(){
  28. addEvent();
  29. };
  30. /**
  31. * 이벤트 등록
  32. */
  33. var addEvent = function(){
  34. //동의서 저장 이벤트
  35. $saveAgreementItem.on("click", function(e) {
  36. saveAgreementItem(e);
  37. });
  38. // 동의서 리스트 이벤트
  39. $selectAllAgreementItem.on("click", function(e) {
  40. selectAllAgreementItem(e);
  41. });
  42. // 동의서 수정 이벤트
  43. $updateAgreementItem.on("click", function(e) {
  44. updateAgreementItem(e);
  45. });
  46. // 동의서 삭제 이벤트
  47. $deleteAgreementItem.on("click", function(e) {
  48. deleteAgreementItem(e);
  49. });
  50. //전화번호 저장
  51. $saveTelNoItem.on("click", function(e) {
  52. saveTelNoItem(e);
  53. });
  54. //전화번호 리스트
  55. $selectAllTelNoItem.on("click", function(e) {
  56. selectAllTelNoItem(e);
  57. });
  58. //전화번호 수정
  59. $updateTelNoItem.on("click", function(e) {
  60. updateTelNoItem(e);
  61. });
  62. //전화번호 삭제
  63. $deleteTelNoItem.on("click", function(e) {
  64. deleteTelNoItem(e);
  65. });
  66. $apiReqTest.on("click", function(e) {
  67. apiReqTest(e);
  68. });
  69. $getAppointmentList.on("click", function(e) {
  70. getAppointmentList("/history/offlinereservation");
  71. });
  72. $getGetoutpatientlistList.on("click", function(e) {
  73. getAppointmentList("/history/getoutpatientlist");
  74. });
  75. $getInpatientlistList.on("click", function(e) {
  76. getAppointmentList("/history/inpatientlist");
  77. });
  78. $getHealthchecklistList.on("click", function(e) {
  79. getAppointmentList("/history/healthchecklist");
  80. });
  81. };
  82. var apiReqTest = function() {
  83. var item = {}
  84. // item['telNoSeq'] = "8";
  85. item['name'] = $("#name").val();
  86. $.ajax({
  87. url : "/admin/agreement/apiReqTester.json",
  88. type : "GET",
  89. data : "name="+$("#name").val(),
  90. dataType : "json",
  91. contentType: "application/json; charset=UTF-8",
  92. success : function(data){
  93. if( data.msg !== undefined ) {
  94. alert("수행 중 에러가 발생하였습니다");
  95. console.log(data.msg);
  96. return false;
  97. }
  98. alert("호출 되었습니다");
  99. location.reload();
  100. }
  101. });
  102. }
  103. var getAppointmentList = function(apiUrl) {
  104. alert(apiUrl);
  105. // var apiUrl = $("#apiUrl").val();
  106. var ptFrrn = $("#ptFrrn").val();
  107. var ptSrrn = $("#ptSrrn").val();
  108. var eiInterface = $("#eiIterface").val();
  109. $.ajax({
  110. url : "/mobile/history.json",
  111. type : "GET",
  112. data : "apiUrl="+apiUrl+"&pt_frrn="+ptFrrn+"&pt_srrn="+ptSrrn+"&ei_interface="+eiInterface,
  113. dataType : "json",
  114. contentType: "application/json; charset=UTF-8",
  115. success : function(data){
  116. if( data.msg !== undefined ) {
  117. alert("수행 중 에러가 발생하였습니다");
  118. console.log(data.msg);
  119. return false;
  120. }
  121. alert(JSON.stringify(data));
  122. alert("호출 되었습니다");
  123. location.reload();
  124. }
  125. });
  126. }
  127. /**
  128. * 동의서 저장
  129. */
  130. var saveAgreementItem = function(e) {
  131. var item = {};
  132. item['agreementOrder'] = "2";
  133. item['agreementName'] = "시술 동의";
  134. item['agreementContents'] = "시술에 동의해 주세요.";
  135. alert(JSON.stringify(item));
  136. $.ajax({
  137. url : '/admin/agreement/save.json',
  138. type : "POST",
  139. data : JSON.stringify(item),
  140. contentType:"application/json; charset=utf-8",
  141. dataType:"json",
  142. success : function(data) {
  143. if (data.msg != null) {
  144. alert('수행 중 에러가 발생하였습니다');
  145. console.log(data.msg);
  146. return false;
  147. }
  148. alert('저장 되었습니다');
  149. location.reload(true);
  150. }
  151. });
  152. }
  153. /**
  154. * 동의서 리스트
  155. */
  156. var selectAllAgreementItem = function(e) {
  157. $.ajax({
  158. url : '/admin/agreement/getList.json',
  159. type : "GET",
  160. contentType:"application/json; charset=utf-8",
  161. success : function(data) {
  162. if(data.msg != null) {
  163. alert("수행 중 에러가 발생하였습니다.");
  164. }
  165. alert(JSON.stringify(data));
  166. }
  167. });
  168. }
  169. /**
  170. * 동의서 수정
  171. */
  172. var updateAgreementItem = function(e) {
  173. alert("동의서 수정");
  174. var item = {};
  175. item['agreementSeq'] = "5";
  176. item['agreementOrder'] = "2";
  177. item['agreementName'] = "성형 수술 동의";
  178. item['agreementContents'] = "성형 수술에 동의해 주세요.";
  179. alert(JSON.stringify(item));
  180. $.ajax({
  181. url : '/admin/agreement/update.json',
  182. type : "POST",
  183. data : JSON.stringify(item),
  184. contentType:"application/json; charset=utf-8",
  185. dataType:"json",
  186. success : function(data) {
  187. if(data.msg != null) {
  188. alert("수행 중 에러가 발생하였습니다. ");
  189. }
  190. alert("수정 되었습니다.");
  191. }
  192. });
  193. }
  194. var deleteAgreementItem = function(e) {
  195. alert("동의서 삭제");
  196. var item = {}
  197. item['agreementSeq'] = "4";
  198. alert(JSON.stringify(item));
  199. $.ajax({
  200. url : '/admin/agreement/remove.json',
  201. type : "POST",
  202. data : JSON.stringify(item),
  203. contentType:"application/json; charset=utf-8",
  204. dataType:"json",
  205. success : function(data) {
  206. if(data.msg != null) {
  207. alert("수행 중 에러가 발생하였습니다. ");
  208. }
  209. alert("삭제 되었습니다.");
  210. }
  211. });
  212. }
  213. var saveTelNoItem = function(e) {
  214. var item = {};
  215. item['buildingDesc'] = "테스트1";
  216. item['roomDesc'] = "비만센터";
  217. item['telValue'] = "051-888-8888";
  218. item['telNoOrder'] = 1;
  219. alert(JSON.stringify(item));
  220. $.ajax({
  221. url : '/admin/telno/save.json',
  222. type : "POST",
  223. data : JSON.stringify(item),
  224. contentType:"application/json; charset=utf-8",
  225. dataType:"json",
  226. success : function(data) {
  227. if (data.msg != null) {
  228. alert('수행 중 에러가 발생하였습니다');
  229. console.log(data.msg);
  230. return false;
  231. }
  232. alert('저장 되었습니다');
  233. location.reload(true);
  234. }
  235. });
  236. }
  237. /**
  238. *
  239. */
  240. var selectAllTelNoItem = function(e) {
  241. alert("전화번화 리스트 조회");
  242. $.ajax({
  243. url : '/admin/telno/getList.json',
  244. type : "GET",
  245. contentType:"application/json; charset=utf-8",
  246. success : function(data) {
  247. if(data.msg != null) {
  248. alert("수행 중 에러가 발생하였습니다.");
  249. }
  250. alert(JSON.stringify(data));
  251. }
  252. });
  253. }
  254. var updateTelNoItem = function(e) {
  255. alert("동의서 수정");
  256. var item = {};
  257. item['telNoSeq'] = "8";
  258. item['buildingDesc'] = "테스트1";
  259. item['roomDesc'] = "비만센터";
  260. item['telValue'] = "051-111-1111";
  261. item['telNoOrder'] = 1;
  262. alert(JSON.stringify(item));
  263. $.ajax({
  264. url : '/admin/telno/update.json',
  265. type : "POST",
  266. data : JSON.stringify(item),
  267. contentType:"application/json; charset=utf-8",
  268. dataType:"json",
  269. success : function(data) {
  270. if(data.msg != null) {
  271. alert("수행 중 에러가 발생하였습니다. ");
  272. }
  273. alert("수정 되었습니다.");
  274. }
  275. });
  276. }
  277. var deleteTelNoItem = function(e) {
  278. alert("전화번호 삭제");
  279. var item = {}
  280. item['telNoSeq'] = "8";
  281. item['telNoValue'] = "051-111-1111";
  282. alert(JSON.stringify(item));
  283. $.ajax({
  284. url : '/admin/telno/remove.json',
  285. type : "POST",
  286. data : JSON.stringify(item),
  287. contentType:"application/json; charset=utf-8",
  288. dataType:"json",
  289. success : function(data) {
  290. if(data.msg != null) {
  291. alert("수행 중 에러가 발생하였습니다. ");
  292. }
  293. alert("삭제 되었습니다.");
  294. }
  295. });
  296. }
  297. };