|
@ -1,6 +1,8 @@
|
|
|
package com.yihu.wlyy.web.patient.prescription;
|
|
|
|
|
|
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExpressageLog;
|
|
|
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
|
|
|
import com.yihu.wlyy.service.app.prescription.PrescriptionExpressageLogService;
|
|
|
import com.yihu.wlyy.service.app.prescription.PrescriptionLogService;
|
|
|
import com.yihu.wlyy.web.BaseController;
|
|
|
import io.swagger.annotations.Api;
|
|
@ -13,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.Collections;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@ -24,6 +28,8 @@ import java.util.List;
|
|
|
public class PatientPrescriptionLogController extends BaseController {
|
|
|
@Autowired
|
|
|
private PrescriptionLogService prescriptionLogService;
|
|
|
@Autowired
|
|
|
private PrescriptionExpressageLogService prescriptionExpressageLogService;
|
|
|
|
|
|
/**
|
|
|
* 订单跟踪
|
|
@ -32,24 +38,55 @@ public class PatientPrescriptionLogController extends BaseController {
|
|
|
* @param prescriptionCode
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/getPrescriptionLogs", method = RequestMethod.GET)
|
|
|
@ApiOperation(value = "获取处方流程")
|
|
|
public String addReply(
|
|
|
@RequestParam(required = true) @ApiParam(value = "处方code", name = "prescriptionCode") String prescriptionCode) {
|
|
|
/**
|
|
|
* 根据处方code获取处方流程
|
|
|
*
|
|
|
* @param prescriptionCode
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/orderFollow", method = RequestMethod.GET)
|
|
|
@ApiOperation(value = "订单状态跟踪")
|
|
|
public String orderFollow(
|
|
|
@ApiParam(value = "处方code", name = "prescriptionCode") @RequestParam(required = true, name = "prescriptionCode") String prescriptionCode,
|
|
|
@ApiParam(value = "1是倒叙 0是正序", name = "sort", required = false) @RequestParam(required = false, defaultValue = "0", name = "sort") Integer sort) {
|
|
|
try {
|
|
|
// (-3 支付过期 -2 患者自己取消 -1 审核不通过 , 0 待审核, 2调整中 10 审核通过/开方中 , 20开方完成/待支付, 21 支付失败 , 30 支付成功/待配药 ,
|
|
|
// 40配药成功/待配送 41配送失败 42分配健管师 45配送中 49配送到服务站 100配送到患者手中/已完成)
|
|
|
|
|
|
Integer[] types = new Integer[]{
|
|
|
PrescriptionLog.PrescriptionLogStatus.revieweding.getValue(),
|
|
|
PrescriptionLog.PrescriptionLogStatus.changeing.getValue(),
|
|
|
PrescriptionLog.PrescriptionLogStatus.reviewed_success.getValue(),
|
|
|
PrescriptionLog.PrescriptionLogStatus.wait_pay.getValue(),
|
|
|
PrescriptionLog.PrescriptionLogStatus.pay_error.getValue(),
|
|
|
PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue(),
|
|
|
PrescriptionLog.PrescriptionLogStatus.pay_success.getValue(),
|
|
|
PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue(),
|
|
|
PrescriptionLog.PrescriptionLogStatus.expressageing.getValue(),
|
|
|
PrescriptionLog.PrescriptionLogStatus.expressage2hospital.getValue(),
|
|
|
PrescriptionLog.PrescriptionLogStatus.finish.getValue()};
|
|
|
List<PrescriptionLog> prescriptionLogs = prescriptionLogService.findPrescriptionLogsByPrescriptionCode(prescriptionCode, types);
|
|
|
|
|
|
//加上快递的log
|
|
|
List<PrescriptionExpressageLog> expressageLogs = prescriptionExpressageLogService.findByPrescriptionCode(prescriptionCode);
|
|
|
for (int i = 0; i < expressageLogs.size(); i++) {
|
|
|
PrescriptionExpressageLog prescriptionExpressageLog = expressageLogs.get(i);
|
|
|
PrescriptionLog prescriptionLog = new PrescriptionLog();
|
|
|
prescriptionLog.setCreateTime(prescriptionExpressageLog.getCreateTime());
|
|
|
prescriptionLog.setHospital(prescriptionExpressageLog.getAcceptHospital());
|
|
|
prescriptionLog.setHospitalName(prescriptionExpressageLog.getAcceptHospitalName());
|
|
|
prescriptionLog.setUserCode(prescriptionExpressageLog.getAcceptUser());
|
|
|
prescriptionLog.setUserName(prescriptionExpressageLog.getAcceptUserName());
|
|
|
prescriptionLogs.add(prescriptionLog);
|
|
|
}
|
|
|
//排序
|
|
|
Collections.sort(prescriptionLogs, new Comparator<PrescriptionLog>() {
|
|
|
public int compare(PrescriptionLog o1, PrescriptionLog o2) {
|
|
|
long map1value = o1.getCreateTime().getTime();
|
|
|
long map2value = o2.getCreateTime().getTime();
|
|
|
|
|
|
if (map1value - map2value > 0) {
|
|
|
return sort == 1 ? -1 : 1;
|
|
|
} else if (map1value - map2value < 0) {
|
|
|
return sort == 1 ? 1 : -1;
|
|
|
} else {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
if (prescriptionLogs != null) {
|
|
|
return write(200, "获取处方流程成功", "data", new JSONArray(copyBeans(prescriptionLogs, "statusName", "createTime")));
|
|
|
} else {
|