Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

yeshijie 7 years ago
parent
commit
b259c49c36

+ 9 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionDispensaryCode.java

@ -21,6 +21,7 @@ public class PrescriptionDispensaryCode extends IdEntity{
    private Date createTime;               //创建时间
    private Integer type;                   //编码类型:1 居民取药码 2 配送员(健管师)取药码
    private String imgUrl;                  //图片存在FastFDS的路径
    private Integer isUse;//是否使用 1是 0否
    @Column(name = "code", unique = true , nullable=false)
    public String getCode() {
@ -65,4 +66,12 @@ public class PrescriptionDispensaryCode extends IdEntity{
    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }
    public Integer getIsUse() {
        return isUse;
    }
    public void setIsUse(Integer isUse) {
        this.isUse = isUse;
    }
}

+ 9 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionExpressage.java

@ -33,6 +33,7 @@ public class PrescriptionExpressage extends IdEntity{
    private String hospitalName;            //如果配送方式是健管师那么这个字段存服务站名称,如果是快递配送那么是快递公司名称
    private Double price;                    //快递的配送费用
    private Date createTime;                //创建的时间
    private Integer oneselfPickupFlg;//是否自取 1是 0否
    @Column(name = "code", unique = true , nullable=false)
    public String getCode() {
@ -171,4 +172,12 @@ public class PrescriptionExpressage extends IdEntity{
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getOneselfPickupFlg() {
        return oneselfPickupFlg;
    }
    public void setOneselfPickupFlg(Integer oneselfPickupFlg) {
        this.oneselfPickupFlg = oneselfPickupFlg;
    }
}

+ 105 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionExpressageLog.java

@ -0,0 +1,105 @@
package com.yihu.wlyy.entity.patient.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Administrator on 2017/7/21.
 * 处方配送
 */
@Entity
@Table(name = "wlyy_prescription_expressage_log")
public class PrescriptionExpressageLog extends IdEntity{
    private String code;                    //业务code
    private String prescriptionCode;      //处方code  关联表wlyy_prescription code
    private String expressageCode;//配送code 关联wlyy_prescription_expressage code
    private Date createTime;                //创建的时间
    private String remark;//备注
    private String acceptAddress;//路由节点发生的城市
    private Date acceptTime;// 路由节点产生的时间,格式:YYYY-MM-DD HH24:MM:SS,示例:2012-7-30 09:30:00。
    private String opCode;//路由节点操作码
    private String acceptRemark;//路由节点具体描述
    @Column(name = "code", unique = true , nullable=false)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getPrescriptionCode() {
        return prescriptionCode;
    }
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getExpressageCode() {
        return expressageCode;
    }
    public void setExpressageCode(String expressageCode) {
        this.expressageCode = expressageCode;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getAcceptAddress() {
        return acceptAddress;
    }
    public void setAcceptAddress(String acceptAddress) {
        this.acceptAddress = acceptAddress;
    }
    public Date getAcceptTime() {
        return acceptTime;
    }
    public void setAcceptTime(Date acceptTime) {
        this.acceptTime = acceptTime;
    }
    public String getOpCode() {
        return opCode;
    }
    public void setOpCode(String opCode) {
        this.opCode = opCode;
    }
    public String getAcceptRemark() {
        return acceptRemark;
    }
    public void setAcceptRemark(String acceptRemark) {
        this.acceptRemark = acceptRemark;
    }
}

+ 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);
        }

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

@ -77,6 +77,9 @@ public class PrescriptionExpressageService {
        prescriptionLog.setUserType(2);
        prescriptionLog.setType(100);
        prescriptionLogDao.save(prescriptionLog);
        //修改取药码code为已经使用
        prescriptionDispensaryCode.setIsUse(1);
        return 1;
    }
}

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

@ -15,6 +15,8 @@ import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionInfoDao;
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.lang3.StringUtils;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
@ -44,6 +46,11 @@ public class PrescriptionInfoService extends BaseService {
    private PatientDao patientDao;
    @Autowired
    private PrescriptionLogDao prescriptionLogDao;
    @Autowired
    private PrescriptionDiagnosisService prescriptionDiagnosisService;
    @Autowired
    private ImUtill imUtill;
    /**
     * 获取处方下的详细药品
     * @param prescriptionCode
@ -264,6 +271,14 @@ public class PrescriptionInfoService extends BaseService {
            log.setRemark("医生审核");
            prescriptionLogDao.save(log);
            //发送Im消息
            JSONObject content = new JSONObject();
            content.put("title","我已经审核您"+ DateUtil.dateToStr(p.getCreateTime(),"yyyy-MM-dd")+"发起的续方申请");
            content.put("result","1".equals(state)?"审核通过":"审核不通过");
            content.put("reason","1".equals(state)?"":reason);
            content.put("url","");
            imUtill.sendTopicIM(p.getDoctor(),p.getDoctorName(),p.getConsult(),"1",content.toString(),null);
            //同步智业接口
            upLoadPrescriotionState();
            return 1;
@ -271,4 +286,40 @@ public class PrescriptionInfoService extends BaseService {
        return 0;
    }
    public int updatePresInfo(String code,String infos){
        if(StringUtils.isNotBlank(code)&&StringUtils.isNotBlank(infos)){
            //同步智业接口
            upload();
            //删除所有药品
            StringBuffer sql = new StringBuffer("UPDATE wlyy_prescription_info SET del = 0 WHERE prescription_code = '"+code+"'");
            jdbcTemplate.execute(sql.toString());
            JSONArray jsonArray = new  JSONArray(infos);
            Iterator<Object> it = jsonArray.iterator();
            while (it.hasNext()){
                JSONObject info = (JSONObject) it.next();
                PrescriptionInfo p = new PrescriptionInfo();
                p.setCode(getCode());
                p.setDel(1);
                p.setPrescriptionCode(code);
                p.setPrice(info.getDouble("price"));
                p.setDrugCode(info.getString("drugCode"));
                p.setDrugName(info.getString("drugName"));
                p.setDrugRate(info.getString("drugRate"));
                p.setDrugFormat(info.getString("drugFormat"));
                p.setNum(info.getInteger("num"));
                p.setIsRefrigerate(info.getInteger("isRefrigerate"));
                p.setDirection(info.getString("direction"));
                prescriptionInfoDao.save(p);
            }
            //设置处方疾病类型
            prescriptionDiagnosisService.setPrescriptionDiagnosis(code);
            return 1 ;
        }
        return 0;
    }
    public String upload(){
     return null;
    }
}

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

@ -0,0 +1,73 @@
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;
    @Autowired
    private PrescriptionExpressageService prescriptionExpressageService;
    /**
     * 显示居民所有的取药码列表
     * @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();
    }
    /**
     * 确认配送 二维码方式
     * 根据处方code获取处方流程
     *
     * @param code wlyy_prescription_dispensary_code的code
     * @return
     */
    @RequestMapping(value = "/expressage", method = RequestMethod.POST)
    @ApiOperation(value = "确认配送")
    public String expressage(
            @RequestParam(required = true) @ApiParam(value = "wlyy_prescription_dispensary_code的code", name = "code") String code) {
        try {
            Integer status = prescriptionExpressageService.expressage(code, getUID());
            if (status == -1) {
                return error(-1, "编码不存在");
            }
            return write(200, "配送成功");
        } catch (Exception e) {
            return error(-1, "失败");
        }
    }
}

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

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.prescription;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.service.app.prescription.PrescriptionExpressageService;
import com.yihu.wlyy.service.app.prescription.PrescriptionInfoService;
import com.yihu.wlyy.web.BaseController;
@ -20,30 +21,6 @@ public class PrescriptionInfoController extends BaseController{
    @Autowired
    private PrescriptionInfoService prescriptionInfoService;
    @Autowired
    private PrescriptionExpressageService prescriptionExpressageService;
    /**
     * 确认配送 二维码方式
     * 根据处方code获取处方流程
     *
     * @param code wlyy_prescription_dispensary_code的code
     * @return
     */
    @RequestMapping(value = "/expressage", method = RequestMethod.POST)
    @ApiOperation(value = "确认配送")
    public String expressage(
            @RequestParam(required = true) @ApiParam(value = "wlyy_prescription_dispensary_code的code", name = "code") String code) {
        try {
            Integer status = prescriptionExpressageService.expressage(code, getUID());
            if (status == -1) {
                return error(-1, "编码不存在");
            }
            return write(200, "配送成功");
        } catch (Exception e) {
            return error(-1, "失败");
        }
    }
    @RequestMapping(value = "/getPrescriptionFilter", method = RequestMethod.GET)
    @ResponseBody
@ -100,4 +77,19 @@ public class PrescriptionInfoController extends BaseController{
        }
    }
    @RequestMapping(value = "/updatePresInfo", method = RequestMethod.POST)
    @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){
        try {
            return write(200, "操作成功!", "data",prescriptionInfoService.updatePresInfo(code,infos));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
}

+ 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();
    }

