|
@ -8735,4 +8735,64 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
}
|
|
}
|
|
return envelop;
|
|
return envelop;
|
|
}
|
|
}
|
|
|
|
//应声开具处方管理
|
|
|
|
public MixEnvelop prescriptionManage(String keyWord,String startTime,String endTime,String checkStatus,Integer page,Integer pageSize){
|
|
|
|
String sql = " select p.create_time as \"createTime\"," +
|
|
|
|
" p.patient_name as \"patientName\"," +
|
|
|
|
" p.idcard as \"idcard\"," +
|
|
|
|
" o.card_no as \"cardNo\"," +
|
|
|
|
" p.check_status as \"checkStatus\"," +
|
|
|
|
" p.check_reason as \"checkReason\" " +
|
|
|
|
" from wlyy_prescription p left join wlyy_outpatient o on p.outpatient_id = o.id" +
|
|
|
|
" where 1=1";
|
|
|
|
if (StringUtils.isNotBlank(keyWord)){
|
|
|
|
sql+=" and (p.patient_name like '%"+keyWord+"%' or p.idcard = '"+keyWord+"'" +
|
|
|
|
" or o.card_no = '"+keyWord+"')";
|
|
|
|
}
|
|
|
|
if(StringUtils.isNotBlank(checkStatus)){
|
|
|
|
sql+=" and p.check_status ="+checkStatus;
|
|
|
|
}
|
|
|
|
wechatId = "12";
|
|
|
|
if(StringUtils.isNotBlank(startTime)){
|
|
|
|
if("xm_ykyy_wx".equals(wechatId)){
|
|
|
|
if (flag){
|
|
|
|
sql+=" and p.create_time > '" + startTime + " 00:00:00'";
|
|
|
|
}else {
|
|
|
|
sql+=" and p.create_time > to_date('" + startTime + " 00:00:00', 'yyyy-mm-dd hh24:mi:ss') ";
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
sql+=" and p.create_time > '" + startTime + " 00:00:00' ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(StringUtils.isNotBlank(endTime)){
|
|
|
|
if("xm_ykyy_wx".equals(wechatId)){
|
|
|
|
if (flag){
|
|
|
|
sql+=" and p.create_time<'" + endTime + " 23:59:59'";
|
|
|
|
}else {
|
|
|
|
sql+=" and p.create_time< to_date('" + endTime + " 23:59:59','yyyy-mm-dd hh24:mi:ss')";
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
sql+=" and p.create_time<'" + endTime + " 23:59:59'";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sql+=" order by p.create_time desc";
|
|
|
|
String sqlcount = "SELECT COUNT(1) AS \"total\" FROM ("+sql+") q";
|
|
|
|
Long count = 0L;
|
|
|
|
List<Map<String,Object>> total = hibenateUtils.createSQLQuery(sqlcount);
|
|
|
|
if(total!=null){
|
|
|
|
//mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
|
|
|
|
count = hibenateUtils.objTransformLong(total.get(0).get("total"));
|
|
|
|
}
|
|
|
|
List<Map<String,Object>> resultList = hibenateUtils.createSQLQuery(sql,page,pageSize);
|
|
|
|
for (Map<String,Object> map:resultList){
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
map.put("createTime",null==map.get("createTime")?"":sdf.format(new Date(Long.parseLong(map.get("createTime").toString()))));
|
|
|
|
}
|
|
|
|
MixEnvelop mixEnvelop = new MixEnvelop();
|
|
|
|
mixEnvelop.setDetailModelList(resultList);
|
|
|
|
mixEnvelop.setPageSize(pageSize);
|
|
|
|
mixEnvelop.setCurrPage(page);
|
|
|
|
mixEnvelop.setTotalCount(count.intValue());
|
|
|
|
return mixEnvelop;
|
|
|
|
}
|
|
}
|
|
}
|