|
@ -1,10 +1,13 @@
|
|
|
package com.yihu.wlyy.web.patient.prescription;
|
|
|
|
|
|
import com.yihu.wlyy.aop.ObserverRequired;
|
|
|
import com.yihu.wlyy.entity.patient.prescription.*;
|
|
|
import com.yihu.wlyy.service.app.medicines.MedicalRecordsService;
|
|
|
import com.yihu.wlyy.service.app.prescription.PrescriptionDispensaryCodeService;
|
|
|
import com.yihu.wlyy.service.app.prescription.*;
|
|
|
import com.yihu.wlyy.web.BaseController;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -20,7 +23,6 @@ import java.util.Random;
|
|
|
|
|
|
/**
|
|
|
* Created by Administrator on 2017/7/21.
|
|
|
*
|
|
|
*/
|
|
|
|
|
|
@RestController("patientPrescriptionLogController")
|
|
@ -30,50 +32,61 @@ public class PatientPrescriptionController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private PrescriptionDispensaryCodeService prescriptionDispensaryCodeService;
|
|
|
@Autowired
|
|
|
private PrescriptionService prescriptionService;
|
|
|
@Autowired
|
|
|
private PrescriptionInfoService prescriptionInfoService;
|
|
|
@Autowired
|
|
|
private PrescriptionPayService prescriptionPayService;
|
|
|
@Autowired
|
|
|
private PrescriptionExpressageService prescriptionExpressageService;
|
|
|
|
|
|
|
|
|
/**
|
|
|
*居民取药码
|
|
|
* 居民取药码
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/dispensaryCode/getResidentQRCode",method = RequestMethod.GET)
|
|
|
@RequestMapping(value = "/dispensaryCode/getResidentQRCode", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
//@ObserverRequired
|
|
|
public String getResidentQRCode(){
|
|
|
public String getResidentQRCode() {
|
|
|
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
String year = String.valueOf(cal.get(Calendar.YEAR));
|
|
|
int temp = cal.get(Calendar.MONTH)+1;
|
|
|
String month = cal.get(Calendar.MONTH)+1<10?"0"+temp:""+temp;
|
|
|
String day = ""+cal.get(Calendar.DAY_OF_MONTH);
|
|
|
String ymd = year+month+day;
|
|
|
int temp2 = (int)((Math.random()*9+1)*100000);
|
|
|
String code = ymd +temp2;
|
|
|
int temp = cal.get(Calendar.MONTH) + 1;
|
|
|
String month = cal.get(Calendar.MONTH) + 1 < 10 ? "0" + temp : "" + temp;
|
|
|
String day = "" + cal.get(Calendar.DAY_OF_MONTH);
|
|
|
String ymd = year + month + day;
|
|
|
int temp2 = (int) ((Math.random() * 9 + 1) * 100000);
|
|
|
String code = ymd + temp2;
|
|
|
return ymd;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*配送员取药码
|
|
|
* 配送员取药码
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/dispensaryCode/getDiliveryQRCode",method = RequestMethod.GET)
|
|
|
@RequestMapping(value = "/dispensaryCode/getDiliveryQRCode", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
//@ObserverRequired
|
|
|
public String getDiliveryQRCode(){
|
|
|
public String getDiliveryQRCode() {
|
|
|
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
String year = String.valueOf(cal.get(Calendar.YEAR));
|
|
|
int temp = cal.get(Calendar.MONTH)+1;
|
|
|
String month = cal.get(Calendar.MONTH)+1<10?"0"+temp:""+temp;
|
|
|
String day = ""+cal.get(Calendar.DAY_OF_MONTH);
|
|
|
String ymd = year+month+day;
|
|
|
int temp = cal.get(Calendar.MONTH) + 1;
|
|
|
String month = cal.get(Calendar.MONTH) + 1 < 10 ? "0" + temp : "" + temp;
|
|
|
String day = "" + cal.get(Calendar.DAY_OF_MONTH);
|
|
|
String ymd = year + month + day;
|
|
|
//int temp2 = (int)((Math.random()*9+1)*100000);
|
|
|
String randomNum = randomString("0123456789",6);
|
|
|
String code = ymd +randomNum;
|
|
|
String randomNum = randomString("0123456789", 6);
|
|
|
String code = ymd + randomNum;
|
|
|
|
|
|
return ymd;
|
|
|
}
|
|
|
|
|
|
public String randomString(String base, int length) {
|
|
|
public String randomString(String base, int length) {
|
|
|
Random random = new Random();
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
for (int i = 0; i < length; i++) {
|
|
@ -85,43 +98,76 @@ public class PatientPrescriptionController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 显示居民所有的取药码列表
|
|
|
*
|
|
|
* @param status
|
|
|
* @param timeType
|
|
|
* @param page
|
|
|
* @param pagesize
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/dispensaryCode/list",method = RequestMethod.GET)
|
|
|
@RequestMapping(value = "/dispensaryCode/list", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
//@ObserverRequired
|
|
|
public String list(
|
|
|
//@RequestParam(value = "patientCode",required = true) String patientCode,
|
|
|
@RequestParam(value = "status",required = false) Integer status,
|
|
|
@RequestParam(value = "timeType",required = false) Integer timeType,
|
|
|
@RequestParam(value = "page",required = true) Integer page,
|
|
|
@RequestParam(value = "pagesize",required = true) Integer pagesize) {
|
|
|
@RequestParam(value = "status", required = false) Integer status,
|
|
|
@RequestParam(value = "timeType", required = false) Integer timeType,
|
|
|
@RequestParam(value = "page", required = true) Integer page,
|
|
|
@RequestParam(value = "pagesize", required = true) Integer pagesize) {
|
|
|
//getRepUID()
|
|
|
JSONArray result = prescriptionDispensaryCodeService.findByStatusAndTime(timeType,"915cc456-5b1d-11e6-8344-fa163e8aee56",status,page,pagesize);
|
|
|
JSONArray result = prescriptionDispensaryCodeService.findByStatusAndTime(timeType, "915cc456-5b1d-11e6-8344-fa163e8aee56", status, page, pagesize);
|
|
|
System.out.println(result.toString());
|
|
|
return result.toString();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 判断该居民是否有待取的药的接口
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/dispensaryCode/whetherHaveCode",method = RequestMethod.GET)
|
|
|
@RequestMapping(value = "/dispensaryCode/whetherHaveCode", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
//@ObserverRequired
|
|
|
public String whetherHaveCode(){
|
|
|
public String whetherHaveCode() {
|
|
|
JSONObject json = new JSONObject();
|
|
|
String patientCode=getRepUID();
|
|
|
String patientCode = getRepUID();
|
|
|
int count = prescriptionDispensaryCodeService.dispensaryCodeCount(patientCode);
|
|
|
if(count>0){
|
|
|
json.put("data",true);
|
|
|
if (count > 0) {
|
|
|
json.put("data", true);
|
|
|
return json.toString();
|
|
|
}
|
|
|
json.put("data",false);
|
|
|
json.put("data", false);
|
|
|
return json.toString();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 订单跟踪 包含处方药品信息 订单记录 支付记录
|
|
|
* 根据处方code获取处方流程
|
|
|
*
|
|
|
* @param prescriptionCode
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/prescriptionFollow", method = RequestMethod.GET)
|
|
|
@ApiOperation(value = "获取处方订单详情")
|
|
|
public String addReply(
|
|
|
@RequestParam(required = true) @ApiParam(value = "处方code", name = "prescriptionCode") String prescriptionCode) {
|
|
|
try {
|
|
|
JSONObject jo = new JSONObject();
|
|
|
//获取处方信息
|
|
|
Prescription prescription = prescriptionService.findByCode(prescriptionCode);
|
|
|
//获取处方药品信息
|
|
|
List<PrescriptionInfo> prescriptionInfos = prescriptionInfoService.getPrescriptionInfo(prescriptionCode);
|
|
|
//获取付款信息
|
|
|
PrescriptionPay prescriptionPay = prescriptionPayService.findByPrescriptionCode(prescriptionCode);
|
|
|
//获取配送信息
|
|
|
PrescriptionExpressage prescriptionExpressage = prescriptionExpressageService.findByPrescriptionCode(prescriptionCode);
|
|
|
jo.put("prescriptionInfos", prescriptionInfos);
|
|
|
jo.put("prescriptionPay", prescriptionPay);
|
|
|
jo.put("prescriptionExpressage", prescriptionExpressage);
|
|
|
jo.put("prescriptionStatus", prescription.getStatus());
|
|
|
return write(200,"查询成功","data",jo);
|
|
|
} catch (Exception e) {
|
|
|
return error(-1, "获取失败");
|
|
|
}
|
|
|
}
|
|
|
}
|