/hospsys/hospsys/insurance/core/javasrc/com/hospital/HospitalServiceImpl.java
Java | 6998 lines | 5771 code | 1049 blank | 178 comment | 2910 complexity | 6d19225d2d1870b83585b46340c2c348 MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- package com.hospital;
- import com.auth.HospService;
- import com.enumclass.ErrorType;
- import com.google.gson.internal.LinkedTreeMap;
- import com.hospital.app.*;
- import com.model.FavoritePages;
- import com.model.Role;
- import com.model.User;
- import com.model.hos.*;
- import com.mongodb.BasicDBObject;
- import com.rpc.RpcHandler;
- import org.bson.types.ObjectId;
- import java.math.BigDecimal;
- import java.text.SimpleDateFormat;
- import java.time.format.DateTimeFormatter;
- import java.util.*;
- public class HospitalServiceImpl extends HospService implements HospitalService {
- private CheckUserRoleControl roleControl = null;
- private ErrorEntity errorEntity = null;
- private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
- public HospitalServiceImpl() {
- handler = new RpcHandler<>(this, HospitalService.class);
- }
- @Override
- public BasicDBObject checkSession(String sessionId) {
- BasicDBObject basicDBObject = new BasicDBObject();
- User loginUser = getUserInfo(sessionId);
- basicDBObject.put("session", true);
- if (loginUser == null) {
- basicDBObject.put("session", false);
- }
- return basicDBObject;
- }
- @Override
- public List<BasicDBObject> getRoles(String sessionId) {
- User user = sessionUser.get(sessionId);
- if (user == null) return null;
- try {
- //Check Role
- roleControl = new CheckUserRoleControl(super.conn);
- if (roleControl == null) {
- return null;
- }
- return roleControl.getUserAccessMenuList(user);
- //End Check Role
- } catch (Exception ex) {
- ex.printStackTrace();
- } finally {
- }
- return null;
- }
- @Override
- public List<NewsEntity> getNewsData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
- System.out.println("Hospital Service Implament ::: get news data");
- try {
- INewsService newsService = new NewsServiceImpl(super.conn);
- User user = sessionUser.get(sessionId);
- NewsEntity newsEntity = new NewsEntity();
- Iterator it = criteria.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry pairs = (Map.Entry) it.next();
- try {
- if (pairs.getKey().equals(newsEntity.ID)) {
- if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
- newsEntity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
- } else if (pairs.getKey().equals(newsEntity.TITLE)) {
- newsEntity.setTitle(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(newsEntity.CONTENT)) {
- newsEntity.setContent(String.valueOf(pairs.getValue()));
- }
- } catch (NullPointerException ex) {
- ex.printStackTrace();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }//end while
- Date utilDate = new Date();
- java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
- try {
- newsEntity.setCreby(user.getUsername());
- } catch (Exception e) {
- newsEntity.setCreby("");
- }
- if (newsEntity != null) {
- return newsService.getListData(newsEntity);
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- } finally {
- }
- return null;
- }
- @Override
- public ErrorEntity setNewsData(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
- System.out.println("Hospital Service Implament ::: set news data");
- try {
- String command = "EDT";
- INewsService newsService = new NewsServiceImpl(super.conn);
- User user = sessionUser.get(sessionId);
- NewsEntity newsEntity = new NewsEntity();
- Iterator it = criteria.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry pairs = (Map.Entry) it.next();
- try {
- if (pairs.getKey().equals(newsEntity.ID)) {
- String tmpId = "";
- if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
- if (pairs.getValue().toString().contains(".")) {
- tmpId = pairs.getValue().toString().substring(0, pairs.getValue().toString().indexOf("."));
- }
- newsEntity.setId(Long.parseLong(String.valueOf(tmpId)));
- }
- } else if (pairs.getKey().equals(newsEntity.TITLE)) {
- newsEntity.setTitle(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(newsEntity.CONTENT)) {
- newsEntity.setContent(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().toString().equalsIgnoreCase("command")) {
- command = String.valueOf(pairs.getValue());
- }
- } catch (NullPointerException ex) {
- ex.printStackTrace();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }//end while
- if (command.equalsIgnoreCase("INS")) {
- newsEntity.setDelflg("N");
- newsEntity.setActflg("Y");
- try {
- newsEntity.setCreby(user.getUsername());
- newsEntity.setModby(user.getUsername());
- } catch (NullPointerException e) {
- newsEntity.setCreby("");
- newsEntity.setModby("");
- }
- Date utilDate = new Date();
- java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
- newsEntity.setCreat(sqlDate);
- newsEntity.setModAt(sqlDate);
- errorEntity = newsService.insertNewData(newsEntity);
- } else if (command.equalsIgnoreCase("EDT") ||
- command.equalsIgnoreCase("DEL") ||
- command.equalsIgnoreCase("ACT")) {
- int quality = 2;
- if (command.equalsIgnoreCase("DEL")) {
- newsEntity.setDelflg("Y");
- quality = 3;
- } else if (command.equalsIgnoreCase("ACT")) {
- newsEntity.setActflg("N");
- }
- errorEntity = newsService.updateData(newsEntity);
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- } finally {
- }
- return errorEntity;
- }
- @Override
- public List<Form08Entity> getForm08Data(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
- System.out.println("Hospital Service Implament ::: get form 08 data");
- try {
- IForm08Service form08Service = new Form08ServiceImpl(super.conn);
- User user = sessionUser.get(sessionId);
- Form08Entity form08Entity = new Form08Entity();
- Iterator it = criteria.entrySet().iterator();
- //Check Role
- roleControl = new CheckUserRoleControl(super.conn);
- if (roleControl == null) {
- return null;
- }
- menuid = menuid.replaceAll("#", "");
- if (!roleControl.checkRole(user, menuid, 1)) {
- return null;
- }
- //End Check Role
- while (it.hasNext()) {
- Map.Entry pairs = (Map.Entry) it.next();
- try {
- if (pairs.getKey().equals(form08Entity.ID)) {
- if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
- form08Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
- } else if (pairs.getKey().equals(form08Entity.AIMAG)) {
- form08Entity.setAimag(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form08Entity.SUM)) {
- form08Entity.setSum(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form08Entity.MALTURUL)) {
- form08Entity.setMalTurul(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form08Entity.ARGA_HEMJEE_NER)) {
- form08Entity.setArgaHemjeeNer(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form08Entity.NER)) {
- form08Entity.setNer(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form08Entity.ZARTSUULSAN_HEMJEE)) {
- form08Entity.setZartsuulsanHemjee(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form08Entity.TOLOVLOGOO)) {
- form08Entity.setTolovlogoo(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form08Entity.GUITSETGEL)) {
- form08Entity.setGuitsetgel(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form08Entity.HUVI)) {
- form08Entity.setHuvi(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form08Entity.OLGOSON_TUN)) {
- try {
- form08Entity.setOLGOSON_TUN(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form08Entity.setOLGOSON_TUN(Long.parseLong("0"));
- }
- } else if (pairs.getKey().equals(form08Entity.HEREGLESEN_TUN)) {
- try {
- form08Entity.setHEREGLESEN_TUN(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form08Entity.setHEREGLESEN_TUN(Long.parseLong("0"));
- }
- } else if (pairs.getKey().equals(form08Entity.USTGASAN_TUN)) {
- try {
- form08Entity.setUSTGASAN_TUN(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form08Entity.setUSTGASAN_TUN(Long.parseLong("0"));
- }
- } else if (pairs.getKey().equals(form08Entity.NUUTSULSEN_TUN)) {
- try {
- form08Entity.setNUUTSULSEN_TUN(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form08Entity.setNUUTSULSEN_TUN(Long.parseLong("0"));
- }
- } else if (pairs.getKey().equals(form08Entity.RECORD_DATE)) {
- String dv = String.valueOf(pairs.getValue());
- if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
- java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
- form08Entity.setRecordDate(sqlDate);
- } else if (pairs.getKey().equals(form08Entity.SEARCH_RECORD_DATE)) {
- String dv = String.valueOf(pairs.getValue());
- if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
- java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
- form08Entity.setSearchRecordDate(sqlDate);
- }
- } catch (NullPointerException ex) {
- ex.printStackTrace();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }//end while
- Date utilDate = new Date();
- java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
- if (form08Entity.getRecordDate() == null) form08Entity.setRecordDate(sqlDate);
- if (form08Entity.getSearchRecordDate() == null) form08Entity.setSearchRecordDate(sqlDate);
- if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
- && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
- form08Entity.setCreby(user.getUsername());
- }
- if (form08Entity != null && form08Entity.getRecordDate() != null && form08Entity.getSearchRecordDate() != null) {
- return form08Service.getListData(form08Entity);
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- } finally {
- }
- return null;
- }
- @Override
- public ErrorEntity setForm08Data(LinkedTreeMap criteria, String sessionId, String menuid) throws Exception {
- System.out.println("Hospital Service Implament ::: get form 08 data");
- try {
- String command = "EDT";
- IForm08Service form08Service = new Form08ServiceImpl(super.conn);
- //Begin Check Role Step 1
- roleControl = new CheckUserRoleControl(super.conn);
- if (roleControl == null) {
- errorEntity = new ErrorEntity(ErrorType.ERROR, Long.valueOf(1002)); // Ерөнхий алдаа : Эрх нь хүрэлцэхгүй үед өгөх
- return errorEntity;
- }
- //End Check Role Step 1
- menuid = menuid.replaceAll("#", "");
- User user = sessionUser.get(sessionId);
- Form08Entity form08Entity = new Form08Entity();
- Iterator it = criteria.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry pairs = (Map.Entry) it.next();
- try {
- if (pairs.getKey().equals(form08Entity.ID)) {
- String tmpId = "";
- if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
- if (pairs.getValue().toString().contains(".")) {
- tmpId = pairs.getValue().toString().substring(0, pairs.getValue().toString().indexOf("."));
- }
- form08Entity.setId(Long.parseLong(String.valueOf(tmpId)));
- }
- } else if (pairs.getKey().equals(form08Entity.ARGA_HEMJEE_NER)) {
- form08Entity.setArgaHemjeeNer(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form08Entity.AIMAG)) {
- form08Entity.setAimag(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form08Entity.SUM)) {
- form08Entity.setSum(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form08Entity.NER)) {
- form08Entity.setNer(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form08Entity.ZARTSUULSAN_HEMJEE)) {
- form08Entity.setZartsuulsanHemjee(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form08Entity.MALTURUL)) {
- form08Entity.setMalTurul(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form08Entity.TOLOVLOGOO)) {
- form08Entity.setTolovlogoo(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form08Entity.GUITSETGEL)) {
- form08Entity.setGuitsetgel(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form08Entity.HUVI)) {
- form08Entity.setHuvi(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form08Entity.OLGOSON_TUN)) {
- try {
- form08Entity.setOLGOSON_TUN(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form08Entity.setOLGOSON_TUN(Long.parseLong("0"));
- }
- } else if (pairs.getKey().equals(form08Entity.HEREGLESEN_TUN)) {
- try {
- form08Entity.setHEREGLESEN_TUN(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form08Entity.setHEREGLESEN_TUN(Long.parseLong("0"));
- }
- } else if (pairs.getKey().equals(form08Entity.USTGASAN_TUN)) {
- try {
- form08Entity.setUSTGASAN_TUN(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form08Entity.setUSTGASAN_TUN(Long.parseLong("0"));
- }
- } else if (pairs.getKey().equals(form08Entity.NUUTSULSEN_TUN)) {
- try {
- form08Entity.setNUUTSULSEN_TUN(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form08Entity.setNUUTSULSEN_TUN(Long.parseLong("0"));
- }
- } else if (pairs.getKey().toString().equalsIgnoreCase("command")) {
- command = String.valueOf(pairs.getValue());
- } else if (pairs.getKey().equals(form08Entity.RECORD_DATE)) {
- String dv = String.valueOf(pairs.getValue());
- if (!dv.isEmpty() && dv.length() >= 8) {
- if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
- java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
- form08Entity.setRecordDate(sqlDate);
- }
- }
- } catch (NullPointerException ex) {
- ex.printStackTrace();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }//end while
- if (command.equalsIgnoreCase("INS")) {
- form08Entity.setDelflg("N");
- form08Entity.setActflg("Y");
- if (user != null && (user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
- || user.getRoleCode().equalsIgnoreCase("ADMIN"))) {
- //Aimag songoh shaardlagagui
- } else {
- form08Entity.setAimag(user.getCity());
- }
- //form08Entity.setSum(user.getSum());
- form08Entity.setCreby(user.getUsername());
- Date utilDate = new Date();
- java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
- form08Entity.setCreat(sqlDate);
- if (form08Entity.getRecordDate() == null) form08Entity.setCreat(sqlDate);
- //Begin Check Role Step 2
- if (roleControl.checkRole(user, menuid, 2)) {
- errorEntity = form08Service.insertNewData(form08Entity);
- } else {
- errorEntity = new ErrorEntity(ErrorType.ERROR, Long.valueOf(1002)); // Ерөнхий алдаа : Эрх нь хүрэлцэхгүй үед өгөх
- }
- //End Check Role Step 2
- } else if (command.equalsIgnoreCase("EDT") ||
- command.equalsIgnoreCase("DEL") ||
- command.equalsIgnoreCase("ACT")) {
- int quality = 2;
- if (command.equalsIgnoreCase("DEL")) {
- form08Entity.setDelflg("Y");
- quality = 3;
- } else if (command.equalsIgnoreCase("ACT")) {
- form08Entity.setActflg("N");
- }
- //Begin Check Role Step 2
- if (roleControl.checkRole(user, menuid, quality)) {
- errorEntity = form08Service.updateData(form08Entity);
- } else {
- errorEntity = new ErrorEntity(ErrorType.ERROR, Long.valueOf(1002)); // Ерөнхий алдаа : Эрх нь хүрэлцэхгүй үед өгөх
- }
- //End Check Role Step 2
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- } finally {
- }
- return errorEntity;
- }
- // Begin-form09
- @Override
- public List<Form09Entity> getForm09Data(LinkedTreeMap criteria, String sessionId) throws Exception {
- System.out.println("Hospital Service Implament ::: get form 09 data");
- try {
- IForm09Service form09Service = new Form09ServiceImpl(super.conn);
- User user = sessionUser.get(sessionId);
- Form09Entity form09Entity = new Form09Entity();
- Iterator it = criteria.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry pairs = (Map.Entry) it.next();
- try {
- if (pairs.getKey().equals(form09Entity.ID)) {
- if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
- form09Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
- } else if (pairs.getKey().equals(form09Entity.AIMAG)) {
- form09Entity.setAimag(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form09Entity.SUM)) {
- form09Entity.setSum(form09Entity.SUM);
- } else if (pairs.getKey().equals(form09Entity.MALTURUL)) {
- form09Entity.setMalTurul(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form09Entity.TARILGANER)) {
- form09Entity.setTarilgaNer(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form09Entity.NER)) {
- form09Entity.setNer(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form09Entity.ZARTSUULSANHEMJEE)) {
- form09Entity.setZartsuulsanHemjee(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form09Entity.TOLOVLOGOO)) {
- form09Entity.setTolovlogoo(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form09Entity.GUITSETGEL)) {
- form09Entity.setGuitsetgel(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form09Entity.HUVI)) {
- form09Entity.setHuvi(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form09Entity.OLGOSON_TUN)) {
- try {
- form09Entity.setOLGOSON_TUN(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form09Entity.setOLGOSON_TUN(Long.parseLong("0"));
- }
- } else if (pairs.getKey().equals(form09Entity.HEREGLESEN_TUN)) {
- try {
- form09Entity.setHEREGLESEN_TUN(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form09Entity.setHEREGLESEN_TUN(Long.parseLong("0"));
- }
- } else if (pairs.getKey().equals(form09Entity.USTGASAN_TUN)) {
- try {
- form09Entity.setUSTGASAN_TUN(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form09Entity.setUSTGASAN_TUN(Long.parseLong("0"));
- }
- } else if (pairs.getKey().equals(form09Entity.NUUTSULSEN_TUN)) {
- try {
- form09Entity.setNUUTSULSEN_TUN(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form09Entity.setNUUTSULSEN_TUN(Long.parseLong("0"));
- }
- } else if (pairs.getKey().equals(form09Entity.RECORD_DATE)) {
- String dv = String.valueOf(pairs.getValue());
- if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
- java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
- form09Entity.setRecordDate(sqlDate);
- } else if (pairs.getKey().equals(form09Entity.SEARCH_RECORD_DATE)) {
- String dv = String.valueOf(pairs.getValue());
- if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
- java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
- form09Entity.setSearchRecordDate(sqlDate);
- }
- } catch (NullPointerException ex) {
- ex.printStackTrace();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }//end while
- if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
- && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
- form09Entity.setCreby(user.getUsername());
- }
- return form09Service.getListData(form09Entity);
- } catch (Exception ex) {
- ex.printStackTrace();
- } finally {
- }
- return null;
- }
- @Override
- public ErrorEntity setForm09Data(LinkedTreeMap criteria, String sessionId) throws Exception {
- System.out.println("Hospital Service Implament ::: get form 09 data");
- try {
- String command = "EDT";
- IForm09Service form09Service = new Form09ServiceImpl(super.conn);
- User user = sessionUser.get(sessionId);
- Form09Entity form09Entity = new Form09Entity();
- Iterator it = criteria.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry pairs = (Map.Entry) it.next();
- try {
- if (pairs.getKey().equals(form09Entity.ID)) {
- String tmpId = "";
- if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
- if (pairs.getValue().toString().contains(".")) {
- tmpId = pairs.getValue().toString().substring(0, pairs.getValue().toString().indexOf("."));
- }
- form09Entity.setId(Long.parseLong(String.valueOf(tmpId)));
- }
- } else if (pairs.getKey().equals(form09Entity.TARILGANER)) {
- form09Entity.setTarilgaNer(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form09Entity.NER)) {
- form09Entity.setNer(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form09Entity.ZARTSUULSANHEMJEE)) {
- form09Entity.setZartsuulsanHemjee(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form09Entity.MALTURUL)) {
- form09Entity.setMalTurul(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form09Entity.TOLOVLOGOO)) {
- form09Entity.setTolovlogoo(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form09Entity.GUITSETGEL)) {
- form09Entity.setGuitsetgel(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form09Entity.HUVI)) {
- form09Entity.setHuvi(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form09Entity.OLGOSON_TUN)) {
- try {
- form09Entity.setOLGOSON_TUN(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form09Entity.setOLGOSON_TUN(Long.parseLong("0"));
- }
- } else if (pairs.getKey().equals(form09Entity.HEREGLESEN_TUN)) {
- try {
- form09Entity.setHEREGLESEN_TUN(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form09Entity.setHEREGLESEN_TUN(Long.parseLong("0"));
- }
- } else if (pairs.getKey().equals(form09Entity.USTGASAN_TUN)) {
- try {
- form09Entity.setUSTGASAN_TUN(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form09Entity.setUSTGASAN_TUN(Long.parseLong("0"));
- }
- } else if (pairs.getKey().equals(form09Entity.NUUTSULSEN_TUN)) {
- try {
- form09Entity.setNUUTSULSEN_TUN(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form09Entity.setNUUTSULSEN_TUN(Long.parseLong("0"));
- }
- } else if (pairs.getKey().toString().equalsIgnoreCase("command")) {
- command = String.valueOf(pairs.getValue());
- } else if (pairs.getKey().equals(form09Entity.RECORD_DATE)) {
- String dv = String.valueOf(pairs.getValue());
- if (!dv.isEmpty() && dv.length() >= 8) {
- if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
- java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
- form09Entity.setRecordDate(sqlDate);
- }
- }
- } catch (NullPointerException ex) {
- ex.printStackTrace();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }//end while
- if (command.equalsIgnoreCase("INS")) {
- form09Entity.setDelflg("N");
- form09Entity.setActflg("Y");
- form09Entity.setAimag(user.getCity());
- form09Entity.setSum(user.getSum());
- form09Entity.setCreby(user.getUsername());
- Date utilDate = new Date();
- java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
- form09Entity.setCreat(sqlDate);
- if (form09Entity.getRecordDate() == null) form09Entity.setCreat(sqlDate);
- errorEntity = form09Service.insertNewData(form09Entity);
- } else if (command.equalsIgnoreCase("EDT") ||
- command.equalsIgnoreCase("DEL") ||
- command.equalsIgnoreCase("ACT")) {
- if (command.equalsIgnoreCase("DEL")) {
- form09Entity.setDelflg("Y");
- } else if (command.equalsIgnoreCase("ACT")) {
- form09Entity.setActflg("N");
- }
- errorEntity = form09Service.updateData(form09Entity);
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- } finally {
- }
- return errorEntity;
- }
- // end-form09
- @Override
- public List<Form11Entity> getForm11Data(LinkedTreeMap criteria, String sessionId) throws Exception {
- System.out.println("Hospital Service Implament ::: get form 11 data");
- try {
- IForm11Service form11Service = new Form11ServiceImpl(super.conn);
- User user = sessionUser.get(sessionId);
- Form11Entity form11Entity = new Form11Entity();
- Iterator it = criteria.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry pairs = (Map.Entry) it.next();
- try {
- if (pairs.getKey().equals(form11Entity.ID)) {
- if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
- form11Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
- }
- } else if (pairs.getKey().equals(form11Entity.AIMAG)) {
- form11Entity.setAimag(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form11Entity.SUM)) {
- form11Entity.setSum(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form11Entity.BAGCODE)) {
- form11Entity.setBagCode(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form11Entity.MALTURUL)) {
- form11Entity.setMalTurul(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form11Entity.DEEJIINTURUL)) {
- form11Entity.setDeejiinTurul(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form11Entity.SUMBAGNER)) {
- form11Entity.setSumBagNer(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form11Entity.TOOTOLGOI)) {
- try {
- form11Entity.setTooTolgoi(Long.parseLong(String.valueOf(pairs.getValue())));
- } catch (Exception e) {
- form11Entity.setTooTolgoi(Long.parseLong(String.valueOf("0")));
- }
- } else if (pairs.getKey().equals(form11Entity.HAANASHINJILSEN)) {
- form11Entity.setHaanaShinjilsen(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form11Entity.SHINJILSENARGA)) {
- form11Entity.setShinjilsenArga(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form11Entity.ERUUL)) {
- try {
- form11Entity.setEruul(Long.parseLong(String.valueOf(pairs.getValue())));
- } catch (Exception e) {
- form11Entity.setEruul(Long.parseLong(String.valueOf("0")));
- }
- } else if (pairs.getKey().equals(form11Entity.UVCHTEI)) {
- try {
- form11Entity.setUvchtei(Long.parseLong(String.valueOf(pairs.getValue())));
- } catch (Exception e) {
- form11Entity.setUvchtei(Long.parseLong(String.valueOf("0")));
- }
- } else if (pairs.getKey().equals(form11Entity.ONOSH)) {
- try {
- form11Entity.setOnosh(Long.parseLong(String.valueOf(pairs.getValue())));
- } catch (Exception e) {
- form11Entity.setOnosh(Long.parseLong(String.valueOf("0")));
- }
- } else if (pairs.getKey().equals(form11Entity.RECORD_DATE)) {
- String dv = String.valueOf(pairs.getValue());
- if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
- java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
- form11Entity.setRecordDate(sqlDate);
- } else if (pairs.getKey().equals(form11Entity.SEARCH_RECORD_DATE)) {
- String dv = String.valueOf(pairs.getValue());
- if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
- java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
- form11Entity.setSearchRecordDate(sqlDate);
- }
- } catch (NullPointerException ex) {
- ex.printStackTrace();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }//end while
- if (user.getRoleCode() != null && !user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
- && !user.getRoleCode().equalsIgnoreCase("ADMIN")) {
- form11Entity.setCreby(user.getUsername());
- }
- if (form11Entity != null && form11Entity.getRecordDate() != null && form11Entity.getSearchRecordDate() != null) {
- return form11Service.getListData(form11Entity);
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- } finally {
- }
- return null;
- }
- @Override
- public ErrorEntity setForm11Data(LinkedTreeMap criteria, String sessionId) throws Exception {
- System.out.println("Hospital Service Implament ::: get form 11 data");
- try {
- String command = "EDT";
- IForm11Service form11Service = new Form11ServiceImpl(super.conn);
- User user = sessionUser.get(sessionId);
- Form11Entity form11Entity = new Form11Entity();
- Iterator it = criteria.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry pairs = (Map.Entry) it.next();
- try {
- if (pairs.getKey().equals(form11Entity.ID)) {
- String tmpId = "";
- if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty()) {
- if (pairs.getValue().toString().contains(".")) {
- tmpId = pairs.getValue().toString().substring(0, pairs.getValue().toString().indexOf("."));
- }
- form11Entity.setId(Long.parseLong(String.valueOf(tmpId)));
- }
- } else if (pairs.getKey().equals(form11Entity.DEEJIINTURUL)) {
- form11Entity.setDeejiinTurul(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form11Entity.AIMAG)) {
- form11Entity.setAimag(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form11Entity.SUMBAGNER)) {
- form11Entity.setSumBagNer(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form11Entity.SUM)) {
- form11Entity.setSum(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form11Entity.BAGCODE)) {
- form11Entity.setBagCode(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form11Entity.MALTURUL)) {
- form11Entity.setMalTurul(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form11Entity.TOOTOLGOI)) {
- form11Entity.setTooTolgoi(Long.parseLong(String.valueOf(pairs.getValue())));
- } else if (pairs.getKey().equals(form11Entity.HAANASHINJILSEN)) {
- form11Entity.setHaanaShinjilsen(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form11Entity.SHINJILSENARGA)) {
- form11Entity.setShinjilsenArga(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form11Entity.ERUUL)) {
- form11Entity.setEruul(Long.parseLong(String.valueOf(pairs.getValue())));
- } else if (pairs.getKey().equals(form11Entity.UVCHTEI)) {
- form11Entity.setUvchtei(Long.parseLong(String.valueOf(pairs.getValue())));
- } else if (pairs.getKey().equals(form11Entity.ONOSH)) {
- form11Entity.setOnosh(Long.parseLong(String.valueOf(pairs.getValue())));
- } else if (pairs.getKey().equals(form11Entity.RECORD_DATE)) {
- String dv = String.valueOf(pairs.getValue());
- if (!dv.isEmpty() && dv.length() >= 8) {
- if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
- java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
- form11Entity.setRecordDate(sqlDate);
- }
- } else if (pairs.getKey().toString().equalsIgnoreCase("command")) {
- command = String.valueOf(pairs.getValue());
- }
- } catch (NullPointerException ex) {
- ex.printStackTrace();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }//end while
- Date utilDate = new Date();
- java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
- form11Entity.setModby(user.getUsername());
- form11Entity.setModAt(sqlDate);
- if (command.equalsIgnoreCase("INS")) {
- form11Entity.setDelflg("N");
- form11Entity.setActflg("Y");
- if (user != null && (user.getRoleCode().equalsIgnoreCase("SUPERADMIN")
- || user.getRoleCode().equalsIgnoreCase("ADMIN"))) {
- //Aimag songoh shaardlagagui
- } else {
- form11Entity.setAimag(user.getCity());
- }
- //form11Entity.setSum(user.getSum());
- form11Entity.setCreby(user.getUsername());
- form11Entity.setCreat(sqlDate);
- if (form11Entity.getRecordDate() == null) form11Entity.setCreat(sqlDate);
- errorEntity = form11Service.insertNewData(form11Entity);
- } else if (command.equalsIgnoreCase("EDT") ||
- command.equalsIgnoreCase("DEL") ||
- command.equalsIgnoreCase("ACT")) {
- if (command.equalsIgnoreCase("DEL")) {
- form11Entity.setDelflg("Y");
- } else if (command.equalsIgnoreCase("ACT")) {
- form11Entity.setActflg("N");
- }
- errorEntity = form11Service.updateData(form11Entity);
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- } finally {
- }
- return errorEntity;
- }
- // Begin-form14
- @Override
- public List<Form14Entity> getForm14Data(LinkedTreeMap criteria, String sessionId) throws Exception {
- System.out.println("Hospital Service Implament ::: get form 14 data");
- try {
- IForm14Service form14Service = new Form14ServiceImpl(super.conn);
- User user = sessionUser.get(sessionId);
- Form14Entity form14Entity = new Form14Entity();
- Iterator it = criteria.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry pairs = (Map.Entry) it.next();
- try {
- if (pairs.getKey().equals(form14Entity.ID)) {
- if (pairs.getValue() != null && !pairs.getValue().toString().isEmpty())
- form14Entity.setId(Long.parseLong(String.valueOf(pairs.getValue())));
- } else if (pairs.getKey().equals(form14Entity.AIMAG)) {
- form14Entity.setAimag(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form14Entity.SUM)) {
- form14Entity.setSum(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form14Entity.SHALGAHGAZAR)) {
- form14Entity.setShalgahGazar(String.valueOf(pairs.getValue()));
- } else if (pairs.getKey().equals(form14Entity.UZLEGTOO)) {
- try {
- form14Entity.setUzlegToo(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form14Entity.setUzlegToo(Long.valueOf("0"));
- }
- } else if (pairs.getKey().equals(form14Entity.BAIGUULLAGATOO)) {
- try {
- form14Entity.setBaiguullagaToo(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form14Entity.setBaiguullagaToo(Long.valueOf("0"));
- }
- } else if (pairs.getKey().equals(form14Entity.AJAHUINNEGJTOO)) {
- try {
- form14Entity.setAjAhuinNegjToo(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form14Entity.setAjAhuinNegjToo(Long.valueOf("0"));
- }
- } else if (pairs.getKey().equals(form14Entity.IRGEDTOO)) {
- try {
- form14Entity.setIrgedToo(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form14Entity.setIrgedToo(Long.valueOf("0"));
- }
- } else if (pairs.getKey().equals(form14Entity.HUULIINBAIGSHILJSEN)) {
- try {
- form14Entity.setHuuliinBaigShiljsen(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form14Entity.setHuuliinBaigShiljsen(Long.valueOf("0"));
- }
- } else if (pairs.getKey().equals(form14Entity.ZAHIRGAAHARITOO)) {
- try {
- form14Entity.setZahirgaaHariToo(Long.valueOf(pairs.getValue().toString()));
- } catch (NumberFormatException e) {
- form14Entity.setZahirgaaHariToo(Long.valueOf("0"));
- }
- } else if (pairs.getKey().equals(form14Entity.TORGUULIHEMJEE)) {
- try {
- form14Entity.setTorguuliHemjee(BigDecimal.valueOf(Long.parseLong(pairs.getValue().toString())));
- } catch (NumberFormatException e) {
- form14Entity.setTorguuliHemjee(BigDecimal.valueOf(Long.parseLong("0")));
- }
- } else if (pairs.getKey().equals(form14Entity.TOLBOR)) {
- try {
- form14Entity.setTolbor(BigDecimal.valueOf(Long.parseLong(pairs.getValue().toString())));
- } catch (NumberFormatException e) {
- form14Entity.setTolbor(BigDecimal.valueOf(Long.parseLong("0")));
- }
- } else if (pairs.getKey().equals(form14Entity.TORGUULIAR)) {
- try {
- form14Entity.setTorguuliar(BigDecimal.valueOf(Long.parseLong(pairs.getValue().toString())));
- } catch (NumberFormatException e) {
- form14Entity.setTorguuliar(BigDecimal.valueOf(Long.parseLong("0")));
- }
- } else if (pairs.getKey().equals(form14Entity.TOLBOROOR)) {
- try {
- form14Entity.setTolboroor(BigDecimal.valueOf(Long.parseLong(pairs.getValue().toString())));
- } catch (NumberFormatException e) {
- form14Entity.setTolboroor(BigDecimal.valueOf(Long.parseLong("0")));
- }
- } else if (pairs.getKey().equals(form14Entity.RECORD_DATE)) {
- String dv = String.valueOf(pairs.getValue());
- if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
- java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
- form14Entity.setRecordDate(sqlDate);
- } else if (pairs.getKey().equals(form14Entity.SEARCH_RECORD_DATE)) {
- String dv = String.valueOf(pairs.getValue());
- if (String.valueOf(pairs.getValue()).length() <= 10) dv += " 00:00:00";
- java.sql.Date sqlDate = new java.sql.Date(dateFormat.parse(dv).getTime());
- form14Entity.setSearchRecordDate(sqlDate);
- }
- } catch (NullPointerException ex) {
- ex.printStackTrace();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }//end while
- return form14Service.getListData(form14Entity);
- } catch (Exception ex) {
- ex.printStackTrace();
- } finally {
- }
- return null;
- }
- @Override
- public ErrorEntity setForm14Data(LinkedTreeMap criteria, String sessi…
Large files files are truncated, but you can click here to view the full file