XMTT 5 years ago
parent
commit
692ea35304

+ 79 - 8
src/main/java/com/ekexiu/project/doctor/DoctorService.java

@ -10,6 +10,8 @@ import org.jfw.util.PageQueryResult;
10 10
11 11
import java.sql.Connection;
12 12
import java.sql.SQLException;
13
import java.util.ArrayList;
14
import java.util.List;
13 15
14 16
/**
15 17
 * Created by TT on 2019/5/30.
@ -31,25 +33,94 @@ public class DoctorService {
31 33
32 34
    @Get
33 35
    @Path("/qo")
34
    public Doctor query(@JdbcConn Connection con, String id) throws SQLException {
35
        return doctorDao.query(con, id);
36
    public SessionDoctor query(@JdbcConn Connection con, String id) throws SQLException {
37
        return makeSessionDoctor(doctorDao.query(con, id));
36 38
    }
37 39
38 40
    @Get
39 41
    @Path("/pq")
40
    public PageQueryResult<Doctor> pageQuery(@JdbcConn Connection con, @Nullable Boolean active, @Nullable String addr, @Nullable String clinicalTitle, @Nullable String level, @Nullable String key, int pageSize, int pageNo) throws SQLException {
41
        return doctorDao.pageQuery(con, active, addr == null ? null : addr + "%", clinicalTitle, level, key == null ? null : "%" + key + "%", pageSize, pageNo);
42
    public PageQueryResult<SessionDoctor> pageQuery(@JdbcConn Connection con, @Nullable Boolean active, @Nullable String addr, @Nullable String clinicalTitle, @Nullable String level, @Nullable String key, int pageSize, int pageNo) throws SQLException {
43
        PageQueryResult<Doctor> pageQueryResult =  doctorDao.pageQuery(con, active, addr == null ? null : addr + "%", clinicalTitle, level, key == null ? null : "%" + key + "%", pageSize, pageNo);
44
        if (pageQueryResult != null) {
45
            List<Doctor> doctors = pageQueryResult.getData();
46
            List<SessionDoctor> sessionDoctors = new ArrayList<>();
47
            if (!doctors.isEmpty()) {
48
                for (Doctor doctor : doctors) {
49
                    sessionDoctors.add(makeSessionDoctor(doctor));
50
                }
51
                PageQueryResult<SessionDoctor> ret = new PageQueryResult<>();
52
                ret.setPageNo(pageQueryResult.getPageNo());
53
                ret.setPageSize(pageQueryResult.getPageSize());
54
                ret.setTotal(pageQueryResult.getTotal());
55
                ret.setData(sessionDoctors);
56
                return ret;
57
            }
58
        }
59
        return null;
42 60
    }
43 61
44 62
    @Path("/hospital")
45 63
    @Get
46
    public PageQueryResult<Doctor> pageQuery(@JdbcConn Connection con, @Nullable Boolean active, String hospital, int pageSize, int pageNo) throws SQLException {
47
        return doctorDao.pageQuery(con, hospital, active, pageSize, pageNo);
64
    public PageQueryResult<SessionDoctor> pageQuery(@JdbcConn Connection con, @Nullable Boolean active, String hospital, int pageSize, int pageNo) throws SQLException {
65
        PageQueryResult<Doctor> pageQueryResult =  doctorDao.pageQuery(con, hospital, active, pageSize, pageNo);
66
        if (pageQueryResult != null) {
67
            List<Doctor> doctors = pageQueryResult.getData();
68
            List<SessionDoctor> sessionDoctors = new ArrayList<>();
69
            if (!doctors.isEmpty()) {
70
                for (Doctor doctor : doctors) {
71
                    sessionDoctors.add(makeSessionDoctor(doctor));
72
                }
73
                PageQueryResult<SessionDoctor> ret = new PageQueryResult<>();
74
                ret.setPageNo(pageQueryResult.getPageNo());
75
                ret.setPageSize(pageQueryResult.getPageSize());
76
                ret.setTotal(pageQueryResult.getTotal());
77
                ret.setData(sessionDoctors);
78
                return ret;
79
            }
80
        }
81
        return null;
48 82
    }
49 83
50 84
    @Path("/department")
51 85
    @Get
52
    public PageQueryResult<Doctor> pageQuery(@JdbcConn Connection con, @Nullable Boolean active, String hospital, String department, int pageSize, int pageNo) throws SQLException {
53
        return doctorDao.pageQuery(con, hospital, department, active, pageSize, pageNo);
86
    public PageQueryResult<SessionDoctor> pageQuery(@JdbcConn Connection con, @Nullable Boolean active, String hospital, String department, int pageSize, int pageNo) throws SQLException {
87
        PageQueryResult<Doctor> pageQueryResult = doctorDao.pageQuery(con, hospital, department, active, pageSize, pageNo);
88
        if (pageQueryResult != null) {
89
            List<Doctor> doctors = pageQueryResult.getData();
90
            List<SessionDoctor> sessionDoctors = new ArrayList<>();
91
            if (!doctors.isEmpty()) {
92
                for (Doctor doctor : doctors) {
93
                    sessionDoctors.add(makeSessionDoctor(doctor));
94
                }
95
                PageQueryResult<SessionDoctor> ret = new PageQueryResult<>();
96
                ret.setPageNo(pageQueryResult.getPageNo());
97
                ret.setPageSize(pageQueryResult.getPageSize());
98
                ret.setTotal(pageQueryResult.getTotal());
99
                ret.setData(sessionDoctors);
100
                return ret;
101
            }
102
        }
103
        return null;
104
    }
105
106
    private static SessionDoctor makeSessionDoctor(Doctor doctor) {
107
        SessionDoctor sessionDoctor = new SessionDoctor();
108
        sessionDoctor.setAccount(doctor.getAccount());
109
        sessionDoctor.setName(doctor.getName());
110
        sessionDoctor.setHospital(doctor.getHospital());
111
        sessionDoctor.setDepartment(doctor.getDepartment());
112
        sessionDoctor.setId(doctor.getId());
113
        sessionDoctor.setClinicalTitle(doctor.getClinicalTitle());
114
        sessionDoctor.setTeachTitle(doctor.getTeachTitle());
115
        sessionDoctor.setPosition(doctor.getPosition());
116
        sessionDoctor.setDirection(doctor.getDirection());
117
        sessionDoctor.setDescp(doctor.getDescp());
118
        sessionDoctor.setImage(doctor.getImage());
119
        sessionDoctor.setActive(doctor.isActive());
120
        sessionDoctor.setCreateTime(doctor.getCreateTime());
121
        sessionDoctor.setModifyTime(doctor.getModifyTime());
122
        sessionDoctor.setCreator(doctor.getCreator());
123
        sessionDoctor.setModifier(doctor.getModifier());
124
        return sessionDoctor;
54 125
    }
55 126
}

+ 160 - 0
src/main/java/com/ekexiu/project/doctor/SessionDoctor.java

@ -0,0 +1,160 @@
1
package com.ekexiu.project.doctor;
2
3
import org.jfw.util.auth.AuthUser;
4
5
/**
6
 * Created by TT on 2019/6/13.
7
 */
