Commit ef2ac6fcd4536e78849cc0b1157ac63e6d8bb9db

Authored by yangfei
1 parent c8ad0a4c1e

服务开通模块

Showing 8 changed files with 137 additions and 24 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/model/HospitalDoctService.java View file @ ef2ac6f
... ... @@ -27,6 +27,20 @@
27 27 */
28 28 private BigDecimal doctPrice;
29 29  
  30 + /**
  31 + * 状态:0-有效、1-暂停、2-删除
  32 + */
  33 + private Integer status;
  34 +
  35 + public Integer getStatus() {
  36 + return status;
  37 + }
  38 +
  39 + public void setStatus(Integer status) {
  40 + this.status = status;
  41 + }
  42 +
  43 +
30 44 public String getId() {
31 45 return id;
32 46 }
platform-biz-service/src/main/java/com/lyms/platform/permission/model/HospitalDoctServiceQuery.java View file @ ef2ac6f
... ... @@ -30,6 +30,20 @@
30 30 */
31 31 private BigDecimal doctPrice;
32 32  
  33 + /**
  34 + * 状态:0-有效、1-暂停、2-删除
  35 + */
  36 + private Integer status;
  37 +
  38 + public Integer getStatus() {
  39 + return status;
  40 + }
  41 +
  42 + public void setStatus(Integer status) {
  43 + this.status = status;
  44 + }
  45 +
  46 +
33 47 public String getId() {
34 48 return id;
35 49 }
platform-biz-service/src/main/java/com/lyms/platform/permission/model/HospitalServiceContent.java View file @ ef2ac6f
1 1 package com.lyms.platform.permission.model;
2 2  
3 3 import java.math.BigDecimal;
  4 +import java.util.ArrayList;
4 5 import java.util.Date;
  6 +import java.util.List;
5 7  
6 8 /**
7 9 * 医院服务配置
... ... @@ -31,6 +33,31 @@
31 33 * 操作人
32 34 */
33 35 private String createUser;
  36 + /**
  37 + * 状态:0-有效、1-暂停、2-删除
  38 + */
  39 + private Integer status;
  40 +
  41 + /**
  42 + * 医生集合
  43 + */
  44 + private List<String> doctIds = new ArrayList<>();
  45 +
  46 + public List<String> getDoctIds() {
  47 + return doctIds;
  48 + }
  49 +
  50 + public void setDoctIds(List<String> doctIds) {
  51 + this.doctIds = doctIds;
  52 + }
  53 +
  54 + public Integer getStatus() {
  55 + return status;
  56 + }
  57 +
  58 + public void setStatus(Integer status) {
  59 + this.status = status;
  60 + }
