|
@@ -22,6 +22,7 @@ import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
|
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
|
+import org.sqlite.core.DB;
|
|
|
import restcontroller.R;
|
|
import restcontroller.R;
|
|
|
import restcontroller.webmanage.executorService.Executor;
|
|
import restcontroller.webmanage.executorService.Executor;
|
|
|
|
|
|
|
@@ -241,6 +242,7 @@ public class Hospital extends Controller {
|
|
|
HashMap<Long, ArrayList<String>> tagList = DataTag.queryTag(this, "sa_customers", ids, false);
|
|
HashMap<Long, ArrayList<String>> tagList = DataTag.queryTag(this, "sa_customers", ids, false);
|
|
|
//系统标签
|
|
//系统标签
|
|
|
HashMap<Long, ArrayList<String>> sysTagList = DataTag.queryTag(this, "sa_customers", ids, true);
|
|
HashMap<Long, ArrayList<String>> sysTagList = DataTag.queryTag(this, "sa_customers", ids, true);
|
|
|
|
|
+ RowsMap opRowsMap = CommonHepler.getHospitalOPRowsMap(this);
|
|
|
for (Row row : rows) {
|
|
for (Row row : rows) {
|
|
|
Long id = row.getLong("sa_customersid");
|
|
Long id = row.getLong("sa_customersid");
|
|
|
row.put("leader", leaderRows.get(row.getString("sa_customersid")));
|
|
row.put("leader", leaderRows.get(row.getString("sa_customersid")));
|
|
@@ -258,7 +260,9 @@ public class Hospital extends Controller {
|
|
|
//系统标签
|
|
//系统标签
|
|
|
row.put("tag_sys", sys_tag);
|
|
row.put("tag_sys", sys_tag);
|
|
|
//预估手术总量
|
|
//预估手术总量
|
|
|
- row.putIfAbsent("totalop", 0);
|
|
|
|
|
|
|
+ //预估手术总量
|
|
|
|
|
+ Rows totalop = opRowsMap.getOrDefault(String.valueOf(id), new Rows());
|
|
|
|
|
+ row.putIfAbsent("totalop", totalop.isNotEmpty() ? totalop.get(0).getInteger("qty") : 0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Row row = rows.isNotEmpty() ? rows.get(0) : new Row();
|
|
Row row = rows.isNotEmpty() ? rows.get(0) : new Row();
|
|
@@ -335,7 +339,7 @@ public class Hospital extends Controller {
|
|
|
//标签
|
|
//标签
|
|
|
if (whereObject.containsKey("tag") && !whereObject.getJSONArray("tag").isEmpty()) {
|
|
if (whereObject.containsKey("tag") && !whereObject.getJSONArray("tag").isEmpty()) {
|
|
|
JSONArray tags = whereObject.getJSONArray("tag");
|
|
JSONArray tags = whereObject.getJSONArray("tag");
|
|
|
- String tag=tags.toString().replace("[","(").replace("]",")");
|
|
|
|
|
|
|
+ String tag = tags.toString().replace("[", "(").replace("]", ")");
|
|
|
if (tags.size() > 0) {
|
|
if (tags.size() > 0) {
|
|
|
where.append(" and exists(select 1 from sys_datatag WHERE ownertable = 'sa_customers' and siteid='").append(siteid).append("' ");
|
|
where.append(" and exists(select 1 from sys_datatag WHERE ownertable = 'sa_customers' and siteid='").append(siteid).append("' ");
|
|
|
where.append(" and tag in ").append(tag).append(" and t1.sa_customersid=ownerid ");
|
|
where.append(" and tag in ").append(tag).append(" and t1.sa_customersid=ownerid ");
|
|
@@ -427,6 +431,7 @@ public class Hospital extends Controller {
|
|
|
Rows stageRows = dbConnect.runSqlQuery("SELECT stagename,sequence from sa_devstage WHERE siteid='" + siteid + "' order by sequence");
|
|
Rows stageRows = dbConnect.runSqlQuery("SELECT stagename,sequence from sa_devstage WHERE siteid='" + siteid + "' order by sequence");
|
|
|
RowsMap AgentRowsMap = CommonHepler.getAgentRowsMap(this, ids);
|
|
RowsMap AgentRowsMap = CommonHepler.getAgentRowsMap(this, ids);
|
|
|
RowsMap KeyDoctorsRowsMap = CommonHepler.getKeyDoctorsRowsMap(this, ids);
|
|
RowsMap KeyDoctorsRowsMap = CommonHepler.getKeyDoctorsRowsMap(this, ids);
|
|
|
|
|
+ RowsMap opRowsMap = CommonHepler.getHospitalOPRowsMap(this);
|
|
|
for (Row row : rows) {
|
|
for (Row row : rows) {
|
|
|
Long id = row.getLong("sa_customersid");
|
|
Long id = row.getLong("sa_customersid");
|
|
|
row.put("leader", leaderRows.get(String.valueOf(id)));
|
|
row.put("leader", leaderRows.get(String.valueOf(id)));
|
|
@@ -442,7 +447,8 @@ public class Hospital extends Controller {
|
|
|
row.put("tag_sys", sys_tag);
|
|
row.put("tag_sys", sys_tag);
|
|
|
row.putIfAbsent("followdate", "");
|
|
row.putIfAbsent("followdate", "");
|
|
|
//预估手术总量
|
|
//预估手术总量
|
|
|
- row.putIfAbsent("totalop", 0);
|
|
|
|
|
|
|
+ Rows totalop = opRowsMap.getOrDefault(String.valueOf(id), new Rows());
|
|
|
|
|
+ row.putIfAbsent("totalop", totalop.isNotEmpty() ? totalop.get(0).getInteger("qty") : 0);
|
|
|
//关键人
|
|
//关键人
|
|
|
Rows KeyDoctors = KeyDoctorsRowsMap.getOrDefault(String.valueOf(id), new Rows());
|
|
Rows KeyDoctors = KeyDoctorsRowsMap.getOrDefault(String.valueOf(id), new Rows());
|
|
|
row.putIfAbsent("keyperson", StringUtils.join(KeyDoctors.toArray("doctorname"), ","));
|
|
row.putIfAbsent("keyperson", StringUtils.join(KeyDoctors.toArray("doctorname"), ","));
|
|
@@ -735,7 +741,7 @@ public class Hospital extends Controller {
|
|
|
Long sa_customersid = content.getLong("sa_customersid");
|
|
Long sa_customersid = content.getLong("sa_customersid");
|
|
|
|
|
|
|
|
QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_agents",
|
|
QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_agents",
|
|
|
- "sa_agentsid", "sys_enterpriseid", "gmname", "gmphonenumber", "agentnum", "cooperatetype", "remarks", "status", "createdate","scale","mainproducts").
|
|
|
|
|
|
|
+ "sa_agentsid", "sys_enterpriseid", "gmname", "gmphonenumber", "agentnum", "cooperatetype", "remarks", "status", "createdate", "scale", "mainproducts").
|
|
|
setTableAlias("t1");
|
|
setTableAlias("t1");
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t2", "t1.siteid = t2.siteid and t1.sys_enterpriseid = t2.sys_enterpriseid",
|
|
querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t2", "t1.siteid = t2.siteid and t1.sys_enterpriseid = t2.sys_enterpriseid",
|
|
|
"enterprisename", "province", "city", "county", "address");
|
|
"enterprisename", "province", "city", "county", "address");
|
|
@@ -744,7 +750,7 @@ public class Hospital extends Controller {
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "sa_agents", "t4", "t4.siteid = t1.siteid and t4.sa_agentsid = t1.parentid");
|
|
querySQL.addJoinTable(JOINTYPE.left, "sa_agents", "t4", "t4.siteid = t1.siteid and t4.sa_agentsid = t1.parentid");
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t5", "t5.siteid = t4.siteid and t5.sys_enterpriseid = t4.sys_enterpriseid");
|
|
querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t5", "t5.siteid = t4.siteid and t5.sys_enterpriseid = t4.sys_enterpriseid");
|
|
|
querySQL.addJoinTable(JOINTYPE.inner, "sa_agents_hospital", "t9", "t9.sa_agentsid=t1.sa_agentsid and t9.siteid=t1.siteid", "sa_agents_hospitalid");
|
|
querySQL.addJoinTable(JOINTYPE.inner, "sa_agents_hospital", "t9", "t9.sa_agentsid=t1.sa_agentsid and t9.siteid=t1.siteid", "sa_agents_hospitalid");
|
|
|
- querySQL.addQueryFields("parent_enterprisename","t5.enterprisename");
|
|
|
|
|
|
|
+ querySQL.addQueryFields("parent_enterprisename", "t5.enterprisename");
|
|
|
querySQL.setWhere("t9.sa_customersid", sa_customersid);
|
|
querySQL.setWhere("t9.sa_customersid", sa_customersid);
|
|
|
querySQL.setSiteid(siteid);
|
|
querySQL.setSiteid(siteid);
|
|
|
querySQL.setWhere(where);
|
|
querySQL.setWhere(where);
|
|
@@ -835,7 +841,7 @@ public class Hospital extends Controller {
|
|
|
hrids.add(hrid);
|
|
hrids.add(hrid);
|
|
|
|
|
|
|
|
QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_agents",
|
|
QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_agents",
|
|
|
- "sa_agentsid", "sys_enterpriseid", "gmname", "gmphonenumber", "agentnum", "cooperatetype", "remarks", "status", "createdate","scale","mainproducts").
|
|
|
|
|
|
|
+ "sa_agentsid", "sys_enterpriseid", "gmname", "gmphonenumber", "agentnum", "cooperatetype", "remarks", "status", "createdate", "scale", "mainproducts").
|
|
|
setTableAlias("t1");
|
|
setTableAlias("t1");
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t2", "t1.siteid = t2.siteid and t1.sys_enterpriseid = t2.sys_enterpriseid",
|
|
querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t2", "t1.siteid = t2.siteid and t1.sys_enterpriseid = t2.sys_enterpriseid",
|
|
|
"enterprisename", "province", "city", "county", "address");
|
|
"enterprisename", "province", "city", "county", "address");
|