Browse Source

参数修改

chenweida 7 years ago
parent
commit
27eba2f333

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

+ 16 - 1
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;
@ -22,7 +23,6 @@ public class PrescriptionInfoController extends BaseController{
    private PrescriptionInfoService prescriptionInfoService;
    @RequestMapping(value = "/getPrescriptionFilter", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "获取过滤规则信息列表")
@ -78,4 +78,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, "查询失败!");
        }
    }
}