XMTT 5 years ago
commit
c15a05674a
23 changed files with 2236 additions and 0 deletions
  1. 4 0
      .gitignore
  2. 84 0
      pom.xml
  3. 35 0
      src/main/java/com/ekexiu/project/msconsole/base/po/BaseTable.java
  4. 140 0
      src/main/java/com/ekexiu/project/msconsole/department/Department.java
  5. 52 0
      src/main/java/com/ekexiu/project/msconsole/department/DepartmentDao.java
  6. 78 0
      src/main/java/com/ekexiu/project/msconsole/department/DepartmentService.java
  7. 194 0
      src/main/java/com/ekexiu/project/msconsole/doctor/Doctor.java
  8. 54 0
      src/main/java/com/ekexiu/project/msconsole/doctor/DoctorDao.java
  9. 80 0
      src/main/java/com/ekexiu/project/msconsole/doctor/DoctorService.java
  10. 160 0
      src/main/java/com/ekexiu/project/msconsole/instrument/Instrument.java
  11. 48 0
      src/main/java/com/ekexiu/project/msconsole/instrument/InstrumentDao.java
  12. 72 0
      src/main/java/com/ekexiu/project/msconsole/instrument/InstrumentService.java
  13. 45 0
      src/main/java/com/ekexiu/project/msconsole/system/dao/DictDao.java
  14. 63 0
      src/main/java/com/ekexiu/project/msconsole/system/dao/HospitalDao.java
  15. 106 0
      src/main/java/com/ekexiu/project/msconsole/system/po/DictItem.java
  16. 197 0
      src/main/java/com/ekexiu/project/msconsole/system/po/Hospital.java
  17. 277 0
      src/main/java/com/ekexiu/project/msconsole/system/service/CommonUtilService.java
  18. 161 0
      src/main/java/com/ekexiu/project/msconsole/system/service/SysService.java
  19. 123 0
      src/main/java/com/ekexiu/project/msconsole/system/vo/SessionUser.java
  20. 42 0
      src/main/java/com/ekexiu/project/msconsole/system/vo/UploadFile.java
  21. 155 0
      src/main/resources/database.sql
  22. 37 0
      src/main/resources/project.properties
  23. 29 0
      src/main/webapp/WEB-INF/web.xml

+ 4 - 0
.gitignore

@ -0,0 +1,4 @@
1
# Created by .ignore support plugin (hsz.mobi)
2
.idea
3
medical-share-console.iml
4
target

+ 84 - 0
pom.xml

@ -0,0 +1,84 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0"
3
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
    <modelVersion>4.0.0</modelVersion>
6
7
    <groupId>com.ekexiu</groupId>
8
    <artifactId>medical-share-console</artifactId>
9
    <version>1.0-SNAPSHOT</version>
10
    <packaging>war</packaging>
11
12
    <properties>
13
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14
        <maven.compiler.source>1.7</maven.compiler.source>
15
        <maven.compiler.target>1.7</maven.compiler.target>
16
        <maven.war.filteringDeploymentDescriptors>true</maven.war.filteringDeploymentDescriptors>
17
        <maven.tomcat.path>/</maven.tomcat.path>
18
    </properties>
19
    <dependencies>
20
    <dependency>
21
        <groupId>org.postgresql</groupId>
22
        <artifactId>postgresql</artifactId>
23
        <version>9.4.1207.jre7</version>
24
    </dependency>
25
    <dependency>
26
        <groupId>org.jfw</groupId>
27
        <artifactId>jfwApt</artifactId>
28
        <version>0.0.2-SNAPSHOT</version>
29
        <optional>true</optional>
30
    </dependency>
31
    <dependency>
32
        <groupId>org.jfw</groupId>
33
        <artifactId>jfwAptOrm</artifactId>
34
        <version>0.0.2-SNAPSHOT</version>
35
        <optional>true</optional>
36
    </dependency>
37
    <dependency>
38
        <groupId>org.jfw</groupId>
39
        <artifactId>jfwAptWeb</artifactId>
40
        <version>0.0.2-SNAPSHOT</version>
41
        <optional>true</optional>
42
    </dependency>
43
    <dependency>
44
        <groupId>org.jfw</groupId>
45
        <artifactId>jfwUtil</artifactId>
46
        <version>0.0.2-SNAPSHOT</version>
47
    </dependency>
48
    <dependency>
49
        <groupId>org.jfw</groupId>
50
        <artifactId>jfwWebUtil</artifactId>
51
        <version>0.0.2-SNAPSHOT</version>
52
    </dependency>
53
    <dependency>
54
        <groupId>javax.servlet</groupId>
55
        <artifactId>servlet-api</artifactId>
56
        <scope>provided</scope>
57
        <version>2.5</version>
58
    </dependency>
59
    <dependency>
60
        <groupId>com.alibaba</groupId>
61
        <artifactId>druid</artifactId>
62
        <version>1.0.20</version>
63
    </dependency>
64
    </dependencies>
65
    <build>
66
        <plugins>
67
            <plugin>
68
                <groupId>org.mortbay.jetty</groupId>
69
                <artifactId>jetty-maven-plugin</artifactId>
70
                <version>8.1.0.RC5</version>
71
                <configuration>
72
                    <stopPort>9966</stopPort>
73
                    <stopKey>foo</stopKey>
74
                    <webAppConfig>
75
                        <contextPath>/msconsole</contextPath>
76
                    </webAppConfig>
77
                </configuration>
78
            </plugin>
79
        </plugins>
80
        <finalName>msconsole</finalName>
81
    </build>
82
83
84
</project>

+ 35 - 0
src/main/java/com/ekexiu/project/msconsole/base/po/BaseTable.java

@ -0,0 +1,35 @@
1
package com.ekexiu.project.msconsole.base.po;
2
3
import org.jfw.apt.annotation.JfwAptConfig;
4
import org.jfw.apt.orm.annotation.entry.Column;
5
import org.jfw.apt.orm.annotation.entry.VirtualTable;
6
import org.jfw.apt.orm.core.defaultImpl.FixLenStringHandler;
7
import org.jfw.apt.orm.core.enums.DE;
8
9
/**
10
 * Created by TT on 2019/5/30.
11
 */
12
@JfwAptConfig("DB:PostgreSQL")
13
@VirtualTable
14
public interface BaseTable {
15
    @Column(descp = "创建时间(YYYYMMDDHH24MISS)不可修改", handlerClass = FixLenStringHandler.class, dbType = "CHAR(14)", fixSqlValueWithInsert = "TO_CHAR(NOW(),'YYYYMMDDHH24MISS')", insertable = true, nullable = false, queryable = true, renewable = false)
16
    String getCreateTime();
17
18
    void setCreateTime(String createTime);
19
20
    @Column(descp = "最后修改时间(YYYYMMDDHH24MISS),初始值:20000101010101", handlerClass = FixLenStringHandler.class, dbType = "CHAR(14)", fixSqlValueWithInsert = "'20000101010101'", fixSqlValueWithUpdate = "TO_CHAR(NOW(),'YYYYMMDDHH24MISS')", insertable = true, nullable = false, queryable = true, renewable = true)
21
    String getModifyTime();
22
23
    void setModifyTime(String modifyTime);
24
25
    @Column(descp = "创建人ID", value = DE.id_32)
26
    String getCreator();
27
28
    void setCreator(String creator);
29
30
    @Column(descp = "最后修改人ID", value = DE.refid_32)
31
    String getModifier();
32
33
    void setModifier(String modifier);
34
35
}

+ 140 - 0
src/main/java/com/ekexiu/project/msconsole/department/Department.java

@ -0,0 +1,140 @@
1
package com.ekexiu.project.msconsole.department;
2
3
import com.ekexiu.project.msconsole.base.po.BaseTable;
4
import org.jfw.apt.orm.annotation.entry.Column;
5
import org.jfw.apt.orm.annotation.entry.PrimaryKey;
6
import org.jfw.apt.orm.annotation.entry.Table;
7
import org.jfw.apt.orm.core.enums.DE;
8
9
/**
10
 * Created by TT on 2019/5/30.
11
 */
12
@Table(descp = "科室",value = "DEPARTMENT")
13
@PrimaryKey("id")
14
public class Department implements BaseTable {
15
    private String id;
16
    private String hospital;
17
    private String name;
18
    private String type;
19
    private String phone;
20
    private String location;
21
    private String descp;
22
    private boolean active;
23
24
    private String createTime;
25
    private String modifyTime;
26
    private String creator;
27
    private String modifier;
28
29
    @Column(descp = "科室ID", value = DE.id_32)
30
    public String getId() {
31
        return id;
32
    }
33
34
    public void setId(String id) {
35
        this.id = id;
36
    }
37
38
    @Column(descp = "所属医院ID", value = DE.id_32)
39
    public String getHospital() {
40
        return hospital;
41
    }
42
43
    public void setHospital(String hospital) {
44
        this.hospital = hospital;
45
    }
46
47
    @Column(descp = "科室名称", value = DE.text_de)
48
    public String getName() {
49
        return name;
50
    }
51
52
    public void setName(String name) {
53
        this.name = name;
54
    }
55
56
    @Column(descp = "科室ID", value = DE.singleChar)
57
    public String getType() {
58
        return type;
59
    }
60
61
    public void setType(String type) {
62
        this.type = type;
63
    }
64
65
    @Column(descp = "科室电话", value = DE.Text_de)
66
    public String getPhone() {
67
        return phone;
68
    }
69
70
    public void setPhone(String phone) {
71
        this.phone = phone;
72
    }
73
74
    @Column(descp = "科室地址", value = DE.Text_de)
75
    public String getLocation() {
76
        return location;
77
    }
78
79
    public void setLocation(String location) {
80
        this.location = location;
81
    }
82
83
    @Column(descp = "科室简介", value = DE.Text_de)
84
    public String getDescp() {
85
        return descp;
86
    }
87
88
    public void setDescp(String descp) {
89
        this.descp = descp;
90
    }
91
92
    @Column(descp = "是否可用", value = DE.boolean_de)
93
    public boolean isActive() {
94
        return active;
95
    }
96
97
    public void setActive(boolean active) {
98
        this.active = active;
99
    }
100
101
    @Override
102
    public String getCreateTime() {
103
        return createTime;
104
    }
105
106
    @Override
107
    public void setCreateTime(String createTime) {
108
        this.createTime = createTime;
109
    }
110
111
    @Override
112
    public String getModifyTime() {
113
        return modifyTime;
114
    }
115
116
    @Override
117
    public void setModifyTime(String modifyTime) {
118
        this.modifyTime = modifyTime;
119
    }
120
121
    @Override
122
    public String getCreator() {
123
        return creator;
124
    }
125
126
    @Override
127
    public void setCreator(String creator) {
128
        this.creator = creator;
129
    }
130
131
    @Override
132
    public String getModifier() {
133
        return modifier;
134
    }
135
136
    @Override
137
    public void setModifier(String modifier) {
138
        this.modifier = modifier;
139
    }
140
}

