Przeglądaj źródła

长处方新建路径

liuwenbin 7 lat temu
rodzic
commit
8dd2831564
18 zmienionych plików z 286 dodań i 82 usunięć
  1. 3 19
      patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java
  2. 0 11
      patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionDispensaryCode.java
  3. 38 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionLog.java
  4. 2 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/PatientInterceptor.java
  5. 1 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorAdminTeamDao.java
  6. 5 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionDao.java
  7. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionDispensaryCodeDao.java
  8. 23 13
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java
  9. 59 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java
  10. 23 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  11. 1 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  12. 26 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwSmjkService.java
  13. 26 4
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/WlyySerivceController.java
  14. 43 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java
  15. 15 18
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java
  16. 16 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionInfoController.java
  17. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PrescriptionLogController.java
  18. 2 2
      patient-co-wlyy/src/main/webapp/WEB-INF/spring-mvc.xml

+ 3 - 19
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java

@ -28,7 +28,7 @@ public class Prescription extends IdEntity {
    private String patient;                  //关联 wlyy_patient code
    private String patient;                  //关联 wlyy_patient code
    private String patientName;             //患者名称
    private String patientName;             //患者名称
    private Integer type;                    //1 处方 2 续方
    private Integer type;                    //1 处方 2 续方
    private Integer status;                  //状态 (1 审核不通过 , 0 审核中, 10 待支付 , 20 配药中, 21 等待领药 ,30 配送中 ,100已完成)
    private Integer status;                  //状态 (-1 审核不通过 , 0 审核中, 10 审核通过/待支付 ,21支付失败  20 配药中/支付成功, 21 等待领药 ,30 配送中 ,100配送成功/已完成)
    private String doctor;                   //开处方的医生code 关联 wlyy_doctor
    private String doctor;                   //开处方的医生code 关联 wlyy_doctor
    private String doctorName;               //医生名称
    private String doctorName;               //医生名称
    private Long adminTeamId;             //患者签约的行政团队
    private Long adminTeamId;             //患者签约的行政团队
@ -48,8 +48,8 @@ public class Prescription extends IdEntity {
    private String caMessage;                   //ca指纹信息
    private String caMessage;                   //ca指纹信息
    private String remark;                     //处方备注
    private String remark;                     //处方备注
    private String reason;                      //续方原因
    private String reason;                      //续方原因
    private Double ybCost;                      //医保费用
    private Double myCost;                      //自己付费
//    private Double ybCost;                      //医保费用
//    private Double myCost;                      //自己付费
    @Column(name = "code", unique = true, nullable = false)
    @Column(name = "code", unique = true, nullable = false)
    public String getCode() {
    public String getCode() {
@ -307,20 +307,4 @@ public class Prescription extends IdEntity {
    public void setCaCertData(String caCertData) {
    public void setCaCertData(String caCertData) {
        this.caCertData = caCertData;
        this.caCertData = caCertData;
    }
    }
    public Double getYbCost() {
        return ybCost;
    }
    public void setYbCost(Double ybCost) {
        this.ybCost = ybCost;
    }
    public Double getMyCost() {
        return myCost;
    }
    public void setMyCost(Double myCost) {
        this.myCost = myCost;
    }
}
}

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

@ -19,7 +19,6 @@ public class PrescriptionDispensaryCode extends IdEntity{
    private String code;                    //年月日8位数字+6位随机数字
    private String code;                    //年月日8位数字+6位随机数字
    private String prescriptionCode;      //处方code  关联表wlyy_prescription code
    private String prescriptionCode;      //处方code  关联表wlyy_prescription code
    private Date createTime;               //创建时间
    private Date createTime;               //创建时间
//    private Date outTime;                  //过期时间
    private Integer type;                   //编码类型:1 居民取药码 2 配送员(健管师)取药码
    private Integer type;                   //编码类型:1 居民取药码 2 配送员(健管师)取药码
    private String imgUrl;                  //图片存在FastFDS的路径
    private String imgUrl;                  //图片存在FastFDS的路径
@ -51,16 +50,6 @@ public class PrescriptionDispensaryCode extends IdEntity{
        this.createTime = createTime;
        this.createTime = createTime;
    }
    }
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
//    @Column(name = "out_time")
//    public Date getOutTime() {
//        return outTime;
//    }
//
//    public void setOutTime(Date outTime) {
//        this.outTime = outTime;
//    }
    public Integer getType() {
    public Integer getType() {
        return type;
        return type;
    }
    }

+ 38 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionLog.java

@ -14,17 +14,29 @@ import java.util.Date;
 */
 */
@Entity
@Entity
@Table(name = "wlyy_prescription_log")
@Table(name = "wlyy_prescription_log")
public class PrescriptionLog extends IdEntity{
public class PrescriptionLog extends IdEntity {
    public final static class PrescriptionLogType {
        static public Integer zy = 1; //智业对接
        static public Integer ylz = 2;  //易联众对接
        static public Integer create = 3;   //创建处方
        static public Integer reviewed  = 4;    //审核
        static public Integer pay = 5;  //支付
        static public Integer expressage = 6;   //配送
        static public Integer finish = 7;   //已完成
    }
    private String code;                    //业务流程
    private String code;                    //业务流程
    private String prescriptionCode;      //处方code 关联表wlyy_prescription code
    private String prescriptionCode;      //处方code 关联表wlyy_prescription code
    private Date createTime;               //处方创建时间
    private Date createTime;               //处方创建时间
    private Integer type;                    //-1与智业对接的日志   11 创建处方  12 审核成功 13 审核失败 20等待付款 21 付款成功 22付款失败  30等待配药 31配药成功 40开始配送 41配送员已领药 42配送员送达  100处方完成
    private Integer status;                  //状态 (-1 审核不通过 , 0 审核中, 10 审核通过/待支付 ,21支付失败  20 配药中/支付成功, 21 等待领药 ,30 配送中 ,100配送成功/已完成)
    private Integer type;                //类型: 1智业对接 2易联众对接  3创建处方 4 审核  5付款 6 配送 7完成
    private String userCode;                  //医生或者患者code
    private String userCode;                  //医生或者患者code
    private String userName;                  //医生或者患者name
    private String userName;                  //医生或者患者name
    private Integer userType;                 //1 患者 2医生
    private Integer userType;                 //1 患者 2医生
    private Integer flag;                      //操作是否成功 1成功 0失败
    private Integer flag;                      //操作是否成功 1成功 0失败
    private String remark;                     //备注信息
    private String remark;                     //备注信息
    private String hospital;//医院code
    private String hospitalName;//医院名称
    @Column(name = "code")
    @Column(name = "code")
    public String getCode() {
    public String getCode() {
@ -107,4 +119,28 @@ public class PrescriptionLog extends IdEntity{
    public void setRemark(String remark) {
    public void setRemark(String remark) {
        this.remark = remark;
        this.remark = remark;
    }
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
}
}

+ 2 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/PatientInterceptor.java

@ -26,7 +26,7 @@ public class PatientInterceptor extends BaseInterceptor {
	@Override
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
		boolean flag = true;
		boolean flag = true;
		/*try {
		try {
			request.setCharacterEncoding("UTF-8");
			request.setCharacterEncoding("UTF-8");
			request.setAttribute("log-start", new Date().getTime());
			request.setAttribute("log-start", new Date().getTime());
			if(request.getRequestURI().contains("/patient/hosptail/getHositalByTownCode")||request.getRequestURI().contains("/patient/feedback/saveAppeal")){
			if(request.getRequestURI().contains("/patient/hosptail/getHositalByTownCode")||request.getRequestURI().contains("/patient/feedback/saveAppeal")){
@ -90,7 +90,7 @@ public class PatientInterceptor extends BaseInterceptor {
			}
			}
		} catch (Exception e) {
		} catch (Exception e) {
			e.printStackTrace();
			e.printStackTrace();
		}*/
		}
		return flag;
		return flag;
	}
	}

+ 1 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorAdminTeamDao.java

@ -84,12 +84,10 @@ public interface DoctorAdminTeamDao extends
    @Query("SELECT t.id from AdminTeam t WHERE t.leaderCode = :leaderCode AND t.available = true")
    @Query("SELECT t.id from AdminTeam t WHERE t.leaderCode = :leaderCode AND t.available = true")
    Long findIdByLeaderCode(@Param("leaderCode") String leaderCode);
    Long findIdByLeaderCode(@Param("leaderCode") String leaderCode);
    @Query(" from AdminTeam t")
    List<AdminTeam> findAllTeam();
    @Query("SELECT t from AdminTeam t WHERE t.leaderCode = :leaderCode AND t.available = true")
    @Query("SELECT t from AdminTeam t WHERE t.leaderCode = :leaderCode AND t.available = true")
    AdminTeam findByLeaderCode(@Param("leaderCode") String leaderCode);
    AdminTeam findByLeaderCode(@Param("leaderCode") String leaderCode);
    @Query("from AdminTeam t WHERE t.available = true  AND t.orgCode = ?1 ")
    List<AdminTeam> findByOrgCode(String orgCode);
    List<AdminTeam> findByOrgCode(String orgCode);
    //  查询当前医生是否为团队长
    //  查询当前医生是否为团队长

+ 5 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionDao.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.repository.prescription;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -14,4 +15,8 @@ import java.util.List;
public interface PrescriptionDao extends PagingAndSortingRepository<Prescription, Long>, JpaSpecificationExecutor<Prescription> {
public interface PrescriptionDao extends PagingAndSortingRepository<Prescription, Long>, JpaSpecificationExecutor<Prescription> {
    @Query("from Prescription p where p.code=?1")
    @Query("from Prescription p where p.code=?1")
    Prescription findByCode(String prescriptionCode);
    Prescription findByCode(String prescriptionCode);
    @Modifying
    @Query("update Prescription p set p.status=?2 where p.code=?1")
    void updateStatus(String prescriptionCode,Integer status);
}
}

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

@ -14,6 +14,8 @@ import java.util.List;
 * 处方取码
 * 处方取码
 */
 */
public interface PrescriptionDispensaryCodeDao extends PagingAndSortingRepository<PrescriptionDispensaryCode, Long>, JpaSpecificationExecutor<PrescriptionDispensaryCode> {
public interface PrescriptionDispensaryCodeDao extends PagingAndSortingRepository<PrescriptionDispensaryCode, Long>, JpaSpecificationExecutor<PrescriptionDispensaryCode> {
    @Query("from PrescriptionDispensaryCode where code=?1")
    PrescriptionDispensaryCode finByCode(String code);
//    @Query("select  count(1) from wlyy_prescription_dispensary_code p1 \n" +
//    @Query("select  count(1) from wlyy_prescription_dispensary_code p1 \n" +
//            "LEFT JOIN wlyy_prescription p2 on p1.prescription_Code = p2.code where p2.status in(21,20,100) and p2.patient =?1 ")
//            "LEFT JOIN wlyy_prescription p2 on p1.prescription_Code = p2.code where p2.status in(21,20,100) and p2.patient =?1 ")

+ 23 - 13
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -710,11 +710,12 @@ public class SignPatientLabelInfoService extends BaseService {
                    Calendar today = Calendar.getInstance();
                    Calendar today = Calendar.getInstance();
                    Calendar startDate = Calendar.getInstance();
                    Calendar startDate = Calendar.getInstance();
                    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
                    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
                    sql = "select count(DISTINCT patient) count" +
                    sql = "select count(DISTINCT t1.patient) count" +
                            " from " +
                            " from " +
                            "     wlyy_sign_family " +
                            " where (doctor = ? or doctor_health = ?) and status > 0 " +
                            (teamCode > 0 ? " and admin_team_code = ? " : "");
                            "     wlyy_sign_family t1," +
                            "     wlyy_patient t3 " +
                            " where t1.patient = t3.code AND (t1.doctor = ? or t1.doctor_health = ?) and t1.status > 0 " +
                            (teamCode > 0 ? " and t1.admin_team_code = ? " : "");
                    if (label.getLabelCode().equals("1")) {
                    if (label.getLabelCode().equals("1")) {
                        int week = today.get(Calendar.DAY_OF_WEEK) - 2;
                        int week = today.get(Calendar.DAY_OF_WEEK) - 2;
@ -745,12 +746,14 @@ public class SignPatientLabelInfoService extends BaseService {
                        sql = " SELECT " +
                        sql = " SELECT " +
                                "     count(DISTINCT t1.patient) count" +
                                "     count(DISTINCT t1.patient) count" +
                                " FROM" +
                                " FROM" +
                                "     wlyy_sign_family t1 " +
                                "     wlyy_sign_family t1  " +
                                " left join " +
                                " left join " +
                                "    (select l.patient,l.label,l.label_type,l.label_name from wlyy_sign_family f left join wlyy_sign_patient_label_info l on f.patient = l.patient where (f.doctor = '" + doctor + "' or f.doctor_health = '" + doctor + "') and f.status > 0 and l.label_type = ? and l.status = 1) t2 " +
                                "    (select l.patient,l.label,l.label_type,l.label_name from wlyy_sign_family f left join wlyy_sign_patient_label_info l on f.patient = l.patient where (f.doctor = '" + doctor + "' or f.doctor_health = '" + doctor + "') and f.status > 0 and l.label_type = ? and l.status = 1) t2 " +
                                " on t1.patient = t2.patient " +
                                " on t1.patient = t2.patient " +
                                "     ,wlyy_patient t3 " +
                                " WHERE" +
                                " WHERE" +
                                "     t2.patient is null " +
                                "     t2.patient is null " +
                                "     AND t1.patient = t3.code "+
                                "     AND (t1.doctor = ? or t1.doctor_health = ?)" +
                                "     AND (t1.doctor = ? or t1.doctor_health = ?)" +
                                "     AND t1.status > 0 " +
                                "     AND t1.status > 0 " +
                                (teamCode > 0 ? "    AND t1.admin_team_code = ? " : "");
                                (teamCode > 0 ? "    AND t1.admin_team_code = ? " : "");
@ -765,9 +768,11 @@ public class SignPatientLabelInfoService extends BaseService {
                                "     count(DISTINCT t1.patient) count" +
                                "     count(DISTINCT t1.patient) count" +
                                " FROM" +
                                " FROM" +
                                "     wlyy_sign_family t1, " +
                                "     wlyy_sign_family t1, " +
                                "     wlyy_sign_patient_label_info t2 " +
                                "     wlyy_sign_patient_label_info t2, " +
                                "     wlyy_patient t3 " +
                                " WHERE" +
                                " WHERE" +
                                "     t1.patient = t2.patient " +
                                "     t1.patient = t2.patient " +
                                "     AND t1.patient = t3.code "+
                                "     AND t2.label = ? " +
                                "     AND t2.label = ? " +
                                "     AND t2.label_type = ? " +
                                "     AND t2.label_type = ? " +
                                "     AND t2.status = 1 " +
                                "     AND t2.status = 1 " +
@ -792,7 +797,7 @@ public class SignPatientLabelInfoService extends BaseService {
                json.put("amount", amount);
                json.put("amount", amount);
                int focusAmount = 0;
                int focusAmount = 0;
                sql += labelType.equals("5") ? " AND LENGTH(TRIM(IFNULL(openid,''))) > 0 " : " AND LENGTH(TRIM(IFNULL(t1.openid,''))) > 0 ";
                sql += labelType.equals("5") ? " AND LENGTH(TRIM(IFNULL(t3.openid,''))) > 0 " : " AND LENGTH(TRIM(IFNULL(t3.openid,''))) > 0 ";
                List<Map<String, Object>> focusCount = jdbcTemplate.queryForList(sql, args);
                List<Map<String, Object>> focusCount = jdbcTemplate.queryForList(sql, args);
                if (focusCount != null && focusCount.size() > 0 && focusCount.get(0).containsKey("count")) {
                if (focusCount != null && focusCount.size() > 0 && focusCount.get(0).containsKey("count")) {
@ -900,10 +905,11 @@ public class SignPatientLabelInfoService extends BaseService {
                    Calendar today = Calendar.getInstance();
                    Calendar today = Calendar.getInstance();
                    Calendar startDate = Calendar.getInstance();
                    Calendar startDate = Calendar.getInstance();
                    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
                    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
                    sql = "select count(DISTINCT  patient) count" +
                    sql = "select count(DISTINCT  t1.patient) count" +
                            " from " +
                            " from " +
                            "     wlyy_sign_family " +
                            " where status > 0 " +
                            "   wlyy_sign_family t1," +
                            "   wlyy_patient t3" +
                            " where t1.patient = t3.code AND status > 0 " +
                            " and admin_team_code = ? ";
                            " and admin_team_code = ? ";
                    if (label.getLabelCode().equals("1")) {
                    if (label.getLabelCode().equals("1")) {
@ -935,9 +941,11 @@ public class SignPatientLabelInfoService extends BaseService {
                                "     wlyy_sign_family t1 " +
                                "     wlyy_sign_family t1 " +
                                " left join " +
                                " left join " +
                                "    (select repl.patient,repl.label,repl.label_type,repl.label_name from wlyy_sign_family repf left join wlyy_sign_patient_label_info repl on repf.patient = repl.patient where repf.admin_team_code = ? and repf.status > 0 and repl.label_type = ? and repl.status = 1) t2 " +
                                "    (select repl.patient,repl.label,repl.label_type,repl.label_name from wlyy_sign_family repf left join wlyy_sign_patient_label_info repl on repf.patient = repl.patient where repf.admin_team_code = ? and repf.status > 0 and repl.label_type = ? and repl.status = 1) t2 " +
                                " on t1.patient = t2.patient " +
                                " on t1.patient = t2.patient ," +
                                " wlyy_patient t3 " +
                                " WHERE" +
                                " WHERE" +
                                "     t2.patient is null " +
                                "     t2.patient is null " +
                                "    AND t1.patient = t3.code" +
                                "     AND t1.status > 0 " +
                                "     AND t1.status > 0 " +
                                "     AND t1.admin_team_code = ? ";
                                "     AND t1.admin_team_code = ? ";
@ -947,9 +955,11 @@ public class SignPatientLabelInfoService extends BaseService {
                                "     count(DISTINCT t1.patient) count" +
                                "     count(DISTINCT t1.patient) count" +
                                " FROM" +
                                " FROM" +
                                "     wlyy_sign_family t1, " +
                                "     wlyy_sign_family t1, " +
                                "     wlyy_sign_patient_label_info t2 " +
                                "     wlyy_sign_patient_label_info t2, " +
                                "     wlyy_patient t3 " +
                                " WHERE" +
                                " WHERE" +
                                "     t1.patient = t2.patient " +
                                "     t1.patient = t2.patient " +
                                "     AND t1.patient = t3.code " +
                                "     AND t2.label = ? " +
                                "     AND t2.label = ? " +
                                "     AND t2.label_type = ? " +
                                "     AND t2.label_type = ? " +
                                "     AND t2.status = 1 " +
                                "     AND t2.status = 1 " +
@ -969,7 +979,7 @@ public class SignPatientLabelInfoService extends BaseService {
                json.put("amount", amount);
                json.put("amount", amount);
                int focusAmount = 0;
                int focusAmount = 0;
                sql += labelType.equals("5") ? " AND LENGTH(TRIM(IFNULL(openid,''))) > 0 " : " AND LENGTH(TRIM(IFNULL(t1.openid,''))) > 0 ";
                sql += labelType.equals("5") ? " AND LENGTH(TRIM(IFNULL(t3.openid,''))) > 0 " : " AND LENGTH(TRIM(IFNULL(t3.openid,''))) > 0 ";
                List<Map<String, Object>> focusCount = jdbcTemplate.queryForList(sql, args);
                List<Map<String, Object>> focusCount = jdbcTemplate.queryForList(sql, args);
                if (focusCount != null && focusCount.size() > 0 && focusCount.get(0).containsKey("count")) {
                if (focusCount != null && focusCount.size() > 0 && focusCount.get(0).containsKey("count")) {

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

@ -1,10 +1,17 @@
package com.yihu.wlyy.service.app.prescription;
package com.yihu.wlyy.service.app.prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExpressage;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionPay;
import com.yihu.wlyy.entity.patient.prescription.*;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDispensaryCodeDao;
import com.yihu.wlyy.repository.prescription.PrescriptionExpressageDao;
import com.yihu.wlyy.repository.prescription.PrescriptionExpressageDao;
import com.yihu.wlyy.repository.prescription.PrescriptionLogDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.Map;
import java.util.UUID;
/**
/**
 * Created by chenweida on 2017/7/27.
 * Created by chenweida on 2017/7/27.
@ -14,13 +21,62 @@ import org.springframework.stereotype.Service;
public class PrescriptionExpressageService {
public class PrescriptionExpressageService {
    @Autowired
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
    private PrescriptionDispensaryCodeDao prescriptionDispensaryCodeDao;
    @Autowired
    private PrescriptionLogDao prescriptionLogDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
    /**
    /**
     *  获取处方配送信息信息
     * 获取处方配送信息信息
     *
     * @param prescriptionCode 处方code
     * @param prescriptionCode 处方code
     * @return
     * @return
     */
     */
    public PrescriptionExpressage findByPrescriptionCode(String prescriptionCode) {
    public PrescriptionExpressage findByPrescriptionCode(String prescriptionCode) {
        return prescriptionExpressageDao.findByPrescriptionPay(prescriptionCode);
        return prescriptionExpressageDao.findByPrescriptionPay(prescriptionCode);
    }
    }
    /**
     * 确认配送成功
     *
     * @param code
     */
    @Transactional
    public Integer expressage(String code, String userCode) throws Exception {
        //获取根据wlyy_prescription_dispensary_code的code处方编码
        PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeDao.finByCode(code);
        if (prescriptionDispensaryCode == null) {
            //保存配送失败的日志
            PrescriptionLog prescriptionLog = new PrescriptionLog();
            prescriptionLog.setCode(UUID.randomUUID().toString());
            prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
            prescriptionLog.setCreateTime(new Date());
            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage);
            prescriptionLog.setFlag(1);
            prescriptionLog.setUserCode(userCode);
            prescriptionLog.setUserType(2);
            prescriptionLog.setType(42);
            prescriptionLog.setRemark("配送失败,处方编码不存在");
            prescriptionLogDao.save(prescriptionLog);
            return -1;
        }
        //修改处方状态为完成
        prescriptionDao.updateStatus(prescriptionDispensaryCode.getPrescriptionCode(),100);
        //保存配送成功的日志
        PrescriptionLog prescriptionLog = new PrescriptionLog();
        prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
        prescriptionLog.setCode(UUID.randomUUID().toString());
        prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage);
        prescriptionLog.setCreateTime(new Date());
        prescriptionLog.setFlag(1);
        prescriptionLog.setUserCode(userCode);
        prescriptionLog.setUserType(2);
        prescriptionLog.setType(100);
        prescriptionLogDao.save(prescriptionLog);
        return 1;
    }
}
}

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

@ -1,13 +1,19 @@
package com.yihu.wlyy.service.app.prescription;
package com.yihu.wlyy.service.app.prescription;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
import com.yihu.wlyy.repository.dict.SystemDictDao;
import com.yihu.wlyy.repository.prescription.PrescriptionInfoDao;
import com.yihu.wlyy.repository.prescription.PrescriptionInfoDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.List;
import java.util.Map;
/**
/**
 * Created by Trick on 2017/7/25.
 * Created by Trick on 2017/7/25.
@ -17,7 +23,8 @@ import java.util.List;
public class PrescriptionInfoService extends BaseService {
public class PrescriptionInfoService extends BaseService {
    @Autowired
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private SystemDictDao systemDictDao;
    /**
    /**
     * 获取处方下的详细药品
     * 获取处方下的详细药品
     * @param prescriptionCode
     * @param prescriptionCode
@ -26,4 +33,19 @@ public class PrescriptionInfoService extends BaseService {
    public List<PrescriptionInfo> getPrescriptionInfo(String prescriptionCode) {
    public List<PrescriptionInfo> getPrescriptionInfo(String prescriptionCode) {
        return prescriptionInfoDao.findByPrescriptionCode(prescriptionCode);
        return prescriptionInfoDao.findByPrescriptionCode(prescriptionCode);
    }
    }
    public JSONObject getPrescriptionFilter(){
        JSONObject rs = new JSONObject();
        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);
        return rs;
    }
}
}

+ 1 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -969,6 +969,7 @@ public class FamilyContractService extends BaseService {
            patient.setPassword(MD5.GetMD5Code(password + salt));
            patient.setPassword(MD5.GetMD5Code(password + salt));
            patient.setStatus(1);
            patient.setStatus(1);
            patient.setDisease(0);
            patient.setDisease(0);
            patient.setPhoto("../../../images/p-female.png");
        }
        }
        // 保存用户信息
        // 保存用户信息

+ 26 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwSmjkService.java

@ -1041,4 +1041,30 @@ public class JwSmjkService {
            return resultArray.toString();
            return resultArray.toString();
        }
        }
    }
    }
    /**
     * 获取转诊预约医生列表
     * @param orgCode   机构编码
     * @param deptCode  科室编码
     * @param strCredential 身份证据
     * @return
     */
    public String getRegDeptSpeDoctorList(String orgCode, String deptCode, String strCredential) {
        String url = jwUrl + "/third/smjk/RegDeptSpeDoctorList";
        List<NameValuePair> params = new ArrayList<>();
        //当前时间;
        String strStart = DateUtil.getStringDateShort();
        //10天预约
        String strEnd = DateUtil.getNextDay(strStart, 11);
        params.add(new BasicNameValuePair("orgCode", orgCode));
        params.add(new BasicNameValuePair("deptCode", deptCode));
        params.add(new BasicNameValuePair("strStart", strStart));
        params.add(new BasicNameValuePair("strEnd", strEnd));
        params.add(new BasicNameValuePair("strCredential", strCredential));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        return response;
    }
}
}

+ 26 - 4
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/WlyySerivceController.java

@ -7,16 +7,14 @@ import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.Document;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.Element;
import org.json.JSONObject;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
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 org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.*;
@ -218,6 +216,30 @@ public class WlyySerivceController extends BaseController{
        }
        }
    }
    }
    /**
     * 获取转诊预约医生列表
     * @param orgCode   机构编码
     * @param deptCode  科室编码
     * @param strCredential 身份证据
     * @return
     */
    @RequestMapping(value = "/third/smjk/RegDeptSpeDoctorList",method = RequestMethod.POST)
    @ApiOperation("获取转诊预约医生列表")
    @ResponseBody
    public String getRegDeptSpeDoctorList(
            @ApiParam(name="orgCode",value="机构编码") @RequestParam(name="orgCode",required = true) String orgCode,
            @ApiParam(name="deptCode",value="科室编码") @RequestParam(name="deptCode",required = true) String deptCode,
            @ApiParam(name="strCredential",value="身份证据") @RequestParam(name="strCredential",required = true) String strCredential){
        try {
            String list  = jwSmjkService.getRegDeptSpeDoctorList(orgCode,deptCode,strCredential);
            return write(200, "获取转诊预约医生列表成功!", "data", list);
        } catch (Exception ex) {
            ex.printStackTrace();
            return error(-1,"获取转诊预约医生列表列表失败");
        }
    }
    /**
    /**
     * 转诊预约医生号源转换
     * 转诊预约医生号源转换
     * @param xml
     * @param xml

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

@ -1,12 +1,14 @@
package com.yihu.wlyy.web.doctor.prescription;
package com.yihu.wlyy.web.doctor.prescription;
import com.yihu.wlyy.service.app.prescription.PrescriptionExpressageService;
import com.yihu.wlyy.service.app.prescription.PrescriptionInfoService;
import com.yihu.wlyy.service.app.prescription.PrescriptionInfoService;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import org.quartz.impl.calendar.BaseCalendar;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
/**
 * Created by Trick on 2017/7/25.
 * Created by Trick on 2017/7/25.
@ -18,4 +20,42 @@ public class PrescriptionInfoController extends BaseController{
    @Autowired
    @Autowired
    private PrescriptionInfoService prescriptionInfoService;
    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
    @ApiOperation(value = "获取过滤规则信息列表")
    public String getPrescriptionFilter(){
        try {
            return write(200, "查询成功!", "data",prescriptionInfoService.getPrescriptionFilter());
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
}
}

+ 15 - 18
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java

@ -1,12 +1,11 @@
package com.yihu.wlyy.web.patient.prescription;
package com.yihu.wlyy.web.patient.prescription;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.emr.DoctorMedicalRecordsPart;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExpressage;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionPay;
import com.yihu.wlyy.entity.patient.prescription.*;
import com.yihu.wlyy.entity.patient.prescription.*;
import com.yihu.wlyy.service.app.medicines.MedicalRecordsService;
import com.yihu.wlyy.service.app.prescription.*;
import com.yihu.wlyy.service.app.prescription.*;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.WeixinBaseController;
import com.yihu.wlyy.web.WeixinBaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
@ -14,21 +13,18 @@ import io.swagger.annotations.ApiParam;
import org.json.JSONArray;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.MediaType;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
import java.util.Calendar;
import java.util.Calendar;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Random;
/**
/**
 * Created by Administrator on 2017/7/21.
 * Created by Administrator on 2017/7/21.
 */
 */
@RestController("patientPrescriptionLogController")
@RestController("patientPrescriptionController")
@RequestMapping(value = "/patient/prescription", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@RequestMapping(value = "/patient/prescription", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "患者端-长处方接口")
@Api(description = "患者端-长处方接口")
public class PatientPrescriptionController extends WeixinBaseController {
public class PatientPrescriptionController extends WeixinBaseController {
@ -123,18 +119,18 @@ public class PatientPrescriptionController extends WeixinBaseController {
     * 判断该居民是否有待取的药的接口
     * 判断该居民是否有待取的药的接口
     * @return
     * @return
     */
     */
    @RequestMapping(value = "/dispensaryCode/whetherHaveCode",method = RequestMethod.GET)
    @RequestMapping(value = "/dispensaryCode/whetherHaveCode", method = RequestMethod.GET)
    @ResponseBody
    @ResponseBody
    //@ObserverRequired
    //@ObserverRequired
    public String whetherHaveCode(){
    public String whetherHaveCode() {
        JSONObject json = new JSONObject();
        JSONObject json = new JSONObject();
        String patientCode=getRepUID();
        String patientCode = getRepUID();
        int count = prescriptionDispensaryCodeService.dispensaryCodeCount(patientCode);
        int count = prescriptionDispensaryCodeService.dispensaryCodeCount(patientCode);
        if(count>0){
            json.put("data",true);
        if (count > 0) {
            json.put("data", true);
            return json.toString();
            return json.toString();
        }
        }
        json.put("data",false);
        json.put("data", false);
        return json.toString();
        return json.toString();
    }
    }
@ -147,7 +143,7 @@ public class PatientPrescriptionController extends WeixinBaseController {
     */
     */
    @RequestMapping(value = "/prescriptionFollow", method = RequestMethod.GET)
    @RequestMapping(value = "/prescriptionFollow", method = RequestMethod.GET)
    @ApiOperation(value = "获取处方订单详情")
    @ApiOperation(value = "获取处方订单详情")
    public String addReply(
    public String prescriptionFollow(
            @RequestParam(required = true) @ApiParam(value = "处方code", name = "prescriptionCode") String prescriptionCode) {
            @RequestParam(required = true) @ApiParam(value = "处方code", name = "prescriptionCode") String prescriptionCode) {
        try {
        try {
            JSONObject jo = new JSONObject();
            JSONObject jo = new JSONObject();
@ -162,10 +158,11 @@ public class PatientPrescriptionController extends WeixinBaseController {
            jo.put("prescriptionInfos", prescriptionInfos);
            jo.put("prescriptionInfos", prescriptionInfos);
            jo.put("prescriptionPay", prescriptionPay);
            jo.put("prescriptionPay", prescriptionPay);
            jo.put("prescriptionExpressage", prescriptionExpressage);
            jo.put("prescriptionExpressage", prescriptionExpressage);
            jo.put("prescriptionStatus", prescription.getStatus());
            return write(200,"查询成功","data",jo);
            jo.put("prescriptionStatus", prescription.getStatus());//处方状态
            return write(200, "查询成功", "data", jo);
        } catch (Exception e) {
        } catch (Exception e) {
            return error(-1, "获取失败");
            return error(-1, "获取失败");
        }
        }
    }
    }
}
}

+ 16 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionInfoController.java

@ -54,5 +54,21 @@ public class PatientPrescriptionInfoController extends BaseController {
            return error(-1, "查询失败!");
            return error(-1, "查询失败!");
        }
        }
    }
    }
    @RequestMapping(value = "/getContinuedPrescription")
    @ResponseBody
    @ApiOperation(value = "获取续方详细信息")
    public String getContinuedPrescription(@RequestParam(required = true)@ApiParam(name="code",value="续方CODE")String code){
        try {
            return write(200, "查询成功!", "data", "");
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
}
}

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

@ -20,7 +20,7 @@ import java.util.List;
@RestController
@RestController
@RequestMapping(value = "/patient/prescriptionlog")
@RequestMapping(value = "/patient/prescriptionlog")
@Api("患者端-处方日志")
@Api("患者端-处方日志")
public class PrescriptionLogController extends BaseController {
public class PatientPrescriptionLogController extends BaseController {
    @Autowired
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    private PrescriptionLogService prescriptionLogService;

+ 2 - 2
patient-co-wlyy/src/main/webapp/WEB-INF/spring-mvc.xml

@ -77,7 +77,7 @@
		</property>
		</property>
	</bean>
	</bean>
	<mvc:interceptors>
	<!--<mvc:interceptors>
		<mvc:interceptor>
		<mvc:interceptor>
	        <mvc:mapping path="/patient/**"/>
	        <mvc:mapping path="/patient/**"/>
	        <bean class="com.yihu.wlyy.interceptors.PatientInterceptor"/>
	        <bean class="com.yihu.wlyy.interceptors.PatientInterceptor"/>
@ -90,6 +90,6 @@
	        <mvc:mapping path="/user/**"/>
	        <mvc:mapping path="/user/**"/>
	        <bean class="com.yihu.wlyy.interceptors.UserInterceptor"/>
	        <bean class="com.yihu.wlyy.interceptors.UserInterceptor"/>
	    </mvc:interceptor>
	    </mvc:interceptor>
	</mvc:interceptors>
	</mvc:interceptors>-->
</beans>
</beans>