8
public class SessionDoctor implements AuthUser {
9
    private String id;
10
    private String hospital;
11
    private String department;
12
    private String account;
13
    private String name;
14
    private String clinicalTitle;
15
    private String teachTitle;
16
    private String position;
17
    private String direction;
18
    private String image;
19
    private String descp;
20
    private boolean active;
21
22
    private String createTime;
23
    private String modifyTime;
24
    private String creator;
25
    private String modifier;
26
27
    @Override
28
    public boolean hasAuthority(int i) {
29
        return true;
30
    }
31
32
    @Override
33
    public String getId() {
34
        return id;
35
    }
36
37
    public void setId(String id) {
38
        this.id = id;
39
    }
40
41
    public String getHospital() {
42
        return hospital;
43
    }
44
45
    public void setHospital(String hospital) {
46
        this.hospital = hospital;
47
    }
48
49
    public String getDepartment() {
50
        return department;
51
    }
52
53
    public void setDepartment(String department) {
54
        this.department = department;
55
    }
56
57
    public String getAccount() {
58
        return account;
59
    }
60
61
    public void setAccount(String account) {
62
        this.account = account;
63
    }
64
65
    public String getName() {
66
        return name;
67
    }
68
69
    public void setName(String name) {
70
        this.name = name;
71
    }
72
73
    public String getClinicalTitle() {
74
        return clinicalTitle;
75
    }
76
77
    public void setClinicalTitle(String clinicalTitle) {
78
        this.clinicalTitle = clinicalTitle;
79
    }
80
81
    public String getTeachTitle() {
82
        return teachTitle;
83
    }
84
85
    public void setTeachTitle(String teachTitle) {
86
        this.teachTitle = teachTitle;
87
    }
88
89
    public String getPosition() {
90
        return position;
91
    }
92
93
    public void setPosition(String position) {
94
        this.position = position;
95
    }
96
97
    public String getDirection() {
98
        return direction;
99
    }
100
101
    public void setDirection(String direction) {
102
        this.direction = direction;
103
    }
104
105
    public String getImage() {
106
        return image;
107
    }
108
109
    public void setImage(String image) {
110
        this.image = image;
111
    }
112
113
    public String getDescp() {
114
        return descp;
115
    }
116
117
    public void setDescp(String descp) {
118
        this.descp = descp;
119
    }
120
121
    public boolean isActive() {
122
        return active;
123
    }
124
125
    public void setActive(boolean active) {
126
        this.active = active;
127
    }
128
129
    public String getCreateTime() {
130
        return createTime;
131
    }
132
133
    public void setCreateTime(String createTime) {
134
        this.createTime = createTime;
135
    }
136
137
    public String getModifyTime() {
138
        return modifyTime;
139
    }
140
141
    public void setModifyTime(String modifyTime) {
142
        this.modifyTime = modifyTime;
143
    }
144
145
    public String getCreator() {
146
        return creator;
147
    }
148
149
    public void setCreator(String creator) {
150
        this.creator = creator;
151
    }
152
153
    public String getModifier() {
154
        return modifier;
155
    }
156
157
    public void setModifier(String modifier) {
158
        this.modifier = modifier;
159
    }
160
}

