瀏覽代碼

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

huangwenjie 8 年之前
父節點
當前提交
3b197ce142
共有 20 個文件被更改,包括 451 次插入115 次删除
  1. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java
  2. 25 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java
  3. 32 11
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/controller/medicine/PhysicalExaminationController.java
  4. 64 3
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PhysicalExaminationService.java
  5. 1 0
      patient-co-customization/patient-co-modern-medicine/src/main/resources/application.yml
  6. 2 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/SpringSecurityConfig.java
  7. 14 14
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/yueren/YueRenController.java
  8. 5 6
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java
  9. 44 15
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/Prescription.java
  10. 36 8
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java
  11. 16 1
      patient-co-service/wlyy_service/src/main/resources/application.yml
  12. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionPayDao.java
  13. 14 22
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  14. 144 13
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java
  15. 20 11
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  16. 7 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java
  17. 12 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/CommonUtil.java
  18. 6 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java
  19. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java
  20. 4 4
      patient-co/patient-co-wlyy/src/main/resources/application.yml

File diff suppressed because it is too large
+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java


+ 25 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java

@ -84,6 +84,11 @@ public class Prescription extends IdEntity {
    private String jwRateTypeCode;//基卫-费别类型编码
    private String jwRegisterFee; //基卫-诊金
    private String prescribeReason; //开方失败/成功原因
    private Date prescribeTime ;//开方失败、成功时间
    private String dispensaryTypeName; //类型翻译
    @Column(name = "code", unique = true, nullable = false)
    public String getCode() {
        return code;
@ -622,4 +627,24 @@ public class Prescription extends IdEntity {
        }
        return "";
    }
    public String getPrescribeReason() {
        return prescribeReason;
    }
    public void setPrescribeReason(String prescribeReason) {
        this.prescribeReason = prescribeReason;
    }
    public Date getPrescribeTime() {
        return prescribeTime;
    }
    public void setPrescribeTime(Date prescribeTime) {
        this.prescribeTime = prescribeTime;
    }
    public void setDispensaryTypeName(String dispensaryTypeName) {
        this.dispensaryTypeName = dispensaryTypeName;
    }
}

+ 32 - 11
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/controller/medicine/PhysicalExaminationController.java

