|
@@ -5,8 +5,10 @@ import (
|
5
|
5
|
"XT_New/models"
|
6
|
6
|
"XT_New/service"
|
7
|
7
|
"XT_New/utils"
|
|
8
|
+ "crypto/md5"
|
8
|
9
|
"encoding/json"
|
9
|
10
|
"fmt"
|
|
11
|
+ "github.com/astaxie/beego"
|
10
|
12
|
"github.com/jinzhu/gorm"
|
11
|
13
|
"strconv"
|
12
|
14
|
"strings"
|
|
@@ -242,7 +244,7 @@ func (this *NewDialysisApiController) SavePatient() {
|
242
|
244
|
fmt.Print("治疗方式", treatmentmethod)
|
243
|
245
|
|
244
|
246
|
//查询身份证号码是否存在
|
245
|
|
- thisPatientOne, _ := service.FindPatientByIdCardNoOne(orgid, idCard)
|
|
247
|
+ thisPatientOne, _ := service.FindPatientByIdCardNoFive(orgid, idCard)
|
246
|
248
|
if thisPatientOne.ID > 0 {
|
247
|
249
|
returnData := make(map[string]interface{}, 0)
|
248
|
250
|
returnData["msg"] = "身份证号码已存在"
|
|
@@ -251,7 +253,7 @@ func (this *NewDialysisApiController) SavePatient() {
|
251
|
253
|
}
|
252
|
254
|
|
253
|
255
|
//查询手机号码是否存在
|
254
|
|
- thisPatient, err := service.FindPatientByMobileOne(phone, orgid)
|
|
256
|
+ thisPatient, err := service.FindPatientByMobileFive(phone, orgid)
|
255
|
257
|
if thisPatient.ID > 0 {
|
256
|
258
|
returnData := make(map[string]interface{}, 0)
|
257
|
259
|
returnData["msg"] = "手机号码已存在"
|
|
@@ -261,7 +263,7 @@ func (this *NewDialysisApiController) SavePatient() {
|
261
|
263
|
//如果是血透病人
|
262
|
264
|
if bloodPatient == 1 {
|
263
|
265
|
//查询透析号是否存在
|
264
|
|
- thisPatientTwo, _ := service.FindPatientByDialysisNoOne(orgid, dialysis)
|
|
266
|
+ thisPatientTwo, _ := service.FindPatientByDialysisNoFive(orgid, dialysis)
|
265
|
267
|
if thisPatientTwo.ID > 0 {
|
266
|
268
|
returnData := make(map[string]interface{}, 0)
|
267
|
269
|
returnData["msg"] = "透析号已存在"
|
|
@@ -1293,7 +1295,7 @@ func (this *NewDialysisApiController) UpdatedPatient() {
|
1293
|
1295
|
patient, _ := service.GetNewPatient(id)
|
1294
|
1296
|
|
1295
|
1297
|
//判断身份证号是否相同
|
1296
|
|
- thisPatient, _ := service.FindPatientByIdCardNoOne(orgid, idCard)
|
|
1298
|
+ thisPatient, _ := service.FindPatientByIdCardNoOne(orgid, idCard, id)
|
1297
|
1299
|
if thisPatient.ID > 0 && thisPatient.ID != patient.BloodId {
|
1298
|
1300
|
returnData := make(map[string]interface{}, 0)
|
1299
|
1301
|
returnData["msg"] = "身份证号码已存在"
|
|
@@ -1302,7 +1304,7 @@ func (this *NewDialysisApiController) UpdatedPatient() {
|
1302
|
1304
|
}
|
1303
|
1305
|
|
1304
|
1306
|
//查询手机号码是否存在
|
1305
|
|
- thisPatientOne, err := service.FindPatientByMobileOne(phone, orgid)
|
|
1307
|
+ thisPatientOne, err := service.FindPatientByMobileOne(phone, orgid, id)
|
1306
|
1308
|
if thisPatientOne.ID > 0 && thisPatientOne.ID != patient.BloodId {
|
1307
|
1309
|
returnData := make(map[string]interface{}, 0)
|
1308
|
1310
|
returnData["msg"] = "手机号码已存在"
|
|
@@ -1311,7 +1313,7 @@ func (this *NewDialysisApiController) UpdatedPatient() {
|
1311
|
1313
|
}
|
1312
|
1314
|
|
1313
|
1315
|
//查询号透析号是否相同
|
1314
|
|
- thisPatientother, _ := service.FindPatientByDialysisNoOne(orgid, dialysis)
|
|
1316
|
+ thisPatientother, _ := service.FindPatientByDialysisNoOne(orgid, dialysis, id)
|
1315
|
1317
|
if thisPatientother.ID > 0 && thisPatientother.ID != patient.BloodId {
|
1316
|
1318
|
returnData := make(map[string]interface{}, 0)
|
1317
|
1319
|
returnData["msg"] = "透析号码已存在"
|
|
@@ -2332,3 +2334,33 @@ func (this *NewDialysisApiController) SaveNameTwo() {
|
2332
|
2334
|
"role": role,
|
2333
|
2335
|
})
|
2334
|
2336
|
}
|
|
2337
|
+
|
|
2338
|
+func (this *NewDialysisApiController) GetCurrentOrg() {
|
|
2339
|
+ nowTime := time.Now().Unix()
|
|
2340
|
+ adminInfo := this.GetMobileAdminUserInfo()
|
|
2341
|
+ orgId := adminInfo.Org.Id
|
|
2342
|
+ fxKey := beego.AppConfig.String("fxtokenkey")
|
|
2343
|
+ stringA := fmt.Sprintf("org_id=%d&time=%d", orgId, nowTime)
|
|
2344
|
+
|
|
2345
|
+ data := []byte(stringA)
|
|
2346
|
+ has := md5.Sum(data)
|
|
2347
|
+ md5str := fmt.Sprintf("%x", has)
|
|
2348
|
+ stringB := fmt.Sprintf("string=%s&key=%s", md5str, fxKey)
|
|
2349
|
+
|
|
2350
|
+ data = []byte(stringB)
|
|
2351
|
+ has = md5.Sum(data)
|
|
2352
|
+ signToken := fmt.Sprintf("%x", has)
|
|
2353
|
+
|
|
2354
|
+ name, err := service.GetOrgName(orgId)
|
|
2355
|
+ //var fxlink = signToken + fmt.Sprintf("&fxtoken=%s&fxorgid=%d×tamp=%d&fxadmin=%d", signToken, orgId, nowTime, name.Creator)
|
|
2356
|
+ //fmt.Println(fxlink)
|
|
2357
|
+ if err != nil {
|
|
2358
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
2359
|
+ return
|
|
2360
|
+ }
|
|
2361
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
2362
|
+ "org": name,
|
|
2363
|
+ "nowTime": nowTime,
|
|
2364
|
+ "signToken": signToken,
|
|
2365
|
+ })
|
|
2366
|
+}
|