34 61  
35 62 public String getId() {
36 63 return id;
platform-biz-service/src/main/java/com/lyms/platform/permission/model/HospitalServiceContentQuery.java View file @ ef2ac6f
... ... @@ -35,6 +35,20 @@
35 35 */
36 36 private String createUser;
37 37  
  38 + /**
  39 + * 状态:0-有效、1-暂停、2-删除
  40 + */
  41 + private Integer status;
  42 +
  43 + public Integer getStatus() {
  44 + return status;
  45 + }
  46 +
  47 + public void setStatus(Integer status) {
  48 + this.status = status;
  49 + }
  50 +
  51 +
38 52 public String getId() {
39 53 return id;
40 54 }
platform-biz-service/src/main/resources/mainOrm/master/HospitalDoctService.xml View file @ ef2ac6f
1 1 <?xml version="1.0" encoding="UTF-8" ?>
2 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3   -<mapper namespace="com.lyms.platform.permission.dao.HospitalDoctServiceMapper">
  3 +<mapper namespace="com.lyms.platform.permission.dao.master.HospitalDoctServiceMapper">
4 4  
5 5 <resultMap id="HospitalDoctServiceResultMap" type="com.lyms.platform.permission.model.HospitalDoctService">
6 6 <id column="id" property="id" jdbcType="VARCHAR"/>
7 7  
... ... @@ -8,11 +8,12 @@
8 8 <result column="doct_id" property="doctId" jdbcType="VARCHAR"/>
9 9 <result column="hosp_id" property="hospId" jdbcType="VARCHAR"/>
10 10 <result column="doct_price" property="doctPrice" jdbcType="DECIMAL"/>
  11 + <result column="status" property="status" jdbcType="INTEGER"/>
11 12 </resultMap>
12 13  
13 14  
14 15 <insert id="addHospitalDoctService" parameterType="com.lyms.platform.permission.model.HospitalDoctService">
15   -insert into hospital_doct_service (id,hosp_service_id,doct_id,hosp_id,doct_price) values (#{id},#{hospServiceId},#{doctId},#{hospId},#{doctPrice})
  16 +insert into hospital_doct_service (id,hosp_service_id,doct_id,hosp_id,doct_price,status) values (#{id},#{hospServiceId},#{doctId},#{hospId},#{doctPrice},#{status})
16 17 </insert>
17 18  
18 19  
... ... @@ -31,6 +32,9 @@
31 32 <if test="doctPrice != null">
32 33 doct_price = #{doctPrice,jdbcType=DECIMAL},
33 34 </if>
  35 + <if test="status != null and status >= 0">
  36 + status = #{status,jdbcType=INTEGER},
  37 + </if>
34 38 </set>
35 39 where id = #{id,jdbcType=VARCHAR}
36 40 </update>
... ... @@ -42,7 +46,7 @@
42 46  
43 47  
44 48 <select id="getHospitalDoctService" resultMap="HospitalDoctServiceResultMap" parameterType="java.lang.String">
45   -select id,hosp_service_id,doct_id,hosp_id,doct_price
  49 +select id,hosp_service_id,doct_id,hosp_id,doct_price,status
46 50 from hospital_doct_service where id = #{id,jdbcType=VARCHAR}
47 51 </select>
48 52  
49 53  
... ... @@ -75,13 +79,16 @@
75 79 <if test="doctPrice != null">
76 80 and doct_price = #{doctPrice,jdbcType=DECIMAL}
77 81 </if>
  82 + <if test="status != null and status >= 0">
  83 + and status = #{status,jdbcType=INTEGER}
  84 + </if>
78 85 </where>
79 86 </sql>
80 87  
81 88  
82 89 <select id="queryHospitalDoctService" resultMap="HospitalDoctServiceResultMap"
83 90 parameterType="com.lyms.platform.permission.model.HospitalDoctServiceQuery">
84   - select id,hosp_service_id,doct_id,hosp_id,doct_price
  91 + select id,hosp_service_id,doct_id,hosp_id,doct_price,status
85 92 from hospital_doct_service
86 93 <include refid="HospitalDoctServiceCondition"/>
87 94 <include refid="orderAndLimit"/>
platform-biz-service/src/main/resources/mainOrm/master/HospitalServiceContent.xml View file @ ef2ac6f
1 1 <?xml version="1.0" encoding="UTF-8" ?>
2 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3   -<mapper namespace="com.lyms.platform.permission.dao.HospitalServiceContentMapper">
  3 +<mapper namespace="com.lyms.platform.permission.dao.master.HospitalServiceContentMapper">
4 4  
5 5 <resultMap id="HospitalServiceContentResultMap" type="com.lyms.platform.permission.model.HospitalServiceContent">
6 6 <id column="id" property="id" jdbcType="VARCHAR"/>
7 7  
... ... @@ -9,11 +9,12 @@
9 9 <result column="ser_price" property="serPrice" jdbcType="DECIMAL"/>
10 10 <result column="create_date" property="createDate" jdbcType="TIMESTAMP"/>
11 11 <result column="create_user" property="createUser" jdbcType="VARCHAR"/>
  12 + <result column="status" property="status" jdbcType="INTEGER"/>
12 13 </resultMap>
13 14  
14 15  
15 16 <insert id="addHospitalServiceContent" parameterType="com.lyms.platform.permission.model.HospitalServiceContent">
16   -insert into hospital_service_content (id,hospital_id,ser_type,ser_price,create_date,create_user) values (#{id},#{hospitalId},#{serType},#{serPrice},#{createDate},#{createUser})
  17 +insert into hospital_service_content (id,hospital_id,ser_type,ser_price,create_date,create_user,status) values (#{id},#{hospitalId},#{serType},#{serPrice},#{createDate},#{createUser},#{status})
17 18 </insert>
18 19  
19 20  
... ... @@ -35,6 +36,9 @@
35 36 <if test="createUser != null and createUser != ''">
36 37 create_user = #{createUser,jdbcType=VARCHAR},
37 38 </if>
  39 + <if test="status != null and status >= 0">
  40 + status = #{status,jdbcType=INTEGER},
  41 + </if>
38 42 </set>
39 43 where id = #{id,jdbcType=VARCHAR}
40 44 </update>
... ... @@ -46,7 +50,7 @@
46 50  
47 51  
48 52 <select id="getHospitalServiceContent" resultMap="HospitalServiceContentResultMap" parameterType="java.lang.String">
49   -select id,hospital_id,ser_type,ser_price,create_date,create_user
  53 +select id,hospital_id,ser_type,ser_price,create_date,create_user,status
50 54 from hospital_service_content where id = #{id,jdbcType=VARCHAR}
51 55 </select>
52 56  
53 57  
... ... @@ -82,13 +86,16 @@
82 86 <if test="createUser != null and createUser != ''">
83 87 and create_user = #{createUser,jdbcType=VARCHAR}
84 88 </if>
  89 + <if test="status != null and status >= 0">
  90 + and status = #{status,jdbcType=INTEGER}
  91 + </if>
85 92 </where>
86 93 </sql>
87 94  
88 95  
89 96 <select id="queryHospitalServiceContent" resultMap="HospitalServiceContentResultMap"
90 97 parameterType="com.lyms.platform.permission.model.HospitalServiceContentQuery">
91   - select id,hospital_id,ser_type,ser_price,create_date,create_user
  98 + select id,hospital_id,ser_type,ser_price,create_date,create_user,status
92 99 from hospital_service_content
93 100 <include refid="HospitalServiceContentCondition"/>
94 101 <include refid="orderAndLimit"/>
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientServiceController.java View file @ ef2ac6f
... ... @@ -36,8 +36,10 @@
36 36 @ResponseBody
37 37 @TokenRequired
38 38 @RequestMapping(value = "/patSer/init", method = RequestMethod.GET)
39   - public BaseResponse patientServiceInit() {
40   - return patientServiceFacade.patientServiceInit();
  39 + public BaseResponse patientServiceInit( HttpServletRequest request) {
  40 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  41 +
  42 + return patientServiceFacade.patientServiceInit(loginState.getId());
41 43 }
42 44  
43 45 /**
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientServiceFacade.java View file @ ef2ac6f
... ... @@ -16,13 +16,8 @@
16 16 import com.lyms.platform.common.utils.StringUtils;
17 17 import com.lyms.platform.operate.web.request.BasePageQueryRequest;
18 18 import com.lyms.platform.operate.web.result.PatientSerResult;
19   -import com.lyms.platform.permission.model.Organization;
20   -import com.lyms.platform.permission.model.PatientService;
21   -import com.lyms.platform.permission.model.PatientServiceQuery;
22   -import com.lyms.platform.permission.model.Users;
23   -import com.lyms.platform.permission.service.OrganizationService;
24   -import com.lyms.platform.permission.service.PatientServiceService;
25   -import com.lyms.platform.permission.service.UsersService;
  19 +import com.lyms.platform.permission.model.*;
  20 +import com.lyms.platform.permission.service.*;
26 21 import com.lyms.platform.pojo.Patients;
27 22 import com.lyms.platform.query.PatientsQuery;
28 23 import net.sf.json.JSONArray;
29 24  
30 25  
31 26  
... ... @@ -56,19 +51,52 @@
56 51 private CommonService commonService;
57 52 @Autowired
58 53 private AntenatalExaminationService antenatalExaminationService;
  54 + @Autowired
  55 + private HospitalDoctServiceService hospitalDoctService;
  56 + @Autowired
  57 + private HospitalServiceContentService hospitalServiceContentService;
59 58  
60   -
61 59 @Autowired
62 60 private OperateLogFacade operateLogFacade;
63 61  
64 62 public static String patSer_sync_url = Config.getItem("patSer_sync_url", "0");
65 63  
66   - public BaseResponse patientServiceInit() {
  64 + public BaseResponse patientServiceInit(Integer id) {
  65 + //根据用户id获取医院ID
  66 + String hospitalId = autoMatchFacade.getHospitalId(id);
  67 +
67 68 Map map = new HashMap();
68 69 //服务类型
69 70 map.put("serTypes", PatientSerEnums.getSerType());
70 71 //服务状态
71 72 map.put("serStatus", PatientSerEnums.getSerStatus());
  73 +
  74 + HospitalServiceContentQuery hscQuery = new HospitalServiceContentQuery();
  75 +
  76 + hscQuery.setHospitalId(hospitalId);
  77 + //状态 1--有效
  78 + hscQuery.setStatus(1);
  79 +
  80 + List<HospitalServiceContent> hospitalServiceContents = hospitalServiceContentService.queryHospitalServiceContent(hscQuery);
  81 + Map<String,HospitalServiceContent> hscMap = new HashMap<>();
  82 + for(HospitalServiceContent hsc:hospitalServiceContents){
  83 + hscMap.put(hsc.getId(),hsc);
  84 + }
  85 + HospitalDoctServiceQuery hospitalDoctServiceQuery = new HospitalDoctServiceQuery();
  86 + //状态 1--有效
  87 + hospitalDoctServiceQuery.setStatus(1);
  88 + hospitalDoctServiceQuery.setHospId(hospitalId);
  89 + List<HospitalDoctService> hospitalDoctServiceList = hospitalDoctService.queryHospitalDoctService(hospitalDoctServiceQuery);
  90 + //给医院服务加入医生的服务价格信息
  91 + for(HospitalDoctService hds:hospitalDoctServiceList){
  92 + HospitalServiceContent hsc = hscMap.get(hds.getHospServiceId());
  93 + if(hsc!=null){
  94 + hsc.getDoctIds().add(hds.getDoctId());
  95 + }
  96 + }
  97 +
  98 + map.put("hospSer",hospitalServiceContents);
  99 +
72 100 return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION).setData(map);
73 101 }
74 102  
75 103  
... ... @@ -128,10 +156,10 @@
128 156 public BaseResponse addPatientService(PatientService ps, Integer id) throws Exception {
129 157 //根据用户id获取医院ID
130 158 String hospitalId = autoMatchFacade.getHospitalId(id);
131   - List<Map<String,String>> serInfos = ps.getSerInfos();
  159 + List<Map<String, String>> serInfos = ps.getSerInfos();
132 160  
133 161 List<PatientService> patientServiceList = new ArrayList<>();
134   - for (Map<String,String> serInfo : serInfos) {
  162 + for (Map<String, String> serInfo : serInfos) {
135 163 //先根据孕妇id和开通服务类型、开通医生进行查询,如果已经开通过则开通失败
136 164 PatientServiceQuery patientQuery = new PatientServiceQuery();
137 165 patientQuery.setHospitalId(hospitalId);
... ... @@ -155,7 +183,7 @@
155 183 ps.setSerStatus(PatientSerEnums.SerStatusEnums.kt.getId());
156 184 //服务类型
157 185 ps.setSerType(Integer.parseInt(serInfo.get("serType")));
158   - if(serInfo.containsKey(serInfo.get("serDoct"))){
  186 + if (serInfo.containsKey(serInfo.get("serDoct"))) {
159 187 ps.setSerDoct(serInfo.get("serDoct"));
160 188 }
161 189 //默认已经领取
... ... @@ -485,7 +513,7 @@
485 513 jsonObject.put("serStatus", ps.getSerStatus());
486 514 jsonObject.put("hospitalId", ps.getHospitalId());
487 515 //领取状态
488   - jsonObject.put("status",ps.getStatus());
  516 + jsonObject.put("status", ps.getStatus());
489 517 jsonObject.put("createDate", DateUtil.getyyyy_MM_dd_hms(ps.getCreateDate()));
490 518 jsonArray.add(jsonObject);
491 519 }
... ... @@ -494,7 +522,7 @@
494 522 baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
495 523 baseResponse.setErrormsg("成功");
496 524 return baseResponse;
497   - } catch (Exception e){
  525 + } catch (Exception e) {
498 526 baseResponse.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR);
499 527 baseResponse.setErrormsg(e.getMessage());
500 528 return baseResponse;