|  | @ -1,16 +1,13 @@
 | 
	
		
			
				|  |  | package com.yihu.wlyy.web.doctor.prescription;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.doctor.reply.DoctorQuickReply;
 | 
	
		
			
				|  |  | 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.PrescriptionExpressageService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.app.prescription.PrescriptionLogService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.web.BaseController;
 | 
	
		
			
				|  |  | import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  | import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  | import io.swagger.annotations.ApiParam;
 | 
	
		
			
				|  |  | import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | import org.json.JSONArray;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.RequestMapping;
 | 
	
	
		
			
				|  | @ -21,7 +18,6 @@ import org.springframework.web.bind.annotation.RestController;
 | 
	
		
			
				|  |  | import java.util.Collections;
 | 
	
		
			
				|  |  | import java.util.Comparator;
 | 
	
		
			
				|  |  | import java.util.List;
 | 
	
		
			
				|  |  | import java.util.Map;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /**
 | 
	
		
			
				|  |  |  * Created by chenweida on 2017/7/27.
 | 
	
	
		
			
				|  | @ -42,7 +38,7 @@ public class PrescriptionLogController extends BaseController {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             // (-3 支付过期 -2 患者自己取消 -1 审核不通过 , 0 待审核, 2调整中 10 审核通过/开方中  , 20开方完成/待支付, 21 支付失败 , 30 支付成功/待配药 ,
 | 
	
		
			
				|  |  |             //  40配药成功/待配送  41配送失败  42配送中   43配送到服务站  100配送到患者手中/已完成)
 | 
	
		
			
				|  |  |             Integer[] types = new Integer[]{
 | 
	
		
			
				|  |  |             Integer[] status = new Integer[]{
 | 
	
		
			
				|  |  |                     PrescriptionLog.PrescriptionLogStatus.revieweding.getValue(),
 | 
	
		
			
				|  |  |                     PrescriptionLog.PrescriptionLogStatus.changeing.getValue(),
 | 
	
		
			
				|  |  |                     PrescriptionLog.PrescriptionLogStatus.reviewed_success.getValue(),
 | 
	
	
		
			
				|  | @ -51,7 +47,7 @@ public class PrescriptionLogController extends BaseController {
 | 
	
		
			
				|  |  |                     PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue(),
 | 
	
		
			
				|  |  |                     PrescriptionLog.PrescriptionLogStatus.expressageing.getValue(),
 | 
	
		
			
				|  |  |                     PrescriptionLog.PrescriptionLogStatus.finish.getValue()};
 | 
	
		
			
				|  |  |             List<PrescriptionLog> prescriptionLogs = prescriptionLogService.findPrescriptionLogsByPrescriptionCode(prescriptionCode, types);
 | 
	
		
			
				|  |  |             List<PrescriptionLog> prescriptionLogs = prescriptionLogService.findPrescriptionLogsByPrescriptionCode(prescriptionCode, status);
 | 
	
		
			
				|  |  |             if (prescriptionLogs != null) {
 | 
	
		
			
				|  |  |                 return write(200, "获取处方流程成功", "data", new JSONArray(copyBeans(prescriptionLogs, "statusName", "createTime")));
 | 
	
		
			
				|  |  |             } else {
 | 
	
	
		
			
				|  | @ -77,12 +73,14 @@ public class PrescriptionLogController extends BaseController {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             // (-3 支付过期 -2 患者自己取消 -1 审核不通过 , 0 待审核, 2调整中 10 审核通过/开方中  , 20开方完成/待支付, 21 支付失败 , 30 支付成功/待配药 ,
 | 
	
		
			
				|  |  |             //  40配药成功/待配送  41配送失败  42配送中   43配送到服务站  100配送到患者手中/已完成)
 | 
	
		
			
				|  |  |             Integer[] types = new Integer[]{
 | 
	
		
			
				|  |  |             Integer[] status = new Integer[]{
 | 
	
		
			
				|  |  |                     PrescriptionLog.PrescriptionLogStatus.reviewed_success.getValue(),
 | 
	
		
			
				|  |  |                     PrescriptionLog.PrescriptionLogStatus.adding.getValue(),
 | 
	
		
			
				|  |  |                     PrescriptionLog.PrescriptionLogStatus.pay_success.getValue(),
 | 
	
		
			
				|  |  |                     PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue(),
 | 
	
		
			
				|  |  |                     PrescriptionLog.PrescriptionLogStatus.expressageing.getValue(),
 | 
	
		
			
				|  |  |                     PrescriptionLog.PrescriptionLogStatus.finish.getValue()};
 | 
	
		
			
				|  |  |             List<PrescriptionLog> prescriptionLogs = prescriptionLogService.findPrescriptionLogsByPrescriptionCode(prescriptionCode, types);
 | 
	
		
			
				|  |  |             List<PrescriptionLog> prescriptionLogs = prescriptionLogService.findPrescriptionLogsByPrescriptionCode(prescriptionCode, status);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //加上快递的log
 | 
	
		
			
				|  |  |             List<PrescriptionExpressageLog> expressageLogs = prescriptionExpressageLogService.findByPrescriptionCode(prescriptionCode);
 | 
	
	
		
			
				|  | @ -97,18 +95,16 @@ public class PrescriptionLogController extends BaseController {
 | 
	
		
			
				|  |  |                 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();
 | 
	
		
			
				|  |  |             Collections.sort(prescriptionLogs, (o1, 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 (map1value - map2value > 0) {
 | 
	
		
			
				|  |  |                     return sort == 1 ? -1 : 1;
 | 
	
		
			
				|  |  |                 } else if (map1value - map2value < 0) {
 | 
	
		
			
				|  |  |                     return sort == 1 ? 1 : -1;
 | 
	
		
			
				|  |  |                 } else {
 | 
	
		
			
				|  |  |                     return 0;
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             });
 | 
	
		
			
				|  |  |             if (prescriptionLogs != null) {
 | 
	
	
		
			
				|  | @ -117,6 +113,7 @@ public class PrescriptionLogController extends BaseController {
 | 
	
		
			
				|  |  |                 return error(-1, "获取失败");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |             return error(-1, "获取失败");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 |