|
@ -28,6 +28,8 @@ public class PrescriptionExpressageService {
|
|
|
@Autowired
|
|
|
private PrescriptionDispensaryCodeDao prescriptionDispensaryCodeDao;
|
|
|
@Autowired
|
|
|
private PrescriptionReviewedDao prescriptionReviewedDao;
|
|
|
@Autowired
|
|
|
private PrescriptionLogDao prescriptionLogDao;
|
|
|
@Autowired
|
|
|
private PrescriptionDao prescriptionDao;
|
|
@ -119,7 +121,7 @@ public class PrescriptionExpressageService {
|
|
|
case 3: {
|
|
|
//判断是3 配送员(健管师)配送码
|
|
|
// returnStatus = dispensaryCode_3(userCode, prescriptionDispensaryCode);
|
|
|
returnStatus=0;
|
|
|
returnStatus = 0;
|
|
|
break;
|
|
|
}
|
|
|
default: {
|
|
@ -148,17 +150,20 @@ public class PrescriptionExpressageService {
|
|
|
* @param prescriptionDispensaryCode
|
|
|
* @return
|
|
|
*/
|
|
|
private Integer dispensaryCode_1(String userCode, PrescriptionDispensaryCode prescriptionDispensaryCode) {
|
|
|
private Integer dispensaryCode_1(String userCode, PrescriptionDispensaryCode prescriptionDispensaryCode) throws Exception {
|
|
|
|
|
|
//修改处方状态为完成
|
|
|
prescriptionDao.updateStatus(prescriptionDispensaryCode.getPrescriptionCode(), PrescriptionLog.PrescriptionLogStatus.finish.getValue());
|
|
|
Prescription prescription = prescriptionDao.findByCode(prescriptionDispensaryCode.getPrescriptionCode());
|
|
|
Date finshTime = new Date();
|
|
|
prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
|
|
|
prescription.setFinishTime(finshTime);
|
|
|
|
|
|
//保存配送成功的日志
|
|
|
PrescriptionLog prescriptionLog = new PrescriptionLog();
|
|
|
prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
|
|
|
prescriptionLog.setCode(UUID.randomUUID().toString());
|
|
|
prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.finish.getValue());
|
|
|
prescriptionLog.setCreateTime(new Date());
|
|
|
prescriptionLog.setCreateTime(finshTime);
|
|
|
prescriptionLog.setFlag(1);
|
|
|
prescriptionLog.setUserCode(userCode);
|
|
|
prescriptionLog.setUserType(2);
|
|
@ -167,6 +172,13 @@ public class PrescriptionExpressageService {
|
|
|
|
|
|
//修改取药码code为已经使用
|
|
|
prescriptionDispensaryCode.setIsUse(1);
|
|
|
|
|
|
//发送模板消息
|
|
|
PrescriptionReviewed reviewed = prescriptionReviewedDao.findByPrescriptionCode(prescription.getCode());
|
|
|
Patient patient = patientDao.findByCode(prescription.getPatient());
|
|
|
String url = "prescription/html/order_tracking.html?openid=" + patient.getOpenid() + "" +
|
|
|
"&code=" + prescriptionDispensaryCode.getPrescriptionCode() + "&toUser=" + patient.getCode() + "&toName=" + patient.getName();
|
|
|
prescriptionNoticesService.sendMessages(prescription.getPatient(), reviewed.getDoctorName(), DateUtil.dateToStrLong(finshTime), 4, 0, url);
|
|
|
return prescriptionDispensaryCode.getType();
|
|
|
}
|
|
|
|
|
@ -218,7 +230,8 @@ public class PrescriptionExpressageService {
|
|
|
|
|
|
/**
|
|
|
* 配送员(健管师)配送码
|
|
|
* 没用的代码
|
|
|
* 没用的代码
|
|
|
*
|
|
|
* @param userCode
|
|
|
* @param prescriptionDispensaryCode
|
|
|
* @return
|
|
@ -363,7 +376,6 @@ public class PrescriptionExpressageService {
|
|
|
prescriptionExpressageLogDao.save(prescriptionExpressageLog);
|
|
|
|
|
|
|
|
|
|
|
|
//更新配送表,接收药品信息
|
|
|
prescriptionExpressage.setAcceptCode(userCode);
|
|
|
prescriptionExpressage.setAcceptName(userName);
|
|
@ -380,12 +392,12 @@ public class PrescriptionExpressageService {
|
|
|
if (hospital.equals(prescriptionExpressage.getPatientHospitalCode())) {
|
|
|
// 如果是最后服务站
|
|
|
//设置配送码失效
|
|
|
prescriptionDispensaryCodeDao.updateToUse(prescriptionCode,3);
|
|
|
prescriptionDispensaryCodeDao.updateToUse(prescriptionCode, 3);
|
|
|
//修改处方是配送完成
|
|
|
Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
|
|
|
prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.expressage2hospital.getValue());
|
|
|
prescription.setExpressageTime(new Date());
|
|
|
}else{
|
|
|
} else {
|
|
|
//如果不是重点服务站,更新配送表,更新配送信息是当前登陆人
|
|
|
prescriptionExpressage.setExpressageCode(userCode);
|
|
|
prescriptionExpressage.setExpressageName(userName);
|