Przeglądaj źródła

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

chenweida 7 lat temu
rodzic
commit
6c5e688b42

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

@ -0,0 +1,17 @@
package com.yihu.wlyy.repository.prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionDispensaryCode;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by chenweida on 2017/7/27.
 */
public interface PrescriptionLogDao extends PagingAndSortingRepository<PrescriptionLog, Long>, JpaSpecificationExecutor<PrescriptionLog> {
    @Query("from PrescriptionLog l where l.prescriptionCode=?1 and l.type in ?2 order by createTime desc")
    List<PrescriptionLog> findPrescriptionLogsByPrescriptionCode(String prescriptionCode, Integer[] types);
}

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

@ -0,0 +1,29 @@
package com.yihu.wlyy.service.app.prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
import com.yihu.wlyy.repository.prescription.PrescriptionLogDao;
import com.yihu.wlyy.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * Created by chenweida on 2017/7/27.
 */
@Service
public class PrescriptionLogService extends BaseService {
    @Autowired
    private PrescriptionLogDao prescriptionLogDao;
    /**
     * 根据处方code 和 types查询处方的流程日志 时间倒叙
     *
     * @param prescriptionCode 处方code
     * @param types            需要查询的types
     * @return
     */
    public List<PrescriptionLog> findPrescriptionLogsByPrescriptionCode(String prescriptionCode, Integer[] types) {
        return prescriptionLogDao.findPrescriptionLogsByPrescriptionCode(prescriptionCode, types);
    }
}

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

@ -0,0 +1,51 @@
package com.yihu.wlyy.web.doctor.prescription;
import com.yihu.wlyy.entity.doctor.reply.DoctorQuickReply;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
 * Created by chenweida on 2017/7/27.
 */
@RestController
@RequestMapping(value = "/doctor/prescriptionlog")
@Api("医生端-处方日志")
public class PrescriptionLogController extends BaseController {
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    /**
     * 根据处方code获取处方流程
     *
     * @param prescriptionCode
     * @return
     */
    @RequestMapping(value = "/getPrescriptionLogs", method = RequestMethod.GET)
    @ApiOperation(value = "获取处方流程")
    public String addReply(
            @RequestParam(required = true) @ApiParam(value = "处方code", name = "prescriptionCode") String prescriptionCode) {
        try {
            Integer[] types = new Integer[]{12, 21, 31, 41, 100};
            List<PrescriptionLog> prescriptionLogs = prescriptionLogService.findPrescriptionLogsByPrescriptionCode(prescriptionCode, types);
            if (prescriptionLogs != null) {
                return write(200, "获取处方流程成功", "data", prescriptionLogs);
            } else {
                return error(-1, "获取失败");
            }
        } catch (Exception e) {
            return error(-1, "获取失败");
        }
    }
}

+ 50 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PrescriptionLogController.java

@ -0,0 +1,50 @@
package com.yihu.wlyy.web.patient.prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
 * Created by chenweida on 2017/7/27.
 */
@RestController
@RequestMapping(value = "/patient/prescriptionlog")
@Api("患者端-处方日志")
public class PrescriptionLogController extends BaseController {
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    /**
     * 订单跟踪
     * 根据处方code获取处方流程
     *
     * @param prescriptionCode
     * @return
     */
    @RequestMapping(value = "/getPrescriptionLogs", method = RequestMethod.GET)
    @ApiOperation(value = "获取处方流程")
    public String addReply(
            @RequestParam(required = true) @ApiParam(value = "处方code", name = "prescriptionCode") String prescriptionCode) {
        try {
            Integer[] types = new Integer[]{12, 21, 31, 41, 100};
            List<PrescriptionLog> prescriptionLogs = prescriptionLogService.findPrescriptionLogsByPrescriptionCode(prescriptionCode, types);
            if (prescriptionLogs != null) {
                return write(200, "获取处方流程成功", "data", prescriptionLogs);
            } else {
                return error(-1, "获取失败");
            }
        } catch (Exception e) {
            return error(-1, "获取失败");
        }
    }
}