+ 52 - 0
src/main/java/com/ekexiu/project/msconsole/department/DepartmentDao.java

@ -0,0 +1,52 @@
1
package com.ekexiu.project.msconsole.department;
2
3
import org.jfw.apt.annotation.Nullable;
4
import org.jfw.apt.orm.annotation.dao.DAO;
5
import org.jfw.apt.orm.annotation.dao.method.Exclude;
6
import org.jfw.apt.orm.annotation.dao.method.From;
7
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
8
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
9
import org.jfw.apt.orm.annotation.dao.method.Where;
10
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
11
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
12
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
13
import org.jfw.apt.orm.annotation.dao.method.operator.Update;
14
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
15
import org.jfw.apt.orm.annotation.dao.param.Like;
16
import org.jfw.apt.orm.annotation.dao.param.Set;
17
import org.jfw.util.PageQueryResult;
18
19
import java.sql.Connection;
20
import java.sql.SQLException;
21
22
/**
23
 * Created by TT on 2019/5/30.
24
 */
25
@DAO
26
public interface DepartmentDao {
27
28
    @Insert
29
    int insert(Connection con, Department department) throws SQLException;
30
31
    @Update
32
    @Exclude({"active"})
33
    int update(Connection con, Department department) throws SQLException;
34
35
    @UpdateWith
36
    @From(Department.class)
37
    @Where("ACTIVE ='1'")
38
    @SetSentence("ACTIVE ='0'")
39
    int ban(Connection con, String id, @Set String modifier) throws SQLException;
40
41
    @Nullable
42
    @SelectOne
43
    Department query(Connection con, String id) throws SQLException;
44
45
    @PageSelect
46
    @OrderBy("ORDER BY CREATE_TIME DESC")
47
    PageQueryResult<Department> pageQuery(Connection con,String hospital, @Nullable Boolean active, @Nullable @Like String name, int pageSize, int pageNo) throws SQLException;
48
49
    @Nullable
50
    @SelectOne
51
    Department queryByName(Connection con,String hospital, String name) throws SQLException;
52
}

+ 78 - 0
src/main/java/com/ekexiu/project/msconsole/department/DepartmentService.java

@ -0,0 +1,78 @@
1
package com.ekexiu.project.msconsole.department;
2
3
import com.ekexiu.project.msconsole.system.vo.SessionUser;
4
import org.jfw.apt.annotation.Autowrie;
5
import org.jfw.apt.annotation.Nullable;
6
import org.jfw.apt.web.annotation.LoginUser;
7
import org.jfw.apt.web.annotation.Path;
8
import org.jfw.apt.web.annotation.operate.Get;
9
import org.jfw.apt.web.annotation.operate.Post;
10
import org.jfw.apt.web.annotation.param.JdbcConn;
11
import org.jfw.util.PageQueryResult;
12
import org.jfw.util.StringUtil;
13
14
import java.sql.Connection;
15
import java.sql.SQLException;
16
17
/**
18
 * Created by TT on 2019/5/30.
19
 */
20
@Path("/department")
21
public class DepartmentService {
22
23
    @Autowrie
24
    private DepartmentDao departmentDao;
25
26
    public DepartmentDao getDepartmentDao() {
27
        return departmentDao;
28
    }
29
30
    public void setDepartmentDao(DepartmentDao departmentDao) {
31
        this.departmentDao = departmentDao;
32
    }
33
34
    @Path
35
    @Post
36
    public String insert(@JdbcConn(true) Connection con, @LoginUser SessionUser sessionUser, Department department) throws SQLException {
37
        String id = StringUtil.buildUUID();
38
        department.setId(id);
39
        department.setActive(true);
40
        department.setHospital(sessionUser.getId());
41
        department.setCreator(sessionUser.getId());
42
        department.setModifier(sessionUser.getId());
43
        departmentDao.insert(con, department);
44
        return id;
45
    }
46
47
    @Path("/update")
48
    @Post
49
    public void update(@JdbcConn(true) Connection con, @LoginUser SessionUser sessionUser, Department department) throws SQLException {
50
        department.setModifier(sessionUser.getId());
51
        departmentDao.update(con, department);
52
    }
53
54
    @Path("/qo")
55
    @Get
56
    public Department query(@JdbcConn Connection con, String id) throws SQLException {
57
        return departmentDao.query(con, id);
58
    }
59
60
    @Path("/ban")
61
    @Get
62
    public void ban(@JdbcConn(true) Connection con, String id, @LoginUser SessionUser sessionUser) throws SQLException {
63
        departmentDao.ban(con, id, sessionUser.getId());
64
    }
65
66
    @Path("/pq")
67
    @Get
68
    public PageQueryResult<Department> pageQuery(@JdbcConn Connection con,@LoginUser SessionUser user, @Nullable Boolean active, @Nullable String name, int pageSize, int pageNo) throws SQLException {
69
        return departmentDao.pageQuery(con,user.getId(), active, name == null ? null : "%" + name + "%", pageSize, pageNo);
70
    }
71
72
    @Path("/checkName")
73
    @Get
74
    public Department queryByName(@JdbcConn Connection con,@LoginUser SessionUser user, String name)throws SQLException {
75
        return departmentDao.queryByName(con, user.getId(), name);
76
    }
77
78
}

+ 194 - 0
src/main/java/com/ekexiu/project/msconsole/doctor/Doctor.java

@ -0,0 +1,194 @@
1
package com.ekexiu.project.msconsole.doctor;
2
3
import com.ekexiu.project.msconsole.base.po.BaseTable;
4
import org.jfw.apt.orm.annotation.entry.Column;
5
import org.jfw.apt.orm.annotation.entry.PrimaryKey;
6
import org.jfw.apt.orm.annotation.entry.Table;
7
import org.jfw.apt.orm.annotation.entry.Unique;
8
import org.jfw.apt.orm.annotation.entry.Uniques;
9
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
10
import org.jfw.apt.orm.core.enums.DE;
11
12
/**
13
 * Created by TT on 2019/5/30.
14
 */
15
@Table(descp = "医生", value = "DOCTOR")
16
@PrimaryKey("id")
17
@Uniques({@Unique(clolumns = "account", name = "UC_DOCTOR_ACCOUNT")})
18
public class Doctor implements BaseTable {
19
    private String id;
20
    private String hospital;
21
    private String department;
22
    private String account;
23
    private String name;
24
    private String clinicalTitle;
25
    private String teachTitle;
26
    private String position;
27
    private String direction;
28
    private String image;
29
    private String descp;
30
    private boolean active;
31
    private String passwd;
32
33
    private String createTime;
34
    private String modifyTime;
35
    private String creator;
36
    private String modifier;
37
38
    @Column(descp = "医生ID", value = DE.id_32)
39
    public String getId() {
40
        return id;
41
    }
42
43
    public void setId(String id) {
44
        this.id = id;
45
    }
46
47
    @Column(descp = "医院ID", value = DE.id_32)
48
    public String getHospital() {
49
        return hospital;
50
    }
51
52
    public void setHospital(String hospital) {
53
        this.hospital = hospital;
54
    }
55
56
    @Column(descp = "医院ID", value = DE.REFID_32)
57
    public String getDepartment() {
58
        return department;
59
    }
60
61
    public void setDepartment(String department) {
62
        this.department = department;
63
    }
64
65
    @Column(descp = "帐号", value = DE.text_de)
66
    public String getAccount() {
67
        return account;
68
    }
69
70
    public void setAccount(String account) {
71
        this.account = account;
72
    }
73
74
    @Column(descp = "医生姓名", value = DE.text_de)
75
    public String getName() {
76
        return name;
77
    }
78
79
    public void setName(String name) {
80
        this.name = name;
81
    }
82
83
    @Column(descp = "临床职称", value = DE.Text_de)
84
    public String getClinicalTitle() {
85
        return clinicalTitle;
86
    }
87
88
    public void setClinicalTitle(String clinicalTitle) {
89
        this.clinicalTitle = clinicalTitle;
90
    }
91
92
    @Column(descp = "教学职称", value = DE.Text_de)
93
    public String getTeachTitle() {
94
        return teachTitle;
95
    }
96
97
    public void setTeachTitle(String teachTitle) {
98
        this.teachTitle = teachTitle;
99
    }
100
101
    @Column(descp = "行政职务", value = DE.Text_de)
102
    public String getPosition() {
103
        return position;
104
    }
105
106
    public void setPosition(String position) {
107
        this.position = position;
108
    }
109
110
    @Column(descp = "擅长方向", value = DE.Text_de)
111
    public String getDirection() {
112
        return direction;
113
    }
114
115
    public void setDirection(String direction) {
116
        this.direction = direction;
117
    }
118
119
    @Column(descp = "图片", value = DE.String_de)
120
    public String getImage() {
121
        return image;
122
    }
123
124
    public void setImage(String image) {
125
        this.image = image;
126
    }
127
128
    @Column(descp = "个人简介", value = DE.Text_de)
129
    public String getDescp() {
130
        return descp;
131
    }
132
133
    public void setDescp(String descp) {
134
        this.descp = descp;
135
    }
136
137
    @Column(descp = "是否可用", value = DE.boolean_de)
138
    public boolean isActive() {
139
        return active;
140
    }
141
142
    public void setActive(boolean active) {
143
        this.active = active;
144
    }
145
146
    @Column(descp = "密码(MD5)", queryable = false, handlerClass = StringHandler.class, dbType = "TEXT")
147
    public String getPasswd() {
148
        return passwd;
149
    }
150
151
    public void setPasswd(String passwd) {
152
        this.passwd = passwd;
153
    }
154
155
    @Override
156
    public String getCreateTime() {
157
        return createTime;
158
    }
159
160
    @Override
161
    public void setCreateTime(String createTime) {
162
        this.createTime = createTime;
163
    }
164
165
    @Override
166
    public String getModifyTime() {
167
        return modifyTime;
168
    }
169
170
    @Override
171
    public void setModifyTime(String modifyTime) {
172
        this.modifyTime = modifyTime;
173
    }
174
175
    @Override
176
    public String getCreator() {
177
        return creator;
178
    }
179
180
    @Override
181
    public void setCreator(String creator) {
182
        this.creator = creator;
183
    }
184
185
    @Override
186
    public String getModifier() {
187
        return modifier;
188
    }
189
190
    @Override
191
    public void setModifier(String modifier) {
192
        this.modifier = modifier;
193
    }
194
}

