package com.jasamedika.medifirst2000.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.stereotype.Service;

import com.jasamedika.medifirst2000.converter.BaseConverterImpl;
import com.jasamedika.medifirst2000.dao.AntrianPasienDiPeriksaDao;
import com.jasamedika.medifirst2000.dao.CairanFiksasiDetailDao;
import com.jasamedika.medifirst2000.dao.InfusDetailDao;
import com.jasamedika.medifirst2000.dao.JaringanTubuhDetailDao;
import com.jasamedika.medifirst2000.dao.KeteranganLainLainDetailDao;
import com.jasamedika.medifirst2000.dao.PembedahanDanInstruksiDao;
import com.jasamedika.medifirst2000.dao.ProdukDetailLabAnatomiDao;
import com.jasamedika.medifirst2000.dao.StatusGinekologiDetailDao;
import com.jasamedika.medifirst2000.dao.StrukOrderDao;
import com.jasamedika.medifirst2000.entities.CairanFiksasiDetail;
import com.jasamedika.medifirst2000.entities.DiagnosaOnkologiMorfologi;
import com.jasamedika.medifirst2000.entities.DiagnosaOnkologiTopologi;
import com.jasamedika.medifirst2000.entities.Infus;
import com.jasamedika.medifirst2000.entities.InfusDetail;
import com.jasamedika.medifirst2000.entities.JaringanTubuhDetail;
import com.jasamedika.medifirst2000.entities.KeteranganLainLainDetail;
import com.jasamedika.medifirst2000.entities.Pegawai;
import com.jasamedika.medifirst2000.entities.PembedahanDanInstruksi;
import com.jasamedika.medifirst2000.entities.Produk;
import com.jasamedika.medifirst2000.entities.ProdukDetailLabAnatomi;
import com.jasamedika.medifirst2000.entities.StatusGinekologiDetail;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.PembedahanDanInstruksiService;
import com.jasamedika.medifirst2000.service.ProdukDetailLabAnatomiService;
import com.jasamedika.medifirst2000.util.CommonUtil;
import com.jasamedika.medifirst2000.util.JsonUtil;
import com.jasamedika.medifirst2000.vo.CairanFiksasiDetailVO;
import com.jasamedika.medifirst2000.vo.DiagnosaOnkologiMorfologiVO;
import com.jasamedika.medifirst2000.vo.DiagnosaOnkologiTopologiVO;
import com.jasamedika.medifirst2000.vo.InfusDetailVO;
import com.jasamedika.medifirst2000.vo.InfusVO;
import com.jasamedika.medifirst2000.vo.JaringanTubuhDetailVO;
import com.jasamedika.medifirst2000.vo.KeteranganLainLainDetailVO;
import com.jasamedika.medifirst2000.vo.PegawaiVO;
import com.jasamedika.medifirst2000.vo.PembedahanDanInstruksiVO;
import com.jasamedika.medifirst2000.vo.ProdukDetailLabAnatomiVO;
import com.jasamedika.medifirst2000.vo.ProdukVO;
import com.jasamedika.medifirst2000.vo.StatusGinekologiDetailVO;

/**
 * Implement class for PembedahanDanInstruksiService
 * 
 * @author Askur
 */
@Service("PembedahanDanInstruksiService")
public class PembedahanDanInstruksiServiceImpl implements PembedahanDanInstruksiService<PembedahanDanInstruksiVO> {
	@Autowired
	private AntrianPasienDiPeriksaDao antrianPasienDiPeriksaDao;
	@Autowired
	private StrukOrderDao strukOrderDao;
	@Autowired
	private InfusDetailDao infusDetailDao;
	@Autowired
	private PembedahanDanInstruksiDao pembedahanDanInstruksiDao;
	@Autowired
	private BaseConverterImpl<PembedahanDanInstruksiVO, PembedahanDanInstruksi> pembedahanDanInstruksiConverter;
	@Autowired
	private BaseConverterImpl<InfusDetailVO, InfusDetail> infusDetailConverter;
	@Autowired
	private BaseConverterImpl<InfusVO, Infus> infusConverter;

	@Override
	public Map<String,Object> addPembedahanDanInstruksi(PembedahanDanInstruksiVO vo) {
		Map<String,Object> result=new HashMap<String,Object>();
		PembedahanDanInstruksi model=pembedahanDanInstruksiConverter.transferVOToModel(vo, new PembedahanDanInstruksi());
	//	for(InfusDetailVO abc:vo.getInfusDetailSet()){
	//		InfusDetail local=infusDetailConverter.transferVOToModel(abc, new InfusDetail());
	//		local.setMacamInfus(infusConverter.transferVOToModel(abc.getMacamInfus(), new Infus()));
	//		model.getInfusDetailSet().add(local);
	//	}
		PembedahanDanInstruksi resultModel=pembedahanDanInstruksiDao.save(model);
		try {
			result.put("pembedahanDanInstruksi", JsonUtil.ToMap(resultModel));
		} catch (IllegalArgumentException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		}
		return result;
	}

	@Override
	public PembedahanDanInstruksiVO add(PembedahanDanInstruksiVO vo) throws JpaSystemException, ServiceVOException {
		return null;
	}

	@Override
	public PembedahanDanInstruksiVO update(PembedahanDanInstruksiVO vo) throws JpaSystemException, ServiceVOException {
		return null;
	}

	@Override
	public Boolean delete(String key) throws JpaSystemException {
		return null;
	}

	@Override
	public PembedahanDanInstruksiVO findById(String key) throws JpaSystemException {
		return null;
	}

	@Override
	public List<PembedahanDanInstruksiVO> findAll() throws JpaSystemException {
		return null;
	}

	@Override
	public Map<String, Object> findAllWithPageAndLimitAndSortByAndDirectionParameter(Integer page, Integer limit,
			String sort, String dir) {
		return null;
	}
	
}
