|
|
|
package com.glxp.mipsdl.service.hlfyyy;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.glxp.mipsdl.entity.hlfyyy.VA010;
|
|
|
|
import com.glxp.mipsdl.req.base.UdiwmsBasicSkPrescribeRequest;
|
|
|
|
import com.glxp.mipsdl.thirddao.hlfyyy.VA010Mapper;
|
|
|
|
import com.glxp.mipsdl.thirddao.hlfyyy.VA015Mapper;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
import com.glxp.mipsdl.entity.hlfyyy.VA015;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Comparator;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@Service
|
|
|
|
public class VA015Service extends ServiceImpl<VA015Mapper, VA015> {
|
|
|
|
@Resource
|
|
|
|
private VA015Mapper va015Mapper;
|
|
|
|
@Value("${DSF_XML_SQL_TYPE:Mysql}")
|
|
|
|
private String defXmlSqlType;
|
|
|
|
public IPage<VA015> getList(Page page , UdiwmsBasicSkPrescribeRequest udiwmsBasicSkPrescribeRequest){
|
|
|
|
IPage<VA015> iPage = va015Mapper.getList(page,udiwmsBasicSkPrescribeRequest);
|
|
|
|
List<VA015> list = iPage.getRecords();
|
|
|
|
List<VA015> listNew = new ArrayList<>();
|
|
|
|
list.sort( Comparator.comparing(VA015::getPrescribedate));
|
|
|
|
if(list!=null && list.size() >0){
|
|
|
|
String lastSql = "";
|
|
|
|
if(defXmlSqlType.equals("Mysql")){
|
|
|
|
lastSql = "AND limit = 1";
|
|
|
|
|
|
|
|
}else if(defXmlSqlType.equals("Oracle")){
|
|
|
|
lastSql = "AND rownum = 1";
|
|
|
|
}
|
|
|
|
for (VA015 va015 : list) {
|
|
|
|
|
|
|
|
|
|
|
|
VA015 va015New = va015Mapper.selectOne(new QueryWrapper<VA015>().eq("code",va015.getCode()).last(lastSql));
|
|
|
|
listNew.add(va015New);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
iPage.setRecords(listNew);
|
|
|
|
|
|
|
|
return iPage;
|
|
|
|
}
|
|
|
|
}
|