+ 54 - 0
src/main/java/com/ekexiu/project/msconsole/doctor/DoctorDao.java

@ -0,0 +1,54 @@
1
package com.ekexiu.project.msconsole.doctor;
2
3
import org.jfw.apt.annotation.Nullable;
4
import org.jfw.apt.orm.annotation.dao.DAO;
5
import org.jfw.apt.orm.annotation.dao.method.Exclude;
6
import org.jfw.apt.orm.annotation.dao.method.From;
7
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
8
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
9
import org.jfw.apt.orm.annotation.dao.method.Where;
10
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
11
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
12
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
13
import org.jfw.apt.orm.annotation.dao.method.operator.Update;
14
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
15
import org.jfw.apt.orm.annotation.dao.param.Like;
16
import org.jfw.apt.orm.annotation.dao.param.Set;
17
import org.jfw.apt.orm.annotation.dao.param.SqlColumn;
18
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
19
import org.jfw.util.PageQueryResult;
20
21
import java.sql.Connection;
22
import java.sql.SQLException;
23
24
/**
25
 * Created by TT on 2019/5/30.
26
 */
27
@DAO
28
public interface DoctorDao {
29
30
    @Insert
31
    int insert(Connection con, Doctor doctor) throws SQLException;
32
33
    @Update
34
    @Exclude({"active", "passwd"})
35
    int update(Connection con, Doctor doctor) throws SQLException;
36
37
    @UpdateWith
38
    @From(Doctor.class)
39
    @Where("ACTIVE ='1'")
40
    @SetSentence("ACTIVE ='0'")
41
    int ban(Connection con, String id, @Set String modifier) throws SQLException;
42
43
    @SelectOne
44
    @Nullable
45
    Doctor query(Connection con, String id) throws SQLException;
46
47
    @PageSelect
48
    @OrderBy("ORDER BY CREATE_TIME DESC")
49
    PageQueryResult<Doctor> pageQuery(Connection con, String hospital, @Nullable boolean active, @Nullable @Like String name, @Nullable @SqlColumn(handlerClass = StringHandler.class, value = "ID IN (SELECT ID FROM DEPARTMENT WHERE NAME LIKE ?)") String department, int pageSize, int pageNo) throws SQLException;
50
51
    @Nullable
52
    @SelectOne
53
    Doctor queryByAccount(Connection con, String account) throws SQLException;
54
}

+ 80 - 0
src/main/java/com/ekexiu/project/msconsole/doctor/DoctorService.java

@ -0,0 +1,80 @@
1
package com.ekexiu.project.msconsole.doctor;
2
3
4
import com.ekexiu.project.msconsole.system.vo.SessionUser;
5
import org.jfw.apt.annotation.Autowrie;
6
import org.jfw.apt.annotation.Nullable;
7
import org.jfw.apt.web.annotation.LoginUser;
8
import org.jfw.apt.web.annotation.Path;
9
import org.jfw.apt.web.annotation.operate.Get;
10
import org.jfw.apt.web.annotation.operate.Post;
11
import org.jfw.apt.web.annotation.param.JdbcConn;
12
import org.jfw.util.PageQueryResult;
13
import org.jfw.util.StringUtil;
14
15
import java.sql.Connection;
16
import java.sql.SQLException;
17
18
/**
19
 * Created by TT on 2019/5/30.
20
 */
21
22
23
@Path("/doctor")
24
public class DoctorService {
25
26
    @Autowrie
27
    private DoctorDao doctorDao;
28
29
    public DoctorDao getDoctorDao() {
30
        return doctorDao;
31
    }
32
33
    public void setDoctorDao(DoctorDao doctorDao) {
34
        this.doctorDao = doctorDao;
35
    }
36
37
    @Post
38
    @Path
39
    public String insert(@JdbcConn(true)Connection con, @LoginUser SessionUser user,Doctor doctor)throws SQLException {
40
        String id = StringUtil.buildUUID();
41
        doctor.setId(id);
42
        doctor.setActive(true);
43
        doctor.setCreator(user.getId());
44
        doctor.setModifier(user.getId());
45
        doctor.setHospital(user.getId());
46
        doctorDao.insert(con, doctor);
47
        return id;
48
    }
49
50
    @Post
51
    @Path("/update")
52
    public void update(@JdbcConn(true)Connection con,@LoginUser SessionUser user,Doctor doctor)throws SQLException {
53
        doctor.setModifier(user.getId());
54
        doctorDao.update(con, doctor);
55
    }
56
57
    @Get
58
    @Path("/qo")
59
    public Doctor query(@JdbcConn Connection con,String id)throws SQLException {
60
        return doctorDao.query(con, id);
61
    }
62
63
    @Get
64
    @Path("/pq")
65
    public PageQueryResult<Doctor> pageQuery(@JdbcConn Connection con, String hospital, @Nullable Boolean active,@Nullable String name,@Nullable String department,int pageSize,int pageNo)throws SQLException {
66
        return doctorDao.pageQuery(con, hospital, active, name == null ? null : "%" + name + "%", department == null ? null : "%" + department + "%", pageSize, pageNo);
67
    }
68
69
    @Get
70
    @Path("/ban")
71
    public void ban(@JdbcConn(true)Connection con,@LoginUser SessionUser user, String id)throws SQLException {
72
        doctorDao.ban(con, id, user.getId());
73
    }
74
75
    @Get
76
    @Path("/check")
77
    public Doctor queryByAccount(@JdbcConn Connection con,String account)throws SQLException {
78
        return doctorDao.queryByAccount(con, account);
79
    }
80
}

+ 160 - 0
src/main/java/com/ekexiu/project/msconsole/instrument/Instrument.java

@ -0,0 +1,160 @@
1
package com.ekexiu.project.msconsole.instrument;
2
3
import com.ekexiu.project.msconsole.base.po.BaseTable;
4
import org.jfw.apt.orm.annotation.entry.Column;
5
import org.jfw.apt.orm.annotation.entry.PrimaryKey;
6
import org.jfw.apt.orm.annotation.entry.Table;
7
import org.jfw.apt.orm.core.enums.DE;
8
9
/**
10
 * Created by TT on 2019/5/30.
11
 */
12
@Table(descp = "器械表", value = "INSTRUMENT")
13
@PrimaryKey("id")
14
public class Instrument implements BaseTable {
15
    private String id;
16
    private String name;
17
    private String status;
18
    private String department;
19
    private String hospital;
20
    private String spec;
21
    private String application;
22
    private String descp;
23
    private String image;
24
    private boolean active;
25
26
    private String createTime;
27
    private String modifyTime;
28
    private String creator;
29
    private String modifier;
30
31
    @Column(descp = "器械ID", value = DE.id_32)
32
    public String getId() {
33
        return id;
34
    }
35
36
    public void setId(String id) {
37
        this.id = id;
38
    }
39
40
    @Column(descp = "器械名称", value = DE.text_de)
41
    public String getName() {
42
        return name;
43
    }
44
45
    public void setName(String name) {
46
        this.name = name;
47
    }
48
49
    @Column(descp = "器械状态", value = DE.singleChar)
50
    public String getStatus() {
51
        return status;
52
    }
53
54
    public void setStatus(String status) {
55
        this.status = status;
56
    }
57
58
    @Column(descp = "所属科室", value = DE.REFID_32)
59
    public String getDepartment() {
60
        return department;
61
    }
62
63
    public void setDepartment(String department) {
64
        this.department = department;
65
    }
66
67
    @Column(descp = "所属医院", value = DE.id_32)
68
    public String getHospital() {
69
        return hospital;
70
    }
71
72
    public void setHospital(String hospital) {
73
        this.hospital = hospital;
74
    }
75
76
    @Column(descp = "厂商型号", value = DE.Text_de)
77
    public String getSpec() {
78
        return spec;
79
    }
80
81
    public void setSpec(String spec) {
82
        this.spec = spec;
83
    }
84
85
    @Column(descp = "功能用途", value = DE.Text_de)
86
    public String getApplication() {
87
        return application;
88
    }
89
90
    public void setApplication(String application) {
91
        this.application = application;
92
    }
93
94
    @Column(descp = "器械简介", value = DE.Text_de)
95
    public String getDescp() {
96
        return descp;
97
    }
98
99
    public void setDescp(String descp) {
100
        this.descp = descp;
101
    }
102
103
    @Column(descp = "器械图片", value = DE.Text_de)
104
    public String getImage() {
105
        return image;
106
    }
107
108
    public void setImage(String image) {
109
        this.image = image;
110
    }
111
112
    @Column(descp = "是否可用", value = DE.boolean_de)
113
    public boolean isActive() {
114
        return active;
115
    }
116
117
    public void setActive(boolean active) {
118
        this.active = active;
119
    }
120
121
    @Override
122
    public String getCreateTime() {
123
        return createTime;
124
    }
125
126
    @Override
127
    public void setCreateTime(String createTime) {
128
        this.createTime = createTime;
129
    }
130
131
    @Override
132
    public String getModifyTime() {
133
        return modifyTime;
134
    }
135
136
    @Override
137
    public void setModifyTime(String modifyTime) {
138
        this.modifyTime = modifyTime;
139
    }
140
141
    @Override
142
    public String getCreator() {
143
        return creator;
144
    }
145
146
    @Override
147
    public void setCreator(String creator) {
148
        this.creator = creator;
149
    }
150
151
    @Override
152
    public String getModifier() {
153
        return modifier;
154
    }
155
156
    @Override
157
    public void setModifier(String modifier) {
158
        this.modifier = modifier;
159
    }
160
}

+ 48 - 0
src/main/java/com/ekexiu/project/msconsole/instrument/InstrumentDao.java