+ 3 - 9
patient-co/patient-co-wlyy/src/main/resources/application.yml

@ -101,8 +101,6 @@ server:
im:
  im_list_get: http://172.19.103.88:3000/
  group_server: http://172.19.103.88:3000/api/v1/chats/gm
  msg_push_server: http://172.19.103.88:3000/api/v1/chats/sm
  data_base_name: im_new
wechat:
@ -171,7 +169,9 @@ spring:
      password: jkzlehr@321465
    health:
      url: jdbc:mysql://59.61.92.94:3306/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
#      username: wlyy
#      password: jkzlehr@321465
      username: jkzl_root
      password: jkzlehr@321465
  redis:
@ -185,8 +185,6 @@ server:
im:
  im_list_get: http://120.41.253.95:3000/
  group_server: http://120.41.253.95:3000/api/v1/chats/gm
  msg_push_server: http://120.41.253.95:3000/api/v1/chats/sm
  data_base_name: im
wechat:
@ -269,8 +267,6 @@ server:
im:
  im_list_get: http://172.19.103.88:3000/
  group_server: http://172.19.103.29:3000/api/v1/chats/gm
  msg_push_server: http://172.19.103.29:3000/api/v1/chats/sm
  data_base_name: ichat
wechat:
@ -356,8 +352,6 @@ server:
im:
  im_list_get: http://172.19.103.88:3000/
  group_server: http://172.19.103.88:3000/api/v1/chats/gm
  msg_push_server: http://172.19.103.88:3000/api/v1/chats/sm
  data_base_name: im_new
wechat: