package com.saye.hospitalgd.service.impl;

import com.saye.hospitalgd.mapper.RefundOrderMapper;
import com.saye.hospitalgd.service.RefundOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @author： Mr.zs
 * @date： 2023/10/9
 * @description：
 * @modifiedBy：
 * @version: 1.0
 */
@Service
public class RefundOrderServiceImpl implements RefundOrderService {

    @Autowired
    RefundOrderMapper refundOrderMapper;

    @Override
    public List<HashMap<Object, Object>> findRefundOrder(HashMap<Object, Object> map) {
        List<HashMap<Object, Object>> tempList = refundOrderMapper.findRefundOrder(map);
        List<HashMap<Object, Object>> hashMaps = new ArrayList<>();
        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

        for (HashMap<Object, Object> ohm : tempList) {
            LocalDateTime o = (LocalDateTime) ohm.get("TIME_STAMP");
            ohm.put("TIME_STAMP", o.format(fmt));
            hashMaps.add(ohm);
        }
        return hashMaps;

    }
}
