Bläddra i källkod

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

trick9191 7 år sedan
förälder
incheckning
6dae3da9e9

+ 2 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -213,9 +213,10 @@ public class PrescriptionInfoService extends BaseService {
                " p.`name`, " +
                " TIMESTAMPDIFF(YEAR,p.birthday,SYSDATE()) age, " +
                " p.sex, " +
                " p.photo," +
                " pr.`status`, " +
                " pr.`code`, " +
                " pr.create_time AS createTime, " +
                " LEFT(pr.create_time,19) AS createTime, " +
                " pr.doctor " +
                " FROM " +
                " wlyy_prescription pr " +

+ 23 - 10
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -19,6 +19,7 @@ import com.yihu.wlyy.repository.prescription.PrescriptionLogDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ImUtill;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
@ -71,10 +72,15 @@ public class PrescriptionInfoService extends BaseService {
        List<SystemDict> states = systemDictDao.findByDictName("PRESCRIPTION_STATE");
        rs.put("states",states);
        List<Map<String,Object>> diseases = new ArrayList<>();
        Map<String,Object> dis = new HashMap<>();
        dis.put("1","糖尿病");
        dis.put("2","高血压");
        rs.put("diseases",dis);
        Map<String,Object> dis1 = new HashMap<>();
        dis1.put("code","1");
        dis1.put("name","糖尿病");
        Map<String,Object> dis2 = new HashMap<>();
        dis2.put("code","2");
        dis2.put("name","高血压");
        diseases.add(dis1);
        diseases.add(dis2);
        rs.put("diseases",diseases);
        return rs;
    }
@ -84,7 +90,7 @@ public class PrescriptionInfoService extends BaseService {
     * @param type
     * @return
     */
    public JSONArray getPrescriptionInfos(String type,String startDate,String endDate,String patient,String isRenewal){
    public JSONArray getPrescriptionInfos(String type,String startDate,String endDate,String patient,String isRenewal,Integer page,Integer size){
        if(StringUtils.isNotBlank(type)){
            if("1".equals(type)){
@ -106,6 +112,9 @@ public class PrescriptionInfoService extends BaseService {
                    sqlBuffer.append(" AND p.create_time <= ?");
                    params.add(endDate+" 23:59:59");
                }
                if(page!=null&&page>0&&size!=null&&size>0){
                    sqlBuffer.append(" LIMIT "+(page-1)*size+","+size);
                }
                //本地库
                List<Map<String,Object>> rs =jdbcTemplate.queryForList(sqlBuffer.toString(),params.toArray());
                //通过缓存查找药品和疾病
@ -208,14 +217,15 @@ public class PrescriptionInfoService extends BaseService {
    }
    public JSONArray getDoctorPrescription(Integer teamCode,String state,String diseases,String startDate,String endDate,String nameKeyword){
    public JSONArray getDoctorPrescription(Integer teamCode,String state,String diseases,String startDate,String endDate,String nameKeyword,Integer page,Integer size){
        StringBuffer pre_sql = new StringBuffer("SELECT " +
                " p.`name`, " +
                " TIMESTAMPDIFF(YEAR,p.birthday,SYSDATE()) age, " +
                " p.sex, " +
                " p.photo, " +
                " pr.`status`, " +
                " pr.`code`, " +
                " pr.create_time AS createTime, " +
                " LEFT(pr.create_time,19) AS createTime, " +
                " pr.doctor " +
                " FROM " +
                " wlyy_prescription pr " +
@ -229,12 +239,12 @@ public class PrescriptionInfoService extends BaseService {
                    " AND pr.admin_team_id =? AND s.code = ?");
            params.add(teamCode);
            params.add(diseases);
            setSQL(pre_sql,params,state,startDate,endDate,nameKeyword);
            setSQL(pre_sql,params,state,startDate,endDate,nameKeyword,page,size);
        }else{
            //查询所有疾病类型表
            pre_sql.append(" WHERE pr.admin_team_id =?");
            params.add(teamCode);
            setSQL(pre_sql,params,state,startDate,endDate,nameKeyword);
            setSQL(pre_sql,params,state,startDate,endDate,nameKeyword,page,size);
        }
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(pre_sql.toString(),params.toArray());
@ -247,7 +257,7 @@ public class PrescriptionInfoService extends BaseService {
        return new JSONArray(rs);
    }
    public void setSQL(StringBuffer pre_sql,List<Object> params,String state,String startDate,String endDate,String nameKeyword){
    public void setSQL(StringBuffer pre_sql,List<Object> params,String state,String startDate,String endDate,String nameKeyword,Integer page,Integer size){
        if(StringUtils.isNotBlank(state)){
            pre_sql.append(" AND pr.status = ?");
            params.add(state);
@ -265,6 +275,9 @@ public class PrescriptionInfoService extends BaseService {
            params.add("%"+nameKeyword+"%");
        }
        pre_sql.append(" GROUP BY pr.code ORDER BY pr.create_time DESC");
        if(page!=null&&page>0&&size!=null&&size>0){
            pre_sql.append(" LIMIT "+(page-1)*size+","+size);
        }
    }
    /**

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

@ -25,7 +25,7 @@ import java.util.List;
@RestController
@RequestMapping(value = "/doctor/prescriptionInfo")
@Api("医生端-长处方接口")
public class PrescriptionInfoController extends BaseController {
public class PrescriptionInfoController extends BaseController{
    @Autowired
    private PrescriptionInfoService prescriptionInfoService;
@ -63,9 +63,9 @@ public class PrescriptionInfoController extends BaseController {
    @RequestMapping(value = "/getPrescriptionFilter", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "获取过滤规则信息列表")
    public String getPrescriptionFilter() {
    public String getPrescriptionFilter(){
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.getPrescriptionFilter());
            return write(200, "查询成功!", "data",prescriptionInfoService.getPrescriptionFilter());
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -75,14 +75,16 @@ public class PrescriptionInfoController extends BaseController {
    @RequestMapping(value = "/getDoctorPrescription", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "获取全科医生/建管师续方列表/搜索")
    public String getDoctorPrescription(@RequestParam(required = true) @ApiParam(value = "团队code", name = "teamCode") Integer teamCode,
                                        @RequestParam(required = false) @ApiParam(value = "续方状态", name = "state") String state,
                                        @RequestParam(required = false) @ApiParam(value = "所有诊断:1 糖尿病 2高血压", name = "dispensary") String diseases,
                                        @RequestParam(required = false) @ApiParam(name = "startDate", value = "开始时间") String startDate,
                                        @RequestParam(required = false) @ApiParam(name = "endDate", value = "结束时间") String endDate,
                                        @RequestParam(required = false) @ApiParam(name = "nameKeyword", value = "患者姓名模糊匹配") String nameKeyword) {
    public String getDoctorPrescription(@RequestParam(required = true)@ApiParam(value = "团队code", name = "teamCode") Integer teamCode,
                                        @RequestParam(required = false)@ApiParam(value = "续方状态", name = "state") String state,
                                        @RequestParam(required = false)@ApiParam(value = "所有诊断:1 糖尿病 2高血压", name = "dispensary") String diseases,
                                        @RequestParam(required = false)@ApiParam(name="startDate",value="开始时间")String startDate,
                                        @RequestParam(required = false)@ApiParam(name="endDate",value="结束时间")String endDate,
                                        @RequestParam(required = false)@ApiParam(name="nameKeyword",value="患者姓名模糊匹配")String nameKeyword,
                                        @RequestParam(required = false)@ApiParam(name="page",value="起始页")Integer page,
                                        @RequestParam(required = false)@ApiParam(name="size",value="每页条数")Integer size){
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.getDoctorPrescription(teamCode, state, diseases, startDate, endDate, nameKeyword));
            return write(200, "查询成功!", "data",prescriptionInfoService.getDoctorPrescription(teamCode,state,diseases,startDate,endDate,nameKeyword));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -92,10 +94,10 @@ public class PrescriptionInfoController extends BaseController {
    @RequestMapping(value = "/getContinuedPrescriptionAsDoctor", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "续方详情")
    public String getContinuedPrescriptionAsDoctor(@RequestParam(required = true) @ApiParam(value = "续方CODE", name = "code") String code,
                                                   @RequestParam(required = true) @ApiParam(value = "团队长标识:1:是;2否", name = "type") String type) {
    public String getContinuedPrescriptionAsDoctor(@RequestParam(required = true)@ApiParam(value = "续方CODE", name = "code") String code,
                                                   @RequestParam(required = true)@ApiParam(value = "团队长标识:1:是;2否", name = "type") String type){
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.getContinuedPrescriptionAsDoctor(code));
            return write(200, "查询成功!", "data",prescriptionInfoService.getContinuedPrescriptionAsDoctor(code));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -105,11 +107,11 @@ public class PrescriptionInfoController extends BaseController {
    @RequestMapping(value = "/reviewPrescription", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "续方审核")
    public String reviewPrescription(@RequestParam(required = true) @ApiParam(value = "续方CODE", name = "code") String code,
                                     @RequestParam(required = false) @ApiParam(value = "不同意原因", name = "reason") String reason,
                                     @RequestParam(required = false) @ApiParam(value = "1同意,2不同意", name = "state") String state) {
    public String reviewPrescription(@RequestParam(required = true)@ApiParam(value = "续方CODE", name = "code") String code,
                                     @RequestParam(required = false)@ApiParam(value = "不同意原因", name = "reason") String reason,
                                     @RequestParam(required = false)@ApiParam(value = "1同意,2不同意", name = "state") String state){
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.reviewPrescription(code, reason, state));
            return write(200, "查询成功!", "data",prescriptionInfoService.reviewPrescription(code,reason,state));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -120,11 +122,11 @@ public class PrescriptionInfoController extends BaseController {
    @ResponseBody
    @ApiOperation(value = "调整处方")
    @ObserverRequired
    public String updatePresInfo(@RequestParam(required = true) @ApiParam(value = "续方CODE", name = "code") String code,
                                 @RequestParam(required = true) @ApiParam(value = "续方药品JSON", name = "infos") String infos,
                                 @RequestParam(required = true) @ApiParam(value = "调整原因", name = "reason") String reason) {
    public String updatePresInfo(@RequestParam(required = true)@ApiParam(value = "续方CODE", name = "code") String code,
                                 @RequestParam(required = true)@ApiParam(value = "续方药品JSON", name = "infos") String infos,
                                 @RequestParam(required = true)@ApiParam(value = "调整原因", name = "reason") String reason ){
        try {
            return write(200, "操作成功!", "data", prescriptionInfoService.updatePresInfo(code, infos, reason));
            return write(200, "操作成功!", "data",prescriptionInfoService.updatePresInfo(code,infos,reason));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -134,9 +136,9 @@ public class PrescriptionInfoController extends BaseController {
    @RequestMapping(value = "/getInfoTitle", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "调整处方-药品分类及种类数目")
    public String getInfoTitle() {
    public String getInfoTitle(){
        try {
            return write(200, "操作成功!", "data", "");
            return write(200, "操作成功!", "data","");
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -146,9 +148,9 @@ public class PrescriptionInfoController extends BaseController {
    @RequestMapping(value = "/getInfoListByParentCode", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "药品类别获取药品")
    private String getInfoListByParentCode(@RequestParam(required = true) @ApiParam(value = "药品类别Code", name = "code") String code) {
    private String getInfoListByParentCode(@RequestParam(required = true)@ApiParam(value = "药品类别Code", name = "code") String code){
        try {
            return write(200, "操作成功!", "data", "");
            return write(200, "操作成功!", "data","");
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");

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

@ -36,9 +36,11 @@ public class PatientPrescriptionInfoController extends BaseController {
    public String getPrescriptionInfos(@RequestParam(required = true)@ApiParam(name="type",value="1:查询处方;2我的续方;3:续方记录")String type,
                                       @RequestParam(required = false)@ApiParam(name="isRenewal",value="处方是否可续方:1.是;2.无过滤")String isRenewal,
                                       @RequestParam(required = false)@ApiParam(name="startDate",value="开始时间")String startDate,
                                       @RequestParam(required = false)@ApiParam(name="endDate",value="结束时间")String endDate){
                                       @RequestParam(required = false)@ApiParam(name="endDate",value="结束时间")String endDate,
                                       @RequestParam(required = false)@ApiParam(name="page",value="起始页")Integer page,
                                       @RequestParam(required = false)@ApiParam(name="size",value="每页条数")Integer size){
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.getPrescriptionInfos(type,startDate,endDate,getRepUID(),isRenewal));
            return write(200, "查询成功!", "data", prescriptionInfoService.getPrescriptionInfos(type,startDate,endDate,getRepUID(),isRenewal,page,size));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");