@ -4,8 +4,11 @@ import com.yihu.mm.controller.BaseController;
import com.yihu.mm.entity.Patient;
import com.yihu.mm.service.PatientService;
import com.yihu.mm.service.PhysicalExaminationService;
import com.yihu.mm.util.HttpClientUtil;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
@ -13,6 +16,9 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
@RestController
@RequestMapping(value = "/medicine/physicalExamination")
public class PhysicalExaminationController extends BaseController {
@ -20,6 +26,9 @@ public class PhysicalExaminationController extends BaseController {
    @Value("${examCode}")
    private String examCode;
    @Value(("${yuerenApi}"))
    private String yuerenApi;
    @Autowired
    private PatientService patientService;
@ -30,28 +39,38 @@ public class PhysicalExaminationController extends BaseController {
    @ApiOperation(value = "获取试卷列表")
    @RequestMapping(value = "/findExames",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String findExames(@ApiParam(name = "tp_type", value = "'问卷类型',(备选值:1,2,4)1:初筛问卷,2:助理问卷,4:现场问卷", required = true)@RequestParam(required = false, name = "tp_type") String tp_type) {
        physicalExaminationService.findExames(tp_type,examCode);
        return null;
    public String findExames(@ApiParam(name = "tp_type", value = "'问卷类型',(备选值:1,2,4)1:初筛问卷,2:助理问卷,4:现场问卷", required = true)@RequestParam(required = false, name = "tp_type") String tp_type,
                             HttpServletRequest req
                             ) {
        HttpSession session = req.getSession();
        String key = (String) session.getAttribute("key");
        if(StringUtils.isBlank(key)){
            key = HttpClientUtil.postBody(yuerenApi + "/phonekey", new JSONObject());
            session.setMaxInactiveInterval(60*60*4);
            session.setAttribute("key",key);
        }
        return physicalExaminationService.findExames(key,tp_type, examCode);
    }
    @ApiOperation(value = "新增预约单/获取咨询编号等信息")
    @RequestMapping(value = "/insertslip",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String insertslip(@ApiParam(name = "patientCode", value = "居民code", required = true)@RequestParam(required = true, name = "patientCode") String patientCode){
    public String insertslip(@ApiParam(name = "patientCode", value = "居民code", required = true)@RequestParam(required = true, name = "patientCode") String patientCode, HttpServletRequest req){
        String key = (String) req.getSession().getAttribute("key");
        Patient patient = patientService.findByCode(patientCode);
        return physicalExaminationService.insertslip(patient);
        return physicalExaminationService.insertslip(key,patient);
    }
    @ApiOperation(value = "获取试题")
    @RequestMapping(value = "/findExames",produces="application/json;charset=UTF-8")
    @RequestMapping(value = "/findQuestion",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String findQuestion(@ApiParam(name = "tp_id", value = "试卷id", required = true)@RequestParam(required = false, name = "tp_id") String tp_id,
                               @ApiParam(name = "pb_id", value = "问卷编号,第一题为0", required = true)@RequestParam(required = false, name = "pb_id") String pb_id,
                               @ApiParam(name = "pb_id", value = "咨询编号", required = true)@RequestParam(required = false, name = "pb_id") String ct_id){
        return null;
                               @ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = false, name = "ct_id") String ct_id,
                               HttpServletRequest req){
        String key = (String) req.getSession().getAttribute("key");
        return physicalExaminationService.findQuestion(key,tp_id,pb_id,ct_id);
    }
    @ApiOperation(value = "提交试卷答案")
@ -60,9 +79,11 @@ public class PhysicalExaminationController extends BaseController {
    public String handleExam(@ApiParam(name = "tp_id", value = "试卷id", required = true)@RequestParam(required = true, name = "tp_id") String tp_id,
                               @ApiParam(name = "pb_id", value = "问卷编号,第一题为0", required = true)@RequestParam(required = true, name = "pb_id") String pb_id,
                               @ApiParam(name = "dc_answer", value = "问题答案", required = true)@RequestParam(required = true, name = "dc_answer") String dc_answer,
                             @ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id){
                             @ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id,
                            HttpServletRequest req){
        String key = (String) req.getSession().getAttribute("key");
        return physicalExaminationService.handleExam(key,tp_id,pb_id,dc_answer,ct_id);
        return null;
    }
    @ApiOperation(value = "四诊资料采集")

+ 64 - 3
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PhysicalExaminationService.java

@ -1,20 +1,81 @@
package com.yihu.mm.service;
import com.yihu.mm.entity.Patient;
import com.yihu.mm.util.HttpClientUtil;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
@Service
public class PhysicalExaminationService {
    @Value(("${yuerenApi}"))
    private String yuerenApi;
    public String findExames(String key,String type, String examCode) {
        //先获取key值
        JSONObject params = new JSONObject();
        params.put("key",key);
        params.put("tp_type", type);
        params.put("sh_id", examCode);
        return HttpClientUtil.postBody(yuerenApi + "/findtest", params);
    public void findExames(String type, String examCode) {
    }
    public String insertslip(String key,Patient patient) {
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        JSONObject params = new JSONObject();
        params.put("key", key);
        params.put("sl_date", sdf.format(date));
        params.put("sl_state", "未签到");
        params.put("u_tel", patient.getMobile());
        params.put("u_name", patient.getName());
        Integer sex = patient.getSex();
        String sexStr = "";
        if(sex==1){
            sexStr="男";
        }else if(sex==2){
            sexStr="女";
        }
        params.put("u_sex",sexStr );
        //todo    sh_id 需要从数据库获取   wlyy_medicine_strores_no
        params.put("sh_id", "");
        params.put("u_idnum", patient.getIdcard());
        //params.put("u_native", u_native);//籍贯
        params.put("u_birthday", patient.getBirthday());
        params.put("u_province", patient.getProvinceName());
        params.put("u_city", patient.getCityName());
        params.put("u_area", patient.getTownName());
        params.put("u_address", patient.getAddress());
        //params.put("sl_pass", );//报告单是否审核通过
        return HttpClientUtil.postBody(yuerenApi + "/findtest", params);
    }
    public String insertslip(Patient patient) {
    public String findQuestion(String key, String tp_id, String pb_id, String ct_id) {
        JSONObject params = new JSONObject();
        params.put("key", key);
        params.put("ct_id", ct_id);
        params.put("tp_id", tp_id);
        params.put("pb_id", pb_id);
        String postStr = HttpClientUtil.postBody("/yueren/giveproblem", params);
        return postStr;
    }
    public String handleExam(String key, String tp_id, String pb_id, String dc_answer, String ct_id) {
        return null;
        JSONObject params = new JSONObject();
        params.put("key", key);
        params.put("ct_id", ct_id);
        params.put("tp_id", tp_id);
        params.put("pb_id", pb_id);
        params.put("dc_answer", dc_answer);
        return HttpClientUtil.postBody("/yueren/handleproblem", params);
    }
}

+ 1 - 0
patient-co-customization/patient-co-modern-medicine/src/main/resources/application.yml

@ -2,6 +2,7 @@ server:
  port: 8080
examCode:         #越人试卷题目code
yuerenApi: http://192.168.131.123:8180/wlyy_admin/yueren       #越人api调用地址
security:
  basic:

+ 2 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/SpringSecurityConfig.java

@ -28,6 +28,7 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
                "/**.jsp",
                "/common/**",
                "/login/**",
                "/yueren/**",
                "/admin/hos/doctor/importFromExcel",
                "/admin/hos/doctor/importData",
                "/admin/team/importData",
@ -46,7 +47,7 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
                .authorizeRequests()
                .accessDecisionManager(accessDecisionManager())
                .expressionHandler(webSecurityExpressionHandler())
//                .antMatchers("/login").permitAll()
                .antMatchers("/yueren/**").permitAll()
//                .antMatchers("/admin/main").permitAll()
//                .antMatchers("/login/**").permitAll()
//                .antMatchers("/admin/**").authenticated()

+ 14 - 14
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/yueren/YueRenController.java

@ -12,8 +12,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Map;
/**
 * Created by Administrator on 2017/8/14.
@ -33,7 +31,7 @@ public class YueRenController extends BaseController {
     * 获取每个接口需要传递的key值
     * @return
     */
    @RequestMapping(value = "/phonekey", method = RequestMethod.POST)
    @RequestMapping(value = "/phonekey", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String getPhoneKey() {
        String postStr = remoteCall("/yueren/phonekey", new JSONObject());
@ -66,7 +64,7 @@ public class YueRenController extends BaseController {
     * @param sl_pass 报告单是否审核通过
     * @return
     */
    @RequestMapping(value = "insertslip", method = RequestMethod.POST)
    @RequestMapping(value = "insertslip", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String insertSlip(String key, String sl_date,String sl_state,String u_tel, String u_name, String u_sex,
                             String sh_id, String u_idnum, String u_native, String u_birthday, String u_province,
@ -98,7 +96,7 @@ public class YueRenController extends BaseController {
     * @param file 附件
     * @return
     */
    @RequestMapping(value = "/uploadattachment", method = RequestMethod.POST)
    @RequestMapping(value = "/uploadattachment", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String uploadAttachment(String file, String e_no) {
        JSONObject params = new JSONObject();
@ -117,7 +115,7 @@ public class YueRenController extends BaseController {
     * @param object_type 对象类型,备选数值(1,2,3)1脸型,2舌像,3录音
     * @return
     */
    @RequestMapping(value = "dillphoneimgdata", method = RequestMethod.POST)
    @RequestMapping(value = "dillphoneimgdata", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String inserTemp(String key, String at_id, String answer, String answer_type, String ct_id, String object_type) {
        JSONObject params = new JSONObject();
@ -140,9 +138,11 @@ public class YueRenController extends BaseController {
     * @param sh_id 所属门店编号
     * @return
     */
    @RequestMapping(value = "findtest", method = RequestMethod.POST)
    @RequestMapping(value = "findtest", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String findTest(String key, String tp_type, String sh_id) {
        String key1 = request.getParameter("key");
        System.out.println(key1);
        JSONObject params = new JSONObject();
        params.put("key", key);
        params.put("tp_type", tp_type);
@ -159,7 +159,7 @@ public class YueRenController extends BaseController {
     * @param pb_id 问题编号
     * @return
     */
    @RequestMapping(value = "giveproblem", method = RequestMethod.POST)
    @RequestMapping(value = "giveproblem", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String giveproblem(String key,String ct_id, String tp_id, String pb_id) {
        JSONObject params = new JSONObject();
@ -180,7 +180,7 @@ public class YueRenController extends BaseController {
     * @param dc_answer 答案数组
     * @return 将用户提交的试卷题目的答案进行保存
     */
    @RequestMapping(value = "handleproblem", method = RequestMethod.POST)
    @RequestMapping(value = "handleproblem", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String handleproblem(String key, String ct_id, String tp_id,String pb_id, String[] dc_answer) {
        JSONObject params = new JSONObject();
@ -199,7 +199,7 @@ public class YueRenController extends BaseController {
     * @param ct_id 咨询编号
     * @return
     */
    @RequestMapping(value = "centralizedproblem", method = RequestMethod.POST)
    @RequestMapping(value = "centralizedproblem", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String centralizedproblem(String key, String ct_id) {
        JSONObject params = new JSONObject();
@ -215,7 +215,7 @@ public class YueRenController extends BaseController {
     * @param ct_id 咨询编号
     * @return
     */
    @RequestMapping(value = "conclusionfactor", method = RequestMethod.POST)
    @RequestMapping(value = "conclusionfactor", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String conclusionFactor(String key, String ct_id) {
        JSONObject params = new JSONObject();
@ -233,7 +233,7 @@ public class YueRenController extends BaseController {
     * @param ct_id 咨询编号
     * @return
     */
    @RequestMapping(value = "insertconconhealth", method = RequestMethod.POST)
    @RequestMapping(value = "insertconconhealth", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String insertConsultConclusionHealth(String key, String ct_id) {
        JSONObject params = new JSONObject();
@ -250,7 +250,7 @@ public class YueRenController extends BaseController {
     * @param reqtype 请求类型(备选数值1)
     * @return
     */
    @RequestMapping(value = "findconconhealth", method = RequestMethod.POST)
    @RequestMapping(value = "findconconhealth", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String insertConsultConclusion(String key, String ct_id, String reqtype) {
        JSONObject params = new JSONObject();
@ -267,7 +267,7 @@ public class YueRenController extends BaseController {
     * @param ct_id 咨询编号
     * @return
     */
    @RequestMapping(value = "findintegral", method = RequestMethod.POST)
    @RequestMapping(value = "findintegral", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String findIntegral(String key, String ct_id) {
        JSONObject params = new JSONObject();

File diff suppressed because it is too large
+ 5 - 6
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java


+ 44 - 15
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/Prescription.java

@ -82,6 +82,10 @@ public class Prescription extends IdEntity {
    private String jwDoctorCode; //基卫-开方医生的编码
    private String jwGisterTypeCode;//基卫-挂号类型编码
    private String jwRateTypeCode;//基卫-费别类型编码
    private String jwRegisterFee; //基卫-诊金
    private String prescribeReason; //开方失败/成功原因
    private Date prescribeTime ;//开方失败、成功时间
    @Column(name = "code", unique = true, nullable = false)
    public String getCode() {
@ -348,21 +352,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 +601,44 @@ public class Prescription extends IdEntity {
    public void setJwHospital(String jwHospital) {
        this.jwHospital = jwHospital;
    }
    public String getJwRegisterFee() {
        return jwRegisterFee;
    }
    public void setJwRegisterFee(String jwRegisterFee) {
        this.jwRegisterFee = jwRegisterFee;
    }
    @Transient
    public String getDispensaryTypeName() {
        switch (dispensaryType) {
            case 1: {
                return "自取";
            }
            case 2: {
                return "快递配送";
            }
            case 3: {
                return "健管师配送";
            }
        }
        return "";
    }
    public String getPrescribeReason() {
        return prescribeReason;
    }
    public void setPrescribeReason(String prescribeReason) {
        this.prescribeReason = prescribeReason;
    }
    public Date getPrescribeTime() {
        return prescribeTime;
    }
    public void setPrescribeTime(Date prescribeTime) {
        this.prescribeTime = prescribeTime;
    }
}

File diff suppressed because it is too large
+ 36 - 8
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java


+ 16 - 1
patient-co-service/wlyy_service/src/main/resources/application.yml

@ -57,7 +57,7 @@ redisChannel:
---
spring:
  profiles: dev
  profiles: dev1
  datasource:
    url: jdbc:mysql://172.19.103.77:3306/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: root
@ -71,6 +71,21 @@ spring:
    port: 6379 # Redis server port.
#    password: jkzl_ehr
---
spring:
  profiles: dev
  datasource:
    url: jdbc:mysql://172.19.103.85:3306/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: linzhou
    password: linzhou
    driverClassName: com.mysql.jdbc.Driver
    maxTotal: 500
    maxIdle: 30
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
#    password: jkzl_ehr
---
spring:
  profiles: test

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionPayDao.java

@ -17,6 +17,6 @@ public interface PrescriptionPayDao extends PagingAndSortingRepository<Prescript
    PrescriptionPay findByPrescriptionPay(String prescriptionCode);
    //查询支付记录
    @Query("from PrescriptionPay p where p.prescriptionCode=?1 ")
    PrescriptionPay findByCode(String prescriptionCode);
    @Query("from PrescriptionPay p where p.code=?1 ")
    PrescriptionPay findByCode(String code);
}

+ 14 - 22
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -38,10 +38,7 @@ import com.yihu.wlyy.service.app.talk.TalkGroupService;
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
import com.yihu.wlyy.service.third.jw.ZyDictService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.ImUtill;
import com.yihu.wlyy.util.MessageType;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.apache.commons.lang3.StringUtils;
@ -64,11 +61,14 @@ import org.springside.modules.persistence.DynamicSpecifications;
import org.springside.modules.persistence.SearchFilter;
import org.springside.modules.persistence.SearchFilter.Operator;
import org.springside.modules.utils.Clock;
import com.yihu.wlyy.util.CommonUtil;
import javax.annotation.PostConstruct;
import java.text.SimpleDateFormat;
import java.util.*;
/**
 * 網絡諮詢类.
 * test
@ -961,7 +961,8 @@ public class ConsultTeamService extends ConsultService {
            JSONObject messages = ImUtill.getCreateTopicMessage(patient, p.getName(), consult.getTitle(), content, consult.getImages(),agent);
            //5、(im创建咨询) 续方咨询的sessionid为居民code+续方code+咨询类型
            JSONObject obj = ImUtill.createTopics(patient + "_" + consult.getCode() + "_" + ct.getType(), consult.getCode(), p.getName(), users, messages, ImUtill.SESSION_TYPE_PRESCRIPTION);
            String sessionId = patient + "_" + consult.getCode() + "_" + ct.getType();
            JSONObject obj = ImUtill.createTopics(sessionId, consult.getCode(), p.getName(), users, messages, ImUtill.SESSION_TYPE_PRESCRIPTION);
            if (obj == null) {
                throw new RuntimeException("IM消息发送异常!");
            }
@ -985,7 +986,7 @@ public class ConsultTeamService extends ConsultService {
            consultTeamDoctorDao.save(cd);
            //7、发送系统消息提示团队长有未审核的消息
            addCheckMessage(prescription);
            addCheckMessage(prescription,sessionId);
            //8、 保存医生咨询信息
            // 添加咨询转发记录
@ -1000,7 +1001,7 @@ public class ConsultTeamService extends ConsultService {
     * 保存审核提醒消息
     * @param prescription
     */
    public void addCheckMessage(Prescription prescription){
    public void addCheckMessage(Prescription prescription,String sessionId){
        Message message = new Message();
        message.setCzrq(new Date());
        message.setCreateTime(new Date());
@ -1017,6 +1018,8 @@ public class ConsultTeamService extends ConsultService {
        message.setDel("1");
        message.setRelationCode(prescription.getConsult());
        message.setPrescriptionStatus("0");
        message.setSessionId(sessionId);
        message.setSessionName(prescription.getPatientName());
        messageDao.save(message);
    }
@ -1076,14 +1079,14 @@ public class ConsultTeamService extends ConsultService {
            prescriptionInfo.setDrugName(info.getString("drugName"));//药品名称
            prescriptionInfo.setDrugRate(info.getString("drugRate"));//吃药频率
            prescriptionInfo.setDrugFormat(info.getString("drugFormat"));//药品规格
            prescriptionInfo.setNum(doubleToInt(info.getDouble("num")));//药品数目
            prescriptionInfo.setPrice(doubleToInt(info.getDouble("price")));//药品单价
            prescriptionInfo.setNum(CommonUtil.doubleToInt(info.getDouble("num")));//药品数目
            prescriptionInfo.setPrice(CommonUtil.doubleToInt(info.getDouble("price")));//药品单价
            prescriptionInfo.setIsRefrigerate(0);//是否冷藏 1是 0否
            prescriptionInfo.setJwSubCode("");//智业子处方号
            prescriptionInfo.setDrugNumUnit(info.getString("drugNumUnit"));//数量单位编码
            prescriptionInfo.setDrugNumUnitName(info.getString("drugNumUnitName"));//数量单位名称
            prescriptionInfo.setCost(doubleToInt(info.getDouble("cost")));//金额
            prescriptionInfo.setCharge(doubleToInt(info.getDouble("charge")));//自付
            prescriptionInfo.setCost(CommonUtil.doubleToInt(info.getDouble("cost")));//金额
            prescriptionInfo.setCharge(CommonUtil.doubleToInt(info.getDouble("charge")));//自付
            prescriptionInfo.setBindFlag(info.getString("bindFlag"));//成组标志, 0.非成组,1.成组
            prescriptionInfo.setDayCount(info.getInteger("dayCount"));//用药天数
            prescriptionInfo.setDrugUsage(info.getString("drugUsage"));//用药方法编码
@ -1134,17 +1137,6 @@ public class ConsultTeamService extends ConsultService {
    }
    /**
     * double*100转int
     * @param d
     * @return
     */
    private Integer doubleToInt(Double d){
        if(d==null){
            return 0;
        }
        return new Double(d*100).intValue();
    }
    /**
     * 发送消息给IM

File diff suppressed because it is too large
+ 144 - 13
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java


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

@ -83,9 +83,9 @@ public class PrescriptionInfoService extends BaseService {
    private StringRedisTemplate redisTemplate;
    @Autowired
    private PresModeAdapter presModeAdapter;
    //健康问题 高血压
    private static final String gxy = "HP0093";
    //健康问题 糖尿病
    private static final String tnb ="HP0047";
    private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class);
@ -355,14 +355,15 @@ public class PrescriptionInfoService extends BaseService {
        return 1;
    }
    public void upLoadPrescriotionState(String state,Prescription p,PrescriptionReviewed reviewed)throws Exception{
        //审核通过
    public int upLoadPrescriotionState(String state,Prescription p,PrescriptionReviewed reviewed)throws Exception{
        //医生审核通过,发起开方及预结算
        if("1".equals(state)){
            String rs =  jwPrescriptionService.saveRecipe(p.getCode());
            com.alibaba.fastjson.JSONObject respone = com.alibaba.fastjson.JSONObject.parseObject(rs);
            int st = respone.getInteger("status");
            com.alibaba.fastjson.JSONObject data = respone.getJSONObject("data");
            String code = data.getString("CODE");
            com.alibaba.fastjson.JSONObject byRefParaData = (com.alibaba.fastjson.JSONObject)data.getJSONObject("byRefParaData");
            if(st==200&&"1".equals(code)&&data.getJSONArray("returnData").size()>0){
                //开方成功返回遗嘱号
                com.alibaba.fastjson.JSONArray returnDatas = data.getJSONArray("returnData");
@ -370,13 +371,16 @@ public class PrescriptionInfoService extends BaseService {
                p.setVisitNo(returnData.getString("VISIT_NO"));
                p.setRecipeNo(returnData.getString("RECIPE_NO"));
                prescriptionDao.save(p);
                return 1;
            }else{
                p.setStatus(PrescriptionLog.PrescriptionLogStatus.add_error.getValue());
                reviewed.setStatus(-1);
                p.setPrescribeReason((String)byRefParaData.get("errorMsg"));
                p.setPrescribeTime(new Date());
                prescriptionDao.save(p);
                prescriptionReviewedDao.save(reviewed);
                return 0;
            }
        }
        return 0;
    }
    public JSONArray getDoctorPrescription(Integer teamCode,String state,String diseases,String startDate,String endDate,String nameKeyword,String patient,Integer page,Integer size){
@ -534,9 +538,7 @@ public class PrescriptionInfoService extends BaseService {
            prescriptionLogDao.save(log);
            //同步智业接口,前往开方
            upLoadPrescriotionState(state,p,reviewed);
            return 1;
            return upLoadPrescriotionState(state,p,reviewed);
        }
        return 0;
@ -1075,8 +1077,15 @@ public class PrescriptionInfoService extends BaseService {
     * @return
     */
   public JSONArray getRegisterRee(String jwHospital,String jwDoctorCode){
        StringBuffer sql = new StringBuffer(" SELECT t.register_fee AS registerFee,t.register_type AS t.registerType,t.register_type_name AS registerTypeName FROM zy_iv_staff_reg_type_allot_dict t " +
                " WHERE t.org_code =? AND t.staff_code =? ");
       StringBuffer sql = new StringBuffer("SELECT " +
               " t.register_fee AS registerFee," +
               " t.register_type AS registerType," +
               " t.register_type_name AS registerTypeName " +
               " FROM" +
               " zy_iv_staff_reg_type_allot_dict t" +
               " WHERE" +
               " t.org_code =? " +
               " AND t.staff_code =?");
       List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql.toString(),new Object[]{jwHospital,jwDoctorCode});
       return new JSONArray(rs);
   }

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

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.doctor.DoctorMapping;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeam;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
@ -11,6 +12,7 @@ import com.yihu.wlyy.entity.patient.prescription.PrescriptionDiagnosis;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExpressage;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
import com.yihu.wlyy.repository.doctor.DoctorMappingDao;
import com.yihu.wlyy.repository.doctor.DoctorTeamDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
@ -61,6 +63,8 @@ public class PrescriptionService extends BaseService {
    private String wechat_base_url;
    @Autowired
    private PrescriptionDispensaryCodeDao prescriptionDispensaryCodeDao;
    @Autowired
    private DoctorTeamDao doctorTeamDao;
    /**
@ -117,6 +121,9 @@ public class PrescriptionService extends BaseService {
                    message.setDel("1");
                    message.setRelationCode(prescription.getCode());
                    message.setPrescriptionStatus("0");//待取药
                    //获取居民团队code
                    DoctorTeam dt = doctorTeamDao.findByParientCode(prescription.getPatient());
                    message.setData(dt.getCode());
                    messageDao.save(message);
                    pushMsgTask.put(expressage.getExpressageCode(), MessageType.MESSAGE_TYPE_PRESCRIPTION_WAIT_TAKE_DRUG.D_P_WRD.name(), MessageType.MESSAGE_TYPE_PRESCRIPTION_WAIT_TAKE_DRUG.续方消息.name(), content, prescription.getCode());

+ 12 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/CommonUtil.java

@ -118,6 +118,18 @@ public class CommonUtil {
        return fileUrls;
    }
    /**
     * double*100转int
     * @param d
     * @return
     */
    public static Integer doubleToInt(Double d){
        if(d==null){
            return 0;
        }
        return new Double(d*100).intValue();
    }
    /**
     * 校验健康指标是否正常
     *

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

@ -97,7 +97,12 @@ public class PrescriptionInfoController extends BaseController{
                                     @RequestParam(required = false)@ApiParam(value = "诊金", name = "registerFee")String registerFee,
                                     @RequestParam(required = false)@ApiParam(value = "诊金类型", name = "rateTypeCode")String rateTypeCode){
        try {
            return write(200, "查询成功!", "data",prescriptionInfoService.reviewPrescription(code,reason,state,dept,registerFee,rateTypeCode));
            int rs = prescriptionInfoService.reviewPrescription(code,reason,state,dept,registerFee,rateTypeCode);
            if(rs==0){
                return write(200, "开方失败!", "data",rs);
            }else{
                return write(200, "成功提交开方", "data",rs);
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");

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

@ -96,8 +96,8 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
    public String chargeQuery(@RequestParam(required = true) @ApiParam(value = "支付应用流水号", name = "outChargeNo") String outChargeNo) throws Exception {
        try {
            String accessToken = getAccessToken();
            payService.chargeQuery(outChargeNo, accessToken);
            return write(200, "获取成功!");
            String result = payService.chargeQuery(outChargeNo, accessToken);
            return write(200, "获取成功!","data",result);
        } catch (Exception e) {
            return error(-1, "获取失败!");
        }

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

@ -138,7 +138,7 @@ wechat:
   #问卷调查
   template_doctor_survey:  OqQXrb-e43_TJpq_70_K_y6vYJgY5mpjFYY4c5RWFP4
   #审核结果通知
   template_doctor_audit:  OFyLUeBW3r9trWw-i6pbB1sPSTD4J2recCv_mc-gKxA
   template_doctor_audit:  lCtOgJgL1tBJbAytqN7cn-FgCH_Usg99FENEy2TrC08
   #服务结果通知
   template_doctor_service:  i34rq3xFLnpf_VN2Jor9n2YlQqJMM7oXyYvuctriISw
@ -237,9 +237,9 @@ wechat:
   #问卷调查
   template_doctor_survey:  8ZWKJmoJ7VR7Uk4YS7aa0Z94QzCkxsyTW6R4CHhUJII
   #审核结果通知
   template_doctor_audit:  OFyLUeBW3r9trWw-i6pbB1sPSTD4J2recCv_mc-gKxA
   template_doctor_audit:  egrX5Larpkv8opQW67_hwsZoT0OHwwUpE1v7HeU_Jnw
   #服务结果通知
   template_doctor_service:  i34rq3xFLnpf_VN2Jor9n2YlQqJMM7oXyYvuctriISw
   template_doctor_service:  xhi1LEudiZwJfZylOHuZNo8EiA73GtSshPQv5XOt9Lk
yihu:
@ -436,7 +436,7 @@ wechat:
    #问卷调查
    template_doctor_survey:  OqQXrb-e43_TJpq_70_K_y6vYJgY5mpjFYY4c5RWFP4
    #审核结果通知
    template_doctor_audit:  OFyLUeBW3r9trWw-i6pbB1sPSTD4J2recCv_mc-gKxA
    template_doctor_audit:  lCtOgJgL1tBJbAytqN7cn-FgCH_Usg99FENEy2TrC08
    #服务结果通知
    template_doctor_service: i34rq3xFLnpf_VN2Jor9n2YlQqJMM7oXyYvuctriISw