@ -0,0 +1,48 @@
1
package com.ekexiu.project.msconsole.instrument;
2
3
import org.jfw.apt.annotation.Nullable;
4
import org.jfw.apt.orm.annotation.dao.DAO;
5
import org.jfw.apt.orm.annotation.dao.method.Exclude;
6
import org.jfw.apt.orm.annotation.dao.method.From;
7
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
8
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
9
import org.jfw.apt.orm.annotation.dao.method.Where;
10
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
11
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
12
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
13
import org.jfw.apt.orm.annotation.dao.method.operator.Update;
14
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
15
import org.jfw.apt.orm.annotation.dao.param.Like;
16
import org.jfw.apt.orm.annotation.dao.param.Set;
17
import org.jfw.util.PageQueryResult;
18
19
import java.sql.Connection;
20
import java.sql.SQLException;
21
22
/**
23
 * Created by TT on 2019/5/30.
24
 */
25
@DAO
26
public interface InstrumentDao {
27
28
    @Insert
29
    int insert(Connection con, Instrument instrument) throws SQLException;
30
31
    @Update
32
    @Exclude({"active"})
33
    int update(Connection con, Instrument instrument) throws SQLException;
34
35
    @UpdateWith
36
    @From(Instrument.class)
37
    @Where("ACTIVE ='1'")
38
    @SetSentence("ACTIVE ='0'")
39
    int ban(Connection con, String id, @Set String modifier) throws SQLException;
40
41
    @Nullable
42
    @SelectOne
43
    Instrument query(Connection con, String id) throws SQLException;
44
45
    @PageSelect
46
    @OrderBy("ORDER BY CREATE_TIME DESC")
47
    PageQueryResult<Instrument> pageQuery(Connection con, String hospital, @Nullable Boolean active, @Nullable @Like String name, @Nullable String status, int pageSize, int pageNo) throws SQLException;
48
}

+ 72 - 0
src/main/java/com/ekexiu/project/msconsole/instrument/InstrumentService.java

@ -0,0 +1,72 @@
1
package com.ekexiu.project.msconsole.instrument;
2
3
import com.ekexiu.project.msconsole.system.vo.SessionUser;
4
import org.jfw.apt.annotation.Autowrie;
5
import org.jfw.apt.annotation.Nullable;
6
import org.jfw.apt.web.annotation.LoginUser;
7
import org.jfw.apt.web.annotation.Path;
8
import org.jfw.apt.web.annotation.operate.Get;
9
import org.jfw.apt.web.annotation.operate.Post;
10
import org.jfw.apt.web.annotation.param.JdbcConn;
11
import org.jfw.util.PageQueryResult;
12
import org.jfw.util.StringUtil;
13
14
import java.sql.Connection;
15
import java.sql.SQLException;
16
17
/**
18
 * Created by TT on 2019/5/30.
19
 */
20
@Path("/instrument")
21
public class InstrumentService {
22
23
    @Autowrie
24
    private InstrumentDao instrumentDao;
25
26
    public InstrumentDao getInstrumentDao() {
27
        return instrumentDao;
28
    }
29
30
    public void setInstrumentDao(InstrumentDao instrumentDao) {
31
        this.instrumentDao = instrumentDao;
32
    }
33
34
    @Path
35
    @Post
36
    public String insert(@JdbcConn(true) Connection con, @LoginUser SessionUser sessionUser, Instrument instrument) throws SQLException {
37
        String id = StringUtil.buildUUID();
38
        instrument.setId(id);
39
        instrument.setActive(true);
40
        instrument.setHospital(sessionUser.getId());
41
        instrument.setCreator(sessionUser.getId());
42
        instrument.setModifier(sessionUser.getId());
43
        instrumentDao.insert(con, instrument);
44
        return id;
45
    }
46
47
    @Path("/update")
48
    @Post
49
    public void update(@JdbcConn(true) Connection con, @LoginUser SessionUser sessionUser, Instrument instrument) throws SQLException {
50
        instrument.setModifier(sessionUser.getId());
51
        instrumentDao.update(con, instrument);
52
    }
53
54
    @Path("/qo")
55
    @Get
56
    public Instrument query(@JdbcConn Connection con, String id) throws SQLException {
57
        return instrumentDao.query(con, id);
58
    }
59
60
    @Path("/ban")
61
    @Get
62
    public void ban(@JdbcConn(true) Connection con, String id, @LoginUser SessionUser sessionUser) throws SQLException {
63
        instrumentDao.ban(con, id, sessionUser.getId());
64
    }
65
66
    @Path("/pq")
67
    @Get
68
    public PageQueryResult<Instrument> pageQuery(@JdbcConn Connection con, @LoginUser SessionUser user, @Nullable Boolean active, @Nullable String name, @Nullable String status, int pageSize, int pageNo) throws SQLException {
69
        return instrumentDao.pageQuery(con, user.getId(), active, name == null ? null : "%" + name + "%", status, pageSize, pageNo);
70
    }
71
72
}

+ 45 - 0
src/main/java/com/ekexiu/project/msconsole/system/dao/DictDao.java

@ -0,0 +1,45 @@
1
package com.ekexiu.project.msconsole.system.dao;
2
3
import com.ekexiu.project.msconsole.system.po.DictItem;
4
import org.jfw.apt.annotation.Nullable;
5
import org.jfw.apt.orm.annotation.dao.DAO;
6
import org.jfw.apt.orm.annotation.dao.method.From;
7
import org.jfw.apt.orm.annotation.dao.method.IncludeFixSet;
8
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
9
import org.jfw.apt.orm.annotation.dao.method.Where;
10
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
11
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
12
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
13
import org.jfw.apt.orm.annotation.dao.param.Set;
14
15
import java.sql.Connection;
16
import java.sql.SQLException;
17
import java.util.List;
18
19
/**
20
 * Created by TT on 2019/5/30.
21
 */
22
@DAO
23
public interface DictDao {
24
25
    @SelectList
26
    List<DictItem> query(Connection con) throws SQLException;
27
28
    @Insert
29
    int insert(Connection con, DictItem dict) throws SQLException;
30
31
    @UpdateWith
32
    @From(DictItem.class)
33
    @Where("ACTIVE = '1' AND READONLY <> '1'")
34
    @SetSentence("ACTIVE='0'")
35
    @IncludeFixSet
36
    int disable(Connection con, String dictCode, String code) throws SQLException;
37
38
39
    @UpdateWith
40
    @From(DictItem.class)
41
    @Where("ACTIVE = '1' AND READONLY <> '1'")
42
    int update(Connection con, @Nullable @Set String bcode, @Set String caption, @Nullable @Set String fullCaption, @Set @Nullable String shortCut,
43
               @Nullable @Set String remark, String code, String dictCode) throws SQLException;
44
45
}

+ 63 - 0
src/main/java/com/ekexiu/project/msconsole/system/dao/HospitalDao.java

@ -0,0 +1,63 @@
1
package com.ekexiu.project.msconsole.system.dao;
2
3
import com.ekexiu.project.msconsole.system.po.Hospital;
4
import org.jfw.apt.annotation.Nullable;
5
import org.jfw.apt.orm.annotation.dao.DAO;
6
import org.jfw.apt.orm.annotation.dao.method.Exclude;
7
import org.jfw.apt.orm.annotation.dao.method.From;
8
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
9
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
10
import org.jfw.apt.orm.annotation.dao.method.Where;
11
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
12
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
13
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
14
import org.jfw.apt.orm.annotation.dao.method.operator.Update;
15
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
16
import org.jfw.apt.orm.annotation.dao.param.Like;
17
import org.jfw.apt.orm.annotation.dao.param.Set;
18
import org.jfw.apt.orm.annotation.dao.param.UnEquals;
19
import org.jfw.util.PageQueryResult;
20
21
import java.sql.Connection;
22
import java.sql.SQLException;
23
24
/**
25
 * Created by TT on 2019/5/30.
26
 */
27
@DAO
28
public interface HospitalDao {
29
30
    @Insert
31
    int insert(Connection con, Hospital hospital) throws SQLException;
32
33
    @Nullable
34
    @SelectOne
35
    Hospital query(Connection con, String id) throws SQLException;
36
37
    @Update
38
    @Exclude({"passwd", "active", "account"})
39
    int update(Connection con, Hospital hospital) throws SQLException;
40
41
    @Nullable
42
    @SelectOne
43
    Hospital login(Connection con, String account, String passwd) throws SQLException;
44
45
    @Nullable
46
    @SelectOne
47
    Hospital queryByAccount(Connection con, String account, @Nullable @UnEquals String id) throws SQLException;
48
49
    @UpdateWith
50
    @From(Hospital.class)
51
    @Where("ACTIVE ='1'")
52
    @SetSentence("ACTIVE ='0'")
53
    int ban(Connection con, String id, @Set String modifier) throws SQLException;
54
55
    @UpdateWith
56
    @From(Hospital.class)
57
    int changePw(Connection con, @Set String passwd, String id) throws SQLException;
58
59
    @PageSelect
60
    @OrderBy("ORDER BY CREATE_TIME DESC")
61
    PageQueryResult<Hospital> pageQuery(Connection con, @Nullable Boolean active, @Nullable String level, @Nullable String subLevel, @Nullable String type, @Nullable @Like String name, int pageSize,
62
                                        int pageNo) throws SQLException;
63
}

+ 106 - 0
src/main/java/com/ekexiu/project/msconsole/system/po/DictItem.java

@ -0,0 +1,106 @@
1
package com.ekexiu.project.msconsole.system.po;
2
3
import org.jfw.apt.orm.annotation.entry.Column;
4
import org.jfw.apt.orm.annotation.entry.PrimaryKey;
5
import org.jfw.apt.orm.annotation.entry.Table;
6
import org.jfw.apt.orm.core.enums.DE;
7
8
/**
9
 * Created by TT on 2019/5/30.
10
 */
