|
@ -60,15 +60,15 @@ public class PrescriptionExpressagePCService extends BaseService {
|
|
|
@Transactional
|
|
|
public JSONObject getMedicine(String code,String userCode) throws Exception{
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
Doctor doctor = doctorService.findDoctorByCode(userCode);
|
|
|
|
|
|
String sql = "select a.type,a.prescription_code as prescriptionCode ,c.status,b.hospital_code as hospitalCode, b.hospital_doctor as hospitalDoctor,\n" +
|
|
|
"b.code as orderCode, b.hospital_name as hospitalName,c.dispensary_type as dispensaryType,b.fetching_medicine_time as fetchingMedicineTime ,\n" +
|
|
|
"b.expressage_name as expressageName, b.expressage_code as expressageCode,b.expressage_mobile as expressageMobile,d.idcard \n" +
|
|
|
"b.expressage_code as expressageCode,c.patient \n" +
|
|
|
"from wlyy_prescription_dispensary_code a \n" +
|
|
|
"left join wlyy_prescription_expressage b on a.prescription_code = b.prescription_code \n" +
|
|
|
"left join wlyy_prescription c on a.prescription_code = c.code \n" +
|
|
|
"left join wlyy_doctor d on b.code=b.expressage_code \n"+
|
|
|
"where a.is_use=0 and a.code=? and c.status>=50";
|
|
|
// "left join wlyy_doctor d on b.code=b.expressage_code \n"+
|
|
|
"where a.code=? and c.status>=50 order by a.id desc ";
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql,code);
|
|
@ -79,23 +79,25 @@ public class PrescriptionExpressagePCService extends BaseService {
|
|
|
switch (type){
|
|
|
//居民取药码
|
|
|
case 1:{
|
|
|
Patient patient = patientDao.findByCode(result.get("patient")+"");
|
|
|
if(status==50){
|
|
|
jsonObject.put("status",-5);//订单正在配药中,暂时无法出药
|
|
|
jsonObject.put("flag",-5);//订单正在配药中,暂时无法出药
|
|
|
}else if(status==60){
|
|
|
List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(result.get("prescriptionCode").toString());
|
|
|
// jsonObject = new JSONObject(result);
|
|
|
// jsonObject = JSONObject.fromObject(result);
|
|
|
|
|
|
jsonObject.put("prescriptionInfoList",list);
|
|
|
jsonObject.put("flag",1);
|
|
|
jsonObject.put("prescriptionInfoList",list);
|
|
|
jsonObject.put("idcard",result.get("idcard"));
|
|
|
jsonObject.put("idcard",patient.getIdcard());
|
|
|
jsonObject.put("orderCode",result.get("orderCode"));
|
|
|
jsonObject.put("hospitalCode",result.get("hospitalCode"));
|
|
|
jsonObject.put("hospitalName",result.get("hospitalName"));
|
|
|
jsonObject.put("status",result.get("status"));
|
|
|
jsonObject.put("dispensaryType",result.get("dispensaryType"));
|
|
|
jsonObject.put("expressageName",result.get("expressageName"));
|
|
|
jsonObject.put("expressageMobile",result.get("expressageMobile"));
|
|
|
jsonObject.put("expressageName",patient.getName());
|
|
|
jsonObject.put("expressageMobile",patient.getMobile());
|
|
|
String date = result.get("fetchingMedicineTime")!=null?DateUtil.dateToStr((Date)result.get("fetchingMedicineTime"),"yyyy-MM-dd HH:mm:ss"):"";
|
|
|
jsonObject.put("fetchingMedicineTime",date);
|
|
|
jsonObject.put("hospitalDoctor",result.get("hospitalDoctor"));
|
|
@ -105,14 +107,14 @@ public class PrescriptionExpressagePCService extends BaseService {
|
|
|
// jsonObject = new JSONObject(result);
|
|
|
jsonObject.put("flag",-6);//”订单已取药,出药人:张三,出药时间:XXXX-XX-XX,无法重新出药
|
|
|
jsonObject.put("prescriptionInfoList",list);
|
|
|
jsonObject.put("idcard",result.get("idcard"));
|
|
|
jsonObject.put("idcard",patient.getIdcard());
|
|
|
jsonObject.put("orderCode",result.get("orderCode"));
|
|
|
jsonObject.put("hospitalCode",result.get("hospitalCode"));
|
|
|
jsonObject.put("hospitalName",result.get("hospitalName"));
|
|
|
jsonObject.put("status",result.get("status"));
|
|
|
jsonObject.put("dispensaryType",result.get("dispensaryType"));
|
|
|
jsonObject.put("expressageName",result.get("expressageName"));
|
|
|
jsonObject.put("expressageMobile",result.get("expressageMobile"));
|
|
|
jsonObject.put("expressageName",patient.getName());
|
|
|
jsonObject.put("expressageMobile",patient.getMobile());
|
|
|
String date = result.get("fetchingMedicineTime")!=null?DateUtil.dateToStr((Date)result.get("fetchingMedicineTime"),"yyyy-MM-dd HH:mm:ss"):"";
|
|
|
jsonObject.put("fetchingMedicineTime",date);
|
|
|
jsonObject.put("hospitalDoctor",result.get("hospitalDoctor"));
|
|
@ -123,7 +125,9 @@ public class PrescriptionExpressagePCService extends BaseService {
|
|
|
case 2:{
|
|
|
|
|
|
//判断出药机构是否与健管师所属机构一致,不一致弹窗提示:“出药机构与您所在机构不一致,无法出药,请重新确认”。一致则进入下一步。
|
|
|
if(doctor.getHospital().equals(result.get("hospitalCode")!=null?result.get("hospitalCode")+"":"")){
|
|
|
Doctor jgsDoctor = doctorService.findDoctorByCode(userCode);
|
|
|
Doctor doctor = doctorService.findDoctorByCode(result.get("expressageCode")+"");
|
|
|
if(jgsDoctor.getHospital().equals(result.get("hospitalCode")!=null?result.get("hospitalCode")+"":"")){
|
|
|
//20开方完成/待支付, 21 支付失败 , 30 支付成功/待配药 , 40配药成功/待配送 41配送失败 42分配健管师 45配送中 49配送到服务站 100配送到患者手中/已完成
|
|
|
if(status==50){
|
|
|
jsonObject.put("flag",-5);//订单正在配药中,暂时无法出药
|
|
@ -133,13 +137,13 @@ public class PrescriptionExpressagePCService extends BaseService {
|
|
|
List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(result.get("prescriptionCode").toString());
|
|
|
jsonObject.put("prescriptionInfoList",list);
|
|
|
jsonObject.put("orderCode",result.get("orderCode"));
|
|
|
jsonObject.put("idcard",result.get("idcard"));
|
|
|
jsonObject.put("idcard",doctor.getIdcard());
|
|
|
jsonObject.put("hospitalCode",result.get("hospitalCode"));
|
|
|
jsonObject.put("hospitalName",result.get("hospitalName"));
|
|
|
jsonObject.put("status",result.get("status"));
|
|
|
jsonObject.put("dispensaryType",result.get("dispensaryType"));
|
|
|
jsonObject.put("expressageName",result.get("expressageName"));
|
|
|
jsonObject.put("expressageMobile",result.get("expressageMobile"));
|
|
|
jsonObject.put("expressageName",doctor.getName());
|
|
|
jsonObject.put("expressageMobile",doctor.getMobile());
|
|
|
String date = result.get("fetchingMedicineTime")!=null?DateUtil.dateToStr((Date)result.get("fetchingMedicineTime"),"yyyy-MM-dd HH:mm:ss"):"";
|
|
|
jsonObject.put("fetchingMedicineTime",date);
|
|
|
jsonObject.put("hospitalDoctor",result.get("hospitalDoctor"));
|
|
@ -149,13 +153,13 @@ public class PrescriptionExpressagePCService extends BaseService {
|
|
|
List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(result.get("prescriptionCode").toString());
|
|
|
jsonObject.put("prescriptionInfoList",list);
|
|
|
jsonObject.put("orderCode",result.get("orderCode"));
|
|
|
jsonObject.put("idcard",result.get("idcard"));
|
|
|
jsonObject.put("idcard",doctor.getIdcard());
|
|
|
jsonObject.put("hospitalCode",result.get("hospitalCode"));
|
|
|
jsonObject.put("hospitalName",result.get("hospitalName"));
|
|
|
jsonObject.put("status",result.get("status"));
|
|
|
jsonObject.put("dispensaryType",result.get("dispensaryType"));
|
|
|
jsonObject.put("expressageName",result.get("expressageName"));
|
|
|
jsonObject.put("expressageMobile",result.get("expressageMobile"));
|
|
|
jsonObject.put("expressageName",doctor.getName());
|
|
|
jsonObject.put("expressageMobile",doctor.getMobile());
|
|
|
String date = result.get("fetchingMedicineTime")!=null?DateUtil.dateToStr((Date)result.get("fetchingMedicineTime"),"yyyy-MM-dd HH:mm:ss"):"";
|
|
|
jsonObject.put("fetchingMedicineTime",date);
|
|
|
jsonObject.put("hospitalDoctor",result.get("hospitalDoctor"));
|
|
@ -166,7 +170,7 @@ public class PrescriptionExpressagePCService extends BaseService {
|
|
|
break;
|
|
|
}
|
|
|
default:{
|
|
|
jsonObject.put("status",-3);
|
|
|
jsonObject.put("flag",-3);
|
|
|
PrescriptionLog prescriptionLog = new PrescriptionLog();
|
|
|
prescriptionLog.setCode(UUID.randomUUID().toString());
|
|
|
prescriptionLog.setPrescriptionCode(result.get("prescriptionCode").toString());
|
|
@ -182,7 +186,7 @@ public class PrescriptionExpressagePCService extends BaseService {
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
jsonObject.put("status",-3);
|
|
|
jsonObject.put("flag",-3);
|
|
|
//保存验证二维码的日志
|
|
|
PrescriptionLog prescriptionLog = new PrescriptionLog();
|
|
|
prescriptionLog.setCode(UUID.randomUUID().toString());
|