Browse Source

Merge branch 'dev' of liuwenbin/patient-co-management into dev

liuwenbin 7 years ago
parent
commit
bf96ca89ba

+ 6 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java

@ -55,7 +55,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    String fastdfs_file_url;
    //获取居民端取药码列表
    public  JSONArray findByStatusAndTime(Integer timeType, String patientCode, Integer status, Integer page, Integer pagesize) {
    public  JSONArray findByStatusAndTime(Integer timeType, String patientCode, Integer status, Integer page, Integer pagesize,Integer type) {
        // 分页信息
        long timeLimit = 0;
        if(timeType!=null){
@ -67,8 +67,9 @@ public class PrescriptionDispensaryCodeService extends BaseService {
            }
        }
        List<Object> params = new ArrayList<>();
        String precriptionSql = "select * from wlyy_prescription_dispensary_code p2 left join  wlyy_prescription p1 on p2.prescription_code=p1.code LEFT JOIN wlyy_prescription_expressage p3 on p1.code=p3.prescription_code where 1=1 ";
        String precriptionSql = "select p2.*,p1.diagnosis as diagnosis ,p3.address as address from wlyy_prescription_dispensary_code p2 left join  wlyy_prescription p1 on p2.prescription_code=p1.code LEFT JOIN wlyy_prescription_expressage p3 on p1.code=p3.prescription_code where p1.patient=? and p2.type=? ";
        params.add(patientCode);
        params.add(type);
        if(status!=null){
            precriptionSql += " and p1.status = ? ";
            params.add(status);
@ -76,14 +77,14 @@ public class PrescriptionDispensaryCodeService extends BaseService {
            precriptionSql += " and p1.status in (20,21,100)" ;
        }
        if(timeType!=null){
            precriptionSql +=  "and TIMESTAMPDIFF(SECOND, a.create_Time, CURRENT_TIME) > ? ORDER BY p1.status desc ,p2.create_Time desc ";
            precriptionSql +=  "and TIMESTAMPDIFF(SECOND, p2.create_Time, CURRENT_TIME) < ? ORDER BY p1.status desc ,p2.create_Time desc ";
            params.add(timeLimit);
        }
        precriptionSql += " limit "+(page-1)*pagesize+","+pagesize;
        List<Map<String, Object>> result = jdbcTemplate.queryForList(precriptionSql,params.toArray());
        List<Map<String, Object>> result2 = new ArrayList<>();
        for (Map<String, Object> m:result) {
            List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(m.get("code").toString());
            List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(m.get("prescription_code").toString());
            m.put("data",list);
            result2.add(m);
        }

+ 49 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionCodeController.java

@ -0,0 +1,49 @@
package com.yihu.wlyy.web.doctor.prescription;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.service.app.prescription.PrescriptionDispensaryCodeService;
import com.yihu.wlyy.service.app.prescription.PrescriptionExpressageService;
import com.yihu.wlyy.service.app.prescription.PrescriptionInfoService;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * Created by Trick on 2017/7/25.
 */
@RestController
@RequestMapping(value = "/doctor/prescriptionCode")
@Api(description = "医生端-长处方接口")
public class PrescriptionCodeController extends BaseController{
    @Autowired
    private PrescriptionDispensaryCodeService prescriptionDispensaryCodeService;
    /**
     * 显示居民所有的取药码列表
     * @param status 处方状态
     * @param timeType 搜索时间类型
     * @param page 当前页
     * @param pagesize  每页总数
     *  type 1、居民端扫码列表 2、配送员(健管师)扫码列表
     * @return
     */
    @RequestMapping(value = "/list",method = RequestMethod.GET)
    @ResponseBody
    @ObserverRequired
    public String list(
            @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) {
        //getUID()
        JSONArray result = prescriptionDispensaryCodeService.findByStatusAndTime(timeType,getUID(),status,page,pagesize,2);
        return result.toString();
    }
}

+ 3 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java

@ -99,20 +99,19 @@ public class PatientPrescriptionController extends WeixinBaseController {
     * @param timeType
     * @param page
     * @param pagesize
     * type 1、居民端扫码列表 2、配送员(健管师)扫码列表
     * @return
     */
    @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) {
        //getUID()
        JSONArray result = prescriptionDispensaryCodeService.findByStatusAndTime(timeType,getUID(),status,page,pagesize);
        System.out.println(result.toString());
        //getUID()"a663d0cf7f8c4d38a8327cedc921e65f"
        JSONArray result = prescriptionDispensaryCodeService.findByStatusAndTime(timeType,getUID(),status,page,pagesize,1);
        return result.toString();
    }