11
@PrimaryKey({"dictCode", "code"})
12
@Table(descp = "数据字典表", value = "SYS_DICT")
13
public class DictItem {
14
    private String code;
15
    private String dictCode;
16
    private String bcode;
17
    private String caption;
18
    private String fullCaption;
19
    private String shortCut;
20
    private String remark;
21
    private boolean readonly;
22
    private boolean active;
23
24
    @Column(descp = "字典项编码", value = DE.rtext_de)
25
    public String getCode() {
26
        return code;
27
    }
28
29
    public void setCode(String code) {
30
        this.code = code;
31
    }
32
33
    @Column(descp = "字典项编码(业务编码)", value = DE.Text_de)
34
    public String getBcode() {
35
        return bcode;
36
    }
37
38
    public void setBcode(String bcode) {
39
        this.bcode = bcode;
40
    }
41
42
    @Column(descp = "字典编码", value = DE.rtext_de)
43
    public String getDictCode() {
44
        return dictCode;
45
    }
46
47
    public void setDictCode(String dictCode) {
48
        this.dictCode = dictCode;
49
    }
50
51
    @Column(descp = "字典项显示", value = DE.text_de)
52
    public String getCaption() {
53
        return caption;
54
    }
55
56
    public void setCaption(String caption) {
57
        this.caption = caption;
58
    }
59
60
    @Column(descp = "字典项显示(全)", value = DE.Text_de)
61
    public String getFullCaption() {
62
        return fullCaption;
63
    }
64
65
    public void setFullCaption(String fullCaption) {
66
        this.fullCaption = fullCaption;
67
    }
68
69
    @Column(descp = "助记码", value = DE.Text_de)
70
    public String getShortCut() {
71
        return shortCut;
72
    }
73
74
    public void setShortCut(String shortCut) {
75
        this.shortCut = shortCut;
76
    }
77
78
    @Column(descp = "备注", value = DE.Text_de)
79
    public String getRemark() {
80
        return remark;
81
    }
82
83
    public void setRemark(String remark) {
84
        this.remark = remark;
85
    }
86
87
    @Column(descp = "是否只读", value = DE.boolean_de)
88
    public boolean isReadonly() {
89
        return readonly;
90
    }
91
92
    public void setReadonly(boolean readonly) {
93
        this.readonly = readonly;
94
    }
95
96
    @Column(descp = "是否有效", value = DE.boolean_de)
97
    public boolean isActive() {
98
        return active;
99
    }
100
101
    public void setActive(boolean active) {
102
        this.active = active;
103
    }
104
105
106
}

+ 197 - 0
src/main/java/com/ekexiu/project/msconsole/system/po/Hospital.java

@ -0,0 +1,197 @@
1
package com.ekexiu.project.msconsole.system.po;
2
3
import com.ekexiu.project.msconsole.base.po.BaseTable;
4
import org.jfw.apt.orm.annotation.entry.Column;
5
import org.jfw.apt.orm.annotation.entry.PrimaryKey;
6
import org.jfw.apt.orm.annotation.entry.Table;
7
import org.jfw.apt.orm.annotation.entry.Unique;
8
import org.jfw.apt.orm.annotation.entry.Uniques;
9
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
10
import org.jfw.apt.orm.core.enums.DE;
11
12
/**
13
 * Created by TT on 2019/5/30.
14
 */
15
@Table(descp = "医院登录表", value = "HOSPITAL")
16
@PrimaryKey("id")
17
@Uniques({@Unique(clolumns = "account", name = "UC_HOSPITAL_ACCOUNT")})
18
public class Hospital implements BaseTable {
19
    private String id;
20
    private String passwd;
21
22
    private String account;
23
    private String name;
24
    private String level;
25
    private String subLevel;
26
    private String type;
27
    private String phone;
28
    private String location;
29
    private String addr;
30
    private String descp;
31
    private String image;
32
    private boolean active;
33
34
    private String createTime;
35
    private String modifyTime;
36
    private String creator;
37
    private String modifier;
38
39
40
    @Column(descp = "医院ID", value = DE.id_32)
41
    public String getId() {
42
        return id;
43
    }
44
45
    public void setId(String id) {
46
        this.id = id;
47
    }
48
49
    @Column(descp = "密码(MD5)", queryable = false, handlerClass = StringHandler.class, dbType = "TEXT")
50
    public String getPasswd() {
51
        return passwd;
52
    }
53
54
    public void setPasswd(String passwd) {
55
        this.passwd = passwd;
56
    }
57
58
    @Column(descp = "医院帐号", value = DE.text_de)
59
    public String getAccount() {
60
        return account;
61
    }
62
63
    public void setAccount(String account) {
64
        this.account = account;
65
    }
66
67
    @Column(descp = "医院名称", value = DE.text_de)
68
    public String getName() {
69
        return name;
70
    }
71
72
    public void setName(String name) {
73
        this.name = name;
74
    }
75
76
    @Column(descp = "医院级别", value = DE.singleChar)
77
    public String getLevel() {
78
        return level;
79
    }
80
81
82
    public void setLevel(String level) {
83
        this.level = level;
84
    }
85
86
    @Column(descp = "医院子级别", value = DE.singleChar)
87
    public String getSubLevel() {
88
        return subLevel;
89
    }
90
91
    public void setSubLevel(String subLevel) {
92
        this.subLevel = subLevel;
93
    }
94
95
    @Column(descp = "医院类型", value = DE.singleChar)
96
    public String getType() {
97
        return type;
98
    }
99
100
    public void setType(String type) {
101
        this.type = type;
102
    }
103
104
    @Column(descp = "电话", value = DE.Text_de)
105
    public String getPhone() {
106
        return phone;
107
    }
108
109
    public void setPhone(String phone) {
110
        this.phone = phone;
111
    }
112
113
    @Column(descp = "医院详细地址", value = DE.Text_de)
114
    public String getLocation() {
115
        return location;
116
    }
117
118
    public void setLocation(String location) {
119
        this.location = location;
120
    }
121
122
    @Column(descp = "医院所在城市编码", value = DE.String_de)
123
    public String getAddr() {
124
        return addr;
125
    }
126
127
    public void setAddr(String addr) {
128
        this.addr = addr;
129
    }
130
131
    @Column(descp = "医院简介", value = DE.Text_de)
132
    public String getDescp() {
133
        return descp;
134
    }
135
136
    public void setDescp(String descp) {
137
        this.descp = descp;
138
    }
139
140
    @Column(descp = "医院图片", value = DE.Text_de)
141
    public String getImage() {
142
        return image;
143
    }
144
145
    public void setImage(String image) {
146
        this.image = image;
147
    }
148
149
    @Column(descp = "是否可用", value = DE.boolean_de)
150
    public boolean isActive() {
151
        return active;
152
    }
153
154
    public void setActive(boolean active) {
155
        this.active = active;
156
    }
157
158
    @Override
159
    public String getCreateTime() {
160
        return createTime;
161
    }
162
163
    @Override
164
    public void setCreateTime(String createTime) {
165
        this.createTime = createTime;
166
    }
167
168
    @Override
169
    public String getModifyTime() {
170
        return modifyTime;
171
    }
172
173
    @Override
174
    public void setModifyTime(String modifyTime) {
175
        this.modifyTime = modifyTime;
176
    }
177
178
    @Override
179
    public String getCreator() {
180
        return creator;
181
    }
182
183
    @Override
184
    public void setCreator(String creator) {
185
        this.creator = creator;
186
    }
187
188
    @Override
189
    public String getModifier() {
190
        return modifier;
191
    }
192
193
    @Override
194
    public void setModifier(String modifier) {
195
        this.modifier = modifier;
196
    }
197
}

+ 277 - 0
src/main/java/com/ekexiu/project/msconsole/system/service/CommonUtilService.java

