Browse Source

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

chenweida 7 years ago
parent
commit
b39dc3489e

+ 18 - 15
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java

@ -348,21 +348,6 @@ public class Prescription extends IdEntity {
        this.prescriptionType = prescriptionType;
    }
    @Transient
    public String getTypeName() {
        switch (type) {
            case 1: {
                return "自取";
            }
            case 2: {
                return "快递配送";
            }
            case 3: {
                return "健管师配送";
            }
        }
        return "";
    }
    @Transient
    public String getStatusName() {
@ -612,4 +597,22 @@ public class Prescription extends IdEntity {
    public void setJwHospital(String jwHospital) {
        this.jwHospital = jwHospital;
    }
    @Transient
    public String getDispensaryTypeName() {
        switch (type) {
            case 1: {
                return "自取";
            }
            case 2: {
                return "快递配送";
            }
            case 3: {
                return "健管师配送";
            }
        }
        return "";
    }
}

+ 4 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionDispensaryCodeDao.java

@ -15,20 +15,20 @@ import java.util.List;
 * 处方取码
 */
public interface PrescriptionDispensaryCodeDao extends PagingAndSortingRepository<PrescriptionDispensaryCode, Long>, JpaSpecificationExecutor<PrescriptionDispensaryCode> {
    @Query("from PrescriptionDispensaryCode where code=?1")
    @Query(nativeQuery = true, value = "select * from wlyy_prescription_dispensary_code  where code=?1 order by create_time desc limit 0,1 ")
    PrescriptionDispensaryCode finByCode(String code);
//    @Query("select  count(1) from wlyy_prescription_dispensary_code p1 \n" +
    //    @Query("select  count(1) from wlyy_prescription_dispensary_code p1 \n" +
//            "LEFT JOIN wlyy_prescription p2 on p1.prescription_Code = p2.code where p2.status in(21,20,100) and p2.patient =?1 ")
//    int dispensaryCodeCount(String patientCode);
    @Query("select count(1) from PrescriptionDispensaryCode a where a.code= ?1 and a.isUse =0")
    Integer getResidentQRCodeCount(String code);
    @Query("select a.code from PrescriptionDispensaryCode a where a.prescriptionCode= ?1 and a.type =?2 ")
    String getCodeByPrescriptionCodeAndType(String prescriptionCode,Integer type);
    String getCodeByPrescriptionCodeAndType(String prescriptionCode, Integer type);
//    @Query("select p1 from PrescriptionInfo p1 left join Prescription p2 on p1.prescriptionCode=p2.code where p1.prescriptionCode = ?1")
//    List<PrescriptionInfo> getPrescriptionInfo(String prescriptionCode);
    PrescriptionDispensaryCode findByCodeAndIsUse(String code,Integer isUse);
    PrescriptionDispensaryCode findByCodeAndIsUse(String code, Integer isUse);
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionLogDao.java

@ -12,6 +12,6 @@ import java.util.List;
 */
public interface PrescriptionLogDao extends PagingAndSortingRepository<PrescriptionLog, Long>, JpaSpecificationExecutor<PrescriptionLog> {
    @Query("select l.status,l.createTime from PrescriptionLog l where l.prescriptionCode=?1 and l.type in ?2 order by createTime desc")
    @Query("select l.status,l.createTime from PrescriptionLog l where l.prescriptionCode=?1 and l.status in ?2 order by createTime desc")
    List<PrescriptionLog> findPrescriptionLogsByPrescriptionCode(String prescriptionCode, Integer[] types);
}

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionLogService.java

@ -22,11 +22,11 @@ public class PrescriptionLogService extends BaseService {
     * 根据处方code 和 types查询处方的流程日志 时间倒叙
     *
     * @param prescriptionCode 处方code
     * @param types            需要查询的types
     * @param status            需要查询的status
     * @return
     */
    public List<PrescriptionLog> findPrescriptionLogsByPrescriptionCode(String prescriptionCode, Integer[] types) {
        return prescriptionLogDao.findPrescriptionLogsByPrescriptionCode(prescriptionCode, types);
    public List<PrescriptionLog> findPrescriptionLogsByPrescriptionCode(String prescriptionCode, Integer[] status) {
        return prescriptionLogDao.findPrescriptionLogsByPrescriptionCode(prescriptionCode, status);
    }
    /**

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java

@ -176,8 +176,8 @@ public class PrescriptionInfoController extends BaseController{
            jo.put("prescriptionPay", prescriptionPay);
            jo.put("prescriptionExpressage", new JSONObject(prescriptionExpressage));
            jo.put("prescriptionHospital", prescription.getHospitalName());//出药机构
            jo.put("dispensaryDispensaryType", prescription.getType());//处方配送方式
            jo.put("dispensaryDispensaryTypeName", prescription.getTypeName());//处方配送方式
            jo.put("dispensaryDispensaryType", prescription.getDispensaryType());//处方配送方式
            jo.put("dispensaryDispensaryTypeName", prescription.getDispensaryTypeName());//处方配送方式
            jo.put("prescriptionStatus", prescription.getStatus());//处方状态
            jo.put("prescriptionStatusName", prescription.getStatusName(prescription.getStatus(),""));//处方状态名称

+ 16 - 19
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionLogController.java

@ -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, "获取失败");
        }
    }

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

@ -233,8 +233,8 @@ public class PatientPrescriptionController extends WeixinBaseController {
            jo.put("prescriptionInfos", prescriptionInfos);
            jo.put("prescriptionPay", prescriptionPay);
            jo.put("prescriptionHospital", prescription.getHospitalName());//出药机构
            jo.put("prescriptionDispensaryType", prescription.getType());//处方配送方式
            jo.put("prescriptionDispensaryTypeName", prescription.getTypeName());//处方配送方式
            jo.put("prescriptionDispensaryType", prescription.getDispensaryType());//处方配送方式
            jo.put("prescriptionDispensaryTypeName", prescription.getDispensaryTypeName());//处方配送方式
            jo.put("prescriptionStatus", prescription.getStatus());//处方状态
            jo.put("prescriptionStatusName", prescription.getStatusName(prescription.getStatus(),""));//处方状态名称
            return write(200, "查询成功", "data", jo);

+ 11 - 13
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionLogController.java

@ -48,12 +48,12 @@ public class PatientPrescriptionLogController extends BaseController {
            // (-3 支付过期 -2 患者自己取消 -1 审核不通过 , 0 待审核, 2调整中 10 审核通过/开方中  , 20开方完成/待支付, 21 支付失败 , 30 支付成功/待配药 ,
            // 40配药成功/待配送  41配送失败 42分配健管师 45配送中   49配送到服务站  100配送到患者手中/已完成)
            Integer[] types = new Integer[]{
            Integer[] status = new Integer[]{
                    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);
@ -68,18 +68,16 @@ public class PatientPrescriptionLogController 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) {