|
@ -168,6 +168,7 @@ public class PrescriptionInfoService extends BaseService {
|
|
Prescription prescription = prescriptionDao.findByCode(code);
|
|
Prescription prescription = prescriptionDao.findByCode(code);
|
|
List<PrescriptionInfo> prescriptionInfos = prescriptionInfoDao.findByPrescriptionCode(code);
|
|
List<PrescriptionInfo> prescriptionInfos = prescriptionInfoDao.findByPrescriptionCode(code);
|
|
PrescriptionReviewed reviewed = prescriptionReviewedDao.findByPrescriptionCode(code);
|
|
PrescriptionReviewed reviewed = prescriptionReviewedDao.findByPrescriptionCode(code);
|
|
|
|
List<PrescriptionAdjust> prescriptionAdjusts = prescriptionAdjustDao.findByPrescriptionCode(code);
|
|
JSONObject rs = new JSONObject();
|
|
JSONObject rs = new JSONObject();
|
|
if(prescription!=null&&StringUtils.isNotBlank(prescription.getPatient())){
|
|
if(prescription!=null&&StringUtils.isNotBlank(prescription.getPatient())){
|
|
Patient p = patientDao.findByCode(prescription.getPatient());
|
|
Patient p = patientDao.findByCode(prescription.getPatient());
|
|
@ -178,13 +179,18 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
|
|
|
if(prescription.getStatus()==10){
|
|
if(prescription.getStatus()==10){
|
|
Long s = (prescription.getCreateTime().getTime()-new Date().getTime())/1000;
|
|
Long s = (prescription.getCreateTime().getTime()-new Date().getTime())/1000;
|
|
rs.put("time",s);
|
|
|
|
|
|
//rs.put("time",s);
|
|
if(s>172800){
|
|
if(s>172800){
|
|
prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue());
|
|
prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue());
|
|
prescriptionDao.save(prescription);
|
|
prescriptionDao.save(prescription);
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
rs.put("time","");
|
|
|
|
|
|
//rs.put("time","");
|
|
|
|
}
|
|
|
|
if(prescriptionAdjusts!=null&&prescriptionAdjusts.size()>0){
|
|
|
|
rs.put("isAdjust",true);
|
|
|
|
}else{
|
|
|
|
rs.put("isAdjust",false);
|
|
}
|
|
}
|
|
rs.put("reviewed",reviewed);
|
|
rs.put("reviewed",reviewed);
|
|
rs.put("prescription",prescription);
|
|
rs.put("prescription",prescription);
|
|
@ -456,4 +462,115 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
|
|
|
return new JSONArray(list);
|
|
return new JSONArray(list);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取订单记录
|
|
|
|
* @param type 1.需跟踪订单 2.已经接受订单
|
|
|
|
* @param doctor 医生code
|
|
|
|
* @param nameKey 用户姓名关键字
|
|
|
|
* @param startDate 开始时间
|
|
|
|
* @param endDate 结束时间
|
|
|
|
* @param hospital 服务站
|
|
|
|
* @param state 状态
|
|
|
|
* @param page 起始页
|
|
|
|
* @param size 分页大小
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public JSONArray getDoctorPrescriptionExpressage(String type,String doctor, String nameKey,String startDate,String endDate,String hospital,String state,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`, " +
|
|
|
|
" LEFT(pr.create_time,19) AS createTime, " +
|
|
|
|
" pr.doctor " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_prescription pr " +
|
|
|
|
" LEFT JOIN wlyy_patient p ON pr.patient = p.`code` ," +
|
|
|
|
" JOIN wlyy_prescription_expressage e ON pr.code = e.prescription_code " +
|
|
|
|
" WHERE 1=1 " );
|
|
|
|
List<Object> params = new ArrayList<>();
|
|
|
|
setExpressageSql(pre_sql,params,type, doctor, nameKey, startDate, endDate, hospital, state, page, size);
|
|
|
|
List<Map<String,Object>> rs = jdbcTemplate.queryForList(pre_sql.toString(),params.toArray());
|
|
|
|
//通过缓存查找药品和疾病
|
|
|
|
for(Map<String,Object> map :rs){
|
|
|
|
String code = (String)map.get("code");
|
|
|
|
map.put("prescriptionInfo",prescriptionDiagnosisService.getPrescriptionInfo(code));
|
|
|
|
map.put("prescriptionDt", prescriptionDiagnosisService.getPrescriptionDiagnosis(code));
|
|
|
|
}
|
|
|
|
return new JSONArray(rs);
|
|
|
|
}
|
|
|
|
public void setExpressageSql(StringBuffer pre_sql,List<Object> param,String type,String doctor, String nameKey,String startDate,String endDate,String hospital,String state,Integer page,Integer size){
|
|
|
|
if(StringUtils.isNotBlank(type)){
|
|
|
|
if("1".equals(type)){
|
|
|
|
pre_sql.append(" AND e.expressageCode = ?");
|
|
|
|
param.add(doctor);
|
|
|
|
}else{
|
|
|
|
pre_sql.append(" AND e.acceptCode = ?");
|
|
|
|
param.add(doctor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(StringUtils.isNotBlank(nameKey)){
|
|
|
|
pre_sql.append(" AND p.name = ? ");
|
|
|
|
param.add("%"+nameKey+"%");
|
|
|
|
}
|
|
|
|
if(StringUtils.isNotBlank(startDate)){
|
|
|
|
pre_sql.append(" AND pr.create_time >= ? ");
|
|
|
|
param.add(startDate+" 00:00:00");
|
|
|
|
}
|
|
|
|
if(StringUtils.isNotBlank(endDate)){
|
|
|
|
pre_sql.append(" AND pr.create_time <= ? ");
|
|
|
|
param.add(startDate+" 23:59:59");
|
|
|
|
}
|
|
|
|
if(StringUtils.isNotBlank(hospital)){
|
|
|
|
pre_sql.append(" AND e.hospital_code = ? ");
|
|
|
|
param.add(hospital);
|
|
|
|
}
|
|
|
|
if(StringUtils.isNotBlank(state)){
|
|
|
|
pre_sql.append(" AND pr.status = ? ");
|
|
|
|
param.add(state);
|
|
|
|
}
|
|
|
|
pre_sql.append(" ORDER BY pr.create_time DESC ");
|
|
|
|
if(page!=null&&size!=null){
|
|
|
|
pre_sql.append(" LIMIT "+(page-1)*size+","+size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public JSONObject getPrescriptionExpressageFilter(){
|
|
|
|
JSONObject rs = new JSONObject();
|
|
|
|
// List<Map<String,Object>> states = new ArrayList<>();
|
|
|
|
// Map<String,Object> map1 = new HashMap<>();
|
|
|
|
// map1.put("name","订单已支付");
|
|
|
|
// map1.put("code",PrescriptionLog.PrescriptionLogStatus.pay_success.getValue());
|
|
|
|
// states.add(map1);
|
|
|
|
//
|
|
|
|
// Map<String,Object> map2 = new HashMap<>();
|
|
|
|
// map2.put("name","配药完成");
|
|
|
|
// map2.put("code",PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
|
|
|
|
// states.add(map2);
|
|
|
|
//
|
|
|
|
// Map<String,Object> map2 = new HashMap<>();
|
|
|
|
// map2.put("name","药品到达服务站");
|
|
|
|
// map2.put("code",PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
|
|
|
|
// states.add(map2);
|
|
|
|
//
|
|
|
|
// Map<String,Object> map3 = new HashMap<>();
|
|
|
|
// map3.put("name","配送中");
|
|
|
|
// map3.put("code",PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
|
|
|
|
// states.add(map3);
|
|
|
|
//
|
|
|
|
// Map<String,Object> map4 = new HashMap<>();
|
|
|
|
// map4.put("name","配药完成");
|
|
|
|
// map4.put("code",PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
|
|
|
|
// states.add(map4);
|
|
|
|
//
|
|
|
|
// Map<String,Object> map5 = new HashMap<>();
|
|
|
|
// map2.put("name","配药完成");
|
|
|
|
// map2.put("code",PrescriptionLog.PrescriptionLogStatus.expressage2hospital.getValue());
|
|
|
|
// states.add(map2);
|
|
|
|
return rs;
|
|
|
|
}
|
|
}
|
|
}
|