@ -0,0 +1,277 @@
1
package com.ekexiu.project.msconsole.system.service;
2
3
import com.ekexiu.project.msconsole.system.vo.UploadFile;
4
import org.jfw.apt.web.annotation.Path;
5
import org.jfw.apt.web.annotation.operate.Post;
6
import org.jfw.apt.web.annotation.param.Upload;
7
import org.jfw.util.io.IoUtil;
8
import org.jfw.util.web.fileupload.Item;
9
import org.jfw.util.web.fileupload.UploadItemIterator;
10
11
import javax.imageio.ImageIO;
12
import java.awt.*;
13
import java.awt.image.BufferedImage;
14
import java.io.ByteArrayOutputStream;
15
import java.io.File;
16
import java.io.FileOutputStream;
17
import java.io.IOException;
18
import java.io.InputStream;
19
import java.io.OutputStream;
20
import java.util.concurrent.atomic.AtomicInteger;
21
22
@Path
23
public class CommonUtilService {
24
25
    public String rootPath;
26
27
    public static final String JPG = "jpg";
28
29
    private static final AtomicInteger HOSPITAL_FN_IND = new AtomicInteger(1);
30
    private File hospitalPath;
31
32
    private static final AtomicInteger DOCTOR_FN_IDX = new AtomicInteger(1);
33
    private File doctorPath;
34
35
    private static final AtomicInteger INSTRUMENT_FN_IDX = new AtomicInteger(1);
36
    private File instrumentPath;
37
38
    private int headMaxHeight = Integer.MAX_VALUE;
39
40
41
    public String getRootPath() {
42
        return rootPath;
43
    }
44
45
    public void setRootPath(String rootPath) {
46
        this.rootPath = rootPath;
47
    }
48
49
    public File getDoctorPath() {
50
        return doctorPath;
51
    }
52
53
    public void setDoctorPath(File doctorPath) {
54
        this.doctorPath = doctorPath;
55
    }
56
57
    public File getHospitalPath() {
58
        return hospitalPath;
59
    }
60
61
    public void setHospitalPath(File hospitalPath) {
62
        this.hospitalPath = hospitalPath;
63
    }
64
65
    public File getInstrumentPath() {
66
        return instrumentPath;
67
    }
68
69
    public void setInstrumentPath(File instrumentPath) {
70
        this.instrumentPath = instrumentPath;
71
    }
72
73
    public int getHeadMaxHeight() {
74
        return headMaxHeight;
75
    }
76
77
    public void setHeadMaxHeight(int headMaxHeight) {
78
        this.headMaxHeight = headMaxHeight;
79
    }
80
81
    private String normalizeFileName(String fn) {
82
        int index = fn.indexOf('\\');
83
        if (index >= 0) {
84
            fn = fn.substring(fn.lastIndexOf('\\') + 1);
85
        }
86
        index = fn.indexOf('/');
87
        if (index >= 0) {
88
            fn = fn.substring(fn.lastIndexOf('/') + 1);
89
        }
90
        if (fn.length() == 0)
91
            throw new RuntimeException("invalid filename in Multipart/data request");
92
        return fn;
93
    }
94
95
    private UploadFile buildTargetFile(File parentPath, AtomicInteger FN_IDX, String ext) {
96
        StringBuilder sb = new StringBuilder();
97
        sb.append("/").append(System.currentTimeMillis() / (1000 * 60 * 60 * 24));
98
        File path = new File(parentPath, sb.toString());
99
        if (!path.exists()) {
100
            synchronized (this) {
101
                if (!path.mkdirs())
102
                    throw new RuntimeException("mkdir error[" + path + "]");
103
                FN_IDX.set(1);
104
            }
105
        }
106
        File file;
107
        do {
108
            String fn = FN_IDX.toString();
109
            if (ext.isEmpty()) {
110
                file = new File(path, fn);
111
            } else {
112
                file = new File(path, fn + "." + ext);
113
            }
114
            FN_IDX.incrementAndGet();
115
        } while (file.exists());
116
        sb.append("/").append(file.getName());
117
        UploadFile uf = new UploadFile();
118
        uf.setFn(file);
119
        uf.setUri(sb.toString());
120
        return uf;
121
    }
122
123
    private void saveHeadPhoto(InputStream in, UploadFile file) throws IOException {
124
        byte[] buf = new byte[8092];
125
        int w, h, sx1, sx2, sy1, sy2;
126
        int len;
127
        ByteArrayOutputStream of = new ByteArrayOutputStream();
128
        while ((len = in.read(buf)) >= 0) {
129
            if (len > 0) {
130
                of.write(buf, 0, len);
131
            }
132
        }
133
        BufferedImage im = ImageIO.read(in);
134
        if (im == null) {
135
            throw new IOException("unsupported image type");
136
        }
137
        sx1 = 0;
138
        sy1 = 0;
139
        sx2 = w = im.getWidth();
140
        sy2 = h = im.getHeight();
141
        if (w > h) {
142
            sx1 = (w - h) / 2;
143
            sx2 = sx1 + h;
144
            w = h;
145
        } else if (w < h) {
146
            sy1 = (h - w) / 2;
147
            sy2 = sy1 + w;
148
            h = w;
149
        }
150
        if (h > this.headMaxHeight) {
151
            w = h = this.headMaxHeight;
152
        }
153
        BufferedImage newBufferedImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
154
        newBufferedImage.createGraphics().drawImage(im, 0, 0, w, h, sx1, sy1, sx2, sy2, Color.WHITE, null);
155
        OutputStream fos = new FileOutputStream(file.getFn());
156
        try {
157
            ImageIO.write(newBufferedImage, JPG, fos);
158
            fos.flush();
159
            file.setSize(file.getFn().length());
160
        } finally {
161
            IoUtil.close(fos);
162
        }
163
    }
164
165
    @Post
166
    @Path("/hospitalPath/logo")
167
    public UploadFile logoUpload(@Upload UploadItemIterator it) throws IOException {
168
        UploadFile uf = null;
169
        try {
170
            while (it.hasNext()) {
171
                Item item = it.next();
172
                if (!item.isFormField()) {
173
                    String name = normalizeFileName(item.getName());
174
                    int index = name.lastIndexOf('.');
175
                    String ext = index >= 0 ? name.substring(index + 1) : "";
176
                    ext = ext.trim();
177
                    uf = buildTargetFile(this.hospitalPath,HOSPITAL_FN_IND , ext);
178
                    uf.setName(name);
179
                    InputStream in = item.getInputStream();
180
                    try {
181
                        OutputStream fos = new FileOutputStream(uf.getFn());
182
                        try {
183
                            IoUtil.copy(in, fos, false, false);
184
                            fos.flush();
185
                        } finally {
186
                            fos.close();
187
                        }
188
                        uf.setUri(rootPath + "/data/hospital/logo" + uf.getUri());
189
                        return uf;
190
                    } finally {
191
                        in.close();
192
                    }
193
                }
194
            }
195
        } finally {
196
            if (it != null)
197
                it.clean();
198
        }
199
        return uf;
200
    }
201
202
    @Post
203
    @Path("/doctor/image")
204
    public UploadFile articleImageUpload(@Upload UploadItemIterator it) throws IOException {
205
        UploadFile uf = null;
206
        try {
207
            while (it.hasNext()) {
208
                Item item = it.next();
209
                if (!item.isFormField()) {
210
                    String name = normalizeFileName(item.getName());
211
                    int index = name.lastIndexOf('.');
212
                    String ext = index >= 0 ? name.substring(index + 1) : "";
213
                    ext = ext.trim();
214
                    uf = buildTargetFile(this.doctorPath, DOCTOR_FN_IDX, ext);
215
                    uf.setName(name);
216
                    InputStream in = item.getInputStream();
217
                    try {
218
                        OutputStream fos = new FileOutputStream(uf.getFn());
219
                        try {
220
                            IoUtil.copy(in, fos, false, false);
221
                            fos.flush();
222
                        } finally {
223
                            fos.close();
224
                        }
225
                        uf.setUri(rootPath + "/data/doctor/logo" + uf.getUri());
226
                        return uf;
227
                    } finally {
228
                        in.close();
229
                    }
230
                }
231
            }
232
        } finally {
233
            if (it != null)
234
                it.clean();
235
        }
236
        return uf;
237
    }
238
239
    @Post
240
    @Path("/instrument/logo")
241
    public UploadFile productImageUpload(@Upload UploadItemIterator it) throws IOException {
242
        UploadFile uf = null;
243
        try {
244
            while (it.hasNext()) {
245
                Item item = it.next();
246
                if (!item.isFormField()) {
247
                    String name = normalizeFileName(item.getName());
248
                    int index = name.lastIndexOf('.');
249
                    String ext = index >= 0 ? name.substring(index + 1) : "";
250
                    ext = ext.trim();
251
                    uf = buildTargetFile(this.instrumentPath, INSTRUMENT_FN_IDX, ext);
252
                    uf.setName(name);
253
                    InputStream in = item.getInputStream();
254
                    try {
255
                        OutputStream fos = new FileOutputStream(uf.getFn());
256
                        try {
257
                            IoUtil.copy(in, fos, false, false);
258
                            fos.flush();
259
                        } finally {
260
                            fos.close();
261
                        }
262
                        uf.setUri(rootPath + "/data/instrument/logo" + uf.getUri());
263
                        return uf;
264
                    } finally {
265
                        in.close();
266
                    }
267
                }
268
            }
269
        } finally {
270
            if (it != null)
271
                it.clean();
272
        }
273
        return uf;
274
    }
275
276
277
}

+ 161 - 0
src/main/java/com/ekexiu/project/msconsole/system/service/SysService.java

@ -0,0 +1,161 @@
1
package com.ekexiu.project.msconsole.system.service;
2
3
import com.ekexiu.project.msconsole.system.dao.HospitalDao;
4
import com.ekexiu.project.msconsole.system.po.Hospital;
5
import com.ekexiu.project.msconsole.system.vo.SessionUser;
6
import org.jfw.apt.annotation.Autowrie;
7
import org.jfw.apt.annotation.Nullable;
8
import org.jfw.apt.web.annotation.LoginUser;
9
import org.jfw.apt.web.annotation.Path;
10
import org.jfw.apt.web.annotation.method.InvalidSession;
11
import org.jfw.apt.web.annotation.method.SetSession;
12
import org.jfw.apt.web.annotation.operate.Get;
13
import org.jfw.apt.web.annotation.operate.Post;
14
import org.jfw.apt.web.annotation.param.JdbcConn;
15
import org.jfw.util.PageQueryResult;
16
import org.jfw.util.StringUtil;
17
import org.jfw.util.exception.JfwBaseException;
18
19
import java.sql.Connection;
20
import java.sql.SQLException;
21
import java.util.ArrayList;
22
import java.util.List;
23
24
/**
25
 * Created by TT on 2019/5/30.
26
 */
27
@Path("/sys")
28
public class SysService {
29
30
    public static final String DEFAULT_PW_STR = StringUtil.md5("123456");
31
32
    @Autowrie
33
    private HospitalDao hospitalDao;
34
35
    public HospitalDao getHospitalDao() {
36
        return hospitalDao;
37
    }
38
39
    public void setHospitalDao(HospitalDao hospitalDao) {
40
        this.hospitalDao = hospitalDao;
41
    }
42
43
    public static String getDefaultPwStr() {
44
        return DEFAULT_PW_STR;
45
    }
46
47
    @SetSession("/JFW_SESSION_LOGIN_USER=result")
48
    @Path("/login")
49
    @Post
50
    public SessionUser login(@JdbcConn Connection con, String account, String pw) throws SQLException, JfwBaseException {
51
        Hospital hospital = hospitalDao.login(con, account, pw);
52
        if (hospital != null) {
53
            if (!hospital.isActive()) {
54
                throw new JfwBaseException(-60005, "hospital is disabled");
55
            }
56
            return makeSessionUser(hospital);
57
        }
58
        return null;
59
    }
60
61
    @InvalidSession
62
    @Path("/logout")
63
    @Get
64
    public void logout() {
65
    }
66
67
    @Path("/user")
68
    @Get
69
    public SessionUser get(@LoginUser SessionUser user) {
70
        return user;
71
    }
72
73
    @Path("/insert")
74
    @Post
75
    public String insert(@JdbcConn(true) Connection con, @LoginUser SessionUser sessionUser, Hospital hospital) throws SQLException {
76
        String id = StringUtil.buildUUID();
77
        String account;
78
        for (; ; ) {
79
            double random = ((Math.random() * 9 + 1) * 100000);
80
            account = Double.toString(random);
81
            Hospital hospital1 = hospitalDao.queryByAccount(con, account, id);
82
            if (hospital1 == null) {
83
                break;
84
            }
85
        }
86
        hospital.setId(id);
87
        hospital.setAccount(account);
88
        hospital.setActive(true);
89
        hospital.setPasswd(DEFAULT_PW_STR);
90
        hospital.setCreator(sessionUser.getId());
91
        hospital.setModifier(sessionUser.getId());
92
        hospitalDao.insert(con, hospital);
93
        return id;
94
    }
95
96
    @Path("/qo")
97
    @Get
98
    public SessionUser query(@JdbcConn Connection con, String id) throws SQLException {
99
        return makeSessionUser(hospitalDao.query(con, id));
100
    }
101
102
    @Path("/update")
103
    @Post
104
    public void update(@JdbcConn(true) Connection con, @LoginUser SessionUser sessionUser, Hospital hospital) throws SQLException {
105
        hospital.setModifier(sessionUser.getId());
106
        hospitalDao.update(con, hospital);
107
    }
108
109
    @Path("/ban")
110
    @Get
111
    public void ban(@JdbcConn(true) Connection con, @LoginUser SessionUser sessionUser, String id) throws SQLException {
112
        hospitalDao.ban(con, id, sessionUser.getId());
113
    }
114
115
    @Post
116
    @Path("/resetPw")
117
    @LoginUser
118
    public void resetPw(@JdbcConn(true) Connection con,String id)throws SQLException {
119
        this.hospitalDao.changePw(con, DEFAULT_PW_STR, id);
120
    }
121
122
    @Path("/pq")
123
    @Get
124
    public PageQueryResult<SessionUser> pageQuery(@JdbcConn Connection con, @Nullable Boolean active,@Nullable String level,@Nullable String subLevel,@Nullable String type,@Nullable String name,int pageSize,int pageNo)throws SQLException {
125
        PageQueryResult<Hospital> pageQueryResult = hospitalDao.pageQuery(con, active, level, subLevel, type, name == null ? null : "%" + name + "%", pageSize, pageNo);
126
        List<Hospital> hospitals = pageQueryResult.getData();
127
        List<SessionUser> sessionUsers = new ArrayList<>();
128
        if (!hospitals.isEmpty()) {
129
            for (Hospital hospital : hospitals) {
130
                sessionUsers.add(makeSessionUser(hospital));
131
            }
132
            PageQueryResult<SessionUser> ret = new PageQueryResult<>();
133
            ret.setPageNo(pageQueryResult.getPageNo());
134
            ret.setPageSize(pageQueryResult.getPageSize());
135
            ret.setTotal(pageQueryResult.getTotal());
136
            ret.setData(sessionUsers);
137
            return ret;
138
        }
139
        return null;
140
    }
141
142
143
144
145
    private static SessionUser makeSessionUser(Hospital hospital) {
146
        SessionUser sessionUser = new SessionUser();
147
        sessionUser.setAccount(hospital.getAccount());
148
        sessionUser.setName(hospital.getName());
149
        sessionUser.setLevel(hospital.getLevel());
150
        sessionUser.setSubLevel(hospital.getSubLevel());
151
        sessionUser.setId(hospital.getId());
152
        sessionUser.setType(hospital.getType());
153
        sessionUser.setPhone(hospital.getPhone());
154
        sessionUser.setLocation(hospital.getLocation());
155
        sessionUser.setAddr(hospital.getAddr());
156
        sessionUser.setDesc(hospital.getDescp());
157
        sessionUser.setImage(hospital.getImage());
158
        sessionUser.setActive(hospital.isActive());
159
        return sessionUser;
160
    }
161
}

