|
@@ -1,38 +1,57 @@
|
|
|
package thyyxxk.webserver.service.medicalinsurance;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import thyyxxk.webserver.config.exception.ExceptionEnum;
|
|
|
+import thyyxxk.webserver.constants.sidicts.SiFunction;
|
|
|
import thyyxxk.webserver.dao.his.medicalinsurance.SiLogDao;
|
|
|
import thyyxxk.webserver.entity.ResultVo;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.log.FetchLog;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.log.SiLog;
|
|
|
import thyyxxk.webserver.utils.ResultVoUtil;
|
|
|
-import thyyxxk.webserver.utils.StringUtil;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@Service
|
|
|
public class SiLogService {
|
|
|
private final SiLogDao dao;
|
|
|
+ private final Map<String, String> userMap;
|
|
|
|
|
|
@Autowired
|
|
|
public SiLogService(SiLogDao dao) {
|
|
|
this.dao = dao;
|
|
|
+ userMap = new HashMap<>();
|
|
|
}
|
|
|
|
|
|
- public ResultVo<List<SiLog>> selectSiLogs(FetchLog ftchlg) {
|
|
|
- QueryWrapper<SiLog> wrapper = new QueryWrapper<>();
|
|
|
- wrapper.eq("log_type", ftchlg.getLogType());
|
|
|
- if (StringUtil.notBlank(ftchlg.getInfno())) {
|
|
|
- wrapper.eq("infno", ftchlg.getInfno());
|
|
|
+ public ResultVo<Map<String, Object>> selectSiLogs(FetchLog ftchlg) {
|
|
|
+ IPage<SiLog> iPage = new Page<>(ftchlg.getCurrentPage(), ftchlg.getPageSize());
|
|
|
+ iPage = dao.selectSiLogs(iPage, ftchlg);
|
|
|
+ if (iPage.getTotal() == 0) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
|
|
|
}
|
|
|
- if (null != ftchlg.getBegntime() && null != ftchlg.getEndtime()) {
|
|
|
- wrapper.between("create_datetime", ftchlg.getBegntime(), ftchlg.getEndtime());
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("total", iPage.getTotal());
|
|
|
+ List<SiLog> list = iPage.getRecords();
|
|
|
+ for (SiLog siLog : list) {
|
|
|
+ siLog.setInfname(SiFunction.getName(siLog.getInfno()));
|
|
|
+ String userid = siLog.getOpter();
|
|
|
+ if (userMap.containsKey(userid)) {
|
|
|
+ siLog.setOpterName(userMap.get(userid));
|
|
|
+ } else {
|
|
|
+ String username = dao.selectUserName(userid);
|
|
|
+ siLog.setOpterName(username);
|
|
|
+ userMap.put(userid, username);
|
|
|
+ }
|
|
|
}
|
|
|
- if (StringUtil.notBlank(ftchlg.getPatNo())) {
|
|
|
- wrapper.eq("pat_no", ftchlg.getPatNo());
|
|
|
- }
|
|
|
- return ResultVoUtil.success(dao.selectList(wrapper));
|
|
|
+ map.put("list", list);
|
|
|
+ return ResultVoUtil.success(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ public ResultVo<SiLog> selectSiLogBody(String msgid) {
|
|
|
+ return ResultVoUtil.success(dao.selectById(msgid));
|
|
|
}
|
|
|
}
|