+ 5 - 1
src/main/java/com/ekexiu/project/hospital/HospitalService.java

@ -89,9 +89,13 @@ public class HospitalService {
89 89
        sessionHospital.setPhone(hospital.getPhone());
90 90
        sessionHospital.setLocation(hospital.getLocation());
91 91
        sessionHospital.setAddr(hospital.getAddr());
92
        sessionHospital.setDesc(hospital.getDescp());
92
        sessionHospital.setDescp(hospital.getDescp());
93 93
        sessionHospital.setImage(hospital.getImage());
94 94
        sessionHospital.setActive(hospital.isActive());
95
        sessionHospital.setCreateTime(hospital.getCreateTime());
96
        sessionHospital.setModifyTime(hospital.getModifyTime());
97
        sessionHospital.setCreator(hospital.getCreator());
98
        sessionHospital.setModifier(hospital.getModifier());
95 99
        return sessionHospital;
96 100
    }
97 101
}

+ 43 - 5
src/main/java/com/ekexiu/project/system/vo/SessionHospital.java

@ -15,10 +15,16 @@ public class SessionHospital implements AuthUser {
15 15
    private String phone;
16 16
    private String location;
17 17
    private String addr;
18
    private String desc;
18
    private String descp;
19 19
    private String image;
20 20
    private boolean active;
21 21
22
    private String createTime;
23
    private String modifyTime;
24
    private String creator;
25
    private String modifier;
26
27
22 28
    @Override
23 29
    public boolean hasAuthority(int i) {
24 30
        return false;
@ -97,12 +103,12 @@ public class SessionHospital implements AuthUser {
97 103
        this.addr = addr;
98 104
    }
99 105
100
    public String getDesc() {
101
        return desc;
106
    public String getDescp() {
107
        return descp;
102 108
    }
103 109
104
    public void setDesc(String desc) {
105
        this.desc = desc;
110
    public void setDescp(String descp) {
111
        this.descp = descp;
106 112
    }
107 113
108 114
    public String getImage() {
@ -120,4 +126,36 @@ public class SessionHospital implements AuthUser {
120 126
    public void setActive(boolean active) {
121 127
        this.active = active;
122 128
    }
129
130
    public String getCreateTime() {
131
        return createTime;
132
    }
133
134
    public void setCreateTime(String createTime) {
135
        this.createTime = createTime;
136
    }
137
138
    public String getModifyTime() {
139
        return modifyTime;
140
    }
141
142
    public void setModifyTime(String modifyTime) {
143
        this.modifyTime = modifyTime;
144
    }
145
146
    public String getCreator() {
147
        return creator;
148
    }
149
150
    public void setCreator(String creator) {
151
        this.creator = creator;
152
    }
153
154
    public String getModifier() {
155
        return modifier;
156
    }
157
158
    public void setModifier(String modifier) {
159
        this.modifier = modifier;
160
    }
123 161
}

+ 7 - 0
src/main/webapp/WEB-INF/web.xml

@ -26,4 +26,11 @@
26 26
        <servlet-name>ajax</servlet-name>
27 27
        <url-pattern>/ajax/*</url-pattern>
28 28
    </servlet-mapping>
29
    <session-config>
30
        <cookie-config>
31
            <name>JSES_MS_F</name>
32
            <http-only>true</http-only>
33
            <path>/</path>
34
        </cookie-config>
35
    </session-config>
29 36
</web-app>