+ 123 - 0
src/main/java/com/ekexiu/project/msconsole/system/vo/SessionUser.java

@ -0,0 +1,123 @@
1
package com.ekexiu.project.msconsole.system.vo;
2
3
import org.jfw.util.auth.AuthUser;
4
5
/**
6
 * Created by TT on 2019/5/30.
7
 */
8
public class SessionUser implements AuthUser {
9
    private String id;
10
    private String account;
11
    private String name;
12
    private String level;
13
    private String subLevel;
14
    private String type;
15
    private String phone;
16
    private String location;
17
    private String addr;
18
    private String desc;
19
    private String image;
20
    private boolean active;
21
22
    @Override
23
    public boolean hasAuthority(int i) {
24
        return false;
25
    }
26
27
    @Override
28
    public String getId() {
29
        return id;
30
    }
31
32
    public void setId(String id) {
33
        this.id = id;
34
    }
35
36
    public String getAccount() {
37
        return account;
38
    }
39
40
    public void setAccount(String account) {
41
        this.account = account;
42
    }
43
44
    public String getName() {
45
        return name;
46
    }
47
48
    public void setName(String name) {
49
        this.name = name;
50
    }
51
52
    public String getLevel() {
53
        return level;
54
    }
55
56
    public void setLevel(String level) {
57
        this.level = level;
58
    }
59
60
    public String getSubLevel() {
61
        return subLevel;
62
    }
63
64
    public void setSubLevel(String subLevel) {
65
        this.subLevel = subLevel;
66
    }
67
68
    public String getType() {
69
        return type;
70
    }
71
72
    public void setType(String type) {
73
        this.type = type;
74
    }
75
76
    public String getPhone() {
77
        return phone;
78
    }
79
80
    public void setPhone(String phone) {
81
        this.phone = phone;
82
    }
83
84
    public String getLocation() {
85
        return location;
86
    }
87
88
    public void setLocation(String location) {
89
        this.location = location;
90
    }
91
92
    public String getAddr() {
93
        return addr;
94
    }
95
96
    public void setAddr(String addr) {
97
        this.addr = addr;
98
    }
99
100
    public String getDesc() {
101
        return desc;
102
    }
103
104
    public void setDesc(String desc) {
105
        this.desc = desc;
106
    }
107
108
    public String getImage() {
109
        return image;
110
    }
111
112
    public void setImage(String image) {
113
        this.image = image;
114
    }
115
116
    public boolean isActive() {
117
        return active;
118
    }
119
120
    public void setActive(boolean active) {
121
        this.active = active;
122
    }
123
}

+ 42 - 0
src/main/java/com/ekexiu/project/msconsole/system/vo/UploadFile.java

@ -0,0 +1,42 @@
1
package com.ekexiu.project.msconsole.system.vo;
2
3
import java.io.File;
4
5
public class UploadFile {
6
	   private String name;
7
       private String uri;
8
       private long size;
9
       private transient File fn;
10
11
       public File getFn() {
12
           return fn;
13
       }
14
15
       public void setFn(File fn) {
16
           this.fn = fn;
17
       }
18
19
       public String getName() {
20
           return name;
21
       }
22
23
       public void setName(String name) {
24
           this.name = name;
25
       }
26
27
       public String getUri() {
28
           return uri;
29
       }
30
31
       public void setUri(String uri) {
32
           this.uri = uri;
33
       }
34
35
       public long getSize() {
36
           return size;
37
       }
38
39
       public void setSize(long size) {
40
           this.size = size;
41
       }
42
}

+ 155 - 0
src/main/resources/database.sql

@ -0,0 +1,155 @@
1
CREATE TABLE HOSPITAL (
2
  ID CHAR(32) NOT NULL,
3
  PASSWD TEXT NOT NULL,
4
  ACCOUNT TEXT NOT NULL,
5
  NAME TEXT NOT NULL,
6
  LEVEL CHAR(1) NOT NULL,
7
  SUB_LEVEL CHAR(1) NOT NULL,
8
  TYPE CHAR(1) NOT NULL,
9
  PHONE TEXT,
10
  LOCATION TEXT,
11
  ADDR VARCHAR(255),
12
  DESCP TEXT,
13
  IMAGE TEXT,
14
  ACTIVE CHAR(1) NOT NULL,
15
  CREATE_TIME CHAR(14) NOT NULL,
16
  MODIFY_TIME CHAR(14) NOT NULL,
17
  CREATOR CHAR(32) NOT NULL,
18
  MODIFIER CHAR(32) NOT NULL);
19
ALTER TABLE HOSPITAL ADD PRIMARY KEY (ID);
20
ALTER TABLE HOSPITAL ADD UNIQUE (ACCOUNT);
21
COMMENT ON TABLE HOSPITAL IS '医院登录表';
22
COMMENT ON COLUMN HOSPITAL.ID IS '医院ID';
23
COMMENT ON COLUMN HOSPITAL.PASSWD IS '密码(MD5)';
24
COMMENT ON COLUMN HOSPITAL.ACCOUNT IS '医院帐号';
25
COMMENT ON COLUMN HOSPITAL.NAME IS '医院名称';
26
COMMENT ON COLUMN HOSPITAL.LEVEL IS '医院级别';
27
COMMENT ON COLUMN HOSPITAL.SUB_LEVEL IS '医院子级别';
28
COMMENT ON COLUMN HOSPITAL.TYPE IS '医院类型';
29
COMMENT ON COLUMN HOSPITAL.PHONE IS '电话';
30
COMMENT ON COLUMN HOSPITAL.LOCATION IS '医院详细地址';
31
COMMENT ON COLUMN HOSPITAL.ADDR IS '医院所在城市编码';
32
COMMENT ON COLUMN HOSPITAL.DESCP IS '医院简介';
33
COMMENT ON COLUMN HOSPITAL.IMAGE IS '医院图片';
34
COMMENT ON COLUMN HOSPITAL.ACTIVE IS '是否可用';
35
COMMENT ON COLUMN HOSPITAL.CREATE_TIME IS '创建时间(YYYYMMDDHH24MISS)不可修改';
36
COMMENT ON COLUMN HOSPITAL.MODIFY_TIME IS '最后修改时间(YYYYMMDDHH24MISS),初始值:20000101010101';
37
COMMENT ON COLUMN HOSPITAL.CREATOR IS '创建人ID';
38
COMMENT ON COLUMN HOSPITAL.MODIFIER IS '最后修改人ID';
39
CREATE TABLE SYS_DICT (
40
  CODE TEXT NOT NULL,
41
  BCODE TEXT,
42
  DICT_CODE TEXT NOT NULL,
43
  CAPTION TEXT NOT NULL,
44
  FULL_CAPTION TEXT,
45
  SHORT_CUT TEXT,
46
  REMARK TEXT,
47
  READONLY CHAR(1) NOT NULL,
48
  ACTIVE CHAR(1) NOT NULL);
49
ALTER TABLE SYS_DICT ADD PRIMARY KEY (DICT_CODE,CODE);
50
COMMENT ON TABLE SYS_DICT IS '数据字典表';
51
COMMENT ON COLUMN SYS_DICT.CODE IS '字典项编码';
52
COMMENT ON COLUMN SYS_DICT.BCODE IS '字典项编码(业务编码)';
53
COMMENT ON COLUMN SYS_DICT.DICT_CODE IS '字典编码';
54
COMMENT ON COLUMN SYS_DICT.CAPTION IS '字典项显示';
55
COMMENT ON COLUMN SYS_DICT.FULL_CAPTION IS '字典项显示(全)';
56
COMMENT ON COLUMN SYS_DICT.SHORT_CUT IS '助记码';
57
COMMENT ON COLUMN SYS_DICT.REMARK IS '备注';
58
COMMENT ON COLUMN SYS_DICT.READONLY IS '是否只读';
59
COMMENT ON COLUMN SYS_DICT.ACTIVE IS '是否有效';
60
CREATE TABLE INSTRUMENT (
61
  ID CHAR(32) NOT NULL,
62
  NAME TEXT NOT NULL,
63
  STATUS CHAR(1) NOT NULL,
64
  DEPARTMENT CHAR(32),
65
  HOSPITAL CHAR(32) NOT NULL,
66
  SPEC TEXT,
67
  APPLICATION TEXT,
68
  DESCP TEXT,
69
  IMAGE TEXT,
70
  ACTIVE CHAR(1) NOT NULL,
71
  CREATE_TIME CHAR(14) NOT NULL,
72
  MODIFY_TIME CHAR(14) NOT NULL,
73
  CREATOR CHAR(32) NOT NULL,
74
  MODIFIER CHAR(32) NOT NULL);
