PageRenderTime 122ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 3ms

/hospsys/hospsys/insurance/core/javasrc/com/hospital/HospitalServiceImpl.java

https://bitbucket.org/dkhaliunaa/mal-emneleg
Java | 6998 lines | 5771 code | 1049 blank | 178 comment | 2910 complexity | 6d19225d2d1870b83585b46340c2c348 MD5 | raw file
  1. package com.hospital;
  2. import com.auth.HospService;
  3. import com.enumclass.ErrorType;
  4. import com.google.gson.internal.LinkedTreeMap;
  5. import com.hospital.app.*;
  6. import com.model.FavoritePages;
  7. import com.model.Role;
  8. import com.model.User;
  9. import com.model.hos.*;
  10. import com.mongodb.BasicDBObject;
  11. import com.rpc.RpcHandler;
  12. import org.bson.types.ObjectId;
  13. import java.math.BigDecimal;
  14. import java.text.SimpleDateFormat;
  15. import java.time.format.DateTimeFormatter;
  16. import java.util.*;
  17. public class HospitalServiceImpl extends HospService implements HospitalService {
  18. private CheckUserRoleControl roleControl = null;
  19. private ErrorEntity errorEntity = null;
  20. private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
  21. public HospitalServiceImpl() {
  22. handler = new RpcHandler<>(this, HospitalService.class);
  23. }
  24. @Override
  25. public BasicDBObject checkSession(String sessionId) {
  26. BasicDBObject basicDBObject = new BasicDBObject();
  27. User loginUser = getUserInfo(sessionId);
  28. basicDBObject.put("session", true);
  29. if (loginUser == null) {
  30. basicDBObject.put("session", false);
  31. }
  32. return basicDBObject;
  33. }
  34. @Override
  35. public List<BasicDBObject> getRoles(String sessionId) {
  36. User user = sessionUser.get(sessionId);
  37. if (user == null) return null;
  38. try {
  39. //Check Role
  40. roleControl = new CheckUserRoleControl(super.conn);
  41. if (roleControl == null) {
  42. return null;
  43. }
  44. return roleControl.getUserAccessMenuList(user);
  45. //End Check Role
  46. } catch (Exception ex) {
  47. ex.printStackTrace();
  48. } finally {
  49. }
  50. return null;
  51. }
  52. @Override
  53. public List<NewsEntity> getNewsData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  54. System.out.println("Hospital Service Implament ::: get news data");
  55. try {
  56. INewsService newsService = new NewsServiceImpl(super.conn);
  57. User user = sessionUser.get(sessionId);
  58. NewsEntity newsEntity = new NewsEntity();
  59. Iterator it = criteria.entrySet().iterator();
  60. while (it.hasNext()) {
  61. Map.Entry pairs = (Map.Entry) it.next();
  62. try {
  63. if (pairs.getKey().equals(newsEntity.ID)) {
  64. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  65. newsEntity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  66. } else if (pairs.getKey().equals(newsEntity.TITLE)) {
  67. newsEntity.setTitle(String.valueOf(pairs.getValue()));
  68. } else if (pairs.getKey().equals(newsEntity.CONTENT)) {
  69. newsEntity.setContent(String.valueOf(pairs.getValue()));
  70. }
  71. } catch (NullPointerException ex) {
  72. ex.printStackTrace();
  73. } catch (Exception ex) {
  74. ex.printStackTrace();
  75. }
  76. }//end while
  77. Date utilDate = new Date();
  78. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  79. try {
  80. newsEntity.setCreby(user.getUsername());
  81. } catch (Exception e) {
  82. newsEntity.setCreby("");
  83. }
  84. if (newsEntity != null) {
  85. return newsService.getListData(newsEntity);
  86. }
  87. } catch (Exception ex) {
  88. ex.printStackTrace();
  89. } finally {
  90. }
  91. return null;
  92. }
  93. @Override
  94. public ErrorEntity setNewsData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  95. System.out.println("Hospital Service Implament ::: set news data");
  96. try {
  97. String command = "EDT";
  98. INewsService newsService = new NewsServiceImpl(super.conn);
  99. User user = sessionUser.get(sessionId);
  100. NewsEntity newsEntity = new NewsEntity();
  101. Iterator it = criteria.entrySet().iterator();
  102. while (it.hasNext()) {
  103. Map.Entry pairs = (Map.Entry) it.next();
  104. try {
  105. if (pairs.getKey().equals(newsEntity.ID)) {
  106. String tmpId = "";
  107. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
  108. if (pairs.getValue().toString().contains(".")) {
  109. tmpId = pairs.getValue().toString().substring(0, pairs.getValue().toString().indexOf("."));
  110. }
  111. newsEntity.setId(Long.parseLong(String.valueOf(tmpId)));
  112. }
  113. } else if (pairs.getKey().equals(newsEntity.TITLE)) {
  114. newsEntity.setTitle(String.valueOf(pairs.getValue()));
  115. } else if (pairs.getKey().equals(newsEntity.CONTENT)) {
  116. newsEntity.setContent(String.valueOf(pairs.getValue()));
  117. } else if (pairs.getKey().toString().equalsIgnoreCase("command")) {
  118. command = String.valueOf(pairs.getValue());
  119. }
  120. } catch (NullPointerException ex) {
  121. ex.printStackTrace();
  122. } catch (Exception ex) {
  123. ex.printStackTrace();
  124. }
  125. }//end while
  126. if (command.equalsIgnoreCase("INS")) {
  127. newsEntity.setDelflg("N");
  128. newsEntity.setActflg("Y");
  129. try {
  130. newsEntity.setCreby(user.getUsername());
  131. newsEntity.setModby(user.getUsername());
  132. } catch (NullPointerException e) {
  133. newsEntity.setCreby("");
  134. newsEntity.setModby("");
  135. }
  136. Date utilDate = new Date();
  137. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  138. newsEntity.setCreat(sqlDate);
  139. newsEntity.setModAt(sqlDate);
  140. errorEntity = newsService.insertNewData(newsEntity);
  141. } else if (command.equalsIgnoreCase("EDT") ||
  142. command.equalsIgnoreCase("DEL") ||
  143. command.equalsIgnoreCase("ACT")) {
  144. int quality = 2;
  145. if (command.equalsIgnoreCase("DEL")) {
  146. newsEntity.setDelflg("Y");
  147. quality = 3;
  148. } else if (command.equalsIgnoreCase("ACT")) {
  149. newsEntity.setActflg("N");
  150. }
  151. errorEntity = newsService.updateData(newsEntity);
  152. }
  153. } catch (Exception ex) {
  154. ex.printStackTrace();
  155. } finally {
  156. }
  157. return errorEntity;
  158. }
  159. @Override
  160. public List<Form08Entity> getForm08Data(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  161. System.out.println("Hospital Service Implament ::: get form 08 data");
  162. try {
  163. IForm08Service form08Service = new Form08ServiceImpl(super.conn);
  164. User user = sessionUser.get(sessionId);
  165. Form08Entity form08Entity = new Form08Entity();
  166. Iterator it = criteria.entrySet().iterator();
  167. //Check Role
  168. roleControl = new CheckUserRoleControl(super.conn);
  169. if (roleControl == null) {
  170. return null;
  171. }
  172. menuid = menuid.replaceAll("#", "");
  173. if (!roleControl.checkRole(user, menuid, 1)) {
  174. return null;
  175. }
  176. //End Check Role
  177. while (it.hasNext()) {
  178. Map.Entry pairs = (Map.Entry) it.next();
  179. try {
  180. if (pairs.getKey().equals(form08Entity.ID)) {
  181. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  182. form08Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  183. } else if (pairs.getKey().equals(form08Entity.AIMAG)) {
  184. form08Entity.setAimag(String.valueOf(pairs.getValue()));
  185. } else if (pairs.getKey().equals(form08Entity.SUM)) {
  186. form08Entity.setSum(String.valueOf(pairs.getValue()));
  187. } else if (pairs.getKey().equals(form08Entity.MALTURUL)) {
  188. form08Entity.setMalTurul(String.valueOf(pairs.getValue()));
  189. } else if (pairs.getKey().equals(form08Entity.ARGA_HEMJEE_NER)) {
  190. form08Entity.setArgaHemjeeNer(String.valueOf(pairs.getValue()));
  191. } else if (pairs.getKey().equals(form08Entity.NER)) {
  192. form08Entity.setNer(String.valueOf(pairs.getValue()));
  193. } else if (pairs.getKey().equals(form08Entity.ZARTSUULSAN_HEMJEE)) {
  194. form08Entity.setZartsuulsanHemjee(String.valueOf(pairs.getValue()));
  195. } else if (pairs.getKey().equals(form08Entity.TOLOVLOGOO)) {
  196. form08Entity.setTolovlogoo(String.valueOf(pairs.getValue()));
  197. } else if (pairs.getKey().equals(form08Entity.GUITSETGEL)) {
  198. form08Entity.setGuitsetgel(String.valueOf(pairs.getValue()));
  199. } else if (pairs.getKey().equals(form08Entity.HUVI)) {
  200. form08Entity.setHuvi(String.valueOf(pairs.getValue()));
  201. } else if (pairs.getKey().equals(form08Entity.OLGOSON_TUN)) {
  202. try {
  203. form08Entity.setOLGOSON_TUN(Long.valueOf(pairs.getValue().toString()));
  204. } catch (NumberFormatException e) {
  205. form08Entity.setOLGOSON_TUN(Long.parseLong("0"));
  206. }
  207. } else if (pairs.getKey().equals(form08Entity.HEREGLESEN_TUN)) {
  208. try {
  209. form08Entity.setHEREGLESEN_TUN(Long.valueOf(pairs.getValue().toString()));
  210. } catch (NumberFormatException e) {
  211. form08Entity.setHEREGLESEN_TUN(Long.parseLong("0"));
  212. }
  213. } else if (pairs.getKey().equals(form08Entity.USTGASAN_TUN)) {
  214. try {
  215. form08Entity.setUSTGASAN_TUN(Long.valueOf(pairs.getValue().toString()));
  216. } catch (NumberFormatException e) {
  217. form08Entity.setUSTGASAN_TUN(Long.parseLong("0"));
  218. }
  219. } else if (pairs.getKey().equals(form08Entity.NUUTSULSEN_TUN)) {
  220. try {
  221. form08Entity.setNUUTSULSEN_TUN(Long.valueOf(pairs.getValue().toString()));
  222. } catch (NumberFormatException e) {
  223. form08Entity.setNUUTSULSEN_TUN(Long.parseLong("0"));
  224. }
  225. } else if (pairs.getKey().equals(form08Entity.RECORD_DATE)) {
  226. String dv = String.valueOf(pairs.getValue());
  227. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  228. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  229. form08Entity.setRecordDate(sqlDate);
  230. } else if (pairs.getKey().equals(form08Entity.SEARCH_RECORD_DATE)) {
  231. String dv = String.valueOf(pairs.getValue());
  232. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  233. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  234. form08Entity.setSearchRecordDate(sqlDate);
  235. }
  236. } catch (NullPointerException ex) {
  237. ex.printStackTrace();
  238. } catch (Exception ex) {
  239. ex.printStackTrace();
  240. }
  241. }//end while
  242. Date utilDate = new Date();
  243. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  244. if (form08Entity.getRecordDate() == null) form08Entity.setRecordDate(sqlDate);
  245. if (form08Entity.getSearchRecordDate() == null) form08Entity.setSearchRecordDate(sqlDate);
  246. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  247. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  248. form08Entity.setCreby(user.getUsername());
  249. }
  250. if (form08Entity != null && form08Entity.getRecordDate() != null && form08Entity.getSearchRecordDate() != null) {
  251. return form08Service.getListData(form08Entity);
  252. }
  253. } catch (Exception ex) {
  254. ex.printStackTrace();
  255. } finally {
  256. }
  257. return null;
  258. }
  259. @Override
  260. public ErrorEntity setForm08Data(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  261. System.out.println("Hospital Service Implament ::: get form 08 data");
  262. try {
  263. String command = "EDT";
  264. IForm08Service form08Service = new Form08ServiceImpl(super.conn);
  265. //Begin Check Role Step 1
  266. roleControl = new CheckUserRoleControl(super.conn);
  267. if (roleControl == null) {
  268. errorEntity = new ErrorEntity(ErrorType.ERROR, Long.valueOf(1002)); // Ерөнхий алдаа : Эрх нь хүрэлцэхгүй үед өгөх
  269. return errorEntity;
  270. }
  271. //End Check Role Step 1
  272. menuid = menuid.replaceAll("#", "");
  273. User user = sessionUser.get(sessionId);
  274. Form08Entity form08Entity = new Form08Entity();
  275. Iterator it = criteria.entrySet().iterator();
  276. while (it.hasNext()) {
  277. Map.Entry pairs = (Map.Entry) it.next();
  278. try {
  279. if (pairs.getKey().equals(form08Entity.ID)) {
  280. String tmpId = "";
  281. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
  282. if (pairs.getValue().toString().contains(".")) {
  283. tmpId = pairs.getValue().toString().substring(0, pairs.getValue().toString().indexOf("."));
  284. }
  285. form08Entity.setId(Long.parseLong(String.valueOf(tmpId)));
  286. }
  287. } else if (pairs.getKey().equals(form08Entity.ARGA_HEMJEE_NER)) {
  288. form08Entity.setArgaHemjeeNer(String.valueOf(pairs.getValue()));
  289. } else if (pairs.getKey().equals(form08Entity.AIMAG)) {
  290. form08Entity.setAimag(String.valueOf(pairs.getValue()));
  291. } else if (pairs.getKey().equals(form08Entity.SUM)) {
  292. form08Entity.setSum(String.valueOf(pairs.getValue()));
  293. } else if (pairs.getKey().equals(form08Entity.NER)) {
  294. form08Entity.setNer(String.valueOf(pairs.getValue()));
  295. } else if (pairs.getKey().equals(form08Entity.ZARTSUULSAN_HEMJEE)) {
  296. form08Entity.setZartsuulsanHemjee(String.valueOf(pairs.getValue()));
  297. } else if (pairs.getKey().equals(form08Entity.MALTURUL)) {
  298. form08Entity.setMalTurul(String.valueOf(pairs.getValue()));
  299. } else if (pairs.getKey().equals(form08Entity.TOLOVLOGOO)) {
  300. form08Entity.setTolovlogoo(String.valueOf(pairs.getValue()));
  301. } else if (pairs.getKey().equals(form08Entity.GUITSETGEL)) {
  302. form08Entity.setGuitsetgel(String.valueOf(pairs.getValue()));
  303. } else if (pairs.getKey().equals(form08Entity.HUVI)) {
  304. form08Entity.setHuvi(String.valueOf(pairs.getValue()));
  305. } else if (pairs.getKey().equals(form08Entity.OLGOSON_TUN)) {
  306. try {
  307. form08Entity.setOLGOSON_TUN(Long.valueOf(pairs.getValue().toString()));
  308. } catch (NumberFormatException e) {
  309. form08Entity.setOLGOSON_TUN(Long.parseLong("0"));
  310. }
  311. } else if (pairs.getKey().equals(form08Entity.HEREGLESEN_TUN)) {
  312. try {
  313. form08Entity.setHEREGLESEN_TUN(Long.valueOf(pairs.getValue().toString()));
  314. } catch (NumberFormatException e) {
  315. form08Entity.setHEREGLESEN_TUN(Long.parseLong("0"));
  316. }
  317. } else if (pairs.getKey().equals(form08Entity.USTGASAN_TUN)) {
  318. try {
  319. form08Entity.setUSTGASAN_TUN(Long.valueOf(pairs.getValue().toString()));
  320. } catch (NumberFormatException e) {
  321. form08Entity.setUSTGASAN_TUN(Long.parseLong("0"));
  322. }
  323. } else if (pairs.getKey().equals(form08Entity.NUUTSULSEN_TUN)) {
  324. try {
  325. form08Entity.setNUUTSULSEN_TUN(Long.valueOf(pairs.getValue().toString()));
  326. } catch (NumberFormatException e) {
  327. form08Entity.setNUUTSULSEN_TUN(Long.parseLong("0"));
  328. }
  329. } else if (pairs.getKey().toString().equalsIgnoreCase("command")) {
  330. command = String.valueOf(pairs.getValue());
  331. } else if (pairs.getKey().equals(form08Entity.RECORD_DATE)) {
  332. String dv = String.valueOf(pairs.getValue());
  333. if (!dv.isEmpty() && dv.length() >= 8) {
  334. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  335. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  336. form08Entity.setRecordDate(sqlDate);
  337. }
  338. }
  339. } catch (NullPointerException ex) {
  340. ex.printStackTrace();
  341. } catch (Exception ex) {
  342. ex.printStackTrace();
  343. }
  344. }//end while
  345. if (command.equalsIgnoreCase("INS")) {
  346. form08Entity.setDelflg("N");
  347. form08Entity.setActflg("Y");
  348. if (user != null && (user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  349. || user.getRoleCode().equalsIgnoreCase("ADMIN"))) {
  350. //Aimag songoh shaardlagagui
  351. } else {
  352. form08Entity.setAimag(user.getCity());
  353. }
  354. //form08Entity.setSum(user.getSum());
  355. form08Entity.setCreby(user.getUsername());
  356. Date utilDate = new Date();
  357. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  358. form08Entity.setCreat(sqlDate);
  359. if (form08Entity.getRecordDate() == null) form08Entity.setCreat(sqlDate);
  360. //Begin Check Role Step 2
  361. if (roleControl.checkRole(user, menuid, 2)) {
  362. errorEntity = form08Service.insertNewData(form08Entity);
  363. } else {
  364. errorEntity = new ErrorEntity(ErrorType.ERROR, Long.valueOf(1002)); // Ерөнхий алдаа : Эрх нь хүрэлцэхгүй үед өгөх
  365. }
  366. //End Check Role Step 2
  367. } else if (command.equalsIgnoreCase("EDT") ||
  368. command.equalsIgnoreCase("DEL") ||
  369. command.equalsIgnoreCase("ACT")) {
  370. int quality = 2;
  371. if (command.equalsIgnoreCase("DEL")) {
  372. form08Entity.setDelflg("Y");
  373. quality = 3;
  374. } else if (command.equalsIgnoreCase("ACT")) {
  375. form08Entity.setActflg("N");
  376. }
  377. //Begin Check Role Step 2
  378. if (roleControl.checkRole(user, menuid, quality)) {
  379. errorEntity = form08Service.updateData(form08Entity);
  380. } else {
  381. errorEntity = new ErrorEntity(ErrorType.ERROR, Long.valueOf(1002)); // Ерөнхий алдаа : Эрх нь хүрэлцэхгүй үед өгөх
  382. }
  383. //End Check Role Step 2
  384. }
  385. } catch (Exception ex) {
  386. ex.printStackTrace();
  387. } finally {
  388. }
  389. return errorEntity;
  390. }
  391. // Begin-form09
  392. @Override
  393. public List<Form09Entity> getForm09Data(LinkedTreeMap criteria, String sessionId) throws Exception {
  394. System.out.println("Hospital Service Implament ::: get form 09 data");
  395. try {
  396. IForm09Service form09Service = new Form09ServiceImpl(super.conn);
  397. User user = sessionUser.get(sessionId);
  398. Form09Entity form09Entity = new Form09Entity();
  399. Iterator it = criteria.entrySet().iterator();
  400. while (it.hasNext()) {
  401. Map.Entry pairs = (Map.Entry) it.next();
  402. try {
  403. if (pairs.getKey().equals(form09Entity.ID)) {
  404. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  405. form09Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  406. } else if (pairs.getKey().equals(form09Entity.AIMAG)) {
  407. form09Entity.setAimag(String.valueOf(pairs.getValue()));
  408. } else if (pairs.getKey().equals(form09Entity.SUM)) {
  409. form09Entity.setSum(form09Entity.SUM);
  410. } else if (pairs.getKey().equals(form09Entity.MALTURUL)) {
  411. form09Entity.setMalTurul(String.valueOf(pairs.getValue()));
  412. } else if (pairs.getKey().equals(form09Entity.TARILGANER)) {
  413. form09Entity.setTarilgaNer(String.valueOf(pairs.getValue()));
  414. } else if (pairs.getKey().equals(form09Entity.NER)) {
  415. form09Entity.setNer(String.valueOf(pairs.getValue()));
  416. } else if (pairs.getKey().equals(form09Entity.ZARTSUULSANHEMJEE)) {
  417. form09Entity.setZartsuulsanHemjee(String.valueOf(pairs.getValue()));
  418. } else if (pairs.getKey().equals(form09Entity.TOLOVLOGOO)) {
  419. form09Entity.setTolovlogoo(String.valueOf(pairs.getValue()));
  420. } else if (pairs.getKey().equals(form09Entity.GUITSETGEL)) {
  421. form09Entity.setGuitsetgel(String.valueOf(pairs.getValue()));
  422. } else if (pairs.getKey().equals(form09Entity.HUVI)) {
  423. form09Entity.setHuvi(String.valueOf(pairs.getValue()));
  424. } else if (pairs.getKey().equals(form09Entity.OLGOSON_TUN)) {
  425. try {
  426. form09Entity.setOLGOSON_TUN(Long.valueOf(pairs.getValue().toString()));
  427. } catch (NumberFormatException e) {
  428. form09Entity.setOLGOSON_TUN(Long.parseLong("0"));
  429. }
  430. } else if (pairs.getKey().equals(form09Entity.HEREGLESEN_TUN)) {
  431. try {
  432. form09Entity.setHEREGLESEN_TUN(Long.valueOf(pairs.getValue().toString()));
  433. } catch (NumberFormatException e) {
  434. form09Entity.setHEREGLESEN_TUN(Long.parseLong("0"));
  435. }
  436. } else if (pairs.getKey().equals(form09Entity.USTGASAN_TUN)) {
  437. try {
  438. form09Entity.setUSTGASAN_TUN(Long.valueOf(pairs.getValue().toString()));
  439. } catch (NumberFormatException e) {
  440. form09Entity.setUSTGASAN_TUN(Long.parseLong("0"));
  441. }
  442. } else if (pairs.getKey().equals(form09Entity.NUUTSULSEN_TUN)) {
  443. try {
  444. form09Entity.setNUUTSULSEN_TUN(Long.valueOf(pairs.getValue().toString()));
  445. } catch (NumberFormatException e) {
  446. form09Entity.setNUUTSULSEN_TUN(Long.parseLong("0"));
  447. }
  448. } else if (pairs.getKey().equals(form09Entity.RECORD_DATE)) {
  449. String dv = String.valueOf(pairs.getValue());
  450. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  451. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  452. form09Entity.setRecordDate(sqlDate);
  453. } else if (pairs.getKey().equals(form09Entity.SEARCH_RECORD_DATE)) {
  454. String dv = String.valueOf(pairs.getValue());
  455. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  456. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  457. form09Entity.setSearchRecordDate(sqlDate);
  458. }
  459. } catch (NullPointerException ex) {
  460. ex.printStackTrace();
  461. } catch (Exception ex) {
  462. ex.printStackTrace();
  463. }
  464. }//end while
  465. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  466. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  467. form09Entity.setCreby(user.getUsername());
  468. }
  469. return form09Service.getListData(form09Entity);
  470. } catch (Exception ex) {
  471. ex.printStackTrace();
  472. } finally {
  473. }
  474. return null;
  475. }
  476. @Override
  477. public ErrorEntity setForm09Data(LinkedTreeMap criteria, String sessionId) throws Exception {
  478. System.out.println("Hospital Service Implament ::: get form 09 data");
  479. try {
  480. String command = "EDT";
  481. IForm09Service form09Service = new Form09ServiceImpl(super.conn);
  482. User user = sessionUser.get(sessionId);
  483. Form09Entity form09Entity = new Form09Entity();
  484. Iterator it = criteria.entrySet().iterator();
  485. while (it.hasNext()) {
  486. Map.Entry pairs = (Map.Entry) it.next();
  487. try {
  488. if (pairs.getKey().equals(form09Entity.ID)) {
  489. String tmpId = "";
  490. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
  491. if (pairs.getValue().toString().contains(".")) {
  492. tmpId = pairs.getValue().toString().substring(0, pairs.getValue().toString().indexOf("."));
  493. }
  494. form09Entity.setId(Long.parseLong(String.valueOf(tmpId)));
  495. }
  496. } else if (pairs.getKey().equals(form09Entity.TARILGANER)) {
  497. form09Entity.setTarilgaNer(String.valueOf(pairs.getValue()));
  498. } else if (pairs.getKey().equals(form09Entity.NER)) {
  499. form09Entity.setNer(String.valueOf(pairs.getValue()));
  500. } else if (pairs.getKey().equals(form09Entity.ZARTSUULSANHEMJEE)) {
  501. form09Entity.setZartsuulsanHemjee(String.valueOf(pairs.getValue()));
  502. } else if (pairs.getKey().equals(form09Entity.MALTURUL)) {
  503. form09Entity.setMalTurul(String.valueOf(pairs.getValue()));
  504. } else if (pairs.getKey().equals(form09Entity.TOLOVLOGOO)) {
  505. form09Entity.setTolovlogoo(String.valueOf(pairs.getValue()));
  506. } else if (pairs.getKey().equals(form09Entity.GUITSETGEL)) {
  507. form09Entity.setGuitsetgel(String.valueOf(pairs.getValue()));
  508. } else if (pairs.getKey().equals(form09Entity.HUVI)) {
  509. form09Entity.setHuvi(String.valueOf(pairs.getValue()));
  510. } else if (pairs.getKey().equals(form09Entity.OLGOSON_TUN)) {
  511. try {
  512. form09Entity.setOLGOSON_TUN(Long.valueOf(pairs.getValue().toString()));
  513. } catch (NumberFormatException e) {
  514. form09Entity.setOLGOSON_TUN(Long.parseLong("0"));
  515. }
  516. } else if (pairs.getKey().equals(form09Entity.HEREGLESEN_TUN)) {
  517. try {
  518. form09Entity.setHEREGLESEN_TUN(Long.valueOf(pairs.getValue().toString()));
  519. } catch (NumberFormatException e) {
  520. form09Entity.setHEREGLESEN_TUN(Long.parseLong("0"));
  521. }
  522. } else if (pairs.getKey().equals(form09Entity.USTGASAN_TUN)) {
  523. try {
  524. form09Entity.setUSTGASAN_TUN(Long.valueOf(pairs.getValue().toString()));
  525. } catch (NumberFormatException e) {
  526. form09Entity.setUSTGASAN_TUN(Long.parseLong("0"));
  527. }
  528. } else if (pairs.getKey().equals(form09Entity.NUUTSULSEN_TUN)) {
  529. try {
  530. form09Entity.setNUUTSULSEN_TUN(Long.valueOf(pairs.getValue().toString()));
  531. } catch (NumberFormatException e) {
  532. form09Entity.setNUUTSULSEN_TUN(Long.parseLong("0"));
  533. }
  534. } else if (pairs.getKey().toString().equalsIgnoreCase("command")) {
  535. command = String.valueOf(pairs.getValue());
  536. } else if (pairs.getKey().equals(form09Entity.RECORD_DATE)) {
  537. String dv = String.valueOf(pairs.getValue());
  538. if (!dv.isEmpty() && dv.length() >= 8) {
  539. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  540. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  541. form09Entity.setRecordDate(sqlDate);
  542. }
  543. }
  544. } catch (NullPointerException ex) {
  545. ex.printStackTrace();
  546. } catch (Exception ex) {
  547. ex.printStackTrace();
  548. }
  549. }//end while
  550. if (command.equalsIgnoreCase("INS")) {
  551. form09Entity.setDelflg("N");
  552. form09Entity.setActflg("Y");
  553. form09Entity.setAimag(user.getCity());
  554. form09Entity.setSum(user.getSum());
  555. form09Entity.setCreby(user.getUsername());
  556. Date utilDate = new Date();
  557. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  558. form09Entity.setCreat(sqlDate);
  559. if (form09Entity.getRecordDate() == null) form09Entity.setCreat(sqlDate);
  560. errorEntity = form09Service.insertNewData(form09Entity);
  561. } else if (command.equalsIgnoreCase("EDT") ||
  562. command.equalsIgnoreCase("DEL") ||
  563. command.equalsIgnoreCase("ACT")) {
  564. if (command.equalsIgnoreCase("DEL")) {
  565. form09Entity.setDelflg("Y");
  566. } else if (command.equalsIgnoreCase("ACT")) {
  567. form09Entity.setActflg("N");
  568. }
  569. errorEntity = form09Service.updateData(form09Entity);
  570. }
  571. } catch (Exception ex) {
  572. ex.printStackTrace();
  573. } finally {
  574. }
  575. return errorEntity;
  576. }
  577. // end-form09
  578. @Override
  579. public List<Form11Entity> getForm11Data(LinkedTreeMap criteria, String sessionId) throws Exception {
  580. System.out.println("Hospital Service Implament ::: get form 11 data");
  581. try {
  582. IForm11Service form11Service = new Form11ServiceImpl(super.conn);
  583. User user = sessionUser.get(sessionId);
  584. Form11Entity form11Entity = new Form11Entity();
  585. Iterator it = criteria.entrySet().iterator();
  586. while (it.hasNext()) {
  587. Map.Entry pairs = (Map.Entry) it.next();
  588. try {
  589. if (pairs.getKey().equals(form11Entity.ID)) {
  590. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
  591. form11Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  592. }
  593. } else if (pairs.getKey().equals(form11Entity.AIMAG)) {
  594. form11Entity.setAimag(String.valueOf(pairs.getValue()));
  595. } else if (pairs.getKey().equals(form11Entity.SUM)) {
  596. form11Entity.setSum(String.valueOf(pairs.getValue()));
  597. } else if (pairs.getKey().equals(form11Entity.BAGCODE)) {
  598. form11Entity.setBagCode(String.valueOf(pairs.getValue()));
  599. } else if (pairs.getKey().equals(form11Entity.MALTURUL)) {
  600. form11Entity.setMalTurul(String.valueOf(pairs.getValue()));
  601. } else if (pairs.getKey().equals(form11Entity.DEEJIINTURUL)) {
  602. form11Entity.setDeejiinTurul(String.valueOf(pairs.getValue()));
  603. } else if (pairs.getKey().equals(form11Entity.SUMBAGNER)) {
  604. form11Entity.setSumBagNer(String.valueOf(pairs.getValue()));
  605. } else if (pairs.getKey().equals(form11Entity.TOOTOLGOI)) {
  606. try {
  607. form11Entity.setTooTolgoi(Long.parseLong(String.valueOf(pairs.getValue())));
  608. } catch (Exception e) {
  609. form11Entity.setTooTolgoi(Long.parseLong(String.valueOf("0")));
  610. }
  611. } else if (pairs.getKey().equals(form11Entity.HAANASHINJILSEN)) {
  612. form11Entity.setHaanaShinjilsen(String.valueOf(pairs.getValue()));
  613. } else if (pairs.getKey().equals(form11Entity.SHINJILSENARGA)) {
  614. form11Entity.setShinjilsenArga(String.valueOf(pairs.getValue()));
  615. } else if (pairs.getKey().equals(form11Entity.ERUUL)) {
  616. try {
  617. form11Entity.setEruul(Long.parseLong(String.valueOf(pairs.getValue())));
  618. } catch (Exception e) {
  619. form11Entity.setEruul(Long.parseLong(String.valueOf("0")));
  620. }
  621. } else if (pairs.getKey().equals(form11Entity.UVCHTEI)) {
  622. try {
  623. form11Entity.setUvchtei(Long.parseLong(String.valueOf(pairs.getValue())));
  624. } catch (Exception e) {
  625. form11Entity.setUvchtei(Long.parseLong(String.valueOf("0")));
  626. }
  627. } else if (pairs.getKey().equals(form11Entity.ONOSH)) {
  628. try {
  629. form11Entity.setOnosh(Long.parseLong(String.valueOf(pairs.getValue())));
  630. } catch (Exception e) {
  631. form11Entity.setOnosh(Long.parseLong(String.valueOf("0")));
  632. }
  633. } else if (pairs.getKey().equals(form11Entity.RECORD_DATE)) {
  634. String dv = String.valueOf(pairs.getValue());
  635. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  636. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  637. form11Entity.setRecordDate(sqlDate);
  638. } else if (pairs.getKey().equals(form11Entity.SEARCH_RECORD_DATE)) {
  639. String dv = String.valueOf(pairs.getValue());
  640. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  641. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  642. form11Entity.setSearchRecordDate(sqlDate);
  643. }
  644. } catch (NullPointerException ex) {
  645. ex.printStackTrace();
  646. } catch (Exception ex) {
  647. ex.printStackTrace();
  648. }
  649. }//end while
  650. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  651. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  652. form11Entity.setCreby(user.getUsername());
  653. }
  654. if (form11Entity != null && form11Entity.getRecordDate() != null && form11Entity.getSearchRecordDate() != null) {
  655. return form11Service.getListData(form11Entity);
  656. }
  657. } catch (Exception ex) {
  658. ex.printStackTrace();
  659. } finally {
  660. }
  661. return null;
  662. }
  663. @Override
  664. public ErrorEntity setForm11Data(LinkedTreeMap criteria, String sessionId) throws Exception {
  665. System.out.println("Hospital Service Implament ::: get form 11 data");
  666. try {
  667. String command = "EDT";
  668. IForm11Service form11Service = new Form11ServiceImpl(super.conn);
  669. User user = sessionUser.get(sessionId);
  670. Form11Entity form11Entity = new Form11Entity();
  671. Iterator it = criteria.entrySet().iterator();
  672. while (it.hasNext()) {
  673. Map.Entry pairs = (Map.Entry) it.next();
  674. try {
  675. if (pairs.getKey().equals(form11Entity.ID)) {
  676. String tmpId = "";
  677. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
  678. if (pairs.getValue().toString().contains(".")) {
  679. tmpId = pairs.getValue().toString().substring(0, pairs.getValue().toString().indexOf("."));
  680. }
  681. form11Entity.setId(Long.parseLong(String.valueOf(tmpId)));
  682. }
  683. } else if (pairs.getKey().equals(form11Entity.DEEJIINTURUL)) {
  684. form11Entity.setDeejiinTurul(String.valueOf(pairs.getValue()));
  685. } else if (pairs.getKey().equals(form11Entity.AIMAG)) {
  686. form11Entity.setAimag(String.valueOf(pairs.getValue()));
  687. } else if (pairs.getKey().equals(form11Entity.SUMBAGNER)) {
  688. form11Entity.setSumBagNer(String.valueOf(pairs.getValue()));
  689. } else if (pairs.getKey().equals(form11Entity.SUM)) {
  690. form11Entity.setSum(String.valueOf(pairs.getValue()));
  691. } else if (pairs.getKey().equals(form11Entity.BAGCODE)) {
  692. form11Entity.setBagCode(String.valueOf(pairs.getValue()));
  693. } else if (pairs.getKey().equals(form11Entity.MALTURUL)) {
  694. form11Entity.setMalTurul(String.valueOf(pairs.getValue()));
  695. } else if (pairs.getKey().equals(form11Entity.TOOTOLGOI)) {
  696. form11Entity.setTooTolgoi(Long.parseLong(String.valueOf(pairs.getValue())));
  697. } else if (pairs.getKey().equals(form11Entity.HAANASHINJILSEN)) {
  698. form11Entity.setHaanaShinjilsen(String.valueOf(pairs.getValue()));
  699. } else if (pairs.getKey().equals(form11Entity.SHINJILSENARGA)) {
  700. form11Entity.setShinjilsenArga(String.valueOf(pairs.getValue()));
  701. } else if (pairs.getKey().equals(form11Entity.ERUUL)) {
  702. form11Entity.setEruul(Long.parseLong(String.valueOf(pairs.getValue())));
  703. } else if (pairs.getKey().equals(form11Entity.UVCHTEI)) {
  704. form11Entity.setUvchtei(Long.parseLong(String.valueOf(pairs.getValue())));
  705. } else if (pairs.getKey().equals(form11Entity.ONOSH)) {
  706. form11Entity.setOnosh(Long.parseLong(String.valueOf(pairs.getValue())));
  707. } else if (pairs.getKey().equals(form11Entity.RECORD_DATE)) {
  708. String dv = String.valueOf(pairs.getValue());
  709. if (!dv.isEmpty() && dv.length() >= 8) {
  710. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  711. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  712. form11Entity.setRecordDate(sqlDate);
  713. }
  714. } else if (pairs.getKey().toString().equalsIgnoreCase("command")) {
  715. command = String.valueOf(pairs.getValue());
  716. }
  717. } catch (NullPointerException ex) {
  718. ex.printStackTrace();
  719. } catch (Exception ex) {
  720. ex.printStackTrace();
  721. }
  722. }//end while
  723. Date utilDate = new Date();
  724. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  725. form11Entity.setModby(user.getUsername());
  726. form11Entity.setModAt(sqlDate);
  727. if (command.equalsIgnoreCase("INS")) {
  728. form11Entity.setDelflg("N");
  729. form11Entity.setActflg("Y");
  730. if (user != null && (user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  731. || user.getRoleCode().equalsIgnoreCase("ADMIN"))) {
  732. //Aimag songoh shaardlagagui
  733. } else {
  734. form11Entity.setAimag(user.getCity());
  735. }
  736. //form11Entity.setSum(user.getSum());
  737. form11Entity.setCreby(user.getUsername());
  738. form11Entity.setCreat(sqlDate);
  739. if (form11Entity.getRecordDate() == null) form11Entity.setCreat(sqlDate);
  740. errorEntity = form11Service.insertNewData(form11Entity);
  741. } else if (command.equalsIgnoreCase("EDT") ||
  742. command.equalsIgnoreCase("DEL") ||
  743. command.equalsIgnoreCase("ACT")) {
  744. if (command.equalsIgnoreCase("DEL")) {
  745. form11Entity.setDelflg("Y");
  746. } else if (command.equalsIgnoreCase("ACT")) {
  747. form11Entity.setActflg("N");
  748. }
  749. errorEntity = form11Service.updateData(form11Entity);
  750. }
  751. } catch (Exception ex) {
  752. ex.printStackTrace();
  753. } finally {
  754. }
  755. return errorEntity;
  756. }
  757. // Begin-form14
  758. @Override
  759. public List<Form14Entity> getForm14Data(LinkedTreeMap criteria, String sessionId) throws Exception {
  760. System.out.println("Hospital Service Implament ::: get form 14 data");
  761. try {
  762. IForm14Service form14Service = new Form14ServiceImpl(super.conn);
  763. User user = sessionUser.get(sessionId);
  764. Form14Entity form14Entity = new Form14Entity();
  765. Iterator it = criteria.entrySet().iterator();
  766. while (it.hasNext()) {
  767. Map.Entry pairs = (Map.Entry) it.next();
  768. try {
  769. if (pairs.getKey().equals(form14Entity.ID)) {
  770. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  771. form14Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  772. } else if (pairs.getKey().equals(form14Entity.AIMAG)) {
  773. form14Entity.setAimag(String.valueOf(pairs.getValue()));
  774. } else if (pairs.getKey().equals(form14Entity.SUM)) {
  775. form14Entity.setSum(String.valueOf(pairs.getValue()));
  776. } else if (pairs.getKey().equals(form14Entity.SHALGAHGAZAR)) {
  777. form14Entity.setShalgahGazar(String.valueOf(pairs.getValue()));
  778. } else if (pairs.getKey().equals(form14Entity.UZLEGTOO)) {
  779. try {
  780. form14Entity.setUzlegToo(Long.valueOf(pairs.getValue().toString()));
  781. } catch (NumberFormatException e) {
  782. form14Entity.setUzlegToo(Long.valueOf("0"));
  783. }
  784. } else if (pairs.getKey().equals(form14Entity.BAIGUULLAGATOO)) {
  785. try {
  786. form14Entity.setBaiguullagaToo(Long.valueOf(pairs.getValue().toString()));
  787. } catch (NumberFormatException e) {
  788. form14Entity.setBaiguullagaToo(Long.valueOf("0"));
  789. }
  790. } else if (pairs.getKey().equals(form14Entity.AJAHUINNEGJTOO)) {
  791. try {
  792. form14Entity.setAjAhuinNegjToo(Long.valueOf(pairs.getValue().toString()));
  793. } catch (NumberFormatException e) {
  794. form14Entity.setAjAhuinNegjToo(Long.valueOf("0"));
  795. }
  796. } else if (pairs.getKey().equals(form14Entity.IRGEDTOO)) {
  797. try {
  798. form14Entity.setIrgedToo(Long.valueOf(pairs.getValue().toString()));
  799. } catch (NumberFormatException e) {
  800. form14Entity.setIrgedToo(Long.valueOf("0"));
  801. }
  802. } else if (pairs.getKey().equals(form14Entity.HUULIINBAIGSHILJSEN)) {
  803. try {
  804. form14Entity.setHuuliinBaigShiljsen(Long.valueOf(pairs.getValue().toString()));
  805. } catch (NumberFormatException e) {
  806. form14Entity.setHuuliinBaigShiljsen(Long.valueOf("0"));
  807. }
  808. } else if (pairs.getKey().equals(form14Entity.ZAHIRGAAHARITOO)) {
  809. try {
  810. form14Entity.setZahirgaaHariToo(Long.valueOf(pairs.getValue().toString()));
  811. } catch (NumberFormatException e) {
  812. form14Entity.setZahirgaaHariToo(Long.valueOf("0"));
  813. }
  814. } else if (pairs.getKey().equals(form14Entity.TORGUULIHEMJEE)) {
  815. try {
  816. form14Entity.setTorguuliHemjee(BigDecimal.valueOf(Long.parseLong(pairs.getValue().toString())));
  817. } catch (NumberFormatException e) {
  818. form14Entity.setTorguuliHemjee(BigDecimal.valueOf(Long.parseLong("0")));
  819. }
  820. } else if (pairs.getKey().equals(form14Entity.TOLBOR)) {
  821. try {
  822. form14Entity.setTolbor(BigDecimal.valueOf(Long.parseLong(pairs.getValue().toString())));
  823. } catch (NumberFormatException e) {
  824. form14Entity.setTolbor(BigDecimal.valueOf(Long.parseLong("0")));
  825. }
  826. } else if (pairs.getKey().equals(form14Entity.TORGUULIAR)) {
  827. try {
  828. form14Entity.setTorguuliar(BigDecimal.valueOf(Long.parseLong(pairs.getValue().toString())));
  829. } catch (NumberFormatException e) {
  830. form14Entity.setTorguuliar(BigDecimal.valueOf(Long.parseLong("0")));
  831. }
  832. } else if (pairs.getKey().equals(form14Entity.TOLBOROOR)) {
  833. try {
  834. form14Entity.setTolboroor(BigDecimal.valueOf(Long.parseLong(pairs.getValue().toString())));
  835. } catch (NumberFormatException e) {
  836. form14Entity.setTolboroor(BigDecimal.valueOf(Long.parseLong("0")));
  837. }
  838. } else if (pairs.getKey().equals(form14Entity.RECORD_DATE)) {
  839. String dv = String.valueOf(pairs.getValue());
  840. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  841. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  842. form14Entity.setRecordDate(sqlDate);
  843. } else if (pairs.getKey().equals(form14Entity.SEARCH_RECORD_DATE)) {
  844. String dv = String.valueOf(pairs.getValue());
  845. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  846. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  847. form14Entity.setSearchRecordDate(sqlDate);
  848. }
  849. } catch (NullPointerException ex) {
  850. ex.printStackTrace();
  851. } catch (Exception ex) {
  852. ex.printStackTrace();
  853. }
  854. }//end while
  855. return form14Service.getListData(form14Entity);
  856. } catch (Exception ex) {
  857. ex.printStackTrace();
  858. } finally {
  859. }
  860. return null;
  861. }
  862. @Override
  863. public ErrorEntity setForm14Data(LinkedTreeMap criteria, String sessionId) throws Exception {
  864. System.out.println("Hospital Service Implament ::: get form 14 data");
  865. try {
  866. String command = "EDT";
  867. IForm14Service form14Service = new Form14ServiceImpl(super.conn);
  868. User user = sessionUser.get(sessionId);
  869. Form14Entity form14Entity = new Form14Entity();
  870. Iterator it = criteria.entrySet().iterator();
  871. while (it.hasNext()) {
  872. Map.Entry pairs = (Map.Entry) it.next();
  873. try {
  874. if (pairs.getKey().equals(form14Entity.ID)) {
  875. String tmpId = "";
  876. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
  877. if (pairs.getValue().toString().contains(".")) {
  878. tmpId = pairs.getValue().toString().substring(0, pairs.getValue().toString().indexOf("."));
  879. }
  880. form14Entity.setId(Long.parseLong(String.valueOf(tmpId)));
  881. }
  882. } else if (pairs.getKey().equals(form14Entity.SHALGAHGAZAR)) {
  883. form14Entity.setShalgahGazar(String.valueOf(pairs.getValue()));
  884. } else if (pairs.getKey().equals(form14Entity.UZLEGTOO)) {
  885. try {
  886. form14Entity.setUzlegToo(Long.valueOf(pairs.getValue().toString()));
  887. } catch (NumberFormatException e) {
  888. form14Entity.setUzlegToo(Long.valueOf("0"));
  889. }
  890. } else if (pairs.getKey().equals(form14Entity.BAIGUULLAGATOO)) {
  891. try {
  892. form14Entity.setBaiguullagaToo(Long.valueOf(pairs.getValue().toString()));
  893. } catch (NumberFormatException e) {
  894. form14Entity.setBaiguullagaToo(Long.valueOf("0"));
  895. }
  896. } else if (pairs.getKey().equals(form14Entity.AJAHUINNEGJTOO)) {
  897. try {
  898. form14Entity.setAjAhuinNegjToo(Long.valueOf(pairs.getValue().toString()));
  899. } catch (NumberFormatException e) {
  900. form14Entity.setAjAhuinNegjToo(Long.valueOf("0"));
  901. }
  902. } else if (pairs.getKey().equals(form14Entity.IRGEDTOO)) {
  903. try {
  904. form14Entity.setIrgedToo(Long.valueOf(pairs.getValue().toString()));
  905. } catch (NumberFormatException e) {
  906. form14Entity.setIrgedToo(Long.valueOf("0"));
  907. }
  908. } else if (pairs.getKey().equals(form14Entity.HUULIINBAIGSHILJSEN)) {
  909. try {
  910. form14Entity.setHuuliinBaigShiljsen(Long.valueOf(pairs.getValue().toString()));
  911. } catch (NumberFormatException e) {
  912. form14Entity.setHuuliinBaigShiljsen(Long.valueOf("0"));
  913. }
  914. } else if (pairs.getKey().equals(form14Entity.ZAHIRGAAHARITOO)) {
  915. try {
  916. form14Entity.setZahirgaaHariToo(Long.valueOf(pairs.getValue().toString()));
  917. } catch (NumberFormatException e) {
  918. form14Entity.setZahirgaaHariToo(Long.valueOf("0"));
  919. }
  920. } else if (pairs.getKey().equals(form14Entity.TORGUULIHEMJEE)) {
  921. try {
  922. form14Entity.setTorguuliHemjee(BigDecimal.valueOf(Long.parseLong(pairs.getValue().toString())));
  923. } catch (NumberFormatException e) {
  924. form14Entity.setTorguuliHemjee(BigDecimal.valueOf(Long.parseLong("0")));
  925. }
  926. } else if (pairs.getKey().equals(form14Entity.TOLBOR)) {
  927. try {
  928. form14Entity.setTolbor(BigDecimal.valueOf(Long.parseLong(pairs.getValue().toString())));
  929. } catch (NumberFormatException e) {
  930. form14Entity.setTolbor(BigDecimal.valueOf(Long.parseLong("0")));
  931. }
  932. } else if (pairs.getKey().equals(form14Entity.TORGUULIAR)) {
  933. try {
  934. form14Entity.setTorguuliar(BigDecimal.valueOf(Long.parseLong(pairs.getValue().toString())));
  935. } catch (NumberFormatException e) {
  936. form14Entity.setTorguuliar(BigDecimal.valueOf(Long.parseLong("0")));
  937. }
  938. } else if (pairs.getKey().equals(form14Entity.TOLBOROOR)) {
  939. try {
  940. form14Entity.setTolboroor(BigDecimal.valueOf(Long.parseLong(pairs.getValue().toString())));
  941. } catch (NumberFormatException e) {
  942. form14Entity.setTolboroor(BigDecimal.valueOf(Long.parseLong("0")));
  943. }
  944. } else if (pairs.getKey().toString().equalsIgnoreCase("command")) {
  945. command = String.valueOf(pairs.getValue());
  946. } else if (pairs.getKey().equals(form14Entity.RECORD_DATE)) {
  947. String dv = String.valueOf(pairs.getValue());
  948. if (!dv.isEmpty() && dv.length() >= 8) {
  949. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  950. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  951. form14Entity.setRecordDate(sqlDate);
  952. }
  953. }
  954. } catch (NullPointerException ex) {
  955. ex.printStackTrace();
  956. } catch (Exception ex) {
  957. ex.printStackTrace();
  958. }
  959. }//end while
  960. if (command.equalsIgnoreCase("INS")) {
  961. form14Entity.setDelflg("N");
  962. form14Entity.setActflg("Y");
  963. form14Entity.setAimag(user.getCity());
  964. form14Entity.setSum(user.getSum());
  965. form14Entity.setCreby(user.getUsername());
  966. Date utilDate = new Date();
  967. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  968. form14Entity.setCreat(sqlDate);
  969. if (form14Entity.getRecordDate() == null) form14Entity.setCreat(sqlDate);
  970. errorEntity = form14Service.insertNewData(form14Entity);
  971. } else if (command.equalsIgnoreCase("EDT") ||
  972. command.equalsIgnoreCase("DEL") ||
  973. command.equalsIgnoreCase("ACT")) {
  974. if (command.equalsIgnoreCase("DEL")) {
  975. form14Entity.setDelflg("Y");
  976. } else if (command.equalsIgnoreCase("ACT")) {
  977. form14Entity.setActflg("N");
  978. }
  979. errorEntity = form14Service.updateData(form14Entity);
  980. }
  981. } catch (Exception ex) {
  982. ex.printStackTrace();
  983. } finally {
  984. }
  985. return errorEntity;
  986. }
  987. // end-form14
  988. @Override
  989. public List<Form46Entity> getForm46Data(LinkedTreeMap criteria, String sessionId) throws Exception {
  990. System.out.println("Hospital Service Implament ::: get form 46 data");
  991. try {
  992. IForm46Service form46Service = new Form46ServiceImpl(super.conn);
  993. User user = sessionUser.get(sessionId);
  994. Form46Entity entity = new Form46Entity();
  995. Iterator it = criteria.entrySet().iterator();
  996. while (it.hasNext()) {
  997. Map.Entry pairs = (Map.Entry) it.next();
  998. try {
  999. if (pairs.getKey().equals(entity.ID)) {
  1000. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  1001. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  1002. } else if (pairs.getKey().equals(entity.AIMAG)) {
  1003. entity.setAimag(String.valueOf(pairs.getValue()));
  1004. } else if (pairs.getKey().equals(entity.SUM)) {
  1005. entity.setSum(String.valueOf(pairs.getValue()));
  1006. } else if (pairs.getKey().equals(entity.BAGHOROONER)) {
  1007. entity.setBagHorooNer(String.valueOf(pairs.getValue()));
  1008. } else if (pairs.getKey().equals(entity.UHERNIITTOO)) {
  1009. entity.setUherNiitToo(String.valueOf(pairs.getValue()));
  1010. } else if (pairs.getKey().equals(entity.TUGALTOO)) {
  1011. try {
  1012. entity.setTugalToo(Long.parseLong(String.valueOf(pairs.getValue())));
  1013. } catch (Exception e) {
  1014. entity.setTugalToo(Long.parseLong(String.valueOf("0")));
  1015. }
  1016. } else if (pairs.getKey().equals(entity.BUSADTOO)) {
  1017. try {
  1018. entity.setBusadToo(Long.parseLong(String.valueOf(pairs.getValue())));
  1019. } catch (Exception e) {
  1020. entity.setBusadToo(Long.parseLong(String.valueOf("0")));
  1021. }
  1022. } else if (pairs.getKey().equals(entity.GUURTAINIITTOO)) {
  1023. entity.setGuurtaiNiitToo(String.valueOf(pairs.getValue()));
  1024. } else if (pairs.getKey().equals(entity.GUURTAITUGALTOO)) {
  1025. try {
  1026. entity.setGuurtaiBusadToo(Long.parseLong(String.valueOf(pairs.getValue())));
  1027. } catch (Exception e) {
  1028. entity.setGuurtaiBusadToo(Long.parseLong(String.valueOf("0")));
  1029. }
  1030. } else if (pairs.getKey().equals(entity.GUURTAIBUSADTOO)) {
  1031. try {
  1032. entity.setGuurtaiBusadToo(Long.parseLong(String.valueOf(pairs.getValue())));
  1033. } catch (Exception e) {
  1034. entity.setGuurtaiBusadToo(Long.parseLong(String.valueOf("0")));
  1035. }
  1036. } else if (pairs.getKey().equals(entity.DUNDAJHUVI)) {
  1037. entity.setDundajHuvi(String.valueOf(pairs.getValue()));
  1038. } else if (pairs.getKey().equals(entity.TUGALHUVI)) {
  1039. entity.setTugalHuvi(String.valueOf(pairs.getValue()));
  1040. } else if (pairs.getKey().equals(entity.BUSADHUVI)) {
  1041. entity.setBusadHuvi(String.valueOf(pairs.getValue()));
  1042. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  1043. String dv = String.valueOf(pairs.getValue());
  1044. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  1045. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  1046. entity.setRecordDate(sqlDate);
  1047. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  1048. String dv = String.valueOf(pairs.getValue());
  1049. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  1050. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  1051. entity.setSearchRecordDate(sqlDate);
  1052. }
  1053. } catch (NullPointerException ex) {
  1054. ex.printStackTrace();
  1055. } catch (Exception ex) {
  1056. ex.printStackTrace();
  1057. }
  1058. }//end while
  1059. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  1060. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  1061. entity.setCreby(user.getUsername());
  1062. }
  1063. return form46Service.getListData(entity);
  1064. } catch (Exception ex) {
  1065. ex.printStackTrace();
  1066. } finally {
  1067. }
  1068. return null;
  1069. }
  1070. @Override
  1071. public ErrorEntity setForm46Data(LinkedTreeMap criteria, String sessionId) throws Exception {
  1072. System.out.println("Hospital Service Implament ::: get form 46 data");
  1073. try {
  1074. String command = "EDT";
  1075. IForm46Service form46Service = new Form46ServiceImpl(super.conn);
  1076. User user = sessionUser.get(sessionId);
  1077. Form46Entity entity = new Form46Entity();
  1078. Iterator it = criteria.entrySet().iterator();
  1079. while (it.hasNext()) {
  1080. Map.Entry pairs = (Map.Entry) it.next();
  1081. try {
  1082. if (pairs.getKey().equals(entity.ID)) {
  1083. String tmpId = "";
  1084. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
  1085. if (pairs.getValue().toString().contains(".")) {
  1086. tmpId = pairs.getValue().toString().substring(0, pairs.getValue().toString().indexOf("."));
  1087. }
  1088. entity.setId(Long.parseLong(String.valueOf(tmpId)));
  1089. }
  1090. } else if (pairs.getKey().equals(entity.AIMAG)) {
  1091. entity.setAimag(String.valueOf(pairs.getValue()));
  1092. } else if (pairs.getKey().equals(entity.SUM)) {
  1093. entity.setSum(String.valueOf(pairs.getValue()));
  1094. } else if (pairs.getKey().equals(entity.BAGHOROONER)) {
  1095. entity.setBagHorooNer(String.valueOf(pairs.getValue()));
  1096. } else if (pairs.getKey().equals(entity.UHERNIITTOO)) {
  1097. entity.setUherNiitToo(String.valueOf(pairs.getValue()));
  1098. } else if (pairs.getKey().equals(entity.TUGALTOO)) {
  1099. try {
  1100. entity.setTugalToo(Long.parseLong(String.valueOf(pairs.getValue())));
  1101. } catch (Exception e) {
  1102. entity.setTugalToo(Long.parseLong(String.valueOf("0")));
  1103. }
  1104. } else if (pairs.getKey().equals(entity.BUSADTOO)) {
  1105. try {
  1106. entity.setBusadToo(Long.parseLong(String.valueOf(pairs.getValue())));
  1107. } catch (Exception e) {
  1108. entity.setBusadToo(Long.parseLong(String.valueOf("0")));
  1109. }
  1110. } else if (pairs.getKey().equals(entity.GUURTAINIITTOO)) {
  1111. entity.setGuurtaiNiitToo(String.valueOf(pairs.getValue()));
  1112. } else if (pairs.getKey().equals(entity.GUURTAITUGALTOO)) {
  1113. try {
  1114. entity.setGuurtaiTugalToo(Long.parseLong(String.valueOf(pairs.getValue())));
  1115. } catch (Exception e) {
  1116. entity.setGuurtaiTugalToo(Long.parseLong(String.valueOf("0")));
  1117. }
  1118. } else if (pairs.getKey().equals(entity.GUURTAIBUSADTOO)) {
  1119. try {
  1120. entity.setGuurtaiBusadToo(Long.parseLong(String.valueOf(pairs.getValue())));
  1121. } catch (Exception e) {
  1122. entity.setGuurtaiBusadToo(Long.parseLong(String.valueOf("0")));
  1123. }
  1124. } else if (pairs.getKey().equals(entity.DUNDAJHUVI)) {
  1125. entity.setDundajHuvi(String.valueOf(pairs.getValue()));
  1126. } else if (pairs.getKey().equals(entity.TUGALHUVI)) {
  1127. entity.setTugalHuvi(String.valueOf(pairs.getValue()));
  1128. } else if (pairs.getKey().equals(entity.BUSADHUVI)) {
  1129. entity.setBusadHuvi(String.valueOf(pairs.getValue()));
  1130. } else if (pairs.getKey().toString().equalsIgnoreCase("command")) {
  1131. command = String.valueOf(pairs.getValue());
  1132. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  1133. String dv = String.valueOf(pairs.getValue());
  1134. if (!dv.isEmpty() && dv.length() >= 8) {
  1135. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  1136. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  1137. entity.setRecordDate(sqlDate);
  1138. }
  1139. }
  1140. } catch (NullPointerException ex) {
  1141. ex.printStackTrace();
  1142. } catch (Exception ex) {
  1143. ex.printStackTrace();
  1144. }
  1145. }//end while
  1146. if (command.equalsIgnoreCase("INS")) {
  1147. entity.setDelflg("N");
  1148. entity.setActflg("Y");
  1149. if (user != null && (user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  1150. || user.getRoleCode().equalsIgnoreCase("ADMIN"))) {
  1151. //Aimag songoh shaardlagagui
  1152. } else {
  1153. entity.setAimag(user.getCity());
  1154. }
  1155. //entity.setSum(user.getSum());
  1156. entity.setCreby(user.getUsername());
  1157. Date utilDate = new Date();
  1158. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  1159. entity.setCreat(sqlDate);
  1160. if (entity.getRecordDate() == null) entity.setCreat(sqlDate);
  1161. errorEntity = form46Service.insertNewData(entity);
  1162. } else if (command.equalsIgnoreCase("EDT") ||
  1163. command.equalsIgnoreCase("DEL") ||
  1164. command.equalsIgnoreCase("ACT")) {
  1165. if (command.equalsIgnoreCase("DEL")) {
  1166. entity.setDelflg("Y");
  1167. } else if (command.equalsIgnoreCase("ACT")) {
  1168. entity.setActflg("N");
  1169. }
  1170. errorEntity = form46Service.updateData(entity);
  1171. }
  1172. } catch (Exception ex) {
  1173. ex.printStackTrace();
  1174. } finally {
  1175. }
  1176. return errorEntity;
  1177. }
  1178. //Begin-form43
  1179. @Override
  1180. public List<Form43Entity> getForm43Data(LinkedTreeMap criteria, String sessionId) throws Exception {
  1181. System.out.println("Hospital Service Implament ::: get form 43 data");
  1182. try {
  1183. IForm43Service form43Service = new Form43ServiceImpl(super.conn);
  1184. User user = sessionUser.get(sessionId);
  1185. Form43Entity form43Entity = new Form43Entity();
  1186. Iterator it = criteria.entrySet().iterator();
  1187. while (it.hasNext()) {
  1188. Map.Entry pairs = (Map.Entry) it.next();
  1189. try {
  1190. if (pairs.getKey().equals(form43Entity.ID)) {
  1191. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  1192. form43Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  1193. } else if (pairs.getKey().equals(form43Entity.AIMAG)) {
  1194. form43Entity.setAimag(String.valueOf(pairs.getValue()));
  1195. } else if (pairs.getKey().equals(form43Entity.SUM)) {
  1196. form43Entity.setSum(String.valueOf(pairs.getValue()));
  1197. } else if (pairs.getKey().equals(form43Entity.AJAHUINNEGJ)) {
  1198. form43Entity.setAjahuinNegj(String.valueOf(pairs.getValue()));
  1199. } else {
  1200. if (pairs.getKey().equals(form43Entity.TUSGAIZOVSHOOROL)) {
  1201. String dv = String.valueOf(pairs.getValue());
  1202. try {
  1203. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  1204. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  1205. form43Entity.setTusgaiZovshoorol(sqlDate);
  1206. } catch (Exception ex) {
  1207. DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
  1208. Date now = new Date();
  1209. form43Entity.setTusgaiZovshoorol(new java.sql.Date(now.getTime()));
  1210. }
  1211. } else if (pairs.getKey().equals(form43Entity.EMBELDMELNER)) {
  1212. form43Entity.setEmBeldmelNer(String.valueOf(pairs.getValue()));
  1213. } else if (pairs.getKey().equals(form43Entity.HEMJIHNEGJ)) {
  1214. form43Entity.setHemjihNegj(String.valueOf(pairs.getValue()));
  1215. } else if (pairs.getKey().equals(form43Entity.PARMAKOP)) {
  1216. try {
  1217. form43Entity.setParmakop(Long.parseLong(String.valueOf(pairs.getValue())));
  1218. } catch (Exception e) {
  1219. form43Entity.setParmakop(Long.parseLong(String.valueOf("0")));
  1220. }
  1221. } else if (pairs.getKey().equals(form43Entity.UILDVERLESENTOO)) {
  1222. try {
  1223. form43Entity.setUildverlesenToo(Long.valueOf(pairs.getValue().toString()));
  1224. } catch (NumberFormatException e) {
  1225. form43Entity.setUildverlesenToo(Long.valueOf("0"));
  1226. }
  1227. } else if (pairs.getKey().equals(form43Entity.NEGJUNE)) {
  1228. try {
  1229. form43Entity.setNegjUne(String.valueOf(pairs.getValue()));
  1230. } catch (NumberFormatException e) {
  1231. form43Entity.setNegjUne(String.valueOf("0"));
  1232. }
  1233. } else if (pairs.getKey().equals(form43Entity.NIITUNE)) {
  1234. try {
  1235. form43Entity.setNiitUne(String.valueOf(pairs.getValue()));
  1236. } catch (NullPointerException e) {
  1237. form43Entity.setNiitUne(String.valueOf("0"));
  1238. }
  1239. } else if (pairs.getKey().equals(form43Entity.RECORD_DATE)) {
  1240. String dv = String.valueOf(pairs.getValue());
  1241. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  1242. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  1243. form43Entity.setRecordDate(sqlDate);
  1244. } else if (pairs.getKey().equals(form43Entity.SEARCH_RECORD_DATE)) {
  1245. String dv = String.valueOf(pairs.getValue());
  1246. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  1247. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  1248. form43Entity.setSearchRecordDate(sqlDate);
  1249. }
  1250. }
  1251. } catch (NullPointerException ex) {
  1252. ex.printStackTrace();
  1253. } catch (Exception ex) {
  1254. ex.printStackTrace();
  1255. }
  1256. }//end while
  1257. return form43Service.getListData(form43Entity);
  1258. } catch (Exception ex) {
  1259. ex.printStackTrace();
  1260. } finally {
  1261. }
  1262. return null;
  1263. }
  1264. @Override
  1265. public ErrorEntity setForm43Data(LinkedTreeMap criteria, String sessionId) throws Exception {
  1266. System.out.println("Hospital Service Implament ::: get form 43 data");
  1267. try {
  1268. String command = "EDT";
  1269. IForm43Service form43Service = new Form43ServiceImpl(super.conn);
  1270. User user = sessionUser.get(sessionId);
  1271. Form43Entity form43Entity = new Form43Entity();
  1272. Iterator it = criteria.entrySet().iterator();
  1273. while (it.hasNext()) {
  1274. Map.Entry pairs = (Map.Entry) it.next();
  1275. try {
  1276. if (pairs.getKey().equals(form43Entity.ID)) {
  1277. String tmpId = "";
  1278. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
  1279. if (pairs.getValue().toString().contains(".")) {
  1280. tmpId = pairs.getValue().toString().substring(0, pairs.getValue().toString().indexOf("."));
  1281. }
  1282. form43Entity.setId(Long.parseLong(String.valueOf(tmpId)));
  1283. }
  1284. } else if (pairs.getKey().equals(form43Entity.AJAHUINNEGJ)) {
  1285. form43Entity.setAjahuinNegj(String.valueOf(pairs.getValue()));
  1286. } else if (pairs.getKey().equals(form43Entity.TUSGAIZOVSHOOROL)) {
  1287. String dv = String.valueOf(pairs.getValue());
  1288. if (!dv.isEmpty() && dv.length() >= 8) {
  1289. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  1290. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  1291. form43Entity.setTusgaiZovshoorol(sqlDate);
  1292. }
  1293. } else if (pairs.getKey().equals(form43Entity.EMBELDMELNER)) {
  1294. form43Entity.setEmBeldmelNer(String.valueOf(pairs.getValue()));
  1295. } else if (pairs.getKey().equals(form43Entity.HEMJIHNEGJ)) {
  1296. form43Entity.setHemjihNegj(String.valueOf(pairs.getValue()));
  1297. } else if (pairs.getKey().equals(form43Entity.PARMAKOP)) {
  1298. try {
  1299. form43Entity.setParmakop(Long.parseLong(String.valueOf(pairs.getValue())));
  1300. } catch (Exception e) {
  1301. form43Entity.setParmakop(Long.parseLong(String.valueOf("0")));
  1302. }
  1303. } else if (pairs.getKey().equals(form43Entity.UILDVERLESENTOO)) {
  1304. try {
  1305. form43Entity.setUildverlesenToo(Long.valueOf(pairs.getValue().toString()));
  1306. } catch (NumberFormatException e) {
  1307. form43Entity.setUildverlesenToo(Long.valueOf("0"));
  1308. }
  1309. } else if (pairs.getKey().equals(form43Entity.NEGJUNE)) {
  1310. try {
  1311. form43Entity.setNegjUne(String.valueOf(pairs.getValue()));
  1312. } catch (NumberFormatException e) {
  1313. form43Entity.setNegjUne(String.valueOf("0"));
  1314. }
  1315. } else if (pairs.getKey().equals(form43Entity.NIITUNE)) {
  1316. try {
  1317. form43Entity.setNiitUne(String.valueOf(pairs.getValue()));
  1318. } catch (NullPointerException e) {
  1319. form43Entity.setNiitUne(String.valueOf("0"));
  1320. }
  1321. } else if (pairs.getKey().equals(form43Entity.RECORD_DATE)) {
  1322. String dv = String.valueOf(pairs.getValue());
  1323. if (!dv.isEmpty() && dv.length() >= 8) {
  1324. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  1325. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  1326. form43Entity.setRecordDate(sqlDate);
  1327. }
  1328. } else if (pairs.getKey().toString().equalsIgnoreCase("command")) {
  1329. command = String.valueOf(pairs.getValue());
  1330. }
  1331. } catch (NullPointerException ex) {
  1332. ex.printStackTrace();
  1333. } catch (Exception ex) {
  1334. ex.printStackTrace();
  1335. }
  1336. }//end while
  1337. Date utilDate = new Date();
  1338. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  1339. form43Entity.setModby(user.getUsername());
  1340. form43Entity.setModAt(sqlDate);
  1341. if (command.equalsIgnoreCase("INS")) {
  1342. form43Entity.setDelflg("N");
  1343. form43Entity.setActflg("Y");
  1344. form43Entity.setAimag(user.getCity());
  1345. form43Entity.setSum(user.getSum());
  1346. form43Entity.setCreby(user.getUsername());
  1347. form43Entity.setCreat(sqlDate);
  1348. if (form43Entity.getRecordDate() == null) form43Entity.setCreat(sqlDate);
  1349. errorEntity = form43Service.insertNewData(form43Entity);
  1350. } else if (command.equalsIgnoreCase("EDT") ||
  1351. command.equalsIgnoreCase("DEL") ||
  1352. command.equalsIgnoreCase("ACT")) {
  1353. if (command.equalsIgnoreCase("DEL")) {
  1354. form43Entity.setDelflg("Y");
  1355. } else if (command.equalsIgnoreCase("ACT")) {
  1356. form43Entity.setActflg("N");
  1357. }
  1358. errorEntity = form43Service.updateData(form43Entity);
  1359. }
  1360. } catch (Exception ex) {
  1361. ex.printStackTrace();
  1362. } finally {
  1363. }
  1364. return errorEntity;
  1365. }
  1366. //end-form43
  1367. //Begin City Form
  1368. @Override
  1369. public List<City> getCityData(LinkedTreeMap criteria, String sessionId) throws Exception {
  1370. System.out.println("Hospital Service ::: get city data");
  1371. try {
  1372. ICityService cityService = new CityServiceImpl(super.conn);
  1373. User user = sessionUser.get(sessionId);
  1374. City city = new City();
  1375. Iterator it = criteria.entrySet().iterator();
  1376. while (it.hasNext()) {
  1377. Map.Entry pairs = (Map.Entry) it.next();
  1378. try {
  1379. if (pairs.getKey().equals(city.ID)) {
  1380. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  1381. city.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  1382. } else if (pairs.getKey().equals(city.CODE)) {
  1383. city.setCode(String.valueOf(pairs.getValue()));
  1384. } else if (pairs.getKey().equals(city.COUNTRYCODE)) {
  1385. city.setCountrycode(String.valueOf(pairs.getValue()));
  1386. } else if (pairs.getKey().equals(city.CITYNAME)) {
  1387. city.setCityname(String.valueOf(pairs.getValue()));
  1388. } else if (pairs.getKey().equals(city.CITYDESC)) {
  1389. city.setCitydesc(String.valueOf(pairs.getValue()));
  1390. } else if (pairs.getKey().equals(city.CITYNAME_EN)) {
  1391. city.setCitynameEn(String.valueOf(pairs.getValue()));
  1392. } else if (pairs.getKey().equals(city.DELFLG)) {
  1393. city.setDelflg(String.valueOf(pairs.getValue()));
  1394. } else if (pairs.getKey().equals(city.ACTFLG)) {
  1395. city.setActflg(String.valueOf(pairs.getValue()));
  1396. }
  1397. } catch (NullPointerException ex) {
  1398. ex.printStackTrace();
  1399. } catch (Exception ex) {
  1400. ex.printStackTrace();
  1401. }
  1402. }//end while
  1403. city.setDelflg("N");
  1404. return cityService.selectAll(city);
  1405. } catch (Exception ex) {
  1406. ex.printStackTrace();
  1407. } finally {
  1408. }
  1409. return null;
  1410. }
  1411. @Override
  1412. public ErrorEntity setCityData(LinkedTreeMap insdata, String sessionId) throws Exception {
  1413. System.out.println("Hospital Service Implament ::: set city data");
  1414. try {
  1415. String command = "EDT";
  1416. ICityService cityService = new CityServiceImpl(super.conn);
  1417. User user = sessionUser.get(sessionId);
  1418. City city = new City();
  1419. Iterator it = insdata.entrySet().iterator();
  1420. while (it.hasNext()) {
  1421. Map.Entry pairs = (Map.Entry) it.next();
  1422. try {
  1423. if (pairs.getKey().equals(city.ID)) {
  1424. String tmpId = "";
  1425. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
  1426. if (pairs.getValue().toString().contains(".")) {
  1427. tmpId = pairs.getValue().toString().substring(0, pairs.getValue().toString().indexOf("."));
  1428. }
  1429. city.setId(Long.parseLong(String.valueOf(tmpId)));
  1430. }
  1431. } else if (pairs.getKey().equals(city.CODE)) {
  1432. city.setCode(String.valueOf(pairs.getValue()));
  1433. } else if (pairs.getKey().equals(city.COUNTRYCODE)) {
  1434. city.setCountrycode(String.valueOf(pairs.getValue()));
  1435. } else if (pairs.getKey().equals(city.CITYNAME)) {
  1436. city.setCityname(String.valueOf(pairs.getValue()));
  1437. } else if (pairs.getKey().equals(city.CITYDESC)) {
  1438. city.setCitydesc(String.valueOf(pairs.getValue()));
  1439. } else if (pairs.getKey().equals(city.CITYNAME_EN)) {
  1440. city.setCitynameEn(String.valueOf(pairs.getValue()));
  1441. } else if (pairs.getKey().equals(city.DELFLG)) {
  1442. city.setDelflg(String.valueOf(pairs.getValue()));
  1443. } else if (pairs.getKey().equals(city.ACTFLG)) {
  1444. city.setActflg(String.valueOf(pairs.getValue()));
  1445. } else if (pairs.getKey().equals(city.LATITUDE)) {
  1446. city.setLatitude(String.valueOf(pairs.getValue()));
  1447. } else if (pairs.getKey().equals(city.LONGITUDE)) {
  1448. city.setLongitude(String.valueOf(pairs.getValue()));
  1449. } else if (pairs.getKey().toString().equalsIgnoreCase("command")) {
  1450. command = String.valueOf(pairs.getValue());
  1451. }
  1452. } catch (NullPointerException ex) {
  1453. ex.printStackTrace();
  1454. } catch (Exception ex) {
  1455. ex.printStackTrace();
  1456. }
  1457. }//end while
  1458. if (command.equalsIgnoreCase("INS")) {
  1459. city.setDelflg("N");
  1460. city.setActflg("Y");
  1461. city.setCountrycode("UB");
  1462. city.setCreby(user.getUsername());
  1463. Date utilDate = new Date();
  1464. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  1465. city.setCreat(sqlDate);
  1466. errorEntity = cityService.insertData(city);
  1467. } else if (command.equalsIgnoreCase("EDT") ||
  1468. command.equalsIgnoreCase("DEL") ||
  1469. command.equalsIgnoreCase("ACT")) {
  1470. city.setModby(user.getUsername());
  1471. Date utilDate = new Date();
  1472. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  1473. city.setModAt(sqlDate);
  1474. if (command.equalsIgnoreCase("DEL")) {
  1475. city.setDelflg("Y");
  1476. }
  1477. errorEntity = cityService.updateData(city);
  1478. }
  1479. } catch (Exception ex) {
  1480. ex.printStackTrace();
  1481. } finally {
  1482. if (errorEntity == null) {
  1483. errorEntity = new ErrorEntity(ErrorType.ERROR, Long.valueOf(1000));
  1484. }
  1485. }
  1486. return errorEntity;
  1487. }
  1488. //End City Form
  1489. //Begin Sum Form
  1490. @Override
  1491. public List<Sum> getSumData(LinkedTreeMap criteria, String sessionId) throws Exception {
  1492. System.out.println("Hospital Service ::: get sum data");
  1493. try {
  1494. ISumService sumService = new SumServiceImpl(super.conn);
  1495. User user = sessionUser.get(sessionId);
  1496. Sum sum = new Sum();
  1497. Iterator it = criteria.entrySet().iterator();
  1498. while (it.hasNext()) {
  1499. Map.Entry pairs = (Map.Entry) it.next();
  1500. try {
  1501. if (pairs.getKey().equals(sum.ID)) {
  1502. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  1503. sum.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  1504. } else if (pairs.getKey().equals(sum.SUMCODE)) {
  1505. sum.setSumcode(String.valueOf(pairs.getValue()));
  1506. } else if (pairs.getKey().equals(sum.CITYCODE)) {
  1507. sum.setCitycode(String.valueOf(pairs.getValue()));
  1508. } else if (pairs.getKey().equals(sum.SUMNAME)) {
  1509. sum.setSumname(String.valueOf(pairs.getValue()));
  1510. } else if (pairs.getKey().equals(sum.SUMDESC)) {
  1511. sum.setSumdesc(String.valueOf(pairs.getValue()));
  1512. } else if (pairs.getKey().equals(sum.SUMNAME_EN)) {
  1513. sum.setSumname_en(String.valueOf(pairs.getValue()));
  1514. } else if (pairs.getKey().equals(sum.DELFLG)) {
  1515. sum.setDelFlg(String.valueOf(pairs.getValue()));
  1516. } else if (pairs.getKey().equals(sum.ACTFLG)) {
  1517. sum.setActFlg(String.valueOf(pairs.getValue()));
  1518. }
  1519. } catch (NullPointerException ex) {
  1520. ex.printStackTrace();
  1521. } catch (Exception ex) {
  1522. ex.printStackTrace();
  1523. }
  1524. }//end while
  1525. if (sum.getCitycode() != null && sum.getCitycode().equalsIgnoreCase("CURRENT")) {
  1526. sum.setCitycode(user.getCity());
  1527. }
  1528. sum.setDelFlg("N");
  1529. return sumService.selectAll(sum);
  1530. } catch (Exception ex) {
  1531. ex.printStackTrace();
  1532. } finally {
  1533. }
  1534. return null;
  1535. }
  1536. @Override
  1537. public ErrorEntity setSumData(LinkedTreeMap insdata, String sessionId) throws Exception {
  1538. System.out.println("Hospital Service Implament ::: set sum data");
  1539. try {
  1540. String command = "EDT";
  1541. ISumService sumService = new SumServiceImpl(super.conn);
  1542. User user = sessionUser.get(sessionId);
  1543. Sum sum = new Sum();
  1544. Iterator it = insdata.entrySet().iterator();
  1545. while (it.hasNext()) {
  1546. Map.Entry pairs = (Map.Entry) it.next();
  1547. try {
  1548. if (pairs.getKey().equals(sum.ID)) {
  1549. String tmpId = "";
  1550. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
  1551. if (pairs.getValue().toString().contains(".")) {
  1552. tmpId = pairs.getValue().toString().substring(0, pairs.getValue().toString().indexOf("."));
  1553. }
  1554. sum.setId(Long.parseLong(String.valueOf(tmpId)));
  1555. }
  1556. } else if (pairs.getKey().equals(sum.SUMCODE)) {
  1557. sum.setSumcode(String.valueOf(pairs.getValue()));
  1558. } else if (pairs.getKey().equals(sum.CITYCODE)) {
  1559. sum.setCitycode(String.valueOf(pairs.getValue()));
  1560. } else if (pairs.getKey().equals(sum.SUMNAME)) {
  1561. sum.setSumname(String.valueOf(pairs.getValue()));
  1562. } else if (pairs.getKey().equals(sum.SUMDESC)) {
  1563. sum.setSumdesc(String.valueOf(pairs.getValue()));
  1564. } else if (pairs.getKey().equals(sum.SUMNAME_EN)) {
  1565. sum.setSumname_en(String.valueOf(pairs.getValue()));
  1566. } else if (pairs.getKey().equals(sum.DELFLG)) {
  1567. sum.setDelFlg(String.valueOf(pairs.getValue()));
  1568. } else if (pairs.getKey().equals(sum.ACTFLG)) {
  1569. sum.setActFlg(String.valueOf(pairs.getValue()));
  1570. } else if (pairs.getKey().equals(sum.LATITUDE)) {
  1571. sum.setLatitude(String.valueOf(pairs.getValue()));
  1572. } else if (pairs.getKey().equals(sum.LONGITUDE)) {
  1573. sum.setLongitude(String.valueOf(pairs.getValue()));
  1574. } else if (pairs.getKey().toString().equalsIgnoreCase("command")) {
  1575. command = String.valueOf(pairs.getValue());
  1576. }
  1577. } catch (NullPointerException ex) {
  1578. ex.printStackTrace();
  1579. } catch (Exception ex) {
  1580. ex.printStackTrace();
  1581. }
  1582. }//end while
  1583. if (command.equalsIgnoreCase("INS")) {
  1584. sum.setDelFlg("N");
  1585. sum.setActFlg("Y");
  1586. sum.setCreBy(user.getUsername());
  1587. Date utilDate = new Date();
  1588. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  1589. sum.setCreAt(sqlDate);
  1590. sum.setModBy(user.getUsername());
  1591. sum.setModAt(sqlDate);
  1592. errorEntity = sumService.insertData(sum);
  1593. } else if (command.equalsIgnoreCase("EDT") ||
  1594. command.equalsIgnoreCase("DEL") ||
  1595. command.equalsIgnoreCase("ACT")) {
  1596. sum.setModBy(user.getUsername());
  1597. Date utilDate = new Date();
  1598. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  1599. sum.setModAt(sqlDate);
  1600. if (command.equalsIgnoreCase("DEL")) {
  1601. sum.setDelFlg("Y");
  1602. }
  1603. errorEntity = sumService.updateData(sum);
  1604. }
  1605. } catch (Exception ex) {
  1606. ex.printStackTrace();
  1607. } finally {
  1608. if (errorEntity == null) {
  1609. errorEntity = new ErrorEntity(ErrorType.ERROR, Long.valueOf(1000));
  1610. }
  1611. }
  1612. return errorEntity;
  1613. }
  1614. //End Sum form
  1615. //Begin User form
  1616. @Override
  1617. public List<User> getUserData(LinkedTreeMap criteria, String sessionId) throws Exception {
  1618. System.out.println("Hospital Service ::: get user data");
  1619. try {
  1620. IUserService userService = new UserServiceImpl(super.conn);
  1621. User user = sessionUser.get(sessionId);
  1622. User seluser = new User();
  1623. Iterator it = criteria.entrySet().iterator();
  1624. while (it.hasNext()) {
  1625. Map.Entry pairs = (Map.Entry) it.next();
  1626. try {
  1627. if (pairs.getKey().equals(seluser.ID)) {
  1628. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  1629. seluser.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  1630. } else if (pairs.getKey().equals(seluser.USERNAME)) {
  1631. seluser.setUsername(String.valueOf(pairs.getValue()));
  1632. } else if (pairs.getKey().equals(seluser.ROLECODE)) {
  1633. seluser.setRoleCode(String.valueOf(pairs.getValue()));
  1634. } else if (pairs.getKey().equals(seluser.FIRSTNAME)) {
  1635. seluser.setFirstName(String.valueOf(pairs.getValue()));
  1636. } else if (pairs.getKey().equals(seluser.LASTNAME)) {
  1637. seluser.setLastName(String.valueOf(pairs.getValue()));
  1638. } else if (pairs.getKey().equals(seluser.GENDER)) {
  1639. seluser.setGender(String.valueOf(pairs.getValue()));
  1640. } else if (pairs.getKey().equals(seluser.REGID)) {
  1641. seluser.setRegId(String.valueOf(pairs.getValue()));
  1642. } else if (pairs.getKey().equals(seluser.CITY)) {
  1643. seluser.setCity(String.valueOf(pairs.getValue()));
  1644. } else if (pairs.getKey().equals(seluser.SUM)) {
  1645. seluser.setSum(String.valueOf(pairs.getValue()));
  1646. } else if (pairs.getKey().equals(seluser.CREBY)) {
  1647. seluser.setCreBy(String.valueOf(pairs.getValue()));
  1648. } else if (pairs.getKey().equals(seluser.MODBY)) {
  1649. seluser.setModBy(String.valueOf(pairs.getValue()));
  1650. } else if (pairs.getKey().equals(seluser.DELFLG)) {
  1651. seluser.setDelFlg(String.valueOf(pairs.getValue()));
  1652. } else if (pairs.getKey().equals(seluser.ACTFLG)) {
  1653. seluser.setActFlg(String.valueOf(pairs.getValue()));
  1654. } else if (pairs.getKey().equals(seluser.CHAT_ID)) {
  1655. seluser.setChatId(String.valueOf(pairs.getValue()));
  1656. }
  1657. } catch (NullPointerException ex) {
  1658. ex.printStackTrace();
  1659. } catch (Exception ex) {
  1660. ex.printStackTrace();
  1661. }
  1662. }//end while
  1663. seluser.setDelFlg("N");
  1664. return userService.getUserList(seluser);
  1665. } catch (Exception ex) {
  1666. ex.printStackTrace();
  1667. } finally {
  1668. }
  1669. return null;
  1670. }
  1671. @Override
  1672. public ErrorEntity setUserData(LinkedTreeMap insdata, String sessionId) throws Exception {
  1673. System.out.println("Hospital Service ::: set user data");
  1674. try {
  1675. String command = "EDT";
  1676. IUserService userService = new UserServiceImpl(super.conn);
  1677. User user = sessionUser.get(sessionId);
  1678. User seluser = new User();
  1679. Iterator it = insdata.entrySet().iterator();
  1680. while (it.hasNext()) {
  1681. Map.Entry pairs = (Map.Entry) it.next();
  1682. try {
  1683. if (pairs.getKey().equals(seluser.ID)) {
  1684. String tmpId = "";
  1685. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
  1686. if (pairs.getValue().toString().contains(".")) {
  1687. tmpId = pairs.getValue().toString().substring(0, pairs.getValue().toString().indexOf("."));
  1688. }
  1689. seluser.setId(Long.parseLong(String.valueOf(tmpId)));
  1690. }
  1691. } else if (pairs.getKey().equals(seluser.USERNAME)) {
  1692. seluser.setUsername(String.valueOf(pairs.getValue()));
  1693. } else if (pairs.getKey().equals(seluser.ROLECODE)) {
  1694. seluser.setRoleCode(String.valueOf(pairs.getValue()));
  1695. } else if (pairs.getKey().equals(seluser.FIRSTNAME)) {
  1696. seluser.setFirstName(String.valueOf(pairs.getValue()));
  1697. } else if (pairs.getKey().equals(seluser.LASTNAME)) {
  1698. seluser.setLastName(String.valueOf(pairs.getValue()));
  1699. } else if (pairs.getKey().equals(seluser.GENDER)) {
  1700. seluser.setGender(String.valueOf(pairs.getValue()));
  1701. } else if (pairs.getKey().equals(seluser.REGID)) {
  1702. seluser.setRegId(String.valueOf(pairs.getValue()));
  1703. } else if (pairs.getKey().equals(seluser.CITY)) {
  1704. seluser.setCity(String.valueOf(pairs.getValue()));
  1705. } else if (pairs.getKey().equals(seluser.SUM)) {
  1706. seluser.setSum(String.valueOf(pairs.getValue()));
  1707. } else if (pairs.getKey().equals(seluser.CREBY)) {
  1708. seluser.setCreBy(String.valueOf(pairs.getValue()));
  1709. } else if (pairs.getKey().equals(seluser.MODBY)) {
  1710. seluser.setModBy(String.valueOf(pairs.getValue()));
  1711. } else if (pairs.getKey().equals(seluser.DELFLG)) {
  1712. seluser.setDelFlg(String.valueOf(pairs.getValue()));
  1713. } else if (pairs.getKey().equals(seluser.ACTFLG)) {
  1714. seluser.setActFlg(String.valueOf(pairs.getValue()));
  1715. } else if (pairs.getKey().equals(seluser.PASSWORD)) {
  1716. seluser.setPassword(String.valueOf(pairs.getValue()));
  1717. } else if (pairs.getKey().toString().equalsIgnoreCase("command")) {
  1718. command = String.valueOf(pairs.getValue());
  1719. }
  1720. } catch (NullPointerException ex) {
  1721. ex.printStackTrace();
  1722. } catch (Exception ex) {
  1723. ex.printStackTrace();
  1724. }
  1725. }//end while
  1726. seluser.setModBy(user.getUsername());
  1727. Date utilDate = new Date();
  1728. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  1729. seluser.setModAt(sqlDate);
  1730. if (command.equalsIgnoreCase("INS")) {
  1731. seluser.setDelFlg("N");
  1732. seluser.setActFlg("Y");
  1733. seluser.setCreBy(user.getUsername());
  1734. seluser.setCreAt(sqlDate);
  1735. String chatid = new ObjectId().toString();
  1736. seluser.setChatId(chatid);
  1737. errorEntity = userService.insertUser(seluser);
  1738. } else if (command.equalsIgnoreCase("EDT") ||
  1739. command.equalsIgnoreCase("DEL")) {
  1740. if (command.equalsIgnoreCase("DEL")) {
  1741. seluser.setDelFlg("Y");
  1742. }
  1743. errorEntity = userService.updateUserData(seluser);
  1744. }
  1745. } catch (Exception ex) {
  1746. ex.printStackTrace();
  1747. } finally {
  1748. if (errorEntity == null) {
  1749. errorEntity = new ErrorEntity(ErrorType.ERROR, Long.valueOf(1000));
  1750. }
  1751. }
  1752. return errorEntity;
  1753. }
  1754. //End User form
  1755. //Begin Bag Horoo form
  1756. @Override
  1757. public List<BagHorooEntity> getBagHorooData(LinkedTreeMap criteria, String sessionId) throws Exception {
  1758. System.out.println("Hospital Service ::: get bag horoo data");
  1759. try {
  1760. IBagHorooService bagService = new BagHorooServiceImpl(super.conn);
  1761. User user = sessionUser.get(sessionId);
  1762. BagHorooEntity bagHorooEntity = new BagHorooEntity();
  1763. Iterator it = criteria.entrySet().iterator();
  1764. while (it.hasNext()) {
  1765. Map.Entry pairs = (Map.Entry) it.next();
  1766. try {
  1767. if (pairs.getKey().equals(bagHorooEntity.ID)) {
  1768. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  1769. bagHorooEntity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  1770. } else if (pairs.getKey().equals(bagHorooEntity.SUM_CODE)) {
  1771. bagHorooEntity.setSumcode(String.valueOf(pairs.getValue()));
  1772. } else if (pairs.getKey().equals(bagHorooEntity.HOROO_CODE)) {
  1773. bagHorooEntity.setHoroocode(String.valueOf(pairs.getValue()));
  1774. } else if (pairs.getKey().equals(bagHorooEntity.HOROO_NAME)) {
  1775. bagHorooEntity.setHorooname(String.valueOf(pairs.getValue()));
  1776. } else if (pairs.getKey().equals(bagHorooEntity.HOROO_DESC)) {
  1777. bagHorooEntity.setHoroodesc(String.valueOf(pairs.getValue()));
  1778. } else if (pairs.getKey().equals(bagHorooEntity.HOROO_NAME_EN)) {
  1779. bagHorooEntity.setHorooname_en(String.valueOf(pairs.getValue()));
  1780. } else if (pairs.getKey().equals(bagHorooEntity.DELFLG)) {
  1781. bagHorooEntity.setDelflg(String.valueOf(pairs.getValue()));
  1782. } else if (pairs.getKey().equals(bagHorooEntity.ACTFLG)) {
  1783. bagHorooEntity.setActflg(String.valueOf(pairs.getValue()));
  1784. }
  1785. } catch (NullPointerException ex) {
  1786. ex.printStackTrace();
  1787. } catch (Exception ex) {
  1788. ex.printStackTrace();
  1789. }
  1790. }//end while
  1791. bagHorooEntity.setDelflg("N");
  1792. return bagService.selectAll(bagHorooEntity);
  1793. } catch (Exception ex) {
  1794. ex.printStackTrace();
  1795. } finally {
  1796. }
  1797. return null;
  1798. }
  1799. //End bag horoo form
  1800. @Override
  1801. public List<BasicDBObject> getComboVals(String type, String langid, String sessionId) throws Exception {
  1802. IComboService comboService = new ComboServiceImpl(conn);
  1803. return comboService.getComboVals(type, langid);
  1804. }
  1805. //End bag horoo form
  1806. @Override
  1807. public List<BasicDBObject> getShalgahGazarVals(String type, String langid, String sessionId) throws Exception {
  1808. IComboService comboService = new ComboServiceImpl(conn);
  1809. return comboService.getShalgahGazarVals(type, langid);
  1810. }
  1811. @Override
  1812. public List<MenuEntity> getMenuList(LinkedTreeMap criteria, String sessionId) throws Exception {
  1813. System.out.println("Hospital Service ::: get menu list data");
  1814. try {
  1815. IMenuService service = new MenuServiceImpl(super.conn);
  1816. User user = sessionUser.get(sessionId);
  1817. MenuEntity entity = new MenuEntity();
  1818. Iterator it = criteria.entrySet().iterator();
  1819. while (it.hasNext()) {
  1820. Map.Entry pairs = (Map.Entry) it.next();
  1821. try {
  1822. if (pairs.getKey().equals(entity.ID)) {
  1823. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  1824. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  1825. } else if (pairs.getKey().equals(entity.MENUID)) {
  1826. entity.setMenuid(String.valueOf(pairs.getValue()));
  1827. } else if (pairs.getKey().equals(entity.MENUNAMEMN)) {
  1828. entity.setMenunamemn(String.valueOf(pairs.getValue()));
  1829. } else if (pairs.getKey().equals(entity.MENUNAMEEN)) {
  1830. entity.setMenunameen(String.valueOf(pairs.getValue()));
  1831. } else if (pairs.getKey().equals(entity.MENUDESC)) {
  1832. entity.setMenudesc(String.valueOf(pairs.getValue()));
  1833. }
  1834. } catch (NullPointerException ex) {
  1835. ex.printStackTrace();
  1836. } catch (Exception ex) {
  1837. ex.printStackTrace();
  1838. }
  1839. }//end while
  1840. entity.setDelflg("N");
  1841. entity.setActflg("Y");
  1842. return service.selectAll(entity);
  1843. } catch (Exception ex) {
  1844. ex.printStackTrace();
  1845. } finally {
  1846. }
  1847. return null;
  1848. }
  1849. @Override
  1850. public List<Role> getRoleList(LinkedTreeMap criteria, String sessionId) throws Exception {
  1851. System.out.println("Hospital Service ::: get role list data");
  1852. try {
  1853. IRoleService service = new RoleServiceImpl(super.conn);
  1854. User user = sessionUser.get(sessionId);
  1855. Role entity = new Role();
  1856. Iterator it = criteria.entrySet().iterator();
  1857. while (it.hasNext()) {
  1858. Map.Entry pairs = (Map.Entry) it.next();
  1859. try {
  1860. if (pairs.getKey().equals(entity.ID)) {
  1861. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  1862. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  1863. } else if (pairs.getKey().equals(entity.CODE)) {
  1864. entity.setCode(String.valueOf(pairs.getValue()));
  1865. } else if (pairs.getKey().equals(entity.NAME)) {
  1866. entity.setName(String.valueOf(pairs.getValue()));
  1867. } else if (pairs.getKey().equals(entity.PARENT)) {
  1868. entity.setParent(String.valueOf(pairs.getValue()));
  1869. } else if (pairs.getKey().equals(entity.DESC)) {
  1870. entity.setDesc(String.valueOf(pairs.getValue()));
  1871. }
  1872. } catch (NullPointerException ex) {
  1873. ex.printStackTrace();
  1874. } catch (Exception ex) {
  1875. ex.printStackTrace();
  1876. }
  1877. }//end while
  1878. return service.selectAll(entity);
  1879. } catch (Exception ex) {
  1880. ex.printStackTrace();
  1881. } finally {
  1882. }
  1883. return null;
  1884. }
  1885. @Override
  1886. public ErrorEntity setMenuRole(LinkedTreeMap insdata, String sessionId) throws Exception {
  1887. System.out.println("Hospital Service ::: register role menu data");
  1888. try {
  1889. String command = "EDT";
  1890. IMenuRolesService service = new MenuRolesServiceImpl(super.conn);
  1891. User user = sessionUser.get(sessionId);
  1892. MenuRoles menuRoles = new MenuRoles();
  1893. Iterator it = insdata.entrySet().iterator();
  1894. List<LinkedTreeMap> menuList = null;
  1895. while (it.hasNext()) {
  1896. Map.Entry pairs = (Map.Entry) it.next();
  1897. try {
  1898. if (pairs.getKey().equals(menuRoles.ID)) {
  1899. String tmpId = "";
  1900. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
  1901. if (pairs.getValue().toString().contains(".")) {
  1902. tmpId = pairs.getValue().toString().substring(0, pairs.getValue().toString().indexOf("."));
  1903. }
  1904. menuRoles.setId(Long.parseLong(String.valueOf(tmpId)));
  1905. }
  1906. } else if (pairs.getKey().equals(menuRoles.ROLECODE)) {
  1907. menuRoles.setRolecode(String.valueOf(pairs.getValue()));
  1908. } else if (pairs.getKey().equals("menulist")) {
  1909. menuList = (List<LinkedTreeMap>) pairs.getValue();
  1910. } else if (pairs.getKey().toString().equalsIgnoreCase("command")) {
  1911. command = String.valueOf(pairs.getValue());
  1912. }
  1913. } catch (NullPointerException ex) {
  1914. ex.printStackTrace();
  1915. } catch (Exception ex) {
  1916. ex.printStackTrace();
  1917. }
  1918. }//end while
  1919. menuRoles.setCreBy(user.getUsername());
  1920. Date utilDate = new Date();
  1921. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  1922. menuRoles.setCreAt(sqlDate);
  1923. if (command.equalsIgnoreCase("INS")) {
  1924. menuRoles.setDelflg("N");
  1925. menuRoles.setCreBy(user.getUsername());
  1926. menuRoles.setCreAt(sqlDate);
  1927. for (LinkedTreeMap regmenu : menuList) {
  1928. Iterator itm = regmenu.entrySet().iterator();
  1929. String provMenuId = menuRoles.getMenuId();
  1930. while (itm.hasNext()) {
  1931. Map.Entry pairs = (Map.Entry) itm.next();
  1932. if (pairs != null && pairs.getKey().equals("menuId")) {
  1933. menuRoles.setMenuId(String.valueOf(pairs.getValue()));
  1934. }
  1935. }
  1936. if (provMenuId != null && menuRoles.getMenuId() != null && !provMenuId.equalsIgnoreCase(menuRoles.getMenuId())) {
  1937. errorEntity = service.insertData(menuRoles);
  1938. }
  1939. }//end of for loop
  1940. } else if (command.equalsIgnoreCase("EDT") ||
  1941. command.equalsIgnoreCase("DEL")) {
  1942. if (command.equalsIgnoreCase("DEL")) {
  1943. menuRoles.setDelflg("Y");
  1944. }
  1945. errorEntity = service.updateData(menuRoles);
  1946. }
  1947. } catch (Exception ex) {
  1948. ex.printStackTrace();
  1949. } finally {
  1950. if (errorEntity == null) {
  1951. errorEntity = new ErrorEntity(ErrorType.ERROR, Long.valueOf(1000));
  1952. }
  1953. }
  1954. return errorEntity;
  1955. }
  1956. @Override
  1957. public List<MenuRoles> getMenuRole(LinkedTreeMap criteria, String sessionId) throws Exception {
  1958. System.out.println("Hospital Service ::: get menu role list data");
  1959. try {
  1960. IMenuRolesService service = new MenuRolesServiceImpl(super.conn);
  1961. User user = sessionUser.get(sessionId);
  1962. MenuRoles entity = new MenuRoles();
  1963. Iterator it = criteria.entrySet().iterator();
  1964. while (it.hasNext()) {
  1965. Map.Entry pairs = (Map.Entry) it.next();
  1966. try {
  1967. if (pairs.getKey().equals(entity.ID)) {
  1968. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  1969. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  1970. } else if (pairs.getKey().equals(entity.ROLECODE)) {
  1971. entity.setRolecode(String.valueOf(pairs.getValue()));
  1972. } else if (pairs.getKey().equals(entity.MENUID)) {
  1973. entity.setMenuId(String.valueOf(pairs.getValue()));
  1974. }
  1975. } catch (NullPointerException ex) {
  1976. ex.printStackTrace();
  1977. } catch (Exception ex) {
  1978. ex.printStackTrace();
  1979. }
  1980. }//end while
  1981. entity.setDelflg("N");
  1982. return service.selectAll(entity);
  1983. } catch (Exception ex) {
  1984. ex.printStackTrace();
  1985. } finally {
  1986. }
  1987. return null;
  1988. }//end of function
  1989. @Override
  1990. public BasicDBObject getForm08ColumnChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  1991. System.out.println("Hospital Service Implament ::: get form 08 data");
  1992. try {
  1993. IForm08Service form08Service = new Form08ServiceImpl(super.conn);
  1994. User user = sessionUser.get(sessionId);
  1995. Form08Entity form08Entity = new Form08Entity();
  1996. Iterator it = criteria.entrySet().iterator();
  1997. //Check Role
  1998. /*roleControl = new CheckUserRoleControl(super.conn);
  1999. if (roleControl == null) {
  2000. return null;
  2001. }
  2002. menuid = menuid.replaceAll("#", "");
  2003. if (!roleControl.checkRole(user, menuid, 1)){
  2004. return null;
  2005. }*/
  2006. //End Check Role
  2007. while (it.hasNext()) {
  2008. Map.Entry pairs = (Map.Entry) it.next();
  2009. try {
  2010. if (pairs.getKey().equals(form08Entity.ID)) {
  2011. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  2012. form08Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  2013. } else if (pairs.getKey().equals(form08Entity.AIMAG)) {
  2014. form08Entity.setAimag(String.valueOf(pairs.getValue()));
  2015. } else if (pairs.getKey().equals(form08Entity.SUM)) {
  2016. form08Entity.setSum(String.valueOf(pairs.getValue()));
  2017. } else if (pairs.getKey().equals(form08Entity.MALTURUL)) {
  2018. form08Entity.setMalTurul(String.valueOf(pairs.getValue()));
  2019. } else if (pairs.getKey().equals(form08Entity.ARGA_HEMJEE_NER)) {
  2020. form08Entity.setArgaHemjeeNer(String.valueOf(pairs.getValue()));
  2021. } else if (pairs.getKey().equals(form08Entity.NER)) {
  2022. form08Entity.setNer(String.valueOf(pairs.getValue()));
  2023. } else if (pairs.getKey().equals(form08Entity.ZARTSUULSAN_HEMJEE)) {
  2024. form08Entity.setZartsuulsanHemjee(String.valueOf(pairs.getValue()));
  2025. } else if (pairs.getKey().equals(form08Entity.TOLOVLOGOO)) {
  2026. form08Entity.setTolovlogoo(String.valueOf(pairs.getValue()));
  2027. } else if (pairs.getKey().equals(form08Entity.GUITSETGEL)) {
  2028. form08Entity.setGuitsetgel(String.valueOf(pairs.getValue()));
  2029. } else if (pairs.getKey().equals(form08Entity.HUVI)) {
  2030. form08Entity.setHuvi(String.valueOf(pairs.getValue()));
  2031. } else if (pairs.getKey().equals(form08Entity.RECORD_DATE)) {
  2032. String dv = String.valueOf(pairs.getValue());
  2033. if (dv != null && !dv.isEmpty()) {
  2034. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  2035. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  2036. form08Entity.setRecordDate(sqlDate);
  2037. }
  2038. } else if (pairs.getKey().equals(form08Entity.SEARCH_RECORD_DATE)) {
  2039. String dv = String.valueOf(pairs.getValue());
  2040. if (dv != null && !dv.isEmpty()) {
  2041. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  2042. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  2043. form08Entity.setSearchRecordDate(sqlDate);
  2044. }
  2045. }
  2046. } catch (NullPointerException ex) {
  2047. ex.printStackTrace();
  2048. } catch (Exception ex) {
  2049. ex.printStackTrace();
  2050. }
  2051. }//end while
  2052. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  2053. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  2054. form08Entity.setCreby(user.getUsername());
  2055. }
  2056. //if(form08Entity.getSum() == null)form08Entity.setSum(user.getSum());
  2057. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  2058. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  2059. form08Entity.setCreby(user.getUsername());
  2060. }
  2061. form08Entity.setDelflg("N");
  2062. form08Entity.setActflg("Y");
  2063. if (form08Entity != null && form08Entity.getRecordDate() != null && form08Entity.getSearchRecordDate() != null) {
  2064. return form08Service.getColumnChartData(form08Entity);
  2065. }
  2066. } catch (Exception ex) {
  2067. ex.printStackTrace();
  2068. } finally {
  2069. }
  2070. return null;
  2071. }//end of function
  2072. @Override
  2073. public List<BasicDBObject> getForm08PieChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  2074. System.out.println("Hospital Service Implament ::: get form 08 data");
  2075. try {
  2076. IForm08Service form08Service = new Form08ServiceImpl(super.conn);
  2077. User user = sessionUser.get(sessionId);
  2078. Form08Entity form08Entity = new Form08Entity();
  2079. Iterator it = criteria.entrySet().iterator();
  2080. //Check Role
  2081. /*roleControl = new CheckUserRoleControl(super.conn);
  2082. if (roleControl == null) {
  2083. return null;
  2084. }
  2085. menuid = menuid.replaceAll("#", "");
  2086. if (!roleControl.checkRole(user, menuid, 1)){
  2087. return null;
  2088. }*/
  2089. //End Check Role
  2090. while (it.hasNext()) {
  2091. Map.Entry pairs = (Map.Entry) it.next();
  2092. try {
  2093. if (pairs.getKey().equals(form08Entity.ID)) {
  2094. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  2095. form08Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  2096. } else if (pairs.getKey().equals(form08Entity.AIMAG)) {
  2097. form08Entity.setAimag(String.valueOf(pairs.getValue()));
  2098. } else if (pairs.getKey().equals(form08Entity.SUM)) {
  2099. form08Entity.setSum(String.valueOf(pairs.getValue()));
  2100. } else if (pairs.getKey().equals(form08Entity.MALTURUL)) {
  2101. form08Entity.setMalTurul(String.valueOf(pairs.getValue()));
  2102. } else if (pairs.getKey().equals(form08Entity.ARGA_HEMJEE_NER)) {
  2103. form08Entity.setArgaHemjeeNer(String.valueOf(pairs.getValue()));
  2104. } else if (pairs.getKey().equals(form08Entity.NER)) {
  2105. form08Entity.setNer(String.valueOf(pairs.getValue()));
  2106. } else if (pairs.getKey().equals(form08Entity.ZARTSUULSAN_HEMJEE)) {
  2107. form08Entity.setZartsuulsanHemjee(String.valueOf(pairs.getValue()));
  2108. } else if (pairs.getKey().equals(form08Entity.TOLOVLOGOO)) {
  2109. form08Entity.setTolovlogoo(String.valueOf(pairs.getValue()));
  2110. } else if (pairs.getKey().equals(form08Entity.GUITSETGEL)) {
  2111. form08Entity.setGuitsetgel(String.valueOf(pairs.getValue()));
  2112. } else if (pairs.getKey().equals(form08Entity.HUVI)) {
  2113. form08Entity.setHuvi(String.valueOf(pairs.getValue()));
  2114. } else if (pairs.getKey().equals(form08Entity.RECORD_DATE)) {
  2115. String dv = String.valueOf(pairs.getValue());
  2116. if (dv != null && !dv.isEmpty()) {
  2117. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  2118. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  2119. form08Entity.setRecordDate(sqlDate);
  2120. }
  2121. } else if (pairs.getKey().equals(form08Entity.SEARCH_RECORD_DATE)) {
  2122. String dv = String.valueOf(pairs.getValue());
  2123. if (dv != null && !dv.isEmpty()) {
  2124. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  2125. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  2126. form08Entity.setSearchRecordDate(sqlDate);
  2127. }
  2128. }
  2129. } catch (NullPointerException ex) {
  2130. ex.printStackTrace();
  2131. } catch (Exception ex) {
  2132. ex.printStackTrace();
  2133. }
  2134. }//end while
  2135. if (form08Entity.getAimag() == null) form08Entity.setAimag(user.getCity());
  2136. //if(form08Entity.getSum() == null)form08Entity.setSum(user.getSum());
  2137. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  2138. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  2139. form08Entity.setCreby(user.getUsername());
  2140. }
  2141. form08Entity.setDelflg("N");
  2142. form08Entity.setActflg("Y");
  2143. if (form08Entity != null && form08Entity.getRecordDate() != null && form08Entity.getSearchRecordDate() != null) {
  2144. return form08Service.getPieChartData(form08Entity);
  2145. }
  2146. } catch (Exception ex) {
  2147. ex.printStackTrace();
  2148. } finally {
  2149. }
  2150. return null;
  2151. }
  2152. @Override
  2153. public List<Form08HavsraltEntity> getForm08HavsraltData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  2154. System.out.println("Hospital Service Implament ::: get form 08 havsralt data");
  2155. try {
  2156. IForm08HavsraltService form08Service = new Form08HavsraltServiceImpl(super.conn);
  2157. User user = sessionUser.get(sessionId);
  2158. Form08HavsraltEntity entity = new Form08HavsraltEntity();
  2159. Iterator it = criteria.entrySet().iterator();
  2160. //Check Role
  2161. /*roleControl = new CheckUserRoleControl(super.conn);
  2162. if (roleControl == null) {
  2163. return null;
  2164. }
  2165. menuid = menuid.replaceAll("#", "");
  2166. if (!roleControl.checkRole(user, menuid, 1)){
  2167. return null;
  2168. }*/
  2169. //End Check Role
  2170. while (it.hasNext()) {
  2171. Map.Entry pairs = (Map.Entry) it.next();
  2172. try {
  2173. if (!pairs.getValue().toString().isEmpty()) {
  2174. if (pairs.getKey().equals(entity.ID)) {
  2175. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  2176. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  2177. } else if (pairs.getKey().equals(entity.CITYCODE)) {
  2178. entity.setCitycode(String.valueOf(pairs.getValue()));
  2179. } else if (pairs.getKey().equals(entity.SUMCODE)) {
  2180. entity.setSumcode(String.valueOf(pairs.getValue()));
  2181. } else if (pairs.getKey().equals(entity.BAGCODE)) {
  2182. entity.setBagcode(String.valueOf(pairs.getValue()));
  2183. } else if (pairs.getKey().equals(entity.GAZARNER)) {
  2184. entity.setGazarner(String.valueOf(pairs.getValue()));
  2185. } else if (pairs.getKey().equals(entity.URTRAG)) {
  2186. entity.setUrtrag(String.valueOf(pairs.getValue()));
  2187. } else if (pairs.getKey().equals(entity.ORGOROG)) {
  2188. entity.setOrgorog(String.valueOf(pairs.getValue()));
  2189. } else if (pairs.getKey().equals(entity.GOLOMTTOO)) {
  2190. entity.setGolomttoo(Integer.parseInt(String.valueOf(pairs.getValue())));
  2191. } else if (pairs.getKey().equals(entity.OVCHIN_NER)) {
  2192. entity.setOvchin_ner(String.valueOf(pairs.getValue()));
  2193. } else if (pairs.getKey().equals(entity.MAL_TURUL)) {
  2194. entity.setMal_turul(String.valueOf(pairs.getValue()));
  2195. } else if (pairs.getKey().equals(entity.UVCHILSON)) {
  2196. entity.setUvchilson(Integer.parseInt(String.valueOf(pairs.getValue())));
  2197. } else if (pairs.getKey().equals(entity.UHSEN)) {
  2198. entity.setUhsen(Integer.parseInt(String.valueOf(pairs.getValue())));
  2199. } else if (pairs.getKey().equals(entity.EDGERSEN)) {
  2200. entity.setEdgersen(Integer.parseInt(String.valueOf(pairs.getValue())));
  2201. } else if (pairs.getKey().equals(entity.USTGASAN)) {
  2202. entity.setUstgasan(Integer.parseInt(String.valueOf(pairs.getValue())));
  2203. } else if (pairs.getKey().equals(entity.NYDLUULSAN)) {
  2204. entity.setNydluulsan(Integer.parseInt(String.valueOf(pairs.getValue())));
  2205. } else if (pairs.getKey().equals(entity.LAB_NER)) {
  2206. entity.setLab_ner(String.valueOf(pairs.getValue()));
  2207. } else if (pairs.getKey().equals(entity.SHINJILGEE_ARGA)) {
  2208. entity.setShinjilgee_arga(String.valueOf(pairs.getValue()));
  2209. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  2210. String dv = String.valueOf(pairs.getValue());
  2211. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  2212. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  2213. entity.setRecordDate(sqlDate);
  2214. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  2215. String dv = String.valueOf(pairs.getValue());
  2216. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  2217. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  2218. entity.setSearchRecordDate(sqlDate);
  2219. }
  2220. }
  2221. } catch (NullPointerException ex) {
  2222. ex.printStackTrace();
  2223. } catch (Exception ex) {
  2224. ex.printStackTrace();
  2225. }
  2226. }//end while
  2227. Date utilDate = new Date();
  2228. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  2229. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  2230. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  2231. entity.setDelflg("N");
  2232. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  2233. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  2234. entity.setCreby(user.getUsername());
  2235. }
  2236. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null) {
  2237. return form08Service.getListData(entity);
  2238. }
  2239. } catch (Exception ex) {
  2240. ex.printStackTrace();
  2241. } finally {
  2242. }
  2243. return null;
  2244. }
  2245. @Override
  2246. public ErrorEntity setForm08HavsraltData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  2247. System.out.println("Hospital Service Implament ::: get form 08 havsralt data");
  2248. try {
  2249. String command = "EDT";
  2250. IForm08HavsraltService service = new Form08HavsraltServiceImpl(super.conn);
  2251. User user = sessionUser.get(sessionId);
  2252. Form08HavsraltEntity entity = new Form08HavsraltEntity();
  2253. //Begin Check Role Step 1
  2254. roleControl = new CheckUserRoleControl(super.conn);
  2255. if (roleControl == null) {
  2256. errorEntity = new ErrorEntity(ErrorType.ERROR, Long.valueOf(1002)); // Ерөнхий алдаа : Эрх нь хүрэлцэхгүй үед өгөх
  2257. return errorEntity;
  2258. }
  2259. //End Check Role Step 1
  2260. menuid = menuid.replaceAll("#", "");
  2261. Iterator it = criteria.entrySet().iterator();
  2262. while (it.hasNext()) {
  2263. Map.Entry pairs = (Map.Entry) it.next();
  2264. try {
  2265. if (pairs.getKey().equals(entity.ID)) {
  2266. String tmpId = "";
  2267. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
  2268. if (pairs.getValue().toString().contains(".")) {
  2269. tmpId = pairs.getValue().toString().substring(0, pairs.getValue().toString().indexOf("."));
  2270. }
  2271. entity.setId(Long.parseLong(String.valueOf(tmpId)));
  2272. }
  2273. } else if (pairs.getKey().equals(entity.CITYCODE)) {
  2274. entity.setCitycode(String.valueOf(pairs.getValue()));
  2275. } else if (pairs.getKey().equals(entity.SUMCODE)) {
  2276. entity.setSumcode(String.valueOf(pairs.getValue()));
  2277. } else if (pairs.getKey().equals(entity.BAGCODE)) {
  2278. entity.setBagcode(String.valueOf(pairs.getValue()));
  2279. } else if (pairs.getKey().equals(entity.GAZARNER)) {
  2280. entity.setGazarner(String.valueOf(pairs.getValue()));
  2281. } else if (pairs.getKey().equals(entity.URTRAG)) {
  2282. entity.setUrtrag(String.valueOf(pairs.getValue()));
  2283. } else if (pairs.getKey().equals(entity.ORGOROG)) {
  2284. entity.setOrgorog(String.valueOf(pairs.getValue()));
  2285. } else if (pairs.getKey().equals(entity.GOLOMTTOO)) {
  2286. entity.setGolomttoo(stringToInteger(String.valueOf(pairs.getValue())));
  2287. } else if (pairs.getKey().equals(entity.OVCHIN_NER)) {
  2288. entity.setOvchin_ner(String.valueOf(pairs.getValue()));
  2289. } else if (pairs.getKey().equals(entity.MAL_TURUL)) {
  2290. entity.setMal_turul(String.valueOf(pairs.getValue()));
  2291. } else if (pairs.getKey().equals(entity.UVCHILSON)) {
  2292. entity.setUvchilson(stringToInteger(String.valueOf(pairs.getValue())));
  2293. } else if (pairs.getKey().equals(entity.UHSEN)) {
  2294. entity.setUhsen(stringToInteger(String.valueOf(pairs.getValue())));
  2295. } else if (pairs.getKey().equals(entity.EDGERSEN)) {
  2296. entity.setEdgersen(stringToInteger(String.valueOf(pairs.getValue())));
  2297. } else if (pairs.getKey().equals(entity.USTGASAN)) {
  2298. entity.setUstgasan(stringToInteger(String.valueOf(pairs.getValue())));
  2299. } else if (pairs.getKey().equals(entity.NYDLUULSAN)) {
  2300. entity.setNydluulsan(stringToInteger(String.valueOf(pairs.getValue())));
  2301. } else if (pairs.getKey().equals(entity.LAB_NER)) {
  2302. entity.setLab_ner(String.valueOf(pairs.getValue()));
  2303. } else if (pairs.getKey().equals(entity.SHINJILGEE_ARGA)) {
  2304. entity.setShinjilgee_arga(String.valueOf(pairs.getValue()));
  2305. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  2306. String dv = String.valueOf(pairs.getValue());
  2307. if (!dv.isEmpty() && dv.length() >= 8) {
  2308. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  2309. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  2310. entity.setRecordDate(sqlDate);
  2311. }
  2312. } else if (pairs.getKey().toString().equalsIgnoreCase("command")) {
  2313. command = String.valueOf(pairs.getValue());
  2314. }
  2315. } catch (NullPointerException ex) {
  2316. ex.printStackTrace();
  2317. } catch (Exception ex) {
  2318. ex.printStackTrace();
  2319. }
  2320. }//end while
  2321. if (command.equalsIgnoreCase("INS")) {
  2322. entity.setDelflg("N");
  2323. if (user != null && (user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  2324. || user.getRoleCode().equalsIgnoreCase("ADMIN"))) {
  2325. //Aimag songoh shaardlagagui
  2326. } else {
  2327. entity.setCitycode(user.getCity());
  2328. }
  2329. //entity.setSumcode(user.getSum());
  2330. entity.setCreby(user.getUsername());
  2331. Date utilDate = new Date();
  2332. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  2333. entity.setCreat(sqlDate);
  2334. if (entity.getRecordDate() == null) entity.setCreat(sqlDate);
  2335. //Begin Check Role Step 2
  2336. if (roleControl.checkRole(user, menuid, 2)) {
  2337. errorEntity = service.insertNewData(entity);
  2338. } else {
  2339. errorEntity = new ErrorEntity(ErrorType.ERROR, Long.valueOf(1002)); // Ерөнхий алдаа : Эрх нь хүрэлцэхгүй үед өгөх
  2340. }
  2341. //End Check Role Step 2
  2342. } else if (command.equalsIgnoreCase("EDT") ||
  2343. command.equalsIgnoreCase("DEL") ||
  2344. command.equalsIgnoreCase("ACT")) {
  2345. int quality = 2;
  2346. if (command.equalsIgnoreCase("DEL")) {
  2347. entity.setDelflg("Y");
  2348. quality = 3;
  2349. }
  2350. //Begin Check Role Step 2
  2351. if (roleControl.checkRole(user, menuid, quality)) {
  2352. errorEntity = service.updateData(entity);
  2353. } else {
  2354. errorEntity = new ErrorEntity(ErrorType.ERROR, Long.valueOf(1002)); // Ерөнхий алдаа : Эрх нь хүрэлцэхгүй үед өгөх
  2355. }
  2356. //End Check Role Step 2
  2357. }
  2358. } catch (Exception ex) {
  2359. ex.printStackTrace();
  2360. } finally {
  2361. }
  2362. return errorEntity;
  2363. }//
  2364. // begin-form09hav
  2365. @Override
  2366. public List<Form09HavsraltEntity> getForm09HavsraltData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  2367. System.out.println("Hospital Service Implament ::: get form 09 havsralt data");
  2368. try {
  2369. IForm09HavsraltService form09Service = new Form09HavsraltServiceImpl(super.conn);
  2370. User user = sessionUser.get(sessionId);
  2371. Form09HavsraltEntity entity = new Form09HavsraltEntity();
  2372. Iterator it = criteria.entrySet().iterator();
  2373. // //Check Role
  2374. // roleControl = new CheckUserRoleControl(super.conn);
  2375. //
  2376. // if (roleControl == null) {
  2377. // return null;
  2378. // }
  2379. //
  2380. // menuid = menuid.replaceAll("#", "");
  2381. //
  2382. // if (!roleControl.checkRole(user, menuid, 1)){
  2383. // return null;
  2384. // }
  2385. // //End Check Role
  2386. while (it.hasNext()) {
  2387. Map.Entry pairs = (Map.Entry) it.next();
  2388. try {
  2389. if (!pairs.getValue().toString().isEmpty()) {
  2390. if (pairs.getKey().equals(entity.ID)) {
  2391. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  2392. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  2393. } else if (pairs.getKey().equals(entity.CITYCODE)) {
  2394. entity.setCitycode(String.valueOf(pairs.getValue()));
  2395. } else if (pairs.getKey().equals(entity.SUMCODE)) {
  2396. entity.setSumcode(String.valueOf(pairs.getValue()));
  2397. } else if (pairs.getKey().equals(entity.BAGCODE)) {
  2398. entity.setBagcode(String.valueOf(pairs.getValue()));
  2399. } else if (pairs.getKey().equals(entity.GAZARNER)) {
  2400. entity.setGazarner(String.valueOf(pairs.getValue()));
  2401. } else if (pairs.getKey().equals(entity.URTRAG)) {
  2402. entity.setUrtrag(String.valueOf(pairs.getValue()));
  2403. } else if (pairs.getKey().equals(entity.ORGOROG)) {
  2404. entity.setOrgorog(String.valueOf(pairs.getValue()));
  2405. } else if (pairs.getKey().equals(entity.GOLOMTTOO)) {
  2406. entity.setGolomttoo(Integer.parseInt(String.valueOf(pairs.getValue())));
  2407. } else if (pairs.getKey().equals(entity.OVCHIN_NER)) {
  2408. entity.setOvchin_ner(String.valueOf(pairs.getValue()));
  2409. } else if (pairs.getKey().equals(entity.MAL_TURUL)) {
  2410. entity.setMal_turul(String.valueOf(pairs.getValue()));
  2411. } else if (pairs.getKey().equals(entity.UVCHILSON)) {
  2412. entity.setUvchilson(Integer.parseInt(String.valueOf(pairs.getValue())));
  2413. } else if (pairs.getKey().equals(entity.UHSEN)) {
  2414. entity.setUhsen(Integer.parseInt(String.valueOf(pairs.getValue())));
  2415. } else if (pairs.getKey().equals(entity.EDGERSEN)) {
  2416. entity.setEdgersen(Integer.parseInt(String.valueOf(pairs.getValue())));
  2417. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  2418. String dv = String.valueOf(pairs.getValue());
  2419. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  2420. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  2421. entity.setRecordDate(sqlDate);
  2422. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  2423. String dv = String.valueOf(pairs.getValue());
  2424. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  2425. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  2426. entity.setSearchRecordDate(sqlDate);
  2427. }
  2428. }
  2429. } catch (NullPointerException ex) {
  2430. ex.printStackTrace();
  2431. } catch (Exception ex) {
  2432. ex.printStackTrace();
  2433. }
  2434. }//end while
  2435. Date utilDate = new Date();
  2436. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  2437. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  2438. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  2439. entity.setDelflg("N");
  2440. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  2441. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  2442. entity.setCreby(user.getUsername());
  2443. }
  2444. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null) {
  2445. return form09Service.getListData(entity);
  2446. }
  2447. } catch (Exception ex) {
  2448. ex.printStackTrace();
  2449. } finally {
  2450. }
  2451. return null;
  2452. }
  2453. @Override
  2454. public ErrorEntity setForm09HavsraltData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  2455. System.out.println("Hospital Service Implament ::: get form 09 havsralt data");
  2456. try {
  2457. String command = "EDT";
  2458. IForm09HavsraltService service = new Form09HavsraltServiceImpl(super.conn);
  2459. User user = sessionUser.get(sessionId);
  2460. Form09HavsraltEntity entity = new Form09HavsraltEntity();
  2461. // //Begin Check Role Step 1
  2462. // roleControl = new CheckUserRoleControl(super.conn);
  2463. //
  2464. // if (roleControl == null) {
  2465. // errorEntity = new ErrorEntity(ErrorType.ERROR, Long.valueOf(1002)); // Ерөнхий алдаа : Эрх нь хүрэлцэхгүй үед өгөх
  2466. // return errorEntity;
  2467. // }
  2468. // //End Check Role Step 1
  2469. // menuid = menuid.replaceAll("#", "");
  2470. Iterator it = criteria.entrySet().iterator();
  2471. while (it.hasNext()) {
  2472. Map.Entry pairs = (Map.Entry) it.next();
  2473. try {
  2474. if (pairs.getKey().equals(entity.ID)) {
  2475. String tmpId = "";
  2476. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
  2477. if (pairs.getValue().toString().contains(".")) {
  2478. tmpId = pairs.getValue().toString().substring(0, pairs.getValue().toString().indexOf("."));
  2479. }
  2480. entity.setId(Long.parseLong(String.valueOf(tmpId)));
  2481. }
  2482. } else if (pairs.getKey().equals(entity.CITYCODE)) {
  2483. entity.setCitycode(String.valueOf(pairs.getValue()));
  2484. } else if (pairs.getKey().equals(entity.SUMCODE)) {
  2485. entity.setSumcode(String.valueOf(pairs.getValue()));
  2486. } else if (pairs.getKey().equals(entity.BAGCODE)) {
  2487. entity.setBagcode(String.valueOf(pairs.getValue()));
  2488. } else if (pairs.getKey().equals(entity.GAZARNER)) {
  2489. entity.setGazarner(String.valueOf(pairs.getValue()));
  2490. } else if (pairs.getKey().equals(entity.URTRAG)) {
  2491. entity.setUrtrag(String.valueOf(pairs.getValue()));
  2492. } else if (pairs.getKey().equals(entity.ORGOROG)) {
  2493. entity.setOrgorog(String.valueOf(pairs.getValue()));
  2494. } else if (pairs.getKey().equals(entity.GOLOMTTOO)) {
  2495. entity.setGolomttoo(stringToInteger(String.valueOf(pairs.getValue())));
  2496. } else if (pairs.getKey().equals(entity.OVCHIN_NER)) {
  2497. entity.setOvchin_ner(String.valueOf(pairs.getValue()));
  2498. } else if (pairs.getKey().equals(entity.MAL_TURUL)) {
  2499. entity.setMal_turul(String.valueOf(pairs.getValue()));
  2500. } else if (pairs.getKey().equals(entity.UVCHILSON)) {
  2501. entity.setUvchilson(stringToInteger(String.valueOf(pairs.getValue())));
  2502. } else if (pairs.getKey().equals(entity.UHSEN)) {
  2503. entity.setUhsen(stringToInteger(String.valueOf(pairs.getValue())));
  2504. } else if (pairs.getKey().equals(entity.EDGERSEN)) {
  2505. entity.setEdgersen(stringToInteger(String.valueOf(pairs.getValue())));
  2506. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  2507. String dv = String.valueOf(pairs.getValue());
  2508. if (!dv.isEmpty() && dv.length() >= 8) {
  2509. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  2510. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  2511. entity.setRecordDate(sqlDate);
  2512. }
  2513. } else if (pairs.getKey().toString().equalsIgnoreCase("command")) {
  2514. command = String.valueOf(pairs.getValue());
  2515. }
  2516. } catch (NullPointerException ex) {
  2517. ex.printStackTrace();
  2518. } catch (Exception ex) {
  2519. ex.printStackTrace();
  2520. }
  2521. }//end while
  2522. if (command.equalsIgnoreCase("INS")) {
  2523. entity.setDelflg("N");
  2524. if (user != null && (user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  2525. || user.getRoleCode().equalsIgnoreCase("ADMIN"))) {
  2526. //Aimag songoh shaardlagagui
  2527. } else {
  2528. entity.setCitycode(user.getCity());
  2529. }
  2530. //entity.setSumcode(user.getSum());
  2531. entity.setCreby(user.getUsername());
  2532. Date utilDate = new Date();
  2533. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  2534. entity.setCreat(sqlDate);
  2535. if (entity.getRecordDate() == null) entity.setCreat(sqlDate);
  2536. errorEntity = service.insertNewData(entity);
  2537. // //Begin Check Role Step 2
  2538. // if (roleControl.checkRole(user, menuid, 2)){
  2539. //
  2540. // }else {
  2541. // errorEntity = new ErrorEntity(ErrorType.ERROR, Long.valueOf(1002)); // Ерөнхий алдаа : Эрх нь хүрэлцэхгүй үед өгөх
  2542. // }
  2543. // //End Check Role Step 2
  2544. } else if (command.equalsIgnoreCase("EDT") ||
  2545. command.equalsIgnoreCase("DEL") ||
  2546. command.equalsIgnoreCase("ACT")) {
  2547. int quality = 2;
  2548. if (command.equalsIgnoreCase("DEL")) {
  2549. entity.setDelflg("Y");
  2550. quality = 3;
  2551. }
  2552. errorEntity = service.updateData(entity);
  2553. // //Begin Check Role Step 2
  2554. // if (roleControl.checkRole(user, menuid, quality)){
  2555. // errorEntity = service.updateData(entity);
  2556. // }else {
  2557. // errorEntity = new ErrorEntity(ErrorType.ERROR, Long.valueOf(1002)); // Ерөнхий алдаа : Эрх нь хүрэлцэхгүй үед өгөх
  2558. // }
  2559. // //End Check Role Step 2
  2560. }
  2561. } catch (Exception ex) {
  2562. ex.printStackTrace();
  2563. } finally {
  2564. }
  2565. return errorEntity;
  2566. }//
  2567. //end-form09hav
  2568. @Override
  2569. public ErrorEntity writeFavoriteMenuLog(String sessionId, String menuid) throws Exception {
  2570. System.out.println("Hospital Service Implament ::: write favorite page");
  2571. try {
  2572. FavoritePageControl service = new FavoritePageControl(super.conn);
  2573. User user = sessionUser.get(sessionId);
  2574. menuid = menuid.replaceAll("#", "");
  2575. service.writeLog(user.getUsername(), menuid);
  2576. } catch (Exception ex) {
  2577. ex.printStackTrace();
  2578. } finally {
  2579. }
  2580. return errorEntity;
  2581. }
  2582. @Override
  2583. public List<FavoritePages> getFavoriteMenuList(String sessionId) throws Exception {
  2584. System.out.println("Hospital Service Implament ::: write favorite page");
  2585. try {
  2586. FavoritePageControl service = new FavoritePageControl(super.conn);
  2587. User user = sessionUser.get(sessionId);
  2588. FavoritePages favoritePages = new FavoritePages();
  2589. favoritePages.setCreate_by(user.getUsername());
  2590. return service.getFavoritePages(favoritePages);
  2591. } catch (Exception ex) {
  2592. ex.printStackTrace();
  2593. } finally {
  2594. }
  2595. return null;
  2596. }
  2597. @Override
  2598. public List<Form13aEntity> getForm13aData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  2599. System.out.println("Hospital Service Implament ::: get form 08 havsralt data");
  2600. try {
  2601. IForm13aService service = new Form13aServiceImpl(super.conn);
  2602. User user = sessionUser.get(sessionId);
  2603. Form13aEntity entity = new Form13aEntity();
  2604. Iterator it = criteria.entrySet().iterator();
  2605. //Check Role
  2606. roleControl = new CheckUserRoleControl(super.conn);
  2607. if (roleControl == null) {
  2608. return null;
  2609. }
  2610. menuid = menuid.replaceAll("#", "");
  2611. if (!roleControl.checkRole(user, menuid, 1)) {
  2612. return null;
  2613. }
  2614. //End Check Role
  2615. while (it.hasNext()) {
  2616. Map.Entry pairs = (Map.Entry) it.next();
  2617. try {
  2618. if (!pairs.getValue().toString().isEmpty()) {
  2619. if (pairs.getKey().equals(entity.ID)) {
  2620. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  2621. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  2622. } else if (pairs.getKey().equals(entity.CITYCODE)) {
  2623. entity.setCitycode(String.valueOf(pairs.getValue()));
  2624. } else if (pairs.getKey().equals(entity.SUMCODE)) {
  2625. entity.setSumcode(String.valueOf(pairs.getValue()));
  2626. } else if (pairs.getKey().equals(entity.BAG_CODE)) {
  2627. entity.setBag_code(String.valueOf(pairs.getValue()));
  2628. } else if (pairs.getKey().equals(entity.UZLEG_HIIH)) {
  2629. entity.setUzleg_hiih(String.valueOf(pairs.getValue()));
  2630. } else if (pairs.getKey().equals(entity.HEMJIH_NEGJ)) {
  2631. entity.setHemjih_negj(String.valueOf(pairs.getValue()));
  2632. } else if (pairs.getKey().equals(entity.TOO_HEMJEE)) {
  2633. entity.setToo_hemjee(String.valueOf(pairs.getValue()));
  2634. } else if (pairs.getKey().equals(entity.DEEJIIN_TOO)) {
  2635. entity.setDeejiin_too(String.valueOf(pairs.getValue()));
  2636. } else if (pairs.getKey().equals(entity.SHINJILGEE_HIISEN)) {
  2637. entity.setShinjilgee_hiisen(String.valueOf(pairs.getValue()));
  2638. } else if (pairs.getKey().equals(entity.SHINJILSEN_ARGA)) {
  2639. entity.setShinjilsen_arga(String.valueOf(pairs.getValue()));
  2640. } else if (pairs.getKey().equals(entity.HERGTSEEND_TOHIRSON)) {
  2641. entity.setHergtseend_tohirson(Double.parseDouble(String.valueOf(pairs.getValue())));
  2642. } else if (pairs.getKey().equals(entity.USTGASAN)) {
  2643. entity.setUstgasan(Double.parseDouble(String.valueOf(pairs.getValue())));
  2644. } else if (pairs.getKey().equals(entity.HALDBARGUIJUULELT)) {
  2645. entity.setHaldbarguijuulelt(Double.parseDouble(String.valueOf(pairs.getValue())));
  2646. } else if (pairs.getKey().equals(entity.BRUTSELLYOZ)) {
  2647. entity.setBrutsellyoz(String.valueOf(pairs.getValue()));
  2648. } else if (pairs.getKey().equals(entity.MASTIT)) {
  2649. entity.setMastit(String.valueOf(pairs.getValue()));
  2650. } else if (pairs.getKey().equals(entity.TRIXINELL)) {
  2651. entity.setTrixinell(String.valueOf(pairs.getValue()));
  2652. } else if (pairs.getKey().equals(entity.FINNOZ)) {
  2653. entity.setFinnoz(String.valueOf(pairs.getValue()));
  2654. } else if (pairs.getKey().equals(entity.SURIYEE)) {
  2655. entity.setSuriyee(String.valueOf(pairs.getValue()));
  2656. } else if (pairs.getKey().equals(entity.BOOM)) {
  2657. entity.setBoom(String.valueOf(pairs.getValue()));
  2658. } else if (pairs.getKey().equals(entity.BUSAD)) {
  2659. entity.setBusad(String.valueOf(pairs.getValue()));
  2660. } else if (pairs.getKey().equals(entity.BUGD)) {
  2661. entity.setBugd(String.valueOf(pairs.getValue()));
  2662. } else if (pairs.getKey().equals(entity.DEL_FLG)) {
  2663. entity.setDel_flg(String.valueOf(pairs.getValue()));
  2664. } else if (pairs.getKey().equals(entity.CRE_BY)) {
  2665. entity.setCre_by(String.valueOf(pairs.getValue()));
  2666. } else if (pairs.getKey().equals(entity.NO_DATA)) {
  2667. entity.setNo_data(String.valueOf(pairs.getValue()));
  2668. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  2669. String dv = String.valueOf(pairs.getValue());
  2670. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  2671. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  2672. entity.setRecordDate(sqlDate);
  2673. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  2674. String dv = String.valueOf(pairs.getValue());
  2675. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  2676. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  2677. entity.setSearchRecordDate(sqlDate);
  2678. }
  2679. }
  2680. } catch (NullPointerException ex) {
  2681. ex.printStackTrace();
  2682. } catch (Exception ex) {
  2683. ex.printStackTrace();
  2684. }
  2685. }//end while
  2686. Date utilDate = new Date();
  2687. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  2688. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  2689. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  2690. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  2691. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  2692. entity.setCre_by(user.getUsername());
  2693. }
  2694. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null) {
  2695. return service.getListData(entity);
  2696. }
  2697. } catch (Exception ex) {
  2698. ex.printStackTrace();
  2699. } finally {
  2700. }
  2701. return null;
  2702. }
  2703. @Override
  2704. public ErrorEntity setForm13aData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  2705. System.out.println("Hospital Service Implament ::: setForm13aData havsralt data");
  2706. try {
  2707. String command = "EDT";
  2708. IForm13aService service = new Form13aServiceImpl(super.conn);
  2709. User user = sessionUser.get(sessionId);
  2710. Form13aEntity entity = new Form13aEntity();
  2711. //Begin Check Role Step 1
  2712. roleControl = new CheckUserRoleControl(super.conn);
  2713. if (roleControl == null) {
  2714. errorEntity = new ErrorEntity(ErrorType.ERROR, Long.valueOf(1002)); // Ерөнхий алдаа : Эрх нь хүрэлцэхгүй үед өгөх
  2715. return errorEntity;
  2716. }
  2717. //End Check Role Step 1
  2718. menuid = menuid.replaceAll("#", "");
  2719. Iterator it = criteria.entrySet().iterator();
  2720. while (it.hasNext()) {
  2721. Map.Entry pairs = (Map.Entry) it.next();
  2722. try {
  2723. if (pairs.getKey().equals(entity.ID)) {
  2724. String tmpId = "";
  2725. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
  2726. if (pairs.getValue().toString().contains(".")) {
  2727. tmpId = pairs.getValue().toString().substring(0, pairs.getValue().toString().indexOf("."));
  2728. }
  2729. entity.setId(Long.parseLong(String.valueOf(tmpId)));
  2730. }
  2731. } else if (pairs.getKey().equals(entity.CITYCODE)) {
  2732. entity.setCitycode(String.valueOf(pairs.getValue()));
  2733. } else if (pairs.getKey().equals(entity.SUMCODE)) {
  2734. entity.setSumcode(String.valueOf(pairs.getValue()));
  2735. } else if (pairs.getKey().equals(entity.BAG_CODE)) {
  2736. entity.setBag_code(String.valueOf(pairs.getValue()));
  2737. } else if (pairs.getKey().equals(entity.UZLEG_HIIH)) {
  2738. entity.setUzleg_hiih(String.valueOf(pairs.getValue()));
  2739. } else if (pairs.getKey().equals(entity.HEMJIH_NEGJ)) {
  2740. entity.setHemjih_negj(String.valueOf(pairs.getValue()));
  2741. } else if (pairs.getKey().equals(entity.TOO_HEMJEE)) {
  2742. entity.setToo_hemjee(String.valueOf(pairs.getValue()));
  2743. } else if (pairs.getKey().equals(entity.DEEJIIN_TOO)) {
  2744. entity.setDeejiin_too(String.valueOf(pairs.getValue()));
  2745. } else if (pairs.getKey().equals(entity.SHINJILGEE_HIISEN)) {
  2746. entity.setShinjilgee_hiisen(String.valueOf(pairs.getValue()));
  2747. } else if (pairs.getKey().equals(entity.SHINJILSEN_ARGA)) {
  2748. entity.setShinjilsen_arga(String.valueOf(pairs.getValue()));
  2749. } else if (pairs.getKey().equals(entity.HERGTSEEND_TOHIRSON)) {
  2750. try {
  2751. entity.setHergtseend_tohirson(Double.valueOf(Double.parseDouble(pairs.getValue().toString())));
  2752. } catch (NumberFormatException e) {
  2753. entity.setHergtseend_tohirson(Double.valueOf(Long.parseLong("0")));
  2754. }
  2755. } else if (pairs.getKey().equals(entity.USTGASAN)) {
  2756. try {
  2757. entity.setUstgasan(Double.valueOf(Double.parseDouble(pairs.getValue().toString())));
  2758. } catch (NumberFormatException e) {
  2759. entity.setUstgasan(Double.valueOf(Long.parseLong("0")));
  2760. }
  2761. } else if (pairs.getKey().equals(entity.HALDBARGUIJUULELT)) {
  2762. try {
  2763. entity.setHaldbarguijuulelt(Double.valueOf(Double.parseDouble(pairs.getValue().toString())));
  2764. } catch (NumberFormatException e) {
  2765. entity.setHaldbarguijuulelt(Double.valueOf(Long.parseLong("0")));
  2766. }
  2767. } else if (pairs.getKey().equals(entity.BRUTSELLYOZ)) {
  2768. entity.setBrutsellyoz(String.valueOf(pairs.getValue()));
  2769. } else if (pairs.getKey().equals(entity.MASTIT)) {
  2770. entity.setMastit(String.valueOf(pairs.getValue()));
  2771. } else if (pairs.getKey().equals(entity.TRIXINELL)) {
  2772. entity.setTrixinell(String.valueOf(pairs.getValue()));
  2773. } else if (pairs.getKey().equals(entity.FINNOZ)) {
  2774. entity.setFinnoz(String.valueOf(pairs.getValue()));
  2775. } else if (pairs.getKey().equals(entity.SURIYEE)) {
  2776. entity.setSuriyee(String.valueOf(pairs.getValue()));
  2777. } else if (pairs.getKey().equals(entity.BOOM)) {
  2778. entity.setBoom(String.valueOf(pairs.getValue()));
  2779. } else if (pairs.getKey().equals(entity.BUSAD)) {
  2780. entity.setBusad(String.valueOf(pairs.getValue()));
  2781. } else if (pairs.getKey().equals(entity.BUGD)) {
  2782. entity.setBugd(String.valueOf(pairs.getValue()));
  2783. } else if (pairs.getKey().equals(entity.DEL_FLG)) {
  2784. entity.setDel_flg(String.valueOf(pairs.getValue()));
  2785. } else if (pairs.getKey().equals(entity.CRE_BY)) {
  2786. entity.setCre_by(String.valueOf(pairs.getValue()));
  2787. } else if (pairs.getKey().equals(entity.NO_DATA)) {
  2788. entity.setNo_data(String.valueOf(pairs.getValue()));
  2789. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  2790. String dv = String.valueOf(pairs.getValue());
  2791. if (!dv.isEmpty() && dv.length() >= 8) {
  2792. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  2793. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  2794. entity.setRecordDate(sqlDate);
  2795. }
  2796. } else if (pairs.getKey().toString().equalsIgnoreCase("command")) {
  2797. command = String.valueOf(pairs.getValue());
  2798. }
  2799. } catch (NullPointerException ex) {
  2800. ex.printStackTrace();
  2801. } catch (Exception ex) {
  2802. ex.printStackTrace();
  2803. }
  2804. }//end while
  2805. Date utilDate = new Date();
  2806. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  2807. entity.setMod_at(sqlDate);
  2808. entity.setMod_by(user.getUsername());
  2809. if (command.equalsIgnoreCase("INS")) {
  2810. entity.setDel_flg("N");
  2811. entity.setCitycode(user.getCity());
  2812. entity.setSumcode(user.getSum());
  2813. entity.setCre_by(user.getUsername());
  2814. entity.setCre_at(sqlDate);
  2815. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  2816. //Begin Check Role Step 2
  2817. if (roleControl.checkRole(user, menuid, 2)) {
  2818. errorEntity = service.insertNewData(entity);
  2819. } else {
  2820. errorEntity = new ErrorEntity(ErrorType.ERROR, Long.valueOf(1002)); // Ерөнхий алдаа : Эрх нь хүрэлцэхгүй үед өгөх
  2821. }
  2822. //End Check Role Step 2
  2823. } else if (command.equalsIgnoreCase("EDT") ||
  2824. command.equalsIgnoreCase("DEL") ||
  2825. command.equalsIgnoreCase("ACT")) {
  2826. int quality = 2;
  2827. if (command.equalsIgnoreCase("DEL")) {
  2828. entity.setDel_flg("Y");
  2829. quality = 3;
  2830. }
  2831. //Begin Check Role Step 2
  2832. if (roleControl.checkRole(user, menuid, quality)) {
  2833. errorEntity = service.updateData(entity);
  2834. } else {
  2835. errorEntity = new ErrorEntity(ErrorType.ERROR, Long.valueOf(1002)); // Ерөнхий алдаа : Эрх нь хүрэлцэхгүй үед өгөх
  2836. }
  2837. //End Check Role Step 2
  2838. }
  2839. } catch (Exception ex) {
  2840. ex.printStackTrace();
  2841. } finally {
  2842. }
  2843. return errorEntity;
  2844. }
  2845. @Override
  2846. public List<User> getAllUserList(LinkedTreeMap credata, String sessionId) throws Exception {
  2847. System.out.println("Hospital Service ::: get all user list");
  2848. try {
  2849. IUserService userService = new UserServiceImpl(super.conn);
  2850. User user = sessionUser.get(sessionId);
  2851. User seluser = new User();
  2852. Iterator it = credata.entrySet().iterator();
  2853. while (it.hasNext()) {
  2854. Map.Entry pairs = (Map.Entry) it.next();
  2855. try {
  2856. if (pairs.getKey().equals(seluser.ID)) {
  2857. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  2858. seluser.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  2859. } else if (pairs.getKey().equals(seluser.USERNAME)) {
  2860. seluser.setUsername(String.valueOf(pairs.getValue()));
  2861. } else if (pairs.getKey().equals(seluser.ROLECODE)) {
  2862. seluser.setRoleCode(String.valueOf(pairs.getValue()));
  2863. } else if (pairs.getKey().equals(seluser.FIRSTNAME)) {
  2864. seluser.setFirstName(String.valueOf(pairs.getValue()));
  2865. } else if (pairs.getKey().equals(seluser.LASTNAME)) {
  2866. seluser.setLastName(String.valueOf(pairs.getValue()));
  2867. } else if (pairs.getKey().equals(seluser.GENDER)) {
  2868. seluser.setGender(String.valueOf(pairs.getValue()));
  2869. } else if (pairs.getKey().equals(seluser.REGID)) {
  2870. seluser.setRegId(String.valueOf(pairs.getValue()));
  2871. } else if (pairs.getKey().equals(seluser.CITY)) {
  2872. seluser.setCity(String.valueOf(pairs.getValue()));
  2873. } else if (pairs.getKey().equals(seluser.SUM)) {
  2874. seluser.setSum(String.valueOf(pairs.getValue()));
  2875. } else if (pairs.getKey().equals(seluser.CREBY)) {
  2876. seluser.setCreBy(String.valueOf(pairs.getValue()));
  2877. } else if (pairs.getKey().equals(seluser.MODBY)) {
  2878. seluser.setModBy(String.valueOf(pairs.getValue()));
  2879. } else if (pairs.getKey().equals(seluser.DELFLG)) {
  2880. seluser.setDelFlg(String.valueOf(pairs.getValue()));
  2881. } else if (pairs.getKey().equals(seluser.ACTFLG)) {
  2882. seluser.setActFlg(String.valueOf(pairs.getValue()));
  2883. }
  2884. } catch (NullPointerException ex) {
  2885. ex.printStackTrace();
  2886. } catch (Exception ex) {
  2887. ex.printStackTrace();
  2888. }
  2889. }//end while
  2890. seluser.setDelFlg("N");
  2891. List<User> arrUserList = new ArrayList<>();
  2892. List<User> listUser = userService.getUserList(seluser);
  2893. if (listUser != null) {
  2894. for (User us : listUser) {
  2895. boolean isme = false;
  2896. User tmp = new User();
  2897. tmp.put("status", "offline");
  2898. tmp.setChatId(us.getChatId());
  2899. tmp.setUsername(us.getUsername());
  2900. tmp.setFirstName(us.getFirstName());
  2901. tmp.setLastName(us.getLastName());
  2902. tmp.setCityName(us.getCityName());
  2903. tmp.setCityNameEn(us.getCityNameEn());
  2904. tmp.setSumName(us.getSumName());
  2905. tmp.setSumNameEn(us.getSumNameEn());
  2906. for (Map.Entry<String, User> entry : sessionUser.entrySet()) {
  2907. String key = entry.getKey();
  2908. User su = entry.getValue();
  2909. if (su.getUsername().equalsIgnoreCase(tmp.getUsername())) {
  2910. if (key.equalsIgnoreCase(sessionId)) {
  2911. isme = true;
  2912. }
  2913. tmp.put("status", "online");
  2914. }
  2915. }//end of for
  2916. if (isme) continue;
  2917. arrUserList.add(tmp);
  2918. }
  2919. }
  2920. return arrUserList;
  2921. } catch (Exception ex) {
  2922. ex.printStackTrace();
  2923. } finally {
  2924. }
  2925. return null;
  2926. }
  2927. /*
  2928. *
  2929. * CHART
  2930. * */
  2931. public List<BasicDBObject> getForm08HavsraltPieChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  2932. System.out.println("Hospital Service Implament ::: get form 08 havsralt data");
  2933. try {
  2934. IForm08HavsraltService service = new Form08HavsraltServiceImpl(super.conn);
  2935. User user = sessionUser.get(sessionId);
  2936. Form08HavsraltEntity entity = new Form08HavsraltEntity();
  2937. Iterator it = criteria.entrySet().iterator();
  2938. while (it.hasNext()) {
  2939. Map.Entry pairs = (Map.Entry) it.next();
  2940. try {
  2941. if (!pairs.getValue().toString().isEmpty()) {
  2942. if (pairs.getKey().equals(entity.ID)) {
  2943. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  2944. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  2945. } else if (pairs.getKey().equals(entity.CITYCODE)) {
  2946. entity.setCitycode(String.valueOf(pairs.getValue()));
  2947. } else if (pairs.getKey().equals(entity.SUMCODE)) {
  2948. entity.setSumcode(String.valueOf(pairs.getValue()));
  2949. } else if (pairs.getKey().equals(entity.BAGCODE)) {
  2950. entity.setBagcode(String.valueOf(pairs.getValue()));
  2951. } else if (pairs.getKey().equals(entity.GAZARNER)) {
  2952. entity.setGazarner(String.valueOf(pairs.getValue()));
  2953. } else if (pairs.getKey().equals(entity.URTRAG)) {
  2954. entity.setUrtrag(String.valueOf(pairs.getValue()));
  2955. } else if (pairs.getKey().equals(entity.ORGOROG)) {
  2956. entity.setOrgorog(String.valueOf(pairs.getValue()));
  2957. } else if (pairs.getKey().equals(entity.GOLOMTTOO)) {
  2958. entity.setGolomttoo(Integer.parseInt(String.valueOf(pairs.getValue())));
  2959. } else if (pairs.getKey().equals(entity.OVCHIN_NER)) {
  2960. entity.setOvchin_ner(String.valueOf(pairs.getValue()));
  2961. } else if (pairs.getKey().equals(entity.MAL_TURUL)) {
  2962. entity.setMal_turul(String.valueOf(pairs.getValue()));
  2963. } else if (pairs.getKey().equals(entity.UVCHILSON)) {
  2964. entity.setUvchilson(Integer.parseInt(String.valueOf(pairs.getValue())));
  2965. } else if (pairs.getKey().equals(entity.UHSEN)) {
  2966. entity.setUhsen(Integer.parseInt(String.valueOf(pairs.getValue())));
  2967. } else if (pairs.getKey().equals(entity.EDGERSEN)) {
  2968. entity.setEdgersen(Integer.parseInt(String.valueOf(pairs.getValue())));
  2969. } else if (pairs.getKey().equals(entity.USTGASAN)) {
  2970. entity.setUstgasan(Integer.parseInt(String.valueOf(pairs.getValue())));
  2971. } else if (pairs.getKey().equals(entity.NYDLUULSAN)) {
  2972. entity.setNydluulsan(Integer.parseInt(String.valueOf(pairs.getValue())));
  2973. } else if (pairs.getKey().equals(entity.LAB_NER)) {
  2974. entity.setLab_ner(String.valueOf(pairs.getValue()));
  2975. } else if (pairs.getKey().equals(entity.SHINJILGEE_ARGA)) {
  2976. entity.setShinjilgee_arga(String.valueOf(pairs.getValue()));
  2977. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  2978. String dv = String.valueOf(pairs.getValue());
  2979. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  2980. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  2981. entity.setRecordDate(sqlDate);
  2982. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  2983. String dv = String.valueOf(pairs.getValue());
  2984. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  2985. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  2986. entity.setSearchRecordDate(sqlDate);
  2987. }
  2988. }
  2989. } catch (NullPointerException ex) {
  2990. ex.printStackTrace();
  2991. } catch (Exception ex) {
  2992. ex.printStackTrace();
  2993. }
  2994. }//end while
  2995. Date utilDate = new Date();
  2996. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  2997. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  2998. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  2999. entity.setDelflg("N");
  3000. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  3001. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  3002. entity.setCreby(user.getUsername());
  3003. }
  3004. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null) {
  3005. return service.getPieChartData(entity);
  3006. }
  3007. } catch (Exception ex) {
  3008. ex.printStackTrace();
  3009. } finally {
  3010. }
  3011. return null;
  3012. }
  3013. @Override
  3014. public BasicDBObject getForm08HavsraltColumnChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  3015. System.out.println("Hospital Service Implament ::: get form 08 havsralt data");
  3016. try {
  3017. IForm08HavsraltService service = new Form08HavsraltServiceImpl(super.conn);
  3018. User user = sessionUser.get(sessionId);
  3019. Form08HavsraltEntity entity = new Form08HavsraltEntity();
  3020. Iterator it = criteria.entrySet().iterator();
  3021. while (it.hasNext()) {
  3022. Map.Entry pairs = (Map.Entry) it.next();
  3023. try {
  3024. if (!pairs.getValue().toString().isEmpty()) {
  3025. if (pairs.getKey().equals(entity.ID)) {
  3026. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  3027. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  3028. } else if (pairs.getKey().equals(entity.CITYCODE)) {
  3029. entity.setCitycode(String.valueOf(pairs.getValue()));
  3030. } else if (pairs.getKey().equals(entity.SUMCODE)) {
  3031. entity.setSumcode(String.valueOf(pairs.getValue()));
  3032. } else if (pairs.getKey().equals(entity.BAGCODE)) {
  3033. entity.setBagcode(String.valueOf(pairs.getValue()));
  3034. } else if (pairs.getKey().equals(entity.GAZARNER)) {
  3035. entity.setGazarner(String.valueOf(pairs.getValue()));
  3036. } else if (pairs.getKey().equals(entity.URTRAG)) {
  3037. entity.setUrtrag(String.valueOf(pairs.getValue()));
  3038. } else if (pairs.getKey().equals(entity.ORGOROG)) {
  3039. entity.setOrgorog(String.valueOf(pairs.getValue()));
  3040. } else if (pairs.getKey().equals(entity.GOLOMTTOO)) {
  3041. entity.setGolomttoo(Integer.parseInt(String.valueOf(pairs.getValue())));
  3042. } else if (pairs.getKey().equals(entity.OVCHIN_NER)) {
  3043. entity.setOvchin_ner(String.valueOf(pairs.getValue()));
  3044. } else if (pairs.getKey().equals(entity.MAL_TURUL)) {
  3045. entity.setMal_turul(String.valueOf(pairs.getValue()));
  3046. } else if (pairs.getKey().equals(entity.UVCHILSON)) {
  3047. entity.setUvchilson(Integer.parseInt(String.valueOf(pairs.getValue())));
  3048. } else if (pairs.getKey().equals(entity.UHSEN)) {
  3049. entity.setUhsen(Integer.parseInt(String.valueOf(pairs.getValue())));
  3050. } else if (pairs.getKey().equals(entity.EDGERSEN)) {
  3051. entity.setEdgersen(Integer.parseInt(String.valueOf(pairs.getValue())));
  3052. } else if (pairs.getKey().equals(entity.USTGASAN)) {
  3053. entity.setUstgasan(Integer.parseInt(String.valueOf(pairs.getValue())));
  3054. } else if (pairs.getKey().equals(entity.NYDLUULSAN)) {
  3055. entity.setNydluulsan(Integer.parseInt(String.valueOf(pairs.getValue())));
  3056. } else if (pairs.getKey().equals(entity.LAB_NER)) {
  3057. entity.setLab_ner(String.valueOf(pairs.getValue()));
  3058. } else if (pairs.getKey().equals(entity.SHINJILGEE_ARGA)) {
  3059. entity.setShinjilgee_arga(String.valueOf(pairs.getValue()));
  3060. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  3061. String dv = String.valueOf(pairs.getValue());
  3062. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3063. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3064. entity.setRecordDate(sqlDate);
  3065. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  3066. String dv = String.valueOf(pairs.getValue());
  3067. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3068. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3069. entity.setSearchRecordDate(sqlDate);
  3070. }
  3071. }
  3072. } catch (NullPointerException ex) {
  3073. ex.printStackTrace();
  3074. } catch (Exception ex) {
  3075. ex.printStackTrace();
  3076. }
  3077. }//end while
  3078. Date utilDate = new Date();
  3079. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  3080. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  3081. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  3082. entity.setDelflg("N");
  3083. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  3084. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  3085. entity.setCreby(user.getUsername());
  3086. }
  3087. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null) {
  3088. return service.getColHighChartData(entity);
  3089. }
  3090. } catch (Exception ex) {
  3091. ex.printStackTrace();
  3092. } finally {
  3093. }
  3094. return null;
  3095. }
  3096. /**
  3097. * Pie Chart
  3098. *
  3099. * @param
  3100. * @return
  3101. * @throws NumberFormatException
  3102. */
  3103. @Override
  3104. public List<BasicDBObject> getForm09PieChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  3105. System.out.println("Hospital Service Implament ::: getForm09PieChartData");
  3106. try {
  3107. IForm09Service formService = new Form09ServiceImpl(super.conn);
  3108. User user = sessionUser.get(sessionId);
  3109. Form09Entity form09Entity = new Form09Entity();
  3110. Iterator it = criteria.entrySet().iterator();
  3111. while (it.hasNext()) {
  3112. Map.Entry pairs = (Map.Entry) it.next();
  3113. try {
  3114. if (pairs.getKey().equals(form09Entity.ID)) {
  3115. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  3116. form09Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  3117. } else if (pairs.getKey().equals(form09Entity.AIMAG)) {
  3118. form09Entity.setAimag(String.valueOf(pairs.getValue()));
  3119. } else if (pairs.getKey().equals(form09Entity.SUM)) {
  3120. form09Entity.setSum(form09Entity.SUM);
  3121. } else if (pairs.getKey().equals(form09Entity.MALTURUL)) {
  3122. form09Entity.setMalTurul(String.valueOf(pairs.getValue()));
  3123. } else if (pairs.getKey().equals(form09Entity.TARILGANER)) {
  3124. form09Entity.setTarilgaNer(String.valueOf(pairs.getValue()));
  3125. } else if (pairs.getKey().equals(form09Entity.NER)) {
  3126. form09Entity.setNer(String.valueOf(pairs.getValue()));
  3127. } else if (pairs.getKey().equals(form09Entity.ZARTSUULSANHEMJEE)) {
  3128. form09Entity.setZartsuulsanHemjee(String.valueOf(pairs.getValue()));
  3129. } else if (pairs.getKey().equals(form09Entity.TOLOVLOGOO)) {
  3130. form09Entity.setTolovlogoo(String.valueOf(pairs.getValue()));
  3131. } else if (pairs.getKey().equals(form09Entity.GUITSETGEL)) {
  3132. form09Entity.setGuitsetgel(String.valueOf(pairs.getValue()));
  3133. } else if (pairs.getKey().equals(form09Entity.HUVI)) {
  3134. form09Entity.setHuvi(String.valueOf(pairs.getValue()));
  3135. } else if (pairs.getKey().equals(form09Entity.OLGOSON_TUN)) {
  3136. try {
  3137. form09Entity.setOLGOSON_TUN(Long.valueOf(pairs.getValue().toString()));
  3138. } catch (NumberFormatException e) {
  3139. form09Entity.setOLGOSON_TUN(Long.parseLong("0"));
  3140. }
  3141. } else if (pairs.getKey().equals(form09Entity.HEREGLESEN_TUN)) {
  3142. try {
  3143. form09Entity.setHEREGLESEN_TUN(Long.valueOf(pairs.getValue().toString()));
  3144. } catch (NumberFormatException e) {
  3145. form09Entity.setHEREGLESEN_TUN(Long.parseLong("0"));
  3146. }
  3147. } else if (pairs.getKey().equals(form09Entity.USTGASAN_TUN)) {
  3148. try {
  3149. form09Entity.setUSTGASAN_TUN(Long.valueOf(pairs.getValue().toString()));
  3150. } catch (NumberFormatException e) {
  3151. form09Entity.setUSTGASAN_TUN(Long.parseLong("0"));
  3152. }
  3153. } else if (pairs.getKey().equals(form09Entity.NUUTSULSEN_TUN)) {
  3154. try {
  3155. form09Entity.setNUUTSULSEN_TUN(Long.valueOf(pairs.getValue().toString()));
  3156. } catch (NumberFormatException e) {
  3157. form09Entity.setNUUTSULSEN_TUN(Long.parseLong("0"));
  3158. }
  3159. } else if (pairs.getKey().equals(form09Entity.RECORD_DATE)) {
  3160. String dv = String.valueOf(pairs.getValue());
  3161. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3162. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3163. form09Entity.setRecordDate(sqlDate);
  3164. } else if (pairs.getKey().equals(form09Entity.SEARCH_RECORD_DATE)) {
  3165. String dv = String.valueOf(pairs.getValue());
  3166. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3167. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3168. form09Entity.setSearchRecordDate(sqlDate);
  3169. }
  3170. } catch (NullPointerException ex) {
  3171. ex.printStackTrace();
  3172. } catch (Exception ex) {
  3173. ex.printStackTrace();
  3174. }
  3175. }//end while
  3176. if (form09Entity.getAimag() == null) form09Entity.setAimag(user.getCity());
  3177. //if(form08Entity.getSum() == null)form08Entity.setSum(user.getSum());
  3178. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  3179. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  3180. form09Entity.setCreby(user.getUsername());
  3181. }
  3182. form09Entity.setDelflg("N");
  3183. form09Entity.setActflg("Y");
  3184. if (form09Entity != null && form09Entity.getRecordDate() != null && form09Entity.getSearchRecordDate() != null) {
  3185. return formService.getPieChartData(form09Entity);
  3186. }
  3187. } catch (Exception ex) {
  3188. ex.printStackTrace();
  3189. } finally {
  3190. }
  3191. return null;
  3192. }
  3193. @Override
  3194. public BasicDBObject getForm09ColumnChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  3195. System.out.println("Hospital Service Implament ::: getForm09ColumnChartData");
  3196. try {
  3197. IForm09Service formService = new Form09ServiceImpl(super.conn);
  3198. User user = sessionUser.get(sessionId);
  3199. Form09Entity form09Entity = new Form09Entity();
  3200. Iterator it = criteria.entrySet().iterator();
  3201. while (it.hasNext()) {
  3202. Map.Entry pairs = (Map.Entry) it.next();
  3203. try {
  3204. if (pairs.getKey().equals(form09Entity.ID)) {
  3205. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  3206. form09Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  3207. } else if (pairs.getKey().equals(form09Entity.AIMAG)) {
  3208. form09Entity.setAimag(String.valueOf(pairs.getValue()));
  3209. } else if (pairs.getKey().equals(form09Entity.SUM)) {
  3210. form09Entity.setSum(form09Entity.SUM);
  3211. } else if (pairs.getKey().equals(form09Entity.MALTURUL)) {
  3212. form09Entity.setMalTurul(String.valueOf(pairs.getValue()));
  3213. } else if (pairs.getKey().equals(form09Entity.TARILGANER)) {
  3214. form09Entity.setTarilgaNer(String.valueOf(pairs.getValue()));
  3215. } else if (pairs.getKey().equals(form09Entity.NER)) {
  3216. form09Entity.setNer(String.valueOf(pairs.getValue()));
  3217. } else if (pairs.getKey().equals(form09Entity.ZARTSUULSANHEMJEE)) {
  3218. form09Entity.setZartsuulsanHemjee(String.valueOf(pairs.getValue()));
  3219. } else if (pairs.getKey().equals(form09Entity.TOLOVLOGOO)) {
  3220. form09Entity.setTolovlogoo(String.valueOf(pairs.getValue()));
  3221. } else if (pairs.getKey().equals(form09Entity.GUITSETGEL)) {
  3222. form09Entity.setGuitsetgel(String.valueOf(pairs.getValue()));
  3223. } else if (pairs.getKey().equals(form09Entity.HUVI)) {
  3224. form09Entity.setHuvi(String.valueOf(pairs.getValue()));
  3225. } else if (pairs.getKey().equals(form09Entity.OLGOSON_TUN)) {
  3226. try {
  3227. form09Entity.setOLGOSON_TUN(Long.valueOf(pairs.getValue().toString()));
  3228. } catch (NumberFormatException e) {
  3229. form09Entity.setOLGOSON_TUN(Long.parseLong("0"));
  3230. }
  3231. } else if (pairs.getKey().equals(form09Entity.HEREGLESEN_TUN)) {
  3232. try {
  3233. form09Entity.setHEREGLESEN_TUN(Long.valueOf(pairs.getValue().toString()));
  3234. } catch (NumberFormatException e) {
  3235. form09Entity.setHEREGLESEN_TUN(Long.parseLong("0"));
  3236. }
  3237. } else if (pairs.getKey().equals(form09Entity.USTGASAN_TUN)) {
  3238. try {
  3239. form09Entity.setUSTGASAN_TUN(Long.valueOf(pairs.getValue().toString()));
  3240. } catch (NumberFormatException e) {
  3241. form09Entity.setUSTGASAN_TUN(Long.parseLong("0"));
  3242. }
  3243. } else if (pairs.getKey().equals(form09Entity.NUUTSULSEN_TUN)) {
  3244. try {
  3245. form09Entity.setNUUTSULSEN_TUN(Long.valueOf(pairs.getValue().toString()));
  3246. } catch (NumberFormatException e) {
  3247. form09Entity.setNUUTSULSEN_TUN(Long.parseLong("0"));
  3248. }
  3249. } else if (pairs.getKey().equals(form09Entity.RECORD_DATE)) {
  3250. String dv = String.valueOf(pairs.getValue());
  3251. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3252. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3253. form09Entity.setRecordDate(sqlDate);
  3254. } else if (pairs.getKey().equals(form09Entity.SEARCH_RECORD_DATE)) {
  3255. String dv = String.valueOf(pairs.getValue());
  3256. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3257. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3258. form09Entity.setSearchRecordDate(sqlDate);
  3259. }
  3260. } catch (NullPointerException ex) {
  3261. ex.printStackTrace();
  3262. } catch (Exception ex) {
  3263. ex.printStackTrace();
  3264. }
  3265. }//end while
  3266. if (form09Entity.getAimag() == null) form09Entity.setAimag(user.getCity());
  3267. //if(form08Entity.getSum() == null)form08Entity.setSum(user.getSum());
  3268. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  3269. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  3270. form09Entity.setCreby(user.getUsername());
  3271. }
  3272. form09Entity.setDelflg("N");
  3273. form09Entity.setActflg("Y");
  3274. if (form09Entity != null && form09Entity.getRecordDate() != null && form09Entity.getSearchRecordDate() != null) {
  3275. return formService.getColumnChartData(form09Entity);
  3276. }
  3277. } catch (Exception ex) {
  3278. ex.printStackTrace();
  3279. } finally {
  3280. }
  3281. return null;
  3282. }
  3283. @Override
  3284. public List<BasicDBObject> getForm09HavsraltPieChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  3285. System.out.println("Hospital Service Implament ::: getForm09HavsraltPieChartData");
  3286. try {
  3287. IForm09HavsraltService form09Service = new Form09HavsraltServiceImpl(super.conn);
  3288. User user = sessionUser.get(sessionId);
  3289. Form09HavsraltEntity entity = new Form09HavsraltEntity();
  3290. Iterator it = criteria.entrySet().iterator();
  3291. while (it.hasNext()) {
  3292. Map.Entry pairs = (Map.Entry) it.next();
  3293. try {
  3294. if (!pairs.getValue().toString().isEmpty()) {
  3295. if (pairs.getKey().equals(entity.ID)) {
  3296. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  3297. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  3298. } else if (pairs.getKey().equals(entity.CITYCODE)) {
  3299. entity.setCitycode(String.valueOf(pairs.getValue()));
  3300. } else if (pairs.getKey().equals(entity.SUMCODE)) {
  3301. entity.setSumcode(String.valueOf(pairs.getValue()));
  3302. } else if (pairs.getKey().equals(entity.BAGCODE)) {
  3303. entity.setBagcode(String.valueOf(pairs.getValue()));
  3304. } else if (pairs.getKey().equals(entity.GAZARNER)) {
  3305. entity.setGazarner(String.valueOf(pairs.getValue()));
  3306. } else if (pairs.getKey().equals(entity.URTRAG)) {
  3307. entity.setUrtrag(String.valueOf(pairs.getValue()));
  3308. } else if (pairs.getKey().equals(entity.ORGOROG)) {
  3309. entity.setOrgorog(String.valueOf(pairs.getValue()));
  3310. } else if (pairs.getKey().equals(entity.GOLOMTTOO)) {
  3311. entity.setGolomttoo(Integer.parseInt(String.valueOf(pairs.getValue())));
  3312. } else if (pairs.getKey().equals(entity.OVCHIN_NER)) {
  3313. entity.setOvchin_ner(String.valueOf(pairs.getValue()));
  3314. } else if (pairs.getKey().equals(entity.MAL_TURUL)) {
  3315. entity.setMal_turul(String.valueOf(pairs.getValue()));
  3316. } else if (pairs.getKey().equals(entity.UVCHILSON)) {
  3317. entity.setUvchilson(Integer.parseInt(String.valueOf(pairs.getValue())));
  3318. } else if (pairs.getKey().equals(entity.UHSEN)) {
  3319. entity.setUhsen(Integer.parseInt(String.valueOf(pairs.getValue())));
  3320. } else if (pairs.getKey().equals(entity.EDGERSEN)) {
  3321. entity.setEdgersen(Integer.parseInt(String.valueOf(pairs.getValue())));
  3322. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  3323. String dv = String.valueOf(pairs.getValue());
  3324. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3325. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3326. entity.setRecordDate(sqlDate);
  3327. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  3328. String dv = String.valueOf(pairs.getValue());
  3329. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3330. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3331. entity.setSearchRecordDate(sqlDate);
  3332. }
  3333. }
  3334. } catch (NullPointerException ex) {
  3335. ex.printStackTrace();
  3336. } catch (Exception ex) {
  3337. ex.printStackTrace();
  3338. }
  3339. }//end while
  3340. Date utilDate = new Date();
  3341. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  3342. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  3343. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  3344. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  3345. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  3346. entity.setCreby(user.getUsername());
  3347. }
  3348. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null) {
  3349. return form09Service.getPieChartData(entity);
  3350. }
  3351. } catch (Exception ex) {
  3352. ex.printStackTrace();
  3353. } finally {
  3354. }
  3355. return null;
  3356. }
  3357. @Override
  3358. public BasicDBObject getForm09HavsraltColumnChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  3359. System.out.println("Hospital Service Implament ::: getForm09HavsraltColumnChartData");
  3360. try {
  3361. IForm09HavsraltService form09Service = new Form09HavsraltServiceImpl(super.conn);
  3362. User user = sessionUser.get(sessionId);
  3363. Form09HavsraltEntity entity = new Form09HavsraltEntity();
  3364. Iterator it = criteria.entrySet().iterator();
  3365. while (it.hasNext()) {
  3366. Map.Entry pairs = (Map.Entry) it.next();
  3367. try {
  3368. if (!pairs.getValue().toString().isEmpty()) {
  3369. if (pairs.getKey().equals(entity.ID)) {
  3370. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  3371. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  3372. } else if (pairs.getKey().equals(entity.CITYCODE)) {
  3373. entity.setCitycode(String.valueOf(pairs.getValue()));
  3374. } else if (pairs.getKey().equals(entity.SUMCODE)) {
  3375. entity.setSumcode(String.valueOf(pairs.getValue()));
  3376. } else if (pairs.getKey().equals(entity.BAGCODE)) {
  3377. entity.setBagcode(String.valueOf(pairs.getValue()));
  3378. } else if (pairs.getKey().equals(entity.GAZARNER)) {
  3379. entity.setGazarner(String.valueOf(pairs.getValue()));
  3380. } else if (pairs.getKey().equals(entity.URTRAG)) {
  3381. entity.setUrtrag(String.valueOf(pairs.getValue()));
  3382. } else if (pairs.getKey().equals(entity.ORGOROG)) {
  3383. entity.setOrgorog(String.valueOf(pairs.getValue()));
  3384. } else if (pairs.getKey().equals(entity.GOLOMTTOO)) {
  3385. entity.setGolomttoo(Integer.parseInt(String.valueOf(pairs.getValue())));
  3386. } else if (pairs.getKey().equals(entity.OVCHIN_NER)) {
  3387. entity.setOvchin_ner(String.valueOf(pairs.getValue()));
  3388. } else if (pairs.getKey().equals(entity.MAL_TURUL)) {
  3389. entity.setMal_turul(String.valueOf(pairs.getValue()));
  3390. } else if (pairs.getKey().equals(entity.UVCHILSON)) {
  3391. entity.setUvchilson(Integer.parseInt(String.valueOf(pairs.getValue())));
  3392. } else if (pairs.getKey().equals(entity.UHSEN)) {
  3393. entity.setUhsen(Integer.parseInt(String.valueOf(pairs.getValue())));
  3394. } else if (pairs.getKey().equals(entity.EDGERSEN)) {
  3395. entity.setEdgersen(Integer.parseInt(String.valueOf(pairs.getValue())));
  3396. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  3397. String dv = String.valueOf(pairs.getValue());
  3398. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3399. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3400. entity.setRecordDate(sqlDate);
  3401. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  3402. String dv = String.valueOf(pairs.getValue());
  3403. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3404. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3405. entity.setSearchRecordDate(sqlDate);
  3406. }
  3407. }
  3408. } catch (NullPointerException ex) {
  3409. ex.printStackTrace();
  3410. } catch (Exception ex) {
  3411. ex.printStackTrace();
  3412. }
  3413. }//end while
  3414. Date utilDate = new Date();
  3415. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  3416. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  3417. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  3418. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  3419. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  3420. entity.setCreby(user.getUsername());
  3421. }
  3422. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null) {
  3423. return form09Service.getColumnChartData(entity);
  3424. }
  3425. } catch (Exception ex) {
  3426. ex.printStackTrace();
  3427. } finally {
  3428. }
  3429. return null;
  3430. }
  3431. @Override
  3432. public List<BasicDBObject> getForm11PieChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  3433. System.out.println("Hospital Service Implament ::: getForm11PieChartData");
  3434. try {
  3435. IForm11Service form11Service = new Form11ServiceImpl(super.conn);
  3436. User user = sessionUser.get(sessionId);
  3437. Form11Entity form11Entity = new Form11Entity();
  3438. Iterator it = criteria.entrySet().iterator();
  3439. while (it.hasNext()) {
  3440. Map.Entry pairs = (Map.Entry) it.next();
  3441. try {
  3442. if (pairs.getKey().equals(form11Entity.ID)) {
  3443. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
  3444. form11Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  3445. }
  3446. } else if (pairs.getKey().equals(form11Entity.AIMAG)) {
  3447. form11Entity.setAimag(String.valueOf(pairs.getValue()));
  3448. } else if (pairs.getKey().equals(form11Entity.SUM)) {
  3449. form11Entity.setSum(String.valueOf(pairs.getValue()));
  3450. } else if (pairs.getKey().equals(form11Entity.BAGCODE)) {
  3451. form11Entity.setBagCode(String.valueOf(pairs.getValue()));
  3452. } else if (pairs.getKey().equals(form11Entity.MALTURUL)) {
  3453. form11Entity.setMalTurul(String.valueOf(pairs.getValue()));
  3454. } else if (pairs.getKey().equals(form11Entity.DEEJIINTURUL)) {
  3455. form11Entity.setDeejiinTurul(String.valueOf(pairs.getValue()));
  3456. } else if (pairs.getKey().equals(form11Entity.SUMBAGNER)) {
  3457. form11Entity.setSumBagNer(String.valueOf(pairs.getValue()));
  3458. } else if (pairs.getKey().equals(form11Entity.TOOTOLGOI)) {
  3459. try {
  3460. form11Entity.setTooTolgoi(Long.parseLong(String.valueOf(pairs.getValue())));
  3461. } catch (Exception e) {
  3462. form11Entity.setTooTolgoi(Long.parseLong(String.valueOf("0")));
  3463. }
  3464. } else if (pairs.getKey().equals(form11Entity.HAANASHINJILSEN)) {
  3465. form11Entity.setHaanaShinjilsen(String.valueOf(pairs.getValue()));
  3466. } else if (pairs.getKey().equals(form11Entity.SHINJILSENARGA)) {
  3467. form11Entity.setShinjilsenArga(String.valueOf(pairs.getValue()));
  3468. } else if (pairs.getKey().equals(form11Entity.ERUUL)) {
  3469. try {
  3470. form11Entity.setEruul(Long.parseLong(String.valueOf(pairs.getValue())));
  3471. } catch (Exception e) {
  3472. form11Entity.setEruul(Long.parseLong(String.valueOf("0")));
  3473. }
  3474. } else if (pairs.getKey().equals(form11Entity.UVCHTEI)) {
  3475. try {
  3476. form11Entity.setUvchtei(Long.parseLong(String.valueOf(pairs.getValue())));
  3477. } catch (Exception e) {
  3478. form11Entity.setUvchtei(Long.parseLong(String.valueOf("0")));
  3479. }
  3480. } else if (pairs.getKey().equals(form11Entity.ONOSH)) {
  3481. try {
  3482. form11Entity.setOnosh(Long.parseLong(String.valueOf(pairs.getValue())));
  3483. } catch (Exception e) {
  3484. form11Entity.setOnosh(Long.parseLong(String.valueOf("0")));
  3485. }
  3486. } else if (pairs.getKey().equals(form11Entity.RECORD_DATE)) {
  3487. String dv = String.valueOf(pairs.getValue());
  3488. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3489. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3490. form11Entity.setRecordDate(sqlDate);
  3491. } else if (pairs.getKey().equals(form11Entity.SEARCH_RECORD_DATE)) {
  3492. String dv = String.valueOf(pairs.getValue());
  3493. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3494. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3495. form11Entity.setSearchRecordDate(sqlDate);
  3496. }
  3497. } catch (NullPointerException ex) {
  3498. ex.printStackTrace();
  3499. } catch (Exception ex) {
  3500. ex.printStackTrace();
  3501. }
  3502. }//end while
  3503. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  3504. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  3505. form11Entity.setCreby(user.getUsername());
  3506. }
  3507. if (form11Entity != null && form11Entity.getRecordDate() != null && form11Entity.getSearchRecordDate() != null) {
  3508. return form11Service.getPieChartData(form11Entity);
  3509. }
  3510. } catch (Exception ex) {
  3511. ex.printStackTrace();
  3512. } finally {
  3513. }
  3514. return null;
  3515. }
  3516. @Override
  3517. public BasicDBObject getForm11ColumnChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  3518. System.out.println("Hospital Service Implament ::: getForm11ColumnChartData");
  3519. try {
  3520. IForm11Service form11Service = new Form11ServiceImpl(super.conn);
  3521. User user = sessionUser.get(sessionId);
  3522. Form11Entity form11Entity = new Form11Entity();
  3523. Iterator it = criteria.entrySet().iterator();
  3524. while (it.hasNext()) {
  3525. Map.Entry pairs = (Map.Entry) it.next();
  3526. try {
  3527. if (pairs.getKey().equals(form11Entity.ID)) {
  3528. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
  3529. form11Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  3530. }
  3531. } else if (pairs.getKey().equals(form11Entity.AIMAG)) {
  3532. form11Entity.setAimag(String.valueOf(pairs.getValue()));
  3533. } else if (pairs.getKey().equals(form11Entity.SUM)) {
  3534. form11Entity.setSum(String.valueOf(pairs.getValue()));
  3535. } else if (pairs.getKey().equals(form11Entity.BAGCODE)) {
  3536. form11Entity.setBagCode(String.valueOf(pairs.getValue()));
  3537. } else if (pairs.getKey().equals(form11Entity.MALTURUL)) {
  3538. form11Entity.setMalTurul(String.valueOf(pairs.getValue()));
  3539. } else if (pairs.getKey().equals(form11Entity.DEEJIINTURUL)) {
  3540. form11Entity.setDeejiinTurul(String.valueOf(pairs.getValue()));
  3541. } else if (pairs.getKey().equals(form11Entity.SUMBAGNER)) {
  3542. form11Entity.setSumBagNer(String.valueOf(pairs.getValue()));
  3543. } else if (pairs.getKey().equals(form11Entity.TOOTOLGOI)) {
  3544. try {
  3545. form11Entity.setTooTolgoi(Long.parseLong(String.valueOf(pairs.getValue())));
  3546. } catch (Exception e) {
  3547. form11Entity.setTooTolgoi(Long.parseLong(String.valueOf("0")));
  3548. }
  3549. } else if (pairs.getKey().equals(form11Entity.HAANASHINJILSEN)) {
  3550. form11Entity.setHaanaShinjilsen(String.valueOf(pairs.getValue()));
  3551. } else if (pairs.getKey().equals(form11Entity.SHINJILSENARGA)) {
  3552. form11Entity.setShinjilsenArga(String.valueOf(pairs.getValue()));
  3553. } else if (pairs.getKey().equals(form11Entity.ERUUL)) {
  3554. try {
  3555. form11Entity.setEruul(Long.parseLong(String.valueOf(pairs.getValue())));
  3556. } catch (Exception e) {
  3557. form11Entity.setEruul(Long.parseLong(String.valueOf("0")));
  3558. }
  3559. } else if (pairs.getKey().equals(form11Entity.UVCHTEI)) {
  3560. try {
  3561. form11Entity.setUvchtei(Long.parseLong(String.valueOf(pairs.getValue())));
  3562. } catch (Exception e) {
  3563. form11Entity.setUvchtei(Long.parseLong(String.valueOf("0")));
  3564. }
  3565. } else if (pairs.getKey().equals(form11Entity.ONOSH)) {
  3566. try {
  3567. form11Entity.setOnosh(Long.parseLong(String.valueOf(pairs.getValue())));
  3568. } catch (Exception e) {
  3569. form11Entity.setOnosh(Long.parseLong(String.valueOf("0")));
  3570. }
  3571. } else if (pairs.getKey().equals(form11Entity.RECORD_DATE)) {
  3572. String dv = String.valueOf(pairs.getValue());
  3573. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3574. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3575. form11Entity.setRecordDate(sqlDate);
  3576. } else if (pairs.getKey().equals(form11Entity.SEARCH_RECORD_DATE)) {
  3577. String dv = String.valueOf(pairs.getValue());
  3578. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3579. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3580. form11Entity.setSearchRecordDate(sqlDate);
  3581. }
  3582. } catch (NullPointerException ex) {
  3583. ex.printStackTrace();
  3584. } catch (Exception ex) {
  3585. ex.printStackTrace();
  3586. }
  3587. }//end while
  3588. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  3589. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  3590. form11Entity.setCreby(user.getUsername());
  3591. }
  3592. if (form11Entity != null && form11Entity.getRecordDate() != null && form11Entity.getSearchRecordDate() != null) {
  3593. return form11Service.getColumnChartData(form11Entity);
  3594. }
  3595. } catch (Exception ex) {
  3596. ex.printStackTrace();
  3597. } finally {
  3598. }
  3599. return null;
  3600. }
  3601. @Override
  3602. public BasicDBObject getForm08HightChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  3603. System.out.println("Hospital Service Implament ::: get form 08 data");
  3604. try {
  3605. IForm08Service form08Service = new Form08ServiceImpl(super.conn);
  3606. User user = sessionUser.get(sessionId);
  3607. Form08Entity form08Entity = new Form08Entity();
  3608. Iterator it = criteria.entrySet().iterator();
  3609. //Check Role
  3610. /*roleControl = new CheckUserRoleControl(super.conn);
  3611. if (roleControl == null) {
  3612. return null;
  3613. }
  3614. menuid = menuid.replaceAll("#", "");
  3615. if (!roleControl.checkRole(user, menuid, 1)){
  3616. return null;
  3617. }*/
  3618. //End Check Role
  3619. while (it.hasNext()) {
  3620. Map.Entry pairs = (Map.Entry) it.next();
  3621. try {
  3622. if (pairs.getKey().equals(form08Entity.ID)) {
  3623. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  3624. form08Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  3625. } else if (pairs.getKey().equals(form08Entity.AIMAG)) {
  3626. form08Entity.setAimag(String.valueOf(pairs.getValue()));
  3627. } else if (pairs.getKey().equals(form08Entity.SUM)) {
  3628. form08Entity.setSum(String.valueOf(pairs.getValue()));
  3629. } else if (pairs.getKey().equals(form08Entity.MALTURUL)) {
  3630. form08Entity.setMalTurul(String.valueOf(pairs.getValue()));
  3631. } else if (pairs.getKey().equals(form08Entity.ARGA_HEMJEE_NER)) {
  3632. form08Entity.setArgaHemjeeNer(String.valueOf(pairs.getValue()));
  3633. } else if (pairs.getKey().equals(form08Entity.NER)) {
  3634. form08Entity.setNer(String.valueOf(pairs.getValue()));
  3635. } else if (pairs.getKey().equals(form08Entity.ZARTSUULSAN_HEMJEE)) {
  3636. form08Entity.setZartsuulsanHemjee(String.valueOf(pairs.getValue()));
  3637. } else if (pairs.getKey().equals(form08Entity.TOLOVLOGOO)) {
  3638. form08Entity.setTolovlogoo(String.valueOf(pairs.getValue()));
  3639. } else if (pairs.getKey().equals(form08Entity.GUITSETGEL)) {
  3640. form08Entity.setGuitsetgel(String.valueOf(pairs.getValue()));
  3641. } else if (pairs.getKey().equals(form08Entity.HUVI)) {
  3642. form08Entity.setHuvi(String.valueOf(pairs.getValue()));
  3643. } else if (pairs.getKey().equals(form08Entity.RECORD_DATE)) {
  3644. String dv = String.valueOf(pairs.getValue());
  3645. if (dv != null && !dv.isEmpty()) {
  3646. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3647. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3648. form08Entity.setRecordDate(sqlDate);
  3649. }
  3650. } else if (pairs.getKey().equals(form08Entity.SEARCH_RECORD_DATE)) {
  3651. String dv = String.valueOf(pairs.getValue());
  3652. if (dv != null && !dv.isEmpty()) {
  3653. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3654. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3655. form08Entity.setSearchRecordDate(sqlDate);
  3656. }
  3657. }
  3658. } catch (NullPointerException ex) {
  3659. ex.printStackTrace();
  3660. } catch (Exception ex) {
  3661. ex.printStackTrace();
  3662. }
  3663. }//end while
  3664. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  3665. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  3666. form08Entity.setCreby(user.getUsername());
  3667. }
  3668. //if(form08Entity.getSum() == null)form08Entity.setSum(user.getSum());
  3669. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  3670. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  3671. form08Entity.setCreby(user.getUsername());
  3672. }
  3673. form08Entity.setDelflg("N");
  3674. form08Entity.setActflg("Y");
  3675. if (form08Entity != null && form08Entity.getRecordDate() != null && form08Entity.getSearchRecordDate() != null) {
  3676. return form08Service.getColHighChartData(form08Entity);
  3677. }
  3678. } catch (Exception ex) {
  3679. ex.printStackTrace();
  3680. } finally {
  3681. }
  3682. return null;
  3683. }
  3684. @Override
  3685. public BasicDBObject getForm08HightPieChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  3686. System.out.println("Hospital Service Implament ::: getForm08HightPieChartData");
  3687. try {
  3688. IForm08Service form08Service = new Form08ServiceImpl(super.conn);
  3689. User user = sessionUser.get(sessionId);
  3690. Form08Entity form08Entity = new Form08Entity();
  3691. Iterator it = criteria.entrySet().iterator();
  3692. while (it.hasNext()) {
  3693. Map.Entry pairs = (Map.Entry) it.next();
  3694. try {
  3695. if (pairs.getKey().equals(form08Entity.ID)) {
  3696. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  3697. form08Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  3698. } else if (pairs.getKey().equals(form08Entity.AIMAG)) {
  3699. form08Entity.setAimag(String.valueOf(pairs.getValue()));
  3700. } else if (pairs.getKey().equals(form08Entity.SUM)) {
  3701. form08Entity.setSum(String.valueOf(pairs.getValue()));
  3702. } else if (pairs.getKey().equals(form08Entity.MALTURUL)) {
  3703. form08Entity.setMalTurul(String.valueOf(pairs.getValue()));
  3704. } else if (pairs.getKey().equals(form08Entity.ARGA_HEMJEE_NER)) {
  3705. form08Entity.setArgaHemjeeNer(String.valueOf(pairs.getValue()));
  3706. } else if (pairs.getKey().equals(form08Entity.NER)) {
  3707. form08Entity.setNer(String.valueOf(pairs.getValue()));
  3708. } else if (pairs.getKey().equals(form08Entity.ZARTSUULSAN_HEMJEE)) {
  3709. form08Entity.setZartsuulsanHemjee(String.valueOf(pairs.getValue()));
  3710. } else if (pairs.getKey().equals(form08Entity.TOLOVLOGOO)) {
  3711. form08Entity.setTolovlogoo(String.valueOf(pairs.getValue()));
  3712. } else if (pairs.getKey().equals(form08Entity.GUITSETGEL)) {
  3713. form08Entity.setGuitsetgel(String.valueOf(pairs.getValue()));
  3714. } else if (pairs.getKey().equals(form08Entity.HUVI)) {
  3715. form08Entity.setHuvi(String.valueOf(pairs.getValue()));
  3716. } else if (pairs.getKey().equals(form08Entity.RECORD_DATE)) {
  3717. String dv = String.valueOf(pairs.getValue());
  3718. if (dv != null && !dv.isEmpty()) {
  3719. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3720. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3721. form08Entity.setRecordDate(sqlDate);
  3722. }
  3723. } else if (pairs.getKey().equals(form08Entity.SEARCH_RECORD_DATE)) {
  3724. String dv = String.valueOf(pairs.getValue());
  3725. if (dv != null && !dv.isEmpty()) {
  3726. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3727. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3728. form08Entity.setSearchRecordDate(sqlDate);
  3729. }
  3730. }
  3731. } catch (NullPointerException ex) {
  3732. ex.printStackTrace();
  3733. } catch (Exception ex) {
  3734. ex.printStackTrace();
  3735. }
  3736. }//end while
  3737. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  3738. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  3739. form08Entity.setCreby(user.getUsername());
  3740. if (form08Entity.getAimag() == null) form08Entity.setAimag(user.getCity());
  3741. }
  3742. form08Entity.setDelflg("N");
  3743. form08Entity.setActflg("Y");
  3744. if (form08Entity != null && form08Entity.getRecordDate() != null && form08Entity.getSearchRecordDate() != null) {
  3745. return form08Service.getPieHighChartData(form08Entity);
  3746. }
  3747. } catch (Exception ex) {
  3748. ex.printStackTrace();
  3749. } finally {
  3750. }
  3751. return null;
  3752. }
  3753. @Override
  3754. public BasicDBObject getForm08HavHightChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  3755. System.out.println("Hospital Service Implament ::: get form 08 havsralt hight chart data");
  3756. try {
  3757. IForm08HavsraltService service = new Form08HavsraltServiceImpl(super.conn);
  3758. User user = sessionUser.get(sessionId);
  3759. Form08HavsraltEntity entity = new Form08HavsraltEntity();
  3760. Iterator it = criteria.entrySet().iterator();
  3761. while (it.hasNext()) {
  3762. Map.Entry pairs = (Map.Entry) it.next();
  3763. try {
  3764. if (!pairs.getValue().toString().isEmpty()) {
  3765. if (pairs.getKey().equals(entity.ID)) {
  3766. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  3767. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  3768. } else if (pairs.getKey().equals(entity.CITYCODE)) {
  3769. entity.setCitycode(String.valueOf(pairs.getValue()));
  3770. } else if (pairs.getKey().equals(entity.SUMCODE)) {
  3771. entity.setSumcode(String.valueOf(pairs.getValue()));
  3772. } else if (pairs.getKey().equals(entity.BAGCODE)) {
  3773. entity.setBagcode(String.valueOf(pairs.getValue()));
  3774. } else if (pairs.getKey().equals(entity.GAZARNER)) {
  3775. entity.setGazarner(String.valueOf(pairs.getValue()));
  3776. } else if (pairs.getKey().equals(entity.URTRAG)) {
  3777. entity.setUrtrag(String.valueOf(pairs.getValue()));
  3778. } else if (pairs.getKey().equals(entity.ORGOROG)) {
  3779. entity.setOrgorog(String.valueOf(pairs.getValue()));
  3780. } else if (pairs.getKey().equals(entity.GOLOMTTOO)) {
  3781. entity.setGolomttoo(Integer.parseInt(String.valueOf(pairs.getValue())));
  3782. } else if (pairs.getKey().equals(entity.OVCHIN_NER)) {
  3783. entity.setOvchin_ner(String.valueOf(pairs.getValue()));
  3784. } else if (pairs.getKey().equals(entity.MAL_TURUL)) {
  3785. entity.setMal_turul(String.valueOf(pairs.getValue()));
  3786. } else if (pairs.getKey().equals(entity.UVCHILSON)) {
  3787. entity.setUvchilson(Integer.parseInt(String.valueOf(pairs.getValue())));
  3788. } else if (pairs.getKey().equals(entity.UHSEN)) {
  3789. entity.setUhsen(Integer.parseInt(String.valueOf(pairs.getValue())));
  3790. } else if (pairs.getKey().equals(entity.EDGERSEN)) {
  3791. entity.setEdgersen(Integer.parseInt(String.valueOf(pairs.getValue())));
  3792. } else if (pairs.getKey().equals(entity.USTGASAN)) {
  3793. entity.setUstgasan(Integer.parseInt(String.valueOf(pairs.getValue())));
  3794. } else if (pairs.getKey().equals(entity.NYDLUULSAN)) {
  3795. entity.setNydluulsan(Integer.parseInt(String.valueOf(pairs.getValue())));
  3796. } else if (pairs.getKey().equals(entity.LAB_NER)) {
  3797. entity.setLab_ner(String.valueOf(pairs.getValue()));
  3798. } else if (pairs.getKey().equals(entity.SHINJILGEE_ARGA)) {
  3799. entity.setShinjilgee_arga(String.valueOf(pairs.getValue()));
  3800. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  3801. String dv = String.valueOf(pairs.getValue());
  3802. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3803. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3804. entity.setRecordDate(sqlDate);
  3805. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  3806. String dv = String.valueOf(pairs.getValue());
  3807. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3808. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3809. entity.setSearchRecordDate(sqlDate);
  3810. }
  3811. }
  3812. } catch (NullPointerException ex) {
  3813. ex.printStackTrace();
  3814. } catch (Exception ex) {
  3815. ex.printStackTrace();
  3816. }
  3817. }//end while
  3818. Date utilDate = new Date();
  3819. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  3820. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  3821. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  3822. entity.setDelflg("N");
  3823. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  3824. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  3825. entity.setCreby(user.getUsername());
  3826. }
  3827. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null) {
  3828. return service.getColHighChartData(entity);
  3829. }
  3830. } catch (Exception ex) {
  3831. ex.printStackTrace();
  3832. } finally {
  3833. }
  3834. return null;
  3835. }
  3836. @Override
  3837. public BasicDBObject getForm08HavHightPieChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  3838. System.out.println("Hospital Service Implament ::: getForm08HavHightPieChartData");
  3839. try {
  3840. IForm08HavsraltService service = new Form08HavsraltServiceImpl(super.conn);
  3841. User user = sessionUser.get(sessionId);
  3842. Form08HavsraltEntity entity = new Form08HavsraltEntity();
  3843. Iterator it = criteria.entrySet().iterator();
  3844. while (it.hasNext()) {
  3845. Map.Entry pairs = (Map.Entry) it.next();
  3846. try {
  3847. if (!pairs.getValue().toString().isEmpty()) {
  3848. if (pairs.getKey().equals(entity.ID)) {
  3849. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  3850. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  3851. } else if (pairs.getKey().equals(entity.CITYCODE)) {
  3852. entity.setCitycode(String.valueOf(pairs.getValue()));
  3853. } else if (pairs.getKey().equals(entity.SUMCODE)) {
  3854. entity.setSumcode(String.valueOf(pairs.getValue()));
  3855. } else if (pairs.getKey().equals(entity.BAGCODE)) {
  3856. entity.setBagcode(String.valueOf(pairs.getValue()));
  3857. } else if (pairs.getKey().equals(entity.GAZARNER)) {
  3858. entity.setGazarner(String.valueOf(pairs.getValue()));
  3859. } else if (pairs.getKey().equals(entity.URTRAG)) {
  3860. entity.setUrtrag(String.valueOf(pairs.getValue()));
  3861. } else if (pairs.getKey().equals(entity.ORGOROG)) {
  3862. entity.setOrgorog(String.valueOf(pairs.getValue()));
  3863. } else if (pairs.getKey().equals(entity.GOLOMTTOO)) {
  3864. entity.setGolomttoo(Integer.parseInt(String.valueOf(pairs.getValue())));
  3865. } else if (pairs.getKey().equals(entity.OVCHIN_NER)) {
  3866. entity.setOvchin_ner(String.valueOf(pairs.getValue()));
  3867. } else if (pairs.getKey().equals(entity.MAL_TURUL)) {
  3868. entity.setMal_turul(String.valueOf(pairs.getValue()));
  3869. } else if (pairs.getKey().equals(entity.UVCHILSON)) {
  3870. entity.setUvchilson(Integer.parseInt(String.valueOf(pairs.getValue())));
  3871. } else if (pairs.getKey().equals(entity.UHSEN)) {
  3872. entity.setUhsen(Integer.parseInt(String.valueOf(pairs.getValue())));
  3873. } else if (pairs.getKey().equals(entity.EDGERSEN)) {
  3874. entity.setEdgersen(Integer.parseInt(String.valueOf(pairs.getValue())));
  3875. } else if (pairs.getKey().equals(entity.USTGASAN)) {
  3876. entity.setUstgasan(Integer.parseInt(String.valueOf(pairs.getValue())));
  3877. } else if (pairs.getKey().equals(entity.NYDLUULSAN)) {
  3878. entity.setNydluulsan(Integer.parseInt(String.valueOf(pairs.getValue())));
  3879. } else if (pairs.getKey().equals(entity.LAB_NER)) {
  3880. entity.setLab_ner(String.valueOf(pairs.getValue()));
  3881. } else if (pairs.getKey().equals(entity.SHINJILGEE_ARGA)) {
  3882. entity.setShinjilgee_arga(String.valueOf(pairs.getValue()));
  3883. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  3884. String dv = String.valueOf(pairs.getValue());
  3885. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3886. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3887. entity.setRecordDate(sqlDate);
  3888. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  3889. String dv = String.valueOf(pairs.getValue());
  3890. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3891. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3892. entity.setSearchRecordDate(sqlDate);
  3893. }
  3894. }
  3895. } catch (NullPointerException ex) {
  3896. ex.printStackTrace();
  3897. } catch (Exception ex) {
  3898. ex.printStackTrace();
  3899. }
  3900. }//end while
  3901. Date utilDate = new Date();
  3902. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  3903. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  3904. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  3905. entity.setDelflg("N");
  3906. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  3907. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  3908. entity.setCreby(user.getUsername());
  3909. }
  3910. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null) {
  3911. return service.getPieHighChartData(entity);
  3912. }
  3913. } catch (Exception ex) {
  3914. ex.printStackTrace();
  3915. } finally {
  3916. }
  3917. return null;
  3918. }
  3919. // form09hav-chart
  3920. @Override
  3921. public BasicDBObject getForm09HavHightChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  3922. System.out.println("Hospital Service Implament ::: get form 08 havsralt hight chart data");
  3923. try {
  3924. IForm09HavsraltService service = new Form09HavsraltServiceImpl(super.conn);
  3925. User user = sessionUser.get(sessionId);
  3926. Form09HavsraltEntity entity = new Form09HavsraltEntity();
  3927. Iterator it = criteria.entrySet().iterator();
  3928. while (it.hasNext()) {
  3929. Map.Entry pairs = (Map.Entry) it.next();
  3930. try {
  3931. if (!pairs.getValue().toString().isEmpty()) {
  3932. if (pairs.getKey().equals(entity.ID)) {
  3933. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  3934. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  3935. } else if (pairs.getKey().equals(entity.CITYCODE)) {
  3936. entity.setCitycode(String.valueOf(pairs.getValue()));
  3937. } else if (pairs.getKey().equals(entity.SUMCODE)) {
  3938. entity.setSumcode(String.valueOf(pairs.getValue()));
  3939. } else if (pairs.getKey().equals(entity.BAGCODE)) {
  3940. entity.setBagcode(String.valueOf(pairs.getValue()));
  3941. } else if (pairs.getKey().equals(entity.GAZARNER)) {
  3942. entity.setGazarner(String.valueOf(pairs.getValue()));
  3943. } else if (pairs.getKey().equals(entity.URTRAG)) {
  3944. entity.setUrtrag(String.valueOf(pairs.getValue()));
  3945. } else if (pairs.getKey().equals(entity.ORGOROG)) {
  3946. entity.setOrgorog(String.valueOf(pairs.getValue()));
  3947. } else if (pairs.getKey().equals(entity.GOLOMTTOO)) {
  3948. entity.setGolomttoo(Integer.parseInt(String.valueOf(pairs.getValue())));
  3949. } else if (pairs.getKey().equals(entity.OVCHIN_NER)) {
  3950. entity.setOvchin_ner(String.valueOf(pairs.getValue()));
  3951. } else if (pairs.getKey().equals(entity.MAL_TURUL)) {
  3952. entity.setMal_turul(String.valueOf(pairs.getValue()));
  3953. } else if (pairs.getKey().equals(entity.UVCHILSON)) {
  3954. entity.setUvchilson(Integer.parseInt(String.valueOf(pairs.getValue())));
  3955. } else if (pairs.getKey().equals(entity.UHSEN)) {
  3956. entity.setUhsen(Integer.parseInt(String.valueOf(pairs.getValue())));
  3957. } else if (pairs.getKey().equals(entity.EDGERSEN)) {
  3958. entity.setEdgersen(Integer.parseInt(String.valueOf(pairs.getValue())));
  3959. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  3960. String dv = String.valueOf(pairs.getValue());
  3961. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3962. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3963. entity.setRecordDate(sqlDate);
  3964. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  3965. String dv = String.valueOf(pairs.getValue());
  3966. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  3967. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  3968. entity.setSearchRecordDate(sqlDate);
  3969. }
  3970. }
  3971. } catch (NullPointerException ex) {
  3972. ex.printStackTrace();
  3973. } catch (Exception ex) {
  3974. ex.printStackTrace();
  3975. }
  3976. }//end while
  3977. Date utilDate = new Date();
  3978. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  3979. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  3980. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  3981. entity.setDelflg("N");
  3982. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  3983. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  3984. entity.setCreby(user.getUsername());
  3985. }
  3986. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null) {
  3987. return service.getColHighChartData(entity);
  3988. }
  3989. } catch (Exception ex) {
  3990. ex.printStackTrace();
  3991. } finally {
  3992. }
  3993. return null;
  3994. }
  3995. @Override
  3996. public BasicDBObject getForm09HavHightPieChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  3997. System.out.println("Hospital Service Implament ::: getForm08HavHightPieChartData");
  3998. try {
  3999. IForm09HavsraltService service = new Form09HavsraltServiceImpl(super.conn);
  4000. User user = sessionUser.get(sessionId);
  4001. Form09HavsraltEntity entity = new Form09HavsraltEntity();
  4002. Iterator it = criteria.entrySet().iterator();
  4003. while (it.hasNext()) {
  4004. Map.Entry pairs = (Map.Entry) it.next();
  4005. try {
  4006. if (!pairs.getValue().toString().isEmpty()) {
  4007. if (pairs.getKey().equals(entity.ID)) {
  4008. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  4009. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  4010. } else if (pairs.getKey().equals(entity.CITYCODE)) {
  4011. entity.setCitycode(String.valueOf(pairs.getValue()));
  4012. } else if (pairs.getKey().equals(entity.SUMCODE)) {
  4013. entity.setSumcode(String.valueOf(pairs.getValue()));
  4014. } else if (pairs.getKey().equals(entity.BAGCODE)) {
  4015. entity.setBagcode(String.valueOf(pairs.getValue()));
  4016. } else if (pairs.getKey().equals(entity.GAZARNER)) {
  4017. entity.setGazarner(String.valueOf(pairs.getValue()));
  4018. } else if (pairs.getKey().equals(entity.URTRAG)) {
  4019. entity.setUrtrag(String.valueOf(pairs.getValue()));
  4020. } else if (pairs.getKey().equals(entity.ORGOROG)) {
  4021. entity.setOrgorog(String.valueOf(pairs.getValue()));
  4022. } else if (pairs.getKey().equals(entity.GOLOMTTOO)) {
  4023. entity.setGolomttoo(Integer.parseInt(String.valueOf(pairs.getValue())));
  4024. } else if (pairs.getKey().equals(entity.OVCHIN_NER)) {
  4025. entity.setOvchin_ner(String.valueOf(pairs.getValue()));
  4026. } else if (pairs.getKey().equals(entity.MAL_TURUL)) {
  4027. entity.setMal_turul(String.valueOf(pairs.getValue()));
  4028. } else if (pairs.getKey().equals(entity.UVCHILSON)) {
  4029. entity.setUvchilson(Integer.parseInt(String.valueOf(pairs.getValue())));
  4030. } else if (pairs.getKey().equals(entity.UHSEN)) {
  4031. entity.setUhsen(Integer.parseInt(String.valueOf(pairs.getValue())));
  4032. } else if (pairs.getKey().equals(entity.EDGERSEN)) {
  4033. entity.setEdgersen(Integer.parseInt(String.valueOf(pairs.getValue())));
  4034. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  4035. String dv = String.valueOf(pairs.getValue());
  4036. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4037. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4038. entity.setRecordDate(sqlDate);
  4039. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  4040. String dv = String.valueOf(pairs.getValue());
  4041. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4042. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4043. entity.setSearchRecordDate(sqlDate);
  4044. }
  4045. }
  4046. } catch (NullPointerException ex) {
  4047. ex.printStackTrace();
  4048. } catch (Exception ex) {
  4049. ex.printStackTrace();
  4050. }
  4051. }//end while
  4052. Date utilDate = new Date();
  4053. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  4054. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  4055. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  4056. entity.setDelflg("N");
  4057. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  4058. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  4059. entity.setCreby(user.getUsername());
  4060. }
  4061. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null) {
  4062. return service.getPieHighChartData(entity);
  4063. }
  4064. } catch (Exception ex) {
  4065. ex.printStackTrace();
  4066. } finally {
  4067. }
  4068. return null;
  4069. }
  4070. // form09hav-chart
  4071. // form11-chart
  4072. @Override
  4073. public BasicDBObject getForm11HightChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  4074. System.out.println("Hospital Service Implament ::: get form 11 havsralt hight chart data");
  4075. try{
  4076. IForm11Service service = new Form11ServiceImpl(super.conn);
  4077. User user = sessionUser.get(sessionId);
  4078. Form11Entity form11Entity = new Form11Entity();
  4079. Iterator it = criteria.entrySet().iterator();
  4080. while (it.hasNext()) {
  4081. Map.Entry pairs = (Map.Entry) it.next();
  4082. try{
  4083. if (!pairs.getValue().toString().isEmpty()){
  4084. if (pairs.getKey().equals(form11Entity.ID)) {
  4085. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  4086. form11Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  4087. }
  4088. else if (pairs.getKey().equals(form11Entity.AIMAG)) {
  4089. form11Entity.setAimag(String.valueOf(pairs.getValue()));
  4090. } else if (pairs.getKey().equals(form11Entity.SUM)) {
  4091. form11Entity.setSum(String.valueOf(pairs.getValue()));
  4092. } else if (pairs.getKey().equals(form11Entity.BAGCODE)) {
  4093. form11Entity.setBagCode(String.valueOf(pairs.getValue()));
  4094. } else if (pairs.getKey().equals(form11Entity.MALTURUL)) {
  4095. form11Entity.setMalTurul(String.valueOf(pairs.getValue()));
  4096. } else if (pairs.getKey().equals(form11Entity.DEEJIINTURUL)) {
  4097. form11Entity.setDeejiinTurul(String.valueOf(pairs.getValue()));
  4098. } else if (pairs.getKey().equals(form11Entity.SUMBAGNER)) {
  4099. form11Entity.setSumBagNer(String.valueOf(pairs.getValue()));
  4100. } else if (pairs.getKey().equals(form11Entity.TOOTOLGOI)) {
  4101. try {
  4102. form11Entity.setTooTolgoi(Long.parseLong(String.valueOf(pairs.getValue())));
  4103. } catch (Exception e) {
  4104. form11Entity.setTooTolgoi(Long.parseLong(String.valueOf("0")));
  4105. }
  4106. } else if (pairs.getKey().equals(form11Entity.HAANASHINJILSEN)) {
  4107. form11Entity.setHaanaShinjilsen(String.valueOf(pairs.getValue()));
  4108. } else if (pairs.getKey().equals(form11Entity.SHINJILSENARGA)) {
  4109. form11Entity.setShinjilsenArga(String.valueOf(pairs.getValue()));
  4110. } else if (pairs.getKey().equals(form11Entity.ERUUL)) {
  4111. try {
  4112. form11Entity.setEruul(Long.parseLong(String.valueOf(pairs.getValue())));
  4113. } catch (Exception e) {
  4114. form11Entity.setEruul(Long.parseLong(String.valueOf("0")));
  4115. }
  4116. } else if (pairs.getKey().equals(form11Entity.UVCHTEI)) {
  4117. try {
  4118. form11Entity.setUvchtei(Long.parseLong(String.valueOf(pairs.getValue())));
  4119. } catch (Exception e) {
  4120. form11Entity.setUvchtei(Long.parseLong(String.valueOf("0")));
  4121. }
  4122. } else if (pairs.getKey().equals(form11Entity.ONOSH)) {
  4123. try {
  4124. form11Entity.setOnosh(Long.parseLong(String.valueOf(pairs.getValue())));
  4125. } catch (Exception e) {
  4126. form11Entity.setOnosh(Long.parseLong(String.valueOf("0")));
  4127. }
  4128. } else if (pairs.getKey().equals(form11Entity.RECORD_DATE)) {
  4129. String dv = String.valueOf(pairs.getValue());
  4130. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4131. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4132. form11Entity.setRecordDate(sqlDate);
  4133. } else if (pairs.getKey().equals(form11Entity.SEARCH_RECORD_DATE)) {
  4134. String dv = String.valueOf(pairs.getValue());
  4135. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4136. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4137. form11Entity.setSearchRecordDate(sqlDate);
  4138. }
  4139. }
  4140. }catch (NullPointerException ex){
  4141. ex.printStackTrace();
  4142. }catch (Exception ex){
  4143. ex.printStackTrace();
  4144. }
  4145. }//end while
  4146. Date utilDate = new Date();
  4147. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  4148. if (form11Entity.getRecordDate() == null) form11Entity.setRecordDate(sqlDate);
  4149. if (form11Entity.getSearchRecordDate() == null) form11Entity.setSearchRecordDate(sqlDate);
  4150. form11Entity.setDelflg("N");
  4151. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  4152. && !user.getRoleCode().equalsIgnoreCase("ADMIN")){
  4153. form11Entity.setCreby(user.getUsername());
  4154. }
  4155. if (form11Entity != null && form11Entity.getRecordDate() != null && form11Entity.getSearchRecordDate() != null){
  4156. return service.getColHighChartData(form11Entity);
  4157. }
  4158. }catch (Exception ex){
  4159. ex.printStackTrace();
  4160. }finally {
  4161. }
  4162. return null;
  4163. }
  4164. @Override
  4165. public BasicDBObject getForm11HightPieChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  4166. System.out.println("Hospital Service Implament ::: getForm11HightPieChartData");
  4167. try {
  4168. IForm11Service service = new Form11ServiceImpl(super.conn);
  4169. User user = sessionUser.get(sessionId);
  4170. Form11Entity form11Entity = new Form11Entity();
  4171. Iterator it = criteria.entrySet().iterator();
  4172. while (it.hasNext()) {
  4173. Map.Entry pairs = (Map.Entry) it.next();
  4174. try {
  4175. if (!pairs.getValue().toString().isEmpty()) {
  4176. if (pairs.getKey().equals(form11Entity.ID)) {
  4177. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  4178. form11Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  4179. } else if (pairs.getKey().equals(form11Entity.AIMAG)) {
  4180. form11Entity.setAimag(String.valueOf(pairs.getValue()));
  4181. } else if (pairs.getKey().equals(form11Entity.SUM)) {
  4182. form11Entity.setSum(String.valueOf(pairs.getValue()));
  4183. } else if (pairs.getKey().equals(form11Entity.BAGCODE)) {
  4184. form11Entity.setBagCode(String.valueOf(pairs.getValue()));
  4185. } else if (pairs.getKey().equals(form11Entity.MALTURUL)) {
  4186. form11Entity.setMalTurul(String.valueOf(pairs.getValue()));
  4187. } else if (pairs.getKey().equals(form11Entity.DEEJIINTURUL)) {
  4188. form11Entity.setDeejiinTurul(String.valueOf(pairs.getValue()));
  4189. } else if (pairs.getKey().equals(form11Entity.SUMBAGNER)) {
  4190. form11Entity.setSumBagNer(String.valueOf(pairs.getValue()));
  4191. } else if (pairs.getKey().equals(form11Entity.TOOTOLGOI)) {
  4192. try {
  4193. form11Entity.setTooTolgoi(Long.parseLong(String.valueOf(pairs.getValue())));
  4194. } catch (Exception e) {
  4195. form11Entity.setTooTolgoi(Long.parseLong(String.valueOf("0")));
  4196. }
  4197. } else if (pairs.getKey().equals(form11Entity.HAANASHINJILSEN)) {
  4198. form11Entity.setHaanaShinjilsen(String.valueOf(pairs.getValue()));
  4199. } else if (pairs.getKey().equals(form11Entity.SHINJILSENARGA)) {
  4200. form11Entity.setShinjilsenArga(String.valueOf(pairs.getValue()));
  4201. } else if (pairs.getKey().equals(form11Entity.ERUUL)) {
  4202. try {
  4203. form11Entity.setEruul(Long.parseLong(String.valueOf(pairs.getValue())));
  4204. } catch (Exception e) {
  4205. form11Entity.setEruul(Long.parseLong(String.valueOf("0")));
  4206. }
  4207. } else if (pairs.getKey().equals(form11Entity.UVCHTEI)) {
  4208. try {
  4209. form11Entity.setUvchtei(Long.parseLong(String.valueOf(pairs.getValue())));
  4210. } catch (Exception e) {
  4211. form11Entity.setUvchtei(Long.parseLong(String.valueOf("0")));
  4212. }
  4213. } else if (pairs.getKey().equals(form11Entity.ONOSH)) {
  4214. try {
  4215. form11Entity.setOnosh(Long.parseLong(String.valueOf(pairs.getValue())));
  4216. } catch (Exception e) {
  4217. form11Entity.setOnosh(Long.parseLong(String.valueOf("0")));
  4218. }
  4219. } else if (pairs.getKey().equals(form11Entity.RECORD_DATE)) {
  4220. String dv = String.valueOf(pairs.getValue());
  4221. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4222. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4223. form11Entity.setRecordDate(sqlDate);
  4224. } else if (pairs.getKey().equals(form11Entity.SEARCH_RECORD_DATE)) {
  4225. String dv = String.valueOf(pairs.getValue());
  4226. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4227. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4228. form11Entity.setSearchRecordDate(sqlDate);
  4229. }
  4230. }
  4231. } catch (NullPointerException ex) {
  4232. ex.printStackTrace();
  4233. } catch (Exception ex) {
  4234. ex.printStackTrace();
  4235. }
  4236. }//end while
  4237. Date utilDate = new Date();
  4238. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  4239. if (form11Entity.getRecordDate() == null) form11Entity.setRecordDate(sqlDate);
  4240. if (form11Entity.getSearchRecordDate() == null) form11Entity.setSearchRecordDate(sqlDate);
  4241. form11Entity.setDelflg("N");
  4242. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  4243. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  4244. form11Entity.setCreby(user.getUsername());
  4245. }
  4246. if (form11Entity != null && form11Entity.getRecordDate() != null && form11Entity.getSearchRecordDate() != null) {
  4247. return service.getPieHighChartData(form11Entity);
  4248. }
  4249. } catch (Exception ex) {
  4250. ex.printStackTrace();
  4251. } finally {
  4252. }
  4253. return null;
  4254. }
  4255. //form11-chart]
  4256. // form09-chart
  4257. @Override
  4258. public BasicDBObject getForm09HightChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  4259. System.out.println("Hospital Service Implament ::: get form 09 havsralt hight chart data");
  4260. try{
  4261. IForm09Service service = new Form09ServiceImpl(super.conn);
  4262. User user = sessionUser.get(sessionId);
  4263. Form09Entity form09Entity = new Form09Entity();
  4264. Iterator it = criteria.entrySet().iterator();
  4265. while (it.hasNext()) {
  4266. Map.Entry pairs = (Map.Entry) it.next();
  4267. try{
  4268. if (!pairs.getValue().toString().isEmpty()){
  4269. if (pairs.getKey().equals(form09Entity.ID)) {
  4270. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  4271. form09Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  4272. }
  4273. else if (pairs.getKey().equals(form09Entity.AIMAG)) {
  4274. form09Entity.setAimag(String.valueOf(pairs.getValue()));
  4275. } else if (pairs.getKey().equals(form09Entity.SUM)) {
  4276. form09Entity.setSum(form09Entity.SUM);
  4277. } else if (pairs.getKey().equals(form09Entity.MALTURUL)) {
  4278. form09Entity.setMalTurul(String.valueOf(pairs.getValue()));
  4279. } else if (pairs.getKey().equals(form09Entity.TARILGANER)) {
  4280. form09Entity.setTarilgaNer(String.valueOf(pairs.getValue()));
  4281. } else if (pairs.getKey().equals(form09Entity.NER)) {
  4282. form09Entity.setNer(String.valueOf(pairs.getValue()));
  4283. } else if (pairs.getKey().equals(form09Entity.ZARTSUULSANHEMJEE)) {
  4284. form09Entity.setZartsuulsanHemjee(String.valueOf(pairs.getValue()));
  4285. } else if (pairs.getKey().equals(form09Entity.TOLOVLOGOO)) {
  4286. form09Entity.setTolovlogoo(String.valueOf(pairs.getValue()));
  4287. } else if (pairs.getKey().equals(form09Entity.GUITSETGEL)) {
  4288. form09Entity.setGuitsetgel(String.valueOf(pairs.getValue()));
  4289. } else if (pairs.getKey().equals(form09Entity.HUVI)) {
  4290. form09Entity.setHuvi(String.valueOf(pairs.getValue()));
  4291. } else if (pairs.getKey().equals(form09Entity.OLGOSON_TUN)) {
  4292. try {
  4293. form09Entity.setOLGOSON_TUN(Long.valueOf(pairs.getValue().toString()));
  4294. } catch (NumberFormatException e) {
  4295. form09Entity.setOLGOSON_TUN(Long.parseLong("0"));
  4296. }
  4297. } else if (pairs.getKey().equals(form09Entity.HEREGLESEN_TUN)) {
  4298. try {
  4299. form09Entity.setHEREGLESEN_TUN(Long.valueOf(pairs.getValue().toString()));
  4300. } catch (NumberFormatException e) {
  4301. form09Entity.setHEREGLESEN_TUN(Long.parseLong("0"));
  4302. }
  4303. } else if (pairs.getKey().equals(form09Entity.USTGASAN_TUN)) {
  4304. try {
  4305. form09Entity.setUSTGASAN_TUN(Long.valueOf(pairs.getValue().toString()));
  4306. } catch (NumberFormatException e) {
  4307. form09Entity.setUSTGASAN_TUN(Long.parseLong("0"));
  4308. }
  4309. } else if (pairs.getKey().equals(form09Entity.NUUTSULSEN_TUN)) {
  4310. try {
  4311. form09Entity.setNUUTSULSEN_TUN(Long.valueOf(pairs.getValue().toString()));
  4312. } catch (NumberFormatException e) {
  4313. form09Entity.setNUUTSULSEN_TUN(Long.parseLong("0"));
  4314. }
  4315. } else if (pairs.getKey().equals(form09Entity.RECORD_DATE)) {
  4316. String dv = String.valueOf(pairs.getValue());
  4317. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4318. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4319. form09Entity.setRecordDate(sqlDate);
  4320. } else if (pairs.getKey().equals(form09Entity.SEARCH_RECORD_DATE)) {
  4321. String dv = String.valueOf(pairs.getValue());
  4322. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4323. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4324. form09Entity.setSearchRecordDate(sqlDate);
  4325. }
  4326. }
  4327. }catch (NullPointerException ex){
  4328. ex.printStackTrace();
  4329. }catch (Exception ex){
  4330. ex.printStackTrace();
  4331. }
  4332. }//end while
  4333. Date utilDate = new Date();
  4334. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  4335. if (form09Entity.getRecordDate() == null) form09Entity.setRecordDate(sqlDate);
  4336. if (form09Entity.getSearchRecordDate() == null) form09Entity.setSearchRecordDate(sqlDate);
  4337. form09Entity.setDelflg("N");
  4338. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  4339. && !user.getRoleCode().equalsIgnoreCase("ADMIN")){
  4340. form09Entity.setCreby(user.getUsername());
  4341. }
  4342. if (form09Entity != null && form09Entity.getRecordDate() != null && form09Entity.getSearchRecordDate() != null){
  4343. return service.getColHighChartData(form09Entity);
  4344. }
  4345. }catch (Exception ex){
  4346. ex.printStackTrace();
  4347. }finally {
  4348. }
  4349. return null;
  4350. }
  4351. @Override
  4352. public BasicDBObject getForm09HightPieChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  4353. System.out.println("Hospital Service Implament ::: getForm09HightPieChartData");
  4354. try {
  4355. IForm09Service service = new Form09ServiceImpl(super.conn);
  4356. User user = sessionUser.get(sessionId);
  4357. Form09Entity form09Entity = new Form09Entity();
  4358. Iterator it = criteria.entrySet().iterator();
  4359. while (it.hasNext()) {
  4360. Map.Entry pairs = (Map.Entry) it.next();
  4361. try {
  4362. if (!pairs.getValue().toString().isEmpty()) {
  4363. if (pairs.getKey().equals(form09Entity.ID)) {
  4364. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  4365. form09Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  4366. } else if (pairs.getKey().equals(form09Entity.AIMAG)) {
  4367. form09Entity.setAimag(String.valueOf(pairs.getValue()));
  4368. } else if (pairs.getKey().equals(form09Entity.SUM)) {
  4369. form09Entity.setSum(form09Entity.SUM);
  4370. } else if (pairs.getKey().equals(form09Entity.MALTURUL)) {
  4371. form09Entity.setMalTurul(String.valueOf(pairs.getValue()));
  4372. } else if (pairs.getKey().equals(form09Entity.TARILGANER)) {
  4373. form09Entity.setTarilgaNer(String.valueOf(pairs.getValue()));
  4374. } else if (pairs.getKey().equals(form09Entity.NER)) {
  4375. form09Entity.setNer(String.valueOf(pairs.getValue()));
  4376. } else if (pairs.getKey().equals(form09Entity.ZARTSUULSANHEMJEE)) {
  4377. form09Entity.setZartsuulsanHemjee(String.valueOf(pairs.getValue()));
  4378. } else if (pairs.getKey().equals(form09Entity.TOLOVLOGOO)) {
  4379. form09Entity.setTolovlogoo(String.valueOf(pairs.getValue()));
  4380. } else if (pairs.getKey().equals(form09Entity.GUITSETGEL)) {
  4381. form09Entity.setGuitsetgel(String.valueOf(pairs.getValue()));
  4382. } else if (pairs.getKey().equals(form09Entity.HUVI)) {
  4383. form09Entity.setHuvi(String.valueOf(pairs.getValue()));
  4384. } else if (pairs.getKey().equals(form09Entity.OLGOSON_TUN)) {
  4385. try {
  4386. form09Entity.setOLGOSON_TUN(Long.valueOf(pairs.getValue().toString()));
  4387. } catch (NumberFormatException e) {
  4388. form09Entity.setOLGOSON_TUN(Long.parseLong("0"));
  4389. }
  4390. } else if (pairs.getKey().equals(form09Entity.HEREGLESEN_TUN)) {
  4391. try {
  4392. form09Entity.setHEREGLESEN_TUN(Long.valueOf(pairs.getValue().toString()));
  4393. } catch (NumberFormatException e) {
  4394. form09Entity.setHEREGLESEN_TUN(Long.parseLong("0"));
  4395. }
  4396. } else if (pairs.getKey().equals(form09Entity.USTGASAN_TUN)) {
  4397. try {
  4398. form09Entity.setUSTGASAN_TUN(Long.valueOf(pairs.getValue().toString()));
  4399. } catch (NumberFormatException e) {
  4400. form09Entity.setUSTGASAN_TUN(Long.parseLong("0"));
  4401. }
  4402. } else if (pairs.getKey().equals(form09Entity.NUUTSULSEN_TUN)) {
  4403. try {
  4404. form09Entity.setNUUTSULSEN_TUN(Long.valueOf(pairs.getValue().toString()));
  4405. } catch (NumberFormatException e) {
  4406. form09Entity.setNUUTSULSEN_TUN(Long.parseLong("0"));
  4407. }
  4408. } else if (pairs.getKey().equals(form09Entity.RECORD_DATE)) {
  4409. String dv = String.valueOf(pairs.getValue());
  4410. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4411. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4412. form09Entity.setRecordDate(sqlDate);
  4413. } else if (pairs.getKey().equals(form09Entity.SEARCH_RECORD_DATE)) {
  4414. String dv = String.valueOf(pairs.getValue());
  4415. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4416. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4417. form09Entity.setSearchRecordDate(sqlDate);
  4418. }
  4419. }
  4420. } catch (NullPointerException ex) {
  4421. ex.printStackTrace();
  4422. } catch (Exception ex) {
  4423. ex.printStackTrace();
  4424. }
  4425. }//end while
  4426. Date utilDate = new Date();
  4427. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  4428. if (form09Entity.getRecordDate() == null) form09Entity.setRecordDate(sqlDate);
  4429. if (form09Entity.getSearchRecordDate() == null) form09Entity.setSearchRecordDate(sqlDate);
  4430. form09Entity.setDelflg("N");
  4431. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  4432. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  4433. form09Entity.setCreby(user.getUsername());
  4434. }
  4435. if (form09Entity != null && form09Entity.getRecordDate() != null && form09Entity.getSearchRecordDate() != null) {
  4436. return service.getPieHighChartData(form09Entity);
  4437. }
  4438. } catch (Exception ex) {
  4439. ex.printStackTrace();
  4440. } finally {
  4441. }
  4442. return null;
  4443. }
  4444. // form09-chart
  4445. // form46-chart
  4446. @Override
  4447. public BasicDBObject getForm46HightChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  4448. System.out.println("Hospital Service Implament ::: get form 46 havsralt hight chart data");
  4449. try{
  4450. IForm46Service service = new Form46ServiceImpl(super.conn);
  4451. User user = sessionUser.get(sessionId);
  4452. Form46Entity entity = new Form46Entity();
  4453. Iterator it = criteria.entrySet().iterator();
  4454. while (it.hasNext()) {
  4455. Map.Entry pairs = (Map.Entry) it.next();
  4456. try{
  4457. if (!pairs.getValue().toString().isEmpty()){
  4458. if (pairs.getKey().equals(entity.ID)) {
  4459. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  4460. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  4461. }
  4462. else if (pairs.getKey().equals(entity.AIMAG)) {
  4463. entity.setAimag(String.valueOf(pairs.getValue()));
  4464. }else if (pairs.getKey().equals(entity.PIE)) {
  4465. entity.setPie(String.valueOf(pairs.getValue()));
  4466. } else if (pairs.getKey().equals(entity.SUM)) {
  4467. entity.setSum(entity.SUM);
  4468. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  4469. String dv = String.valueOf(pairs.getValue());
  4470. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4471. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4472. entity.setRecordDate(sqlDate);
  4473. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  4474. String dv = String.valueOf(pairs.getValue());
  4475. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4476. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4477. entity.setSearchRecordDate(sqlDate);
  4478. }
  4479. }
  4480. }catch (NullPointerException ex){
  4481. ex.printStackTrace();
  4482. }catch (Exception ex){
  4483. ex.printStackTrace();
  4484. }
  4485. }//end while
  4486. Date utilDate = new Date();
  4487. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  4488. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  4489. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  4490. entity.setDelflg("N");
  4491. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  4492. && !user.getRoleCode().equalsIgnoreCase("ADMIN")){
  4493. entity.setCreby(user.getUsername());
  4494. }
  4495. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null){
  4496. return service.getColHighChartData(entity);
  4497. }
  4498. }catch (Exception ex){
  4499. ex.printStackTrace();
  4500. }finally {
  4501. }
  4502. return null;
  4503. }
  4504. // form 46 high chart
  4505. // form13a-chart
  4506. @Override
  4507. public BasicDBObject getForm13aHightChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  4508. System.out.println("Hospital Service Implament ::: get form 13a hight chart data");
  4509. try{
  4510. IForm13aService service = new Form13aServiceImpl(super.conn);
  4511. User user = sessionUser.get(sessionId);
  4512. Form13aEntity entity = new Form13aEntity();
  4513. Iterator it = criteria.entrySet().iterator();
  4514. while (it.hasNext()) {
  4515. Map.Entry pairs = (Map.Entry) it.next();
  4516. try{
  4517. if (!pairs.getValue().toString().isEmpty()){
  4518. if (pairs.getKey().equals(entity.ID)) {
  4519. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  4520. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  4521. }
  4522. else if (pairs.getKey().equals(entity.CITYCODE)) {
  4523. entity.setCitycode(String.valueOf(pairs.getValue()));
  4524. }else if (pairs.getKey().equals(entity.SHINJILSEN_ARGA)) {
  4525. entity.setShinjilsen_arga(String.valueOf(pairs.getValue()));
  4526. } else if (pairs.getKey().equals(entity.UZLEG_HIIH)) {
  4527. entity.setUzleg_hiih(String.valueOf(pairs.getValue()));
  4528. } if (pairs.getKey().equals(entity.SUMCODE)) {
  4529. entity.setSumcode(entity.SUMCODE);
  4530. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  4531. String dv = String.valueOf(pairs.getValue());
  4532. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4533. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4534. entity.setRecordDate(sqlDate);
  4535. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  4536. String dv = String.valueOf(pairs.getValue());
  4537. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4538. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4539. entity.setSearchRecordDate(sqlDate);
  4540. }
  4541. }
  4542. }catch (NullPointerException ex){
  4543. ex.printStackTrace();
  4544. }catch (Exception ex){
  4545. ex.printStackTrace();
  4546. }
  4547. }//end while
  4548. Date utilDate = new Date();
  4549. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  4550. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  4551. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  4552. entity.setDel_flg("N");
  4553. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  4554. && !user.getRoleCode().equalsIgnoreCase("ADMIN")){
  4555. entity.setCre_by(user.getUsername());
  4556. }
  4557. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null){
  4558. return service.getColHighChartData(entity);
  4559. }
  4560. }catch (Exception ex){
  4561. ex.printStackTrace();
  4562. }finally {
  4563. }
  4564. return null;
  4565. }
  4566. @Override
  4567. public BasicDBObject getForm13aHightPieChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  4568. System.out.println("Hospital Service Implament ::: getForm13aHightPieChartData");
  4569. try {
  4570. IForm13aService service = new Form13aServiceImpl(super.conn);
  4571. User user = sessionUser.get(sessionId);
  4572. Form13aEntity entity = new Form13aEntity();
  4573. Iterator it = criteria.entrySet().iterator();
  4574. while (it.hasNext()) {
  4575. Map.Entry pairs = (Map.Entry) it.next();
  4576. try {
  4577. if (!pairs.getValue().toString().isEmpty()) {
  4578. if (pairs.getKey().equals(entity.ID)) {
  4579. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  4580. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  4581. }else if (pairs.getKey().equals(entity.CITYCODE)) {
  4582. entity.setCitycode(String.valueOf(pairs.getValue()));
  4583. }else if (pairs.getKey().equals(entity.SHINJILSEN_ARGA)) {
  4584. entity.setShinjilsen_arga(String.valueOf(pairs.getValue()));
  4585. } else if (pairs.getKey().equals(entity.UZLEG_HIIH)) {
  4586. entity.setUzleg_hiih(String.valueOf(pairs.getValue()));
  4587. } if (pairs.getKey().equals(entity.SUMCODE)) {
  4588. entity.setSumcode(entity.SUMCODE);
  4589. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  4590. String dv = String.valueOf(pairs.getValue());
  4591. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4592. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4593. entity.setRecordDate(sqlDate);
  4594. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  4595. String dv = String.valueOf(pairs.getValue());
  4596. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4597. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4598. entity.setSearchRecordDate(sqlDate);
  4599. }
  4600. }
  4601. } catch (NullPointerException ex) {
  4602. ex.printStackTrace();
  4603. } catch (Exception ex) {
  4604. ex.printStackTrace();
  4605. }
  4606. }//end while
  4607. Date utilDate = new Date();
  4608. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  4609. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  4610. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  4611. entity.setDel_flg("N");
  4612. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  4613. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  4614. entity.setCre_by(user.getUsername());
  4615. }
  4616. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null) {
  4617. return service.getPieHighChartData(entity);
  4618. }
  4619. } catch (Exception ex) {
  4620. ex.printStackTrace();
  4621. } finally {
  4622. }
  4623. return null;
  4624. }
  4625. // form13-chart
  4626. @Override
  4627. public BasicDBObject getForm46HightPieChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  4628. System.out.println("Hospital Service Implament ::: getForm46HightPieChartData");
  4629. try {
  4630. IForm46Service service = new Form46ServiceImpl(super.conn);
  4631. User user = sessionUser.get(sessionId);
  4632. Form46Entity entity = new Form46Entity();
  4633. Iterator it = criteria.entrySet().iterator();
  4634. while (it.hasNext()) {
  4635. Map.Entry pairs = (Map.Entry) it.next();
  4636. try {
  4637. if (!pairs.getValue().toString().isEmpty()) {
  4638. if (pairs.getKey().equals(entity.ID)) {
  4639. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  4640. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  4641. } else if (pairs.getKey().equals(entity.PIE)) {
  4642. entity.setPie(String.valueOf(pairs.getValue()));
  4643. } else if (pairs.getKey().equals(entity.AIMAG)) {
  4644. entity.setAimag(String.valueOf(pairs.getValue()));
  4645. } else if (pairs.getKey().equals(entity.SUM)) {
  4646. entity.setSum(entity.SUM);
  4647. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  4648. String dv = String.valueOf(pairs.getValue());
  4649. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4650. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4651. entity.setRecordDate(sqlDate);
  4652. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  4653. String dv = String.valueOf(pairs.getValue());
  4654. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4655. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4656. entity.setSearchRecordDate(sqlDate);
  4657. }
  4658. }
  4659. } catch (NullPointerException ex) {
  4660. ex.printStackTrace();
  4661. } catch (Exception ex) {
  4662. ex.printStackTrace();
  4663. }
  4664. }//end while
  4665. Date utilDate = new Date();
  4666. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  4667. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  4668. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  4669. entity.setDelflg("N");
  4670. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  4671. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  4672. entity.setCreby(user.getUsername());
  4673. }
  4674. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null) {
  4675. return service.getPieHighChartData(entity);
  4676. }
  4677. } catch (Exception ex) {
  4678. ex.printStackTrace();
  4679. } finally {
  4680. }
  4681. return null;
  4682. }
  4683. // form46-chart
  4684. // form14-chart
  4685. @Override
  4686. public BasicDBObject getForm14HightChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  4687. System.out.println("Hospital Service Implament ::: get form 14 havsralt hight chart data");
  4688. try{
  4689. IForm14Service service = new Form14ServiceImpl(super.conn);
  4690. User user = sessionUser.get(sessionId);
  4691. Form14Entity entity = new Form14Entity();
  4692. Iterator it = criteria.entrySet().iterator();
  4693. while (it.hasNext()) {
  4694. Map.Entry pairs = (Map.Entry) it.next();
  4695. try{
  4696. if (!pairs.getValue().toString().isEmpty()){
  4697. if (pairs.getKey().equals(entity.ID)) {
  4698. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  4699. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  4700. }
  4701. else if (pairs.getKey().equals(entity.AIMAG)) {
  4702. entity.setAimag(String.valueOf(pairs.getValue()));
  4703. }else if (pairs.getKey().equals(entity.SHALGAHGAZAR)) {
  4704. entity.setShalgahGazar(String.valueOf(pairs.getValue()));
  4705. } else if (pairs.getKey().equals(entity.SUM)) {
  4706. entity.setSum(entity.SUM);
  4707. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  4708. String dv = String.valueOf(pairs.getValue());
  4709. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4710. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4711. entity.setRecordDate(sqlDate);
  4712. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  4713. String dv = String.valueOf(pairs.getValue());
  4714. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4715. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4716. entity.setSearchRecordDate(sqlDate);
  4717. }
  4718. }
  4719. }catch (NullPointerException ex){
  4720. ex.printStackTrace();
  4721. }catch (Exception ex){
  4722. ex.printStackTrace();
  4723. }
  4724. }//end while
  4725. Date utilDate = new Date();
  4726. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  4727. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  4728. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  4729. entity.setDelflg("N");
  4730. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  4731. && !user.getRoleCode().equalsIgnoreCase("ADMIN")){
  4732. entity.setCreby(user.getUsername());
  4733. }
  4734. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null){
  4735. return service.getColHighChartData(entity);
  4736. }
  4737. }catch (Exception ex){
  4738. ex.printStackTrace();
  4739. }finally {
  4740. }
  4741. return null;
  4742. }
  4743. @Override
  4744. public BasicDBObject getForm14HightPieChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  4745. System.out.println("Hospital Service Implament ::: getForm14HightPieChartData");
  4746. try {
  4747. IForm14Service service = new Form14ServiceImpl(super.conn);
  4748. User user = sessionUser.get(sessionId);
  4749. Form14Entity entity = new Form14Entity();
  4750. Iterator it = criteria.entrySet().iterator();
  4751. while (it.hasNext()) {
  4752. Map.Entry pairs = (Map.Entry) it.next();
  4753. try {
  4754. if (!pairs.getValue().toString().isEmpty()) {
  4755. if (pairs.getKey().equals(entity.ID)) {
  4756. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  4757. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  4758. } else if (pairs.getKey().equals(entity.SHALGAHGAZAR)) {
  4759. entity.setShalgahGazar(String.valueOf(pairs.getValue()));
  4760. } else if (pairs.getKey().equals(entity.AIMAG)) {
  4761. entity.setAimag(String.valueOf(pairs.getValue()));
  4762. } else if (pairs.getKey().equals(entity.SUM)) {
  4763. entity.setSum(entity.SUM);
  4764. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  4765. String dv = String.valueOf(pairs.getValue());
  4766. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4767. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4768. entity.setRecordDate(sqlDate);
  4769. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  4770. String dv = String.valueOf(pairs.getValue());
  4771. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4772. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4773. entity.setSearchRecordDate(sqlDate);
  4774. }
  4775. }
  4776. } catch (NullPointerException ex) {
  4777. ex.printStackTrace();
  4778. } catch (Exception ex) {
  4779. ex.printStackTrace();
  4780. }
  4781. }//end while
  4782. Date utilDate = new Date();
  4783. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  4784. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  4785. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  4786. entity.setDelflg("N");
  4787. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  4788. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  4789. entity.setCreby(user.getUsername());
  4790. }
  4791. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null) {
  4792. return service.getPieHighChartData(entity);
  4793. }
  4794. } catch (Exception ex) {
  4795. ex.printStackTrace();
  4796. } finally {
  4797. }
  4798. return null;
  4799. }
  4800. // form14-chart
  4801. // form51-chart
  4802. @Override
  4803. public BasicDBObject getForm51HightChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  4804. System.out.println("Hospital Service Implament ::: get form 51 hight chart data");
  4805. try{
  4806. IForm51Service service = new Form51ServiceImpl(super.conn);
  4807. User user = sessionUser.get(sessionId);
  4808. Form51Entity entity = new Form51Entity();
  4809. Iterator it = criteria.entrySet().iterator();
  4810. while (it.hasNext()) {
  4811. Map.Entry pairs = (Map.Entry) it.next();
  4812. try{
  4813. if (!pairs.getValue().toString().isEmpty()){
  4814. if (pairs.getKey().equals(entity.ID)) {
  4815. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  4816. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  4817. }else if (pairs.getKey().equals(entity.AIMAG)) {
  4818. entity.setAimag(String.valueOf(pairs.getValue()));
  4819. } else if (pairs.getKey().equals(entity.SUM)) {
  4820. entity.setSum(entity.SUM);
  4821. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  4822. String dv = String.valueOf(pairs.getValue());
  4823. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4824. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4825. entity.setRecordDate(sqlDate);
  4826. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  4827. String dv = String.valueOf(pairs.getValue());
  4828. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4829. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4830. entity.setSearchRecordDate(sqlDate);
  4831. }
  4832. }
  4833. }catch (NullPointerException ex){
  4834. ex.printStackTrace();
  4835. }catch (Exception ex){
  4836. ex.printStackTrace();
  4837. }
  4838. }//end while
  4839. Date utilDate = new Date();
  4840. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  4841. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  4842. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  4843. entity.setDelflg("N");
  4844. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  4845. && !user.getRoleCode().equalsIgnoreCase("ADMIN")){
  4846. entity.setCreby(user.getUsername());
  4847. }
  4848. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null){
  4849. return service.getColHighChartData(entity);
  4850. }
  4851. }catch (Exception ex){
  4852. ex.printStackTrace();
  4853. }finally {
  4854. }
  4855. return null;
  4856. }
  4857. @Override
  4858. public BasicDBObject getForm51HightPieChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  4859. System.out.println("Hospital Service Implament ::: getForm51aHightPieChartData");
  4860. try {
  4861. IForm51Service service = new Form51ServiceImpl(super.conn);
  4862. User user = sessionUser.get(sessionId);
  4863. Form51Entity entity = new Form51Entity();
  4864. Iterator it = criteria.entrySet().iterator();
  4865. while (it.hasNext()) {
  4866. Map.Entry pairs = (Map.Entry) it.next();
  4867. try {
  4868. if (!pairs.getValue().toString().isEmpty()) {
  4869. if (pairs.getKey().equals(entity.ID)) {
  4870. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  4871. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  4872. }else if (pairs.getKey().equals(entity.AIMAG)) {
  4873. entity.setAimag(String.valueOf(pairs.getValue()));
  4874. } if (pairs.getKey().equals(entity.SUM)) {
  4875. entity.setSum(entity.SUM);
  4876. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  4877. String dv = String.valueOf(pairs.getValue());
  4878. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4879. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4880. entity.setRecordDate(sqlDate);
  4881. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  4882. String dv = String.valueOf(pairs.getValue());
  4883. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  4884. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  4885. entity.setSearchRecordDate(sqlDate);
  4886. }
  4887. }
  4888. } catch (NullPointerException ex) {
  4889. ex.printStackTrace();
  4890. } catch (Exception ex) {
  4891. ex.printStackTrace();
  4892. }
  4893. }//end while
  4894. Date utilDate = new Date();
  4895. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  4896. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  4897. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  4898. entity.setDelflg("N");
  4899. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  4900. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  4901. entity.setCreby(user.getUsername());
  4902. }
  4903. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null) {
  4904. return service.getPieHighChartData(entity);
  4905. }
  4906. } catch (Exception ex) {
  4907. ex.printStackTrace();
  4908. } finally {
  4909. }
  4910. return null;
  4911. }
  4912. // form51-chart
  4913. //form52-chart
  4914. @Override
  4915. public BasicDBObject getForm52HightChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  4916. System.out.println("Hospital Service Implament ::: get form 52 havsralt hight chart data");
  4917. try{
  4918. IForm52Service service = new Form52ServiceImpl(super.conn);
  4919. User user = sessionUser.get(sessionId);
  4920. Form52Entity entity = new Form52Entity();
  4921. Iterator it = criteria.entrySet().iterator();
  4922. while (it.hasNext()) {
  4923. Map.Entry pairs = (Map.Entry) it.next();
  4924. try{
  4925. if (!pairs.getValue().toString().isEmpty()){
  4926. if (pairs.getKey().equals(entity.ID)) {
  4927. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  4928. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  4929. }
  4930. else if (pairs.getKey().equals(entity.AIMAG)) {
  4931. entity.setAimag(String.valueOf(pairs.getValue()));
  4932. } else if (pairs.getKey().equals(entity.SUM)) {
  4933. entity.setSum(String.valueOf(pairs.getValue()));
  4934. } else if (pairs.getKey().equals(entity.UVCHINNER)) {
  4935. entity.setUvchinNer(String.valueOf(pairs.getValue()));
  4936. } else if (pairs.getKey().equals(entity.MALNER)) {
  4937. entity.setMalNer(String.valueOf(pairs.getValue()));
  4938. } else if (pairs.getKey().equals(entity.BUGDUVCHILSEN)) {
  4939. try {
  4940. entity.setBugdUvchilsen(Long.valueOf(pairs.getValue().toString()));
  4941. } catch (NumberFormatException e) {
  4942. entity.setBugdUvchilsen(Long.valueOf("0"));
  4943. }
  4944. } else if (pairs.getKey().equals(entity.BUGDUHSEN)) {
  4945. try {
  4946. entity.setBugdUhsen(Long.valueOf(pairs.getValue().toString()));
  4947. } catch (NumberFormatException e) {
  4948. entity.setBugdUhsen(Long.valueOf("0"));
  4949. }
  4950. } else if (pairs.getKey().equals(entity.BUGDEDGERSEN)) {
  4951. try {
  4952. entity.setBugdEdgersen(Long.valueOf(pairs.getValue().toString()));
  4953. } catch (NumberFormatException e) {
  4954. entity.setBugdEdgersen(Long.valueOf("0"));
  4955. }
  4956. } else if (pairs.getKey().equals(entity.TEMEEUVCHILSEN)) {
  4957. try {
  4958. entity.setTemeeUvchilsen(Long.valueOf(pairs.getValue().toString()));
  4959. } catch (NumberFormatException e) {
  4960. entity.setTemeeUvchilsen(Long.valueOf("0"));
  4961. }
  4962. }
  4963. else if (pairs.getKey().equals(entity.TEMEEUHSEN)) {
  4964. try {
  4965. entity.setTemeeUhsen(Long.valueOf(pairs.getValue().toString()));
  4966. } catch (NumberFormatException e) {
  4967. entity.setTemeeUhsen(Long.valueOf("0"));
  4968. }
  4969. } else if (pairs.getKey().equals(entity.TEMEEEDGERSEN)) {
  4970. try {
  4971. entity.setTemeeEdgersen(Long.valueOf(pairs.getValue().toString()));
  4972. } catch (NumberFormatException e) {
  4973. entity.setTemeeEdgersen(Long.valueOf("0"));
  4974. }
  4975. } else if (pairs.getKey().equals(entity.ADUUUVCHILSEN)) {
  4976. try {
  4977. entity.setAduuUvchilsen(Long.valueOf(pairs.getValue().toString()));
  4978. } catch (NumberFormatException e) {
  4979. entity.setAduuUvchilsen(Long.valueOf("0"));
  4980. }
  4981. } else if (pairs.getKey().equals(entity.ADUUUHSEN)) {
  4982. try {
  4983. entity.setAduuUhsen(Long.valueOf(pairs.getValue().toString()));
  4984. } catch (NumberFormatException e) {
  4985. entity.setAduuUhsen(Long.valueOf("0"));
  4986. }
  4987. }
  4988. else if (pairs.getKey().equals(entity.ADUUEDGERSEN)) {
  4989. try {
  4990. entity.setAduuEdgersen(Long.valueOf(pairs.getValue().toString()));
  4991. } catch (NumberFormatException e) {
  4992. entity.setAduuEdgersen(Long.valueOf("0"));
  4993. }
  4994. } else if (pairs.getKey().equals(entity.UHERUVCHILSEN)) {
  4995. try {
  4996. entity.setUherUvchilsen(Long.valueOf(pairs.getValue().toString()));
  4997. } catch (NumberFormatException e) {
  4998. entity.setUherUvchilsen(Long.valueOf("0"));
  4999. }
  5000. } else if (pairs.getKey().equals(entity.UHERUHSEN)) {
  5001. try {
  5002. entity.setUherUhsen(Long.valueOf(pairs.getValue().toString()));
  5003. } catch (NumberFormatException e) {
  5004. entity.setUherUhsen(Long.valueOf("0"));
  5005. }
  5006. } else if (pairs.getKey().equals(entity.UHEREDGERSEN)) {
  5007. try {
  5008. entity.setUherEdgersen(Long.valueOf(pairs.getValue().toString()));
  5009. } catch (NumberFormatException e) {
  5010. entity.setUherEdgersen(Long.valueOf("0"));
  5011. }
  5012. }
  5013. else if (pairs.getKey().equals(entity.HONIUVCHILSEN)) {
  5014. try {
  5015. entity.setHoniUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5016. } catch (NumberFormatException e) {
  5017. entity.setHoniUvchilsen(Long.valueOf("0"));
  5018. }
  5019. } else if (pairs.getKey().equals(entity.HONIUHSEN)) {
  5020. try {
  5021. entity.setHoniUhsen(Long.valueOf(pairs.getValue().toString()));
  5022. } catch (NumberFormatException e) {
  5023. entity.setHoniUhsen(Long.valueOf("0"));
  5024. }
  5025. } else if (pairs.getKey().equals(entity.HONIEDGERSEN)) {
  5026. try {
  5027. entity.setHoniEdgersen(Long.valueOf(pairs.getValue().toString()));
  5028. } catch (NumberFormatException e) {
  5029. entity.setHoniEdgersen(Long.valueOf("0"));
  5030. }
  5031. } else if (pairs.getKey().equals(entity.YAMAAUVCHILSEN)) {
  5032. try {
  5033. entity.setYamaaUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5034. } catch (NumberFormatException e) {
  5035. entity.setYamaaUvchilsen(Long.valueOf("0"));
  5036. }
  5037. }
  5038. else if (pairs.getKey().equals(entity.YAMAAUHSEN)) {
  5039. try {
  5040. entity.setYamaaUhsen(Long.valueOf(pairs.getValue().toString()));
  5041. } catch (NumberFormatException e) {
  5042. entity.setYamaaUhsen(Long.valueOf("0"));
  5043. }
  5044. } else if (pairs.getKey().equals(entity.YAMAAEDGERSEN)) {
  5045. try {
  5046. entity.setYamaaEdgersen(Long.valueOf(pairs.getValue().toString()));
  5047. } catch (NumberFormatException e) {
  5048. entity.setYamaaEdgersen(Long.valueOf("0"));
  5049. }
  5050. } else if (pairs.getKey().equals(entity.BUSADUVCHILSEN)) {
  5051. try {
  5052. entity.setBusadUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5053. } catch (NumberFormatException e) {
  5054. entity.setBusadUvchilsen(Long.valueOf("0"));
  5055. }
  5056. } else if (pairs.getKey().equals(entity.BUSADUHSEN)) {
  5057. try {
  5058. entity.setBusadUhsen(Long.valueOf(pairs.getValue().toString()));
  5059. } catch (NumberFormatException e) {
  5060. entity.setBusadUhsen(Long.valueOf("0"));
  5061. }
  5062. }
  5063. else if (pairs.getKey().equals(entity.BUSADEDGERSEN)) {
  5064. try {
  5065. entity.setBusadEdgersen(Long.valueOf(pairs.getValue().toString()));
  5066. } catch (NumberFormatException e) {
  5067. entity.setBusadEdgersen(Long.valueOf("0"));
  5068. }
  5069. }
  5070. else if (pairs.getKey().equals(entity.RECORD_DATE)){
  5071. String dv = String.valueOf(pairs.getValue());
  5072. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  5073. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  5074. entity.setRecordDate(sqlDate);
  5075. }
  5076. else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)){
  5077. String dv = String.valueOf(pairs.getValue());
  5078. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  5079. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  5080. entity.setSearchRecordDate(sqlDate);
  5081. }
  5082. }
  5083. }catch (NullPointerException ex){
  5084. ex.printStackTrace();
  5085. }catch (Exception ex){
  5086. ex.printStackTrace();
  5087. }
  5088. }//end while
  5089. Date utilDate = new Date();
  5090. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  5091. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  5092. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  5093. entity.setDelflg("N");
  5094. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  5095. && !user.getRoleCode().equalsIgnoreCase("ADMIN")){
  5096. entity.setCreby(user.getUsername());
  5097. }
  5098. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null){
  5099. return service.getColHighChartData(entity);
  5100. }
  5101. }catch (Exception ex){
  5102. ex.printStackTrace();
  5103. }finally {
  5104. }
  5105. return null;
  5106. }
  5107. @Override
  5108. public BasicDBObject getForm52HightPieChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  5109. System.out.println("Hospital Service Implament ::: getForm52HightPieChartData");
  5110. try{
  5111. IForm52Service service = new Form52ServiceImpl(super.conn);
  5112. User user = sessionUser.get(sessionId);
  5113. Form52Entity entity = new Form52Entity();
  5114. Iterator it = criteria.entrySet().iterator();
  5115. while (it.hasNext()) {
  5116. Map.Entry pairs = (Map.Entry) it.next();
  5117. try{
  5118. if (!pairs.getValue().toString().isEmpty()){
  5119. if (pairs.getKey().equals(entity.ID)) {
  5120. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  5121. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  5122. } else if (pairs.getKey().equals(entity.MALNER)) {
  5123. entity.setMalNer(String.valueOf(pairs.getValue()));
  5124. } else if (pairs.getKey().equals(entity.AIMAG)) {
  5125. entity.setAimag(String.valueOf(pairs.getValue()));
  5126. } else if (pairs.getKey().equals(entity.SUM)) {
  5127. entity.setSum(String.valueOf(pairs.getValue()));
  5128. } else if (pairs.getKey().equals(entity.UVCHINNER)) {
  5129. entity.setUvchinNer(String.valueOf(pairs.getValue()));
  5130. } else if (pairs.getKey().equals(entity.BUGDUVCHILSEN)) {
  5131. try {
  5132. entity.setBugdUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5133. } catch (NumberFormatException e) {
  5134. entity.setBugdUvchilsen(Long.valueOf("0"));
  5135. }
  5136. } else if (pairs.getKey().equals(entity.BUGDUHSEN)) {
  5137. try {
  5138. entity.setBugdUhsen(Long.valueOf(pairs.getValue().toString()));
  5139. } catch (NumberFormatException e) {
  5140. entity.setBugdUhsen(Long.valueOf("0"));
  5141. }
  5142. } else if (pairs.getKey().equals(entity.BUGDEDGERSEN)) {
  5143. try {
  5144. entity.setBugdEdgersen(Long.valueOf(pairs.getValue().toString()));
  5145. } catch (NumberFormatException e) {
  5146. entity.setBugdEdgersen(Long.valueOf("0"));
  5147. }
  5148. } else if (pairs.getKey().equals(entity.TEMEEUVCHILSEN)) {
  5149. try {
  5150. entity.setTemeeUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5151. } catch (NumberFormatException e) {
  5152. entity.setTemeeUvchilsen(Long.valueOf("0"));
  5153. }
  5154. }
  5155. else if (pairs.getKey().equals(entity.TEMEEUHSEN)) {
  5156. try {
  5157. entity.setTemeeUhsen(Long.valueOf(pairs.getValue().toString()));
  5158. } catch (NumberFormatException e) {
  5159. entity.setTemeeUhsen(Long.valueOf("0"));
  5160. }
  5161. } else if (pairs.getKey().equals(entity.TEMEEEDGERSEN)) {
  5162. try {
  5163. entity.setTemeeEdgersen(Long.valueOf(pairs.getValue().toString()));
  5164. } catch (NumberFormatException e) {
  5165. entity.setTemeeEdgersen(Long.valueOf("0"));
  5166. }
  5167. } else if (pairs.getKey().equals(entity.ADUUUVCHILSEN)) {
  5168. try {
  5169. entity.setAduuUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5170. } catch (NumberFormatException e) {
  5171. entity.setAduuUvchilsen(Long.valueOf("0"));
  5172. }
  5173. } else if (pairs.getKey().equals(entity.ADUUUHSEN)) {
  5174. try {
  5175. entity.setAduuUhsen(Long.valueOf(pairs.getValue().toString()));
  5176. } catch (NumberFormatException e) {
  5177. entity.setAduuUhsen(Long.valueOf("0"));
  5178. }
  5179. }
  5180. else if (pairs.getKey().equals(entity.ADUUEDGERSEN)) {
  5181. try {
  5182. entity.setAduuEdgersen(Long.valueOf(pairs.getValue().toString()));
  5183. } catch (NumberFormatException e) {
  5184. entity.setAduuEdgersen(Long.valueOf("0"));
  5185. }
  5186. } else if (pairs.getKey().equals(entity.UHERUVCHILSEN)) {
  5187. try {
  5188. entity.setUherUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5189. } catch (NumberFormatException e) {
  5190. entity.setUherUvchilsen(Long.valueOf("0"));
  5191. }
  5192. } else if (pairs.getKey().equals(entity.UHERUHSEN)) {
  5193. try {
  5194. entity.setUherUhsen(Long.valueOf(pairs.getValue().toString()));
  5195. } catch (NumberFormatException e) {
  5196. entity.setUherUhsen(Long.valueOf("0"));
  5197. }
  5198. } else if (pairs.getKey().equals(entity.UHEREDGERSEN)) {
  5199. try {
  5200. entity.setUherEdgersen(Long.valueOf(pairs.getValue().toString()));
  5201. } catch (NumberFormatException e) {
  5202. entity.setUherEdgersen(Long.valueOf("0"));
  5203. }
  5204. }
  5205. else if (pairs.getKey().equals(entity.HONIUVCHILSEN)) {
  5206. try {
  5207. entity.setHoniUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5208. } catch (NumberFormatException e) {
  5209. entity.setHoniUvchilsen(Long.valueOf("0"));
  5210. }
  5211. } else if (pairs.getKey().equals(entity.HONIUHSEN)) {
  5212. try {
  5213. entity.setHoniUhsen(Long.valueOf(pairs.getValue().toString()));
  5214. } catch (NumberFormatException e) {
  5215. entity.setHoniUhsen(Long.valueOf("0"));
  5216. }
  5217. } else if (pairs.getKey().equals(entity.HONIEDGERSEN)) {
  5218. try {
  5219. entity.setHoniEdgersen(Long.valueOf(pairs.getValue().toString()));
  5220. } catch (NumberFormatException e) {
  5221. entity.setHoniEdgersen(Long.valueOf("0"));
  5222. }
  5223. } else if (pairs.getKey().equals(entity.YAMAAUVCHILSEN)) {
  5224. try {
  5225. entity.setYamaaUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5226. } catch (NumberFormatException e) {
  5227. entity.setYamaaUvchilsen(Long.valueOf("0"));
  5228. }
  5229. }
  5230. else if (pairs.getKey().equals(entity.YAMAAUHSEN)) {
  5231. try {
  5232. entity.setYamaaUhsen(Long.valueOf(pairs.getValue().toString()));
  5233. } catch (NumberFormatException e) {
  5234. entity.setYamaaUhsen(Long.valueOf("0"));
  5235. }
  5236. } else if (pairs.getKey().equals(entity.YAMAAEDGERSEN)) {
  5237. try {
  5238. entity.setYamaaEdgersen(Long.valueOf(pairs.getValue().toString()));
  5239. } catch (NumberFormatException e) {
  5240. entity.setYamaaEdgersen(Long.valueOf("0"));
  5241. }
  5242. } else if (pairs.getKey().equals(entity.BUSADUVCHILSEN)) {
  5243. try {
  5244. entity.setBusadUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5245. } catch (NumberFormatException e) {
  5246. entity.setBusadUvchilsen(Long.valueOf("0"));
  5247. }
  5248. } else if (pairs.getKey().equals(entity.BUSADUHSEN)) {
  5249. try {
  5250. entity.setBusadUhsen(Long.valueOf(pairs.getValue().toString()));
  5251. } catch (NumberFormatException e) {
  5252. entity.setBusadUhsen(Long.valueOf("0"));
  5253. }
  5254. }
  5255. else if (pairs.getKey().equals(entity.BUSADEDGERSEN)) {
  5256. try {
  5257. entity.setBusadEdgersen(Long.valueOf(pairs.getValue().toString()));
  5258. } catch (NumberFormatException e) {
  5259. entity.setBusadEdgersen(Long.valueOf("0"));
  5260. }
  5261. }
  5262. else if (pairs.getKey().equals(entity.RECORD_DATE)){
  5263. String dv = String.valueOf(pairs.getValue());
  5264. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  5265. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  5266. entity.setRecordDate(sqlDate);
  5267. }
  5268. else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)){
  5269. String dv = String.valueOf(pairs.getValue());
  5270. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  5271. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  5272. entity.setSearchRecordDate(sqlDate);
  5273. }
  5274. }
  5275. }catch (NullPointerException ex){
  5276. ex.printStackTrace();
  5277. }catch (Exception ex){
  5278. ex.printStackTrace();
  5279. }
  5280. }//end while
  5281. Date utilDate = new Date();
  5282. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  5283. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  5284. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  5285. entity.setDelflg("N");
  5286. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  5287. && !user.getRoleCode().equalsIgnoreCase("ADMIN")){
  5288. entity.setCreby(user.getUsername());
  5289. }
  5290. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null){
  5291. return service.getPieHighChartData(entity);
  5292. }
  5293. }catch (Exception ex){
  5294. ex.printStackTrace();
  5295. }finally {
  5296. }
  5297. return null;
  5298. }
  5299. //form52-chart
  5300. //form53-chart
  5301. @Override
  5302. public BasicDBObject getForm53HightChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  5303. System.out.println("Hospital Service Implament ::: get form 53 havsralt hight chart data");
  5304. try{
  5305. IForm53Service service = new Form53ServiceImpl(super.conn);
  5306. User user = sessionUser.get(sessionId);
  5307. Form53Entity entity = new Form53Entity();
  5308. Iterator it = criteria.entrySet().iterator();
  5309. while (it.hasNext()) {
  5310. Map.Entry pairs = (Map.Entry) it.next();
  5311. try{
  5312. if (!pairs.getValue().toString().isEmpty()){
  5313. if (pairs.getKey().equals(entity.ID)) {
  5314. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  5315. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  5316. }
  5317. else if (pairs.getKey().equals(entity.AIMAG)) {
  5318. entity.setAimag(String.valueOf(pairs.getValue()));
  5319. } else if (pairs.getKey().equals(entity.SUM)) {
  5320. entity.setSum(String.valueOf(pairs.getValue()));
  5321. } else if (pairs.getKey().equals(entity.UVCHINNER)) {
  5322. entity.setUvchinNer(String.valueOf(pairs.getValue()));
  5323. } else if (pairs.getKey().equals(entity.MALNER)) {
  5324. entity.setMalNer(String.valueOf(pairs.getValue()));
  5325. } else if (pairs.getKey().equals(entity.BUGDUVCHILSEN)) {
  5326. try {
  5327. entity.setBugdUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5328. } catch (NumberFormatException e) {
  5329. entity.setBugdUvchilsen(Long.valueOf("0"));
  5330. }
  5331. } else if (pairs.getKey().equals(entity.BUGDUHSEN)) {
  5332. try {
  5333. entity.setBugdUhsen(Long.valueOf(pairs.getValue().toString()));
  5334. } catch (NumberFormatException e) {
  5335. entity.setBugdUhsen(Long.valueOf("0"));
  5336. }
  5337. } else if (pairs.getKey().equals(entity.BUGDEDGERSEN)) {
  5338. try {
  5339. entity.setBugdEdgersen(Long.valueOf(pairs.getValue().toString()));
  5340. } catch (NumberFormatException e) {
  5341. entity.setBugdEdgersen(Long.valueOf("0"));
  5342. }
  5343. } else if (pairs.getKey().equals(entity.BOTGOUVCHILSEN)) {
  5344. try {
  5345. entity.setBotgoUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5346. } catch (NumberFormatException e) {
  5347. entity.setBotgoUvchilsen(Long.valueOf("0"));
  5348. }
  5349. }
  5350. else if (pairs.getKey().equals(entity.BOTGOUHSEN)) {
  5351. try {
  5352. entity.setBotgoUhsen(Long.valueOf(pairs.getValue().toString()));
  5353. } catch (NumberFormatException e) {
  5354. entity.setBotgoUhsen(Long.valueOf("0"));
  5355. }
  5356. } else if (pairs.getKey().equals(entity.BOTGOEDGERSEN)) {
  5357. try {
  5358. entity.setBotgoEdgersen(Long.valueOf(pairs.getValue().toString()));
  5359. } catch (NumberFormatException e) {
  5360. entity.setBotgoEdgersen(Long.valueOf("0"));
  5361. }
  5362. } else if (pairs.getKey().equals(entity.UNAGAUVCHILSEN)) {
  5363. try {
  5364. entity.setUnagaUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5365. } catch (NumberFormatException e) {
  5366. entity.setUnagaUvchilsen(Long.valueOf("0"));
  5367. }
  5368. } else if (pairs.getKey().equals(entity.UNAGAUHSEN)) {
  5369. try {
  5370. entity.setUnagaUhsen(Long.valueOf(pairs.getValue().toString()));
  5371. } catch (NumberFormatException e) {
  5372. entity.setUnagaUhsen(Long.valueOf("0"));
  5373. }
  5374. }
  5375. else if (pairs.getKey().equals(entity.UNAGAEDGERSEN)) {
  5376. try {
  5377. entity.setUnagaEdgersen(Long.valueOf(pairs.getValue().toString()));
  5378. } catch (NumberFormatException e) {
  5379. entity.setUnagaEdgersen(Long.valueOf("0"));
  5380. }
  5381. } else if (pairs.getKey().equals(entity.TUGALUVCHILSEN)) {
  5382. try {
  5383. entity.setTugalUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5384. } catch (NumberFormatException e) {
  5385. entity.setTugalUvchilsen(Long.valueOf("0"));
  5386. }
  5387. } else if (pairs.getKey().equals(entity.TUGALUHSEN)) {
  5388. try {
  5389. entity.setTugalUhsen(Long.valueOf(pairs.getValue().toString()));
  5390. } catch (NumberFormatException e) {
  5391. entity.setTugalUhsen(Long.valueOf("0"));
  5392. }
  5393. } else if (pairs.getKey().equals(entity.TUGALEDGERSEN)) {
  5394. try {
  5395. entity.setTugalEdgersen(Long.valueOf(pairs.getValue().toString()));
  5396. } catch (NumberFormatException e) {
  5397. entity.setTugalEdgersen(Long.valueOf("0"));
  5398. }
  5399. }
  5400. else if (pairs.getKey().equals(entity.HURGAUVCHILSEN)) {
  5401. try {
  5402. entity.setHurgaUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5403. } catch (NumberFormatException e) {
  5404. entity.setHurgaUvchilsen(Long.valueOf("0"));
  5405. }
  5406. } else if (pairs.getKey().equals(entity.HURGAUHSEN)) {
  5407. try {
  5408. entity.setHurgaUhsen(Long.valueOf(pairs.getValue().toString()));
  5409. } catch (NumberFormatException e) {
  5410. entity.setHurgaUhsen(Long.valueOf("0"));
  5411. }
  5412. } else if (pairs.getKey().equals(entity.HURGAEDGERSEN)) {
  5413. try {
  5414. entity.setHurgaEdgersen(Long.valueOf(pairs.getValue().toString()));
  5415. } catch (NumberFormatException e) {
  5416. entity.setHurgaEdgersen(Long.valueOf("0"));
  5417. }
  5418. } else if (pairs.getKey().equals(entity.ISHIGUVCHILSEN)) {
  5419. try {
  5420. entity.setIshigUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5421. } catch (NumberFormatException e) {
  5422. entity.setIshigUvchilsen(Long.valueOf("0"));
  5423. }
  5424. }
  5425. else if (pairs.getKey().equals(entity.ISHIGUHSEN)) {
  5426. try {
  5427. entity.setIshigUhsen(Long.valueOf(pairs.getValue().toString()));
  5428. } catch (NumberFormatException e) {
  5429. entity.setIshigUhsen(Long.valueOf("0"));
  5430. }
  5431. } else if (pairs.getKey().equals(entity.ISHIGEDGERSEN)) {
  5432. try {
  5433. entity.setIshigEdgersen(Long.valueOf(pairs.getValue().toString()));
  5434. } catch (NumberFormatException e) {
  5435. entity.setIshigEdgersen(Long.valueOf("0"));
  5436. }
  5437. } else if (pairs.getKey().equals(entity.BUSADUVCHILSEN)) {
  5438. try {
  5439. entity.setBusadUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5440. } catch (NumberFormatException e) {
  5441. entity.setBusadUvchilsen(Long.valueOf("0"));
  5442. }
  5443. } else if (pairs.getKey().equals(entity.BUSADUHSEN)) {
  5444. try {
  5445. entity.setBusadUhsen(Long.valueOf(pairs.getValue().toString()));
  5446. } catch (NumberFormatException e) {
  5447. entity.setBusadUhsen(Long.valueOf("0"));
  5448. }
  5449. }
  5450. else if (pairs.getKey().equals(entity.BUSADEDGERSEN)) {
  5451. try {
  5452. entity.setBusadEdgersen(Long.valueOf(pairs.getValue().toString()));
  5453. } catch (NumberFormatException e) {
  5454. entity.setBusadEdgersen(Long.valueOf("0"));
  5455. }
  5456. }
  5457. else if (pairs.getKey().equals(entity.RECORD_DATE)){
  5458. String dv = String.valueOf(pairs.getValue());
  5459. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  5460. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  5461. entity.setRecordDate(sqlDate);
  5462. }
  5463. else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)){
  5464. String dv = String.valueOf(pairs.getValue());
  5465. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  5466. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  5467. entity.setSearchRecordDate(sqlDate);
  5468. }
  5469. }
  5470. }catch (NullPointerException ex){
  5471. ex.printStackTrace();
  5472. }catch (Exception ex){
  5473. ex.printStackTrace();
  5474. }
  5475. }//end while
  5476. Date utilDate = new Date();
  5477. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  5478. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  5479. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  5480. entity.setDelflg("N");
  5481. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  5482. && !user.getRoleCode().equalsIgnoreCase("ADMIN")){
  5483. entity.setCreby(user.getUsername());
  5484. }
  5485. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null){
  5486. return service.getColHighChartData(entity);
  5487. }
  5488. }catch (Exception ex){
  5489. ex.printStackTrace();
  5490. }finally {
  5491. }
  5492. return null;
  5493. }
  5494. @Override
  5495. public BasicDBObject getForm53HightPieChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  5496. System.out.println("Hospital Service Implament ::: getForm53HightPieChartData");
  5497. try{
  5498. IForm53Service service = new Form53ServiceImpl(super.conn);
  5499. User user = sessionUser.get(sessionId);
  5500. Form53Entity entity = new Form53Entity();
  5501. Iterator it = criteria.entrySet().iterator();
  5502. while (it.hasNext()) {
  5503. Map.Entry pairs = (Map.Entry) it.next();
  5504. try{
  5505. if (!pairs.getValue().toString().isEmpty()){
  5506. if (pairs.getKey().equals(entity.ID)) {
  5507. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  5508. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  5509. } else if (pairs.getKey().equals(entity.MALNER)) {
  5510. entity.setMalNer(String.valueOf(pairs.getValue()));
  5511. } else if (pairs.getKey().equals(entity.AIMAG)) {
  5512. entity.setAimag(String.valueOf(pairs.getValue()));
  5513. } else if (pairs.getKey().equals(entity.SUM)) {
  5514. entity.setSum(String.valueOf(pairs.getValue()));
  5515. } else if (pairs.getKey().equals(entity.UVCHINNER)) {
  5516. entity.setUvchinNer(String.valueOf(pairs.getValue()));
  5517. } else if (pairs.getKey().equals(entity.BUGDUVCHILSEN)) {
  5518. try {
  5519. entity.setBugdUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5520. } catch (NumberFormatException e) {
  5521. entity.setBugdUvchilsen(Long.valueOf("0"));
  5522. }
  5523. } else if (pairs.getKey().equals(entity.BUGDUHSEN)) {
  5524. try {
  5525. entity.setBugdUhsen(Long.valueOf(pairs.getValue().toString()));
  5526. } catch (NumberFormatException e) {
  5527. entity.setBugdUhsen(Long.valueOf("0"));
  5528. }
  5529. } else if (pairs.getKey().equals(entity.BUGDEDGERSEN)) {
  5530. try {
  5531. entity.setBugdEdgersen(Long.valueOf(pairs.getValue().toString()));
  5532. } catch (NumberFormatException e) {
  5533. entity.setBugdEdgersen(Long.valueOf("0"));
  5534. }
  5535. } else if (pairs.getKey().equals(entity.BOTGOUVCHILSEN)) {
  5536. try {
  5537. entity.setBotgoUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5538. } catch (NumberFormatException e) {
  5539. entity.setBotgoUvchilsen(Long.valueOf("0"));
  5540. }
  5541. }
  5542. else if (pairs.getKey().equals(entity.BOTGOUHSEN)) {
  5543. try {
  5544. entity.setBotgoUhsen(Long.valueOf(pairs.getValue().toString()));
  5545. } catch (NumberFormatException e) {
  5546. entity.setBotgoUhsen(Long.valueOf("0"));
  5547. }
  5548. } else if (pairs.getKey().equals(entity.BOTGOEDGERSEN)) {
  5549. try {
  5550. entity.setBotgoEdgersen(Long.valueOf(pairs.getValue().toString()));
  5551. } catch (NumberFormatException e) {
  5552. entity.setBotgoEdgersen(Long.valueOf("0"));
  5553. }
  5554. } else if (pairs.getKey().equals(entity.UNAGAUVCHILSEN)) {
  5555. try {
  5556. entity.setUnagaUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5557. } catch (NumberFormatException e) {
  5558. entity.setUnagaUvchilsen(Long.valueOf("0"));
  5559. }
  5560. } else if (pairs.getKey().equals(entity.UNAGAUHSEN)) {
  5561. try {
  5562. entity.setUnagaUhsen(Long.valueOf(pairs.getValue().toString()));
  5563. } catch (NumberFormatException e) {
  5564. entity.setUnagaUhsen(Long.valueOf("0"));
  5565. }
  5566. }
  5567. else if (pairs.getKey().equals(entity.UNAGAEDGERSEN)) {
  5568. try {
  5569. entity.setUnagaEdgersen(Long.valueOf(pairs.getValue().toString()));
  5570. } catch (NumberFormatException e) {
  5571. entity.setUnagaEdgersen(Long.valueOf("0"));
  5572. }
  5573. } else if (pairs.getKey().equals(entity.TUGALUVCHILSEN)) {
  5574. try {
  5575. entity.setTugalUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5576. } catch (NumberFormatException e) {
  5577. entity.setTugalUvchilsen(Long.valueOf("0"));
  5578. }
  5579. } else if (pairs.getKey().equals(entity.TUGALUHSEN)) {
  5580. try {
  5581. entity.setTugalUhsen(Long.valueOf(pairs.getValue().toString()));
  5582. } catch (NumberFormatException e) {
  5583. entity.setTugalUhsen(Long.valueOf("0"));
  5584. }
  5585. } else if (pairs.getKey().equals(entity.TUGALEDGERSEN)) {
  5586. try {
  5587. entity.setTugalEdgersen(Long.valueOf(pairs.getValue().toString()));
  5588. } catch (NumberFormatException e) {
  5589. entity.setTugalEdgersen(Long.valueOf("0"));
  5590. }
  5591. }
  5592. else if (pairs.getKey().equals(entity.HURGAUVCHILSEN)) {
  5593. try {
  5594. entity.setHurgaUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5595. } catch (NumberFormatException e) {
  5596. entity.setHurgaUvchilsen(Long.valueOf("0"));
  5597. }
  5598. } else if (pairs.getKey().equals(entity.HURGAUHSEN)) {
  5599. try {
  5600. entity.setHurgaUhsen(Long.valueOf(pairs.getValue().toString()));
  5601. } catch (NumberFormatException e) {
  5602. entity.setHurgaUhsen(Long.valueOf("0"));
  5603. }
  5604. } else if (pairs.getKey().equals(entity.HURGAEDGERSEN)) {
  5605. try {
  5606. entity.setHurgaEdgersen(Long.valueOf(pairs.getValue().toString()));
  5607. } catch (NumberFormatException e) {
  5608. entity.setHurgaEdgersen(Long.valueOf("0"));
  5609. }
  5610. } else if (pairs.getKey().equals(entity.ISHIGUVCHILSEN)) {
  5611. try {
  5612. entity.setIshigUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5613. } catch (NumberFormatException e) {
  5614. entity.setIshigUvchilsen(Long.valueOf("0"));
  5615. }
  5616. }
  5617. else if (pairs.getKey().equals(entity.ISHIGUHSEN)) {
  5618. try {
  5619. entity.setIshigUhsen(Long.valueOf(pairs.getValue().toString()));
  5620. } catch (NumberFormatException e) {
  5621. entity.setIshigUhsen(Long.valueOf("0"));
  5622. }
  5623. } else if (pairs.getKey().equals(entity.ISHIGEDGERSEN)) {
  5624. try {
  5625. entity.setIshigEdgersen(Long.valueOf(pairs.getValue().toString()));
  5626. } catch (NumberFormatException e) {
  5627. entity.setIshigEdgersen(Long.valueOf("0"));
  5628. }
  5629. } else if (pairs.getKey().equals(entity.BUSADUVCHILSEN)) {
  5630. try {
  5631. entity.setBusadUvchilsen(Long.valueOf(pairs.getValue().toString()));
  5632. } catch (NumberFormatException e) {
  5633. entity.setBusadUvchilsen(Long.valueOf("0"));
  5634. }
  5635. } else if (pairs.getKey().equals(entity.BUSADUHSEN)) {
  5636. try {
  5637. entity.setBusadUhsen(Long.valueOf(pairs.getValue().toString()));
  5638. } catch (NumberFormatException e) {
  5639. entity.setBusadUhsen(Long.valueOf("0"));
  5640. }
  5641. }
  5642. else if (pairs.getKey().equals(entity.BUSADEDGERSEN)) {
  5643. try {
  5644. entity.setBusadEdgersen(Long.valueOf(pairs.getValue().toString()));
  5645. } catch (NumberFormatException e) {
  5646. entity.setBusadEdgersen(Long.valueOf("0"));
  5647. }
  5648. }
  5649. else if (pairs.getKey().equals(entity.RECORD_DATE)){
  5650. String dv = String.valueOf(pairs.getValue());
  5651. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  5652. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  5653. entity.setRecordDate(sqlDate);
  5654. }
  5655. else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)){
  5656. String dv = String.valueOf(pairs.getValue());
  5657. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  5658. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  5659. entity.setSearchRecordDate(sqlDate);
  5660. }
  5661. }
  5662. }catch (NullPointerException ex){
  5663. ex.printStackTrace();
  5664. }catch (Exception ex){
  5665. ex.printStackTrace();
  5666. }
  5667. }//end while
  5668. Date utilDate = new Date();
  5669. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  5670. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  5671. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  5672. entity.setDelflg("N");
  5673. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  5674. && !user.getRoleCode().equalsIgnoreCase("ADMIN")){
  5675. entity.setCreby(user.getUsername());
  5676. }
  5677. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null){
  5678. return service.getPieHighChartData(entity);
  5679. }
  5680. }catch (Exception ex){
  5681. ex.printStackTrace();
  5682. }finally {
  5683. }
  5684. return null;
  5685. }
  5686. //form53-chart
  5687. // form61-chart
  5688. @Override
  5689. public BasicDBObject getForm61HightChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  5690. System.out.println("Hospital Service Implament ::: get form 61 hight chart data");
  5691. try{
  5692. IForm61Service service = new Form61ServiceImpl(super.conn);
  5693. User user = sessionUser.get(sessionId);
  5694. Form61Entity entity = new Form61Entity();
  5695. Iterator it = criteria.entrySet().iterator();
  5696. while (it.hasNext()) {
  5697. Map.Entry pairs = (Map.Entry) it.next();
  5698. try{
  5699. if (!pairs.getValue().toString().isEmpty()){
  5700. if (pairs.getKey().equals(entity.ID)) {
  5701. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  5702. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  5703. }else if (pairs.getKey().equals(entity.AIMAG)) {
  5704. entity.setAimag(String.valueOf(pairs.getValue()));
  5705. } else if (pairs.getKey().equals(entity.SUM)) {
  5706. entity.setSum(entity.SUM);
  5707. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  5708. String dv = String.valueOf(pairs.getValue());
  5709. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  5710. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  5711. entity.setRecordDate(sqlDate);
  5712. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  5713. String dv = String.valueOf(pairs.getValue());
  5714. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  5715. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  5716. entity.setSearchRecordDate(sqlDate);
  5717. }
  5718. }
  5719. }catch (NullPointerException ex){
  5720. ex.printStackTrace();
  5721. }catch (Exception ex){
  5722. ex.printStackTrace();
  5723. }
  5724. }//end while
  5725. Date utilDate = new Date();
  5726. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  5727. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  5728. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  5729. entity.setDelflg("N");
  5730. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  5731. && !user.getRoleCode().equalsIgnoreCase("ADMIN")){
  5732. entity.setCreby(user.getUsername());
  5733. }
  5734. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null){
  5735. return service.getColHighChartData(entity);
  5736. }
  5737. }catch (Exception ex){
  5738. ex.printStackTrace();
  5739. }finally {
  5740. }
  5741. return null;
  5742. }
  5743. @Override
  5744. public BasicDBObject getForm61HightPieChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  5745. System.out.println("Hospital Service Implament ::: getForm61aHightPieChartData");
  5746. try {
  5747. IForm61Service service = new Form61ServiceImpl(super.conn);
  5748. User user = sessionUser.get(sessionId);
  5749. Form61Entity entity = new Form61Entity();
  5750. Iterator it = criteria.entrySet().iterator();
  5751. while (it.hasNext()) {
  5752. Map.Entry pairs = (Map.Entry) it.next();
  5753. try {
  5754. if (!pairs.getValue().toString().isEmpty()) {
  5755. if (pairs.getKey().equals(entity.ID)) {
  5756. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  5757. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  5758. }else if (pairs.getKey().equals(entity.AIMAG)) {
  5759. entity.setAimag(String.valueOf(pairs.getValue()));
  5760. } if (pairs.getKey().equals(entity.SUM)) {
  5761. entity.setSum(entity.SUM);
  5762. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  5763. String dv = String.valueOf(pairs.getValue());
  5764. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  5765. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  5766. entity.setRecordDate(sqlDate);
  5767. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  5768. String dv = String.valueOf(pairs.getValue());
  5769. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  5770. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  5771. entity.setSearchRecordDate(sqlDate);
  5772. }
  5773. }
  5774. } catch (NullPointerException ex) {
  5775. ex.printStackTrace();
  5776. } catch (Exception ex) {
  5777. ex.printStackTrace();
  5778. }
  5779. }//end while
  5780. Date utilDate = new Date();
  5781. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  5782. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  5783. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  5784. entity.setDelflg("N");
  5785. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  5786. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  5787. entity.setCreby(user.getUsername());
  5788. }
  5789. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null) {
  5790. return service.getPieHighChartData(entity);
  5791. }
  5792. } catch (Exception ex) {
  5793. ex.printStackTrace();
  5794. } finally {
  5795. }
  5796. return null;
  5797. }
  5798. // form61-chart
  5799. // form62-chart
  5800. @Override
  5801. public BasicDBObject getForm62HightChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  5802. System.out.println("Hospital Service Implament ::: get form 62 hight chart data");
  5803. try{
  5804. IForm62Service service = new Form62ServiceImpl(super.conn);
  5805. User user = sessionUser.get(sessionId);
  5806. Form62Entity entity = new Form62Entity();
  5807. Iterator it = criteria.entrySet().iterator();
  5808. while (it.hasNext()) {
  5809. Map.Entry pairs = (Map.Entry) it.next();
  5810. try{
  5811. if (!pairs.getValue().toString().isEmpty()){
  5812. if (pairs.getKey().equals(entity.ID)) {
  5813. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  5814. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  5815. }else if (pairs.getKey().equals(entity.AIMAG)) {
  5816. entity.setAimag(String.valueOf(pairs.getValue()));
  5817. } else if (pairs.getKey().equals(entity.SUM)) {
  5818. entity.setSum(entity.SUM);
  5819. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  5820. String dv = String.valueOf(pairs.getValue());
  5821. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  5822. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  5823. entity.setRecordDate(sqlDate);
  5824. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  5825. String dv = String.valueOf(pairs.getValue());
  5826. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  5827. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  5828. entity.setSearchRecordDate(sqlDate);
  5829. }
  5830. }
  5831. }catch (NullPointerException ex){
  5832. ex.printStackTrace();
  5833. }catch (Exception ex){
  5834. ex.printStackTrace();
  5835. }
  5836. }//end while
  5837. Date utilDate = new Date();
  5838. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  5839. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  5840. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  5841. entity.setDelflg("N");
  5842. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  5843. && !user.getRoleCode().equalsIgnoreCase("ADMIN")){
  5844. entity.setCreby(user.getUsername());
  5845. }
  5846. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null){
  5847. return service.getColHighChartData(entity);
  5848. }
  5849. }catch (Exception ex){
  5850. ex.printStackTrace();
  5851. }finally {
  5852. }
  5853. return null;
  5854. }
  5855. @Override
  5856. public BasicDBObject getForm62HightPieChartData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
  5857. System.out.println("Hospital Service Implament ::: getForm62HightPieChartData");
  5858. try {
  5859. IForm62Service service = new Form62ServiceImpl(super.conn);
  5860. User user = sessionUser.get(sessionId);
  5861. Form62Entity entity = new Form62Entity();
  5862. Iterator it = criteria.entrySet().iterator();
  5863. while (it.hasNext()) {
  5864. Map.Entry pairs = (Map.Entry) it.next();
  5865. try {
  5866. if (!pairs.getValue().toString().isEmpty()) {
  5867. if (pairs.getKey().equals(entity.ID)) {
  5868. if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
  5869. entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
  5870. }else if (pairs.getKey().equals(entity.AIMAG)) {
  5871. entity.setAimag(String.valueOf(pairs.getValue()));
  5872. } if (pairs.getKey().equals(entity.SUM)) {
  5873. entity.setSum(entity.SUM);
  5874. } else if (pairs.getKey().equals(entity.RECORD_DATE)) {
  5875. String dv = String.valueOf(pairs.getValue());
  5876. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  5877. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  5878. entity.setRecordDate(sqlDate);
  5879. } else if (pairs.getKey().equals(entity.SEARCH_RECORD_DATE)) {
  5880. String dv = String.valueOf(pairs.getValue());
  5881. if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
  5882. java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
  5883. entity.setSearchRecordDate(sqlDate);
  5884. }
  5885. }
  5886. } catch (NullPointerException ex) {
  5887. ex.printStackTrace();
  5888. } catch (Exception ex) {
  5889. ex.printStackTrace();
  5890. }
  5891. }//end while
  5892. Date utilDate = new Date();
  5893. java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  5894. if (entity.getRecordDate() == null) entity.setRecordDate(sqlDate);
  5895. if (entity.getSearchRecordDate() == null) entity.setSearchRecordDate(sqlDate);
  5896. entity.setDelflg("N");
  5897. if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
  5898. && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
  5899. entity.setCreby(user.getUsername());
  5900. }
  5901. if (entity != null && entity.getRecordDate() != null && entity.getSearchRecordDate() != null) {
  5902. return service.getPieHighChartData(entity);
  5903. }
  5904. } catch (Exception ex) {
  5905. ex.printStackTrace();
  5906. } finally {
  5907. }
  5908. return null;
  5909. }
  5910. // form62-chart
  5911. @Override
  5912. public BasicDBObject getStatistic(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception{
  5913. BasicDBObject basicDBObject = new BasicDBObject();
  5914. try{
  5915. IUserService userService = new UserServiceImpl(super.conn);
  5916. IUploadFileService fileService = new UploadFileServiceImpl(super.conn);
  5917. INewsService newsService = new NewsServiceImpl(super.conn);
  5918. basicDBObject.put("usercount", String.valueOf(userService.getUsersCount()));
  5919. basicDBObject.put("filecount", String.valueOf(fileService.getFileCount()));
  5920. basicDBObject.put("newscount", String.valueOf(newsService.getNewsCount()));
  5921. }catch (Exception ex){
  5922. ex.printStackTrace();
  5923. }
  5924. return basicDBObject;
  5925. }
  5926. private int stringToInteger(String val) throws NumberFormatException {
  5927. if (val != null && !val.isEmpty()) {
  5928. if (val.contains(".")) {
  5929. String buhel = val.substring(0, val.indexOf("."));
  5930. return Integer.parseInt(buhel);
  5931. } else {
  5932. return Integer.parseInt(val);
  5933. }
  5934. }
  5935. return 0;
  5936. }
  5937. }