|
@ -19,6 +19,7 @@ import com.yihu.wlyy.repository.prescription.PrescriptionLogDao;
|
|
|
import com.yihu.wlyy.service.BaseService;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import com.yihu.wlyy.util.ImUtill;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.json.JSONArray;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -71,10 +72,15 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
List<SystemDict> states = systemDictDao.findByDictName("PRESCRIPTION_STATE");
|
|
|
rs.put("states",states);
|
|
|
List<Map<String,Object>> diseases = new ArrayList<>();
|
|
|
Map<String,Object> dis = new HashMap<>();
|
|
|
dis.put("1","糖尿病");
|
|
|
dis.put("2","高血压");
|
|
|
rs.put("diseases",dis);
|
|
|
Map<String,Object> dis1 = new HashMap<>();
|
|
|
dis1.put("code","1");
|
|
|
dis1.put("name","糖尿病");
|
|
|
Map<String,Object> dis2 = new HashMap<>();
|
|
|
dis2.put("code","2");
|
|
|
dis2.put("name","高血压");
|
|
|
diseases.add(dis1);
|
|
|
diseases.add(dis2);
|
|
|
rs.put("diseases",diseases);
|
|
|
|
|
|
return rs;
|
|
|
}
|
|
@ -84,7 +90,7 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
* @param type
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray getPrescriptionInfos(String type,String startDate,String endDate,String patient,String isRenewal){
|
|
|
public JSONArray getPrescriptionInfos(String type,String startDate,String endDate,String patient,String isRenewal,Integer page,Integer size){
|
|
|
|
|
|
if(StringUtils.isNotBlank(type)){
|
|
|
if("1".equals(type)){
|
|
@ -106,6 +112,9 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
sqlBuffer.append(" AND p.create_time <= ?");
|
|
|
params.add(endDate+" 23:59:59");
|
|
|
}
|
|
|
if(page!=null&&page>0&&size!=null&&size>0){
|
|
|
sqlBuffer.append(" LIMIT "+(page-1)*size+","+size);
|
|
|
}
|
|
|
//本地库
|
|
|
List<Map<String,Object>> rs =jdbcTemplate.queryForList(sqlBuffer.toString(),params.toArray());
|
|
|
//通过缓存查找药品和疾病
|
|
@ -208,14 +217,15 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
|
|
|
}
|
|
|
|
|
|
public JSONArray getDoctorPrescription(Integer teamCode,String state,String diseases,String startDate,String endDate,String nameKeyword){
|
|
|
public JSONArray getDoctorPrescription(Integer teamCode,String state,String diseases,String startDate,String endDate,String nameKeyword,Integer page,Integer size){
|
|
|
StringBuffer pre_sql = new StringBuffer("SELECT " +
|
|
|
" p.`name`, " +
|
|
|
" TIMESTAMPDIFF(YEAR,p.birthday,SYSDATE()) age, " +
|
|
|
" p.sex, " +
|
|
|
" p.photo, " +
|
|
|
" pr.`status`, " +
|
|
|
" pr.`code`, " +
|
|
|
" pr.create_time AS createTime, " +
|
|
|
" LEFT(pr.create_time,19) AS createTime, " +
|
|
|
" pr.doctor " +
|
|
|
" FROM " +
|
|
|
" wlyy_prescription pr " +
|
|
@ -229,12 +239,12 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
" AND pr.admin_team_id =? AND s.code = ?");
|
|
|
params.add(teamCode);
|
|
|
params.add(diseases);
|
|
|
setSQL(pre_sql,params,state,startDate,endDate,nameKeyword);
|
|
|
setSQL(pre_sql,params,state,startDate,endDate,nameKeyword,page,size);
|
|
|
}else{
|
|
|
//查询所有疾病类型表
|
|
|
pre_sql.append(" WHERE pr.admin_team_id =?");
|
|
|
params.add(teamCode);
|
|
|
setSQL(pre_sql,params,state,startDate,endDate,nameKeyword);
|
|
|
setSQL(pre_sql,params,state,startDate,endDate,nameKeyword,page,size);
|
|
|
}
|
|
|
List<Map<String,Object>> rs = jdbcTemplate.queryForList(pre_sql.toString(),params.toArray());
|
|
|
|
|
@ -247,7 +257,7 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
return new JSONArray(rs);
|
|
|
}
|
|
|
|
|
|
public void setSQL(StringBuffer pre_sql,List<Object> params,String state,String startDate,String endDate,String nameKeyword){
|
|
|
public void setSQL(StringBuffer pre_sql,List<Object> params,String state,String startDate,String endDate,String nameKeyword,Integer page,Integer size){
|
|
|
if(StringUtils.isNotBlank(state)){
|
|
|
pre_sql.append(" AND pr.status = ?");
|
|
|
params.add(state);
|
|
@ -265,6 +275,9 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
params.add("%"+nameKeyword+"%");
|
|
|
}
|
|
|
pre_sql.append(" GROUP BY pr.code ORDER BY pr.create_time DESC");
|
|
|
if(page!=null&&page>0&&size!=null&&size>0){
|
|
|
pre_sql.append(" LIMIT "+(page-1)*size+","+size);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|