|
|
@@ -1,10 +1,12 @@
|
|
|
package restcontroller.sale.customer;
|
|
|
|
|
|
+import beans.brand.Brand;
|
|
|
import beans.datacontrllog.DataContrlLog;
|
|
|
import beans.dataextend.DataExtend;
|
|
|
import beans.datatag.DataTag;
|
|
|
import beans.datateam.DataTeam;
|
|
|
import beans.hr.Hr;
|
|
|
+import beans.itemclass.ItemClass;
|
|
|
import beans.proxy.Proxy;
|
|
|
import beans.recycle.Recycle;
|
|
|
import beans.salearea.SaleArea;
|
|
|
@@ -667,5 +669,57 @@ public class Hospital extends Controller {
|
|
|
return getSucReturnObject().setData(rows).toString();
|
|
|
}
|
|
|
|
|
|
+ @API(title = "关联查询科室产品", apiversion = R.ID2025102711132502.v1.class)
|
|
|
+ public String queryItems() throws YosException {
|
|
|
+ StringBuffer where = new StringBuffer(" 1=1 ");
|
|
|
+ if (content.containsKey("where")) {
|
|
|
+ JSONObject whereObject = content.getJSONObject("where");
|
|
|
+ if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
|
|
|
+ where.append(" and(");
|
|
|
+ where.append("t1.itemno like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
+ where.append("or t1.itemname like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
+ where.append("or t1.model like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
+ where.append("or t1.spec like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
+ where.append("or t1.assistance like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
+ where.append("or t1.goodstype like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
+ where.append("or t1.explains like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
+ where.append("or t4.stagename like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ Long sa_customersid = content.getLong("sa_customersid");
|
|
|
+
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "plm_item",
|
|
|
+ "itemid", "itemno", "itemname", "model", "spec", "assistance", "goodstype", "explains")
|
|
|
+ .setTableAlias("t1");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "plm_itemextend", "t2", "t2.itemid = t1.itemid AND t2.siteid = t1.siteid",
|
|
|
+ "erpitemname", "erpitemno");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.inner, "sa_hospitaldep_item", "t3", "t3.itemid = t1.itemid AND t3.siteid = t1.siteid","sa_hospitaldep_itemid");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.inner, "sa_devstage", "t4", "t4.sa_devstageid = t3.sa_devstageid AND t4.siteid = t3.siteid",
|
|
|
+ "stagename");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.inner, "sa_hospitaldep", "t5", "t5.sa_hospitaldepid = t3.sa_hospitaldepid AND t5.siteid = t3.siteid",
|
|
|
+ "hospitaldepname","sa_hospitaldepid");
|
|
|
+ querySQL.setWhere("t5.sa_customersid", sa_customersid);
|
|
|
+ querySQL.setSiteid(siteid);
|
|
|
+ querySQL.setWhere(where);
|
|
|
+ if(pageSorting.equals("''")){
|
|
|
+ pageSorting="t5.sa_hospitaldepid,t3.sa_hospitaldep_itemid";
|
|
|
+ }
|
|
|
+ querySQL.setPage(pageSize, pageNumber).setOrderBy(pageSorting);
|
|
|
+ Rows rows = querySQL.query();
|
|
|
+ ArrayList<Long> ids = rows.toArrayList("itemid", new ArrayList<>());
|
|
|
+ // 商品品牌
|
|
|
+ RowsMap brandRowsMap = Brand.getBrandRowsMap(this, ids);
|
|
|
+ RowsMap itemclassRowsMap = ItemClass.getAllItemClassRowsMap(this, ids);
|
|
|
+ for (Row row : rows) {
|
|
|
+ Rows brandRows = brandRowsMap.getOrDefault(row.getString("itemid"), new Rows());
|
|
|
+ Rows itemclassRows = itemclassRowsMap.getOrDefault(row.getString("itemid"), new Rows());
|
|
|
+ row.put("brandname", StringUtils.join(brandRows.toArray("brandname"), ","));
|
|
|
+ row.put("itemclassname", StringUtils.join(itemclassRows.toArray("itemclassname"), ","));
|
|
|
+ }
|
|
|
+ return getSucReturnObject().setData(rows).toString();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|