75
ALTER TABLE INSTRUMENT ADD PRIMARY KEY (ID);
76
COMMENT ON TABLE INSTRUMENT IS '器械表';
77
COMMENT ON COLUMN INSTRUMENT.ID IS '器械ID';
78
COMMENT ON COLUMN INSTRUMENT.NAME IS '器械名称';
79
COMMENT ON COLUMN INSTRUMENT.STATUS IS '器械状态';
80
COMMENT ON COLUMN INSTRUMENT.DEPARTMENT IS '所属科室';
81
COMMENT ON COLUMN INSTRUMENT.HOSPITAL IS '所属医院';
82
COMMENT ON COLUMN INSTRUMENT.SPEC IS '厂商型号';
83
COMMENT ON COLUMN INSTRUMENT.APPLICATION IS '功能用途';
84
COMMENT ON COLUMN INSTRUMENT.DESCP IS '器械简介';
85
COMMENT ON COLUMN INSTRUMENT.IMAGE IS '器械图片';
86
COMMENT ON COLUMN INSTRUMENT.ACTIVE IS '是否可用';
87
COMMENT ON COLUMN INSTRUMENT.CREATE_TIME IS '创建时间(YYYYMMDDHH24MISS)不可修改';
88
COMMENT ON COLUMN INSTRUMENT.MODIFY_TIME IS '最后修改时间(YYYYMMDDHH24MISS),初始值:20000101010101';
89
COMMENT ON COLUMN INSTRUMENT.CREATOR IS '创建人ID';
90
COMMENT ON COLUMN INSTRUMENT.MODIFIER IS '最后修改人ID';
91
CREATE TABLE DOCTOR (
92
  ID CHAR(32) NOT NULL,
93
  HOSPITAL CHAR(32) NOT NULL,
94
  DEPARTMENT CHAR(32),
95
  ACCOUNT TEXT NOT NULL,
96
  NAME TEXT NOT NULL,
97
  CLINICAL_TITLE TEXT,
98
  TEACH_TITLE TEXT,
99
  POSITION TEXT,
100
  DIRECTION TEXT,
101
  IMAGE VARCHAR(255),
102
  DESCP TEXT,
103
  ACTIVE CHAR(1) NOT NULL,
104
  PASSWD TEXT NOT NULL,
105
  CREATE_TIME CHAR(14) NOT NULL,
106
  MODIFY_TIME CHAR(14) NOT NULL,
107
  CREATOR CHAR(32) NOT NULL,
108
  MODIFIER CHAR(32) NOT NULL);
109
ALTER TABLE DOCTOR ADD PRIMARY KEY (ID);
110
ALTER TABLE DOCTOR ADD UNIQUE (ACCOUNT);
111
COMMENT ON TABLE DOCTOR IS '医生';
112
COMMENT ON COLUMN DOCTOR.ID IS '医生ID';
113
COMMENT ON COLUMN DOCTOR.HOSPITAL IS '医院ID';
114
COMMENT ON COLUMN DOCTOR.DEPARTMENT IS '医院ID';
115
COMMENT ON COLUMN DOCTOR.ACCOUNT IS '帐号';
116
COMMENT ON COLUMN DOCTOR.NAME IS '医生姓名';
117
COMMENT ON COLUMN DOCTOR.CLINICAL_TITLE IS '临床职称';
118
COMMENT ON COLUMN DOCTOR.TEACH_TITLE IS '教学职称';
119
COMMENT ON COLUMN DOCTOR.POSITION IS '行政职务';
120
COMMENT ON COLUMN DOCTOR.DIRECTION IS '擅长方向';
121
COMMENT ON COLUMN DOCTOR.IMAGE IS '图片';
122
COMMENT ON COLUMN DOCTOR.DESCP IS '个人简介';
123
COMMENT ON COLUMN DOCTOR.ACTIVE IS '是否可用';
124
COMMENT ON COLUMN DOCTOR.PASSWD IS '密码(MD5)';
125
COMMENT ON COLUMN DOCTOR.CREATE_TIME IS '创建时间(YYYYMMDDHH24MISS)不可修改';
126
COMMENT ON COLUMN DOCTOR.MODIFY_TIME IS '最后修改时间(YYYYMMDDHH24MISS),初始值:20000101010101';
127
COMMENT ON COLUMN DOCTOR.CREATOR IS '创建人ID';
128
COMMENT ON COLUMN DOCTOR.MODIFIER IS '最后修改人ID';
129
CREATE TABLE DEPARTMENT (
130
  ID CHAR(32) NOT NULL,
131
  HOSPITAL CHAR(32) NOT NULL,
132
  NAME TEXT NOT NULL,
133
  TYPE CHAR(1) NOT NULL,
134
  PHONE TEXT,
135
  LOCATION TEXT,
136
  DESCP TEXT,
137
  ACTIVE CHAR(1) NOT NULL,
138
  CREATE_TIME CHAR(14) NOT NULL,
139
  MODIFY_TIME CHAR(14) NOT NULL,
140
  CREATOR CHAR(32) NOT NULL,
141
  MODIFIER CHAR(32) NOT NULL);
142
ALTER TABLE DEPARTMENT ADD PRIMARY KEY (ID);
143
COMMENT ON TABLE DEPARTMENT IS '科室';
144
COMMENT ON COLUMN DEPARTMENT.ID IS '科室ID';
145
COMMENT ON COLUMN DEPARTMENT.HOSPITAL IS '所属医院ID';
146
COMMENT ON COLUMN DEPARTMENT.NAME IS '科室名称';
147
COMMENT ON COLUMN DEPARTMENT.TYPE IS '科室ID';
148
COMMENT ON COLUMN DEPARTMENT.PHONE IS '科室电话';
149
COMMENT ON COLUMN DEPARTMENT.LOCATION IS '科室地址';
150
COMMENT ON COLUMN DEPARTMENT.DESCP IS '科室简介';
151
COMMENT ON COLUMN DEPARTMENT.ACTIVE IS '是否可用';
152
COMMENT ON COLUMN DEPARTMENT.CREATE_TIME IS '创建时间(YYYYMMDDHH24MISS)不可修改';
153
COMMENT ON COLUMN DEPARTMENT.MODIFY_TIME IS '最后修改时间(YYYYMMDDHH24MISS),初始值:20000101010101';
154
COMMENT ON COLUMN DEPARTMENT.CREATOR IS '创建人ID';
155
COMMENT ON COLUMN DEPARTMENT.MODIFIER IS '最后修改人ID';

+ 37 - 0
src/main/resources/project.properties

@ -0,0 +1,37 @@
1
dataSource=com.alibaba.druid.pool.DruidDataSource
2
#数据库连接地址、名称、密码
3
dataSource.url=jdbc:postgresql://192.168.3.233:5432/medical_share
4
dataSource.username=postgres
5
dataSource.password=postgres
6
#连接池启动时的初始值(初始化连接)
7
dataSource.initialSize::int=1
8
#最小空闲连接值
9
dataSource.minIdle::int=1 
10
#连接池的最大值(最大连接数量)
11
dataSource.maxActive::int=1
12
#超时等待时间(maxWait代表当Connection用尽了,多久之后进行回收丢失连接)
13
dataSource.maxWait::long=60000
14
#连接超时任务的时间间隔
15
dataSource.timeBetweenEvictionRunsMillis::long=60000
16
#连接的超时时间
17
dataSource.minEvictableIdleTimeMillis::long=300000  
18
#用来验证从连接池取出的连接
19
dataSource.validationQuery=SELECT 1  
20
#指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败则连接将被从池中去除
21
dataSource.testWhileIdle::boolean=true
22
#在从池中取出连接前进行检验,如果检验失败则从池中去除连接并尝试取出另一个
23
dataSource.testOnBorrow::boolean=true
24
#指明是否在归还到池中前进行检验
25
dataSource.testOnReturn::boolean=true   
26
#开启池的prepared statement 池功能
27
dataSource.poolPreparedStatements::boolean=true 
28
#statement池能够同时分配的打开的statements的最大数量
29
dataSource.maxPoolPreparedStatementPerConnectionSize::int=20
30
#默认的SQL语句自动提交状态(开启或关闭)设置由连接池本身设置(false由连接池定)
31
dataSource.defaultAutoCommit::boolean=false
32
33
34
com_ekexiu_project_msconsole_system_service_CommonUtilService.rootPath=http://192.168.3.233:84
35
com_ekexiu_project_msconsole_system_service_CommonUtilService.hospitalPath::java.io.File=/medical/data/hospitalPath/logo
36
com_ekexiu_project_msconsole_system_service_CommonUtilService.doctorPath::java.io.File=/medical/data/doctor/logo
37
com_ekexiu_project_msconsole_system_service_CommonUtilService.instrumentPath::java.io.File=/medical/data/instrument/logo

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

@ -0,0 +1,29 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
3
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
5
         version="4.0">
6
7
    <servlet>
8
        <servlet-name>ajax</servlet-name>
9
        <servlet-class>org.jfw.web.servlet.core.FilenameConfigServlet</servlet-class>
10
        <init-param>
11
            <param-name>prefixLen</param-name>
12
            <param-value>16</param-value>
13
        </init-param>
14
        <init-param>
15
            <param-name>viewType</param-name>
16
            <param-value>1</param-value>
17
        </init-param>
18
        <init-param>
19
            <param-name>configFileName</param-name>
20
            <param-value>beanConfig.properties,project.properties</param-value>
21
        </init-param>
22
        <load-on-startup>1</load-on-startup>
23
    </servlet>
24
25
    <servlet-mapping>
26
        <servlet-name>ajax</servlet-name>
27
        <url-pattern>/ajax/*</url-pattern>
28
    </servlet-mapping>
29
</web-app>