Browse Source

Merge branch '20230223_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20230223_xt_api_new_branch

陈少旭 2 months ago
parent
commit
e26befa8e4

BIN
XT_New.exe View File


+ 4 - 4
controllers/base_api_controller.go View File

83
 		userAdmin.ModifyTime = 1530786071
83
 		userAdmin.ModifyTime = 1530786071
84
 		var subscibe models.ServeSubscibe
84
 		var subscibe models.ServeSubscibe
85
 		subscibe.ID = 11
85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10644 //机构id
86
+		subscibe.OrgId = 10340 //机构id
87
 		subscibe.PeriodStart = 1547447814
87
 		subscibe.PeriodStart = 1547447814
88
 		subscibe.PeriodEnd = 1550039814
88
 		subscibe.PeriodEnd = 1550039814
89
 		subscibe.State = 1
89
 		subscibe.State = 1
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94
 		subscibes[4] = &subscibe
94
 		subscibes[4] = &subscibe
95
 		var adminUserInfo service.AdminUserInfo
95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10644 //机构id小英9675或4
96
+		adminUserInfo.CurrentOrgId = 10340 //机构id小英9675或4
97
 		adminUserInfo.CurrentAppId = 17260 //4
97
 		adminUserInfo.CurrentAppId = 17260 //4
98
 		adminUserInfo.AdminUser = &userAdmin
98
 		adminUserInfo.AdminUser = &userAdmin
99
 		adminUserInfo.Subscibes = subscibes
99
 		adminUserInfo.Subscibes = subscibes
329
 		userAdmin.ModifyTime = 1530786071
329
 		userAdmin.ModifyTime = 1530786071
330
 		var subscibe models.ServeSubscibe
330
 		var subscibe models.ServeSubscibe
331
 		subscibe.ID = 11
331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10644 //机构id小英9675或4
332
+		subscibe.OrgId = 10340 //机构id小英9675或4
333
 		subscibe.PeriodStart = 1538035409
333
 		subscibe.PeriodStart = 1538035409
334
 		subscibe.PeriodEnd = 1569571409
334
 		subscibe.PeriodEnd = 1569571409
335
 		subscibe.State = 1
335
 		subscibe.State = 1
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340
 		subscibes[4] = &subscibe
340
 		subscibes[4] = &subscibe
341
 		var adminUserInfo service.AdminUserInfo
341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10644 //机构id小英9675或4
342
+		adminUserInfo.CurrentOrgId = 10340 //机构id小英9675或4
343
 		adminUserInfo.CurrentAppId = 17260 //4
343
 		adminUserInfo.CurrentAppId = 17260 //4
344
 		adminUserInfo.AdminUser = &userAdmin
344
 		adminUserInfo.AdminUser = &userAdmin
345
 		adminUserInfo.Subscibes = subscibes
345
 		adminUserInfo.Subscibes = subscibes

+ 8 - 3
controllers/device_api_controller.go View File

1
 package controllers
1
 package controllers
2
 
2
 
3
 import (
3
 import (
4
+	"time"
5
+
4
 	"XT_New/utils"
6
 	"XT_New/utils"
5
 	"github.com/jinzhu/gorm"
7
 	"github.com/jinzhu/gorm"
6
-	"time"
7
 
8
 
8
 	"XT_New/enums"
9
 	"XT_New/enums"
9
 	"XT_New/models"
10
 	"XT_New/models"
10
 	"XT_New/service"
11
 	"XT_New/service"
11
 
12
 
12
 	"fmt"
13
 	"fmt"
14
+
13
 	"github.com/astaxie/beego"
15
 	"github.com/astaxie/beego"
14
 )
16
 )
15
 
17
 
520
 func (this *DeviceAPIController) CreateZone() {
522
 func (this *DeviceAPIController) CreateZone() {
521
 	name := this.GetString("name")
523
 	name := this.GetString("name")
522
 	type_, _ := this.GetInt("type")
524
 	type_, _ := this.GetInt("type")
525
+	sort, _ := this.GetInt64("sort")
523
 	if len(name) == 0 || type_ <= 0 {
526
 	if len(name) == 0 || type_ <= 0 {
524
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
527
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
525
 		return
528
 		return
527
 
530
 
528
 	adminInfo := this.GetAdminUserInfo()
531
 	adminInfo := this.GetAdminUserInfo()
529
 	_, errcode := service.GetZoneByName(name, adminInfo.CurrentOrgId)
532
 	_, errcode := service.GetZoneByName(name, adminInfo.CurrentOrgId)
530
-	fmt.Println("errcode=----------", errcode)
533
+
531
 	if errcode == gorm.ErrRecordNotFound {
534
 	if errcode == gorm.ErrRecordNotFound {
532
-		zone, createErr := service.CreateDeviceZone(adminInfo.CurrentOrgId, name, type_)
535
+		zone, createErr := service.CreateDeviceZone(adminInfo.CurrentOrgId, name, type_, sort)
533
 		if createErr != nil {
536
 		if createErr != nil {
534
 			this.ErrorLog("创建设备分区失败:%v", createErr)
537
 			this.ErrorLog("创建设备分区失败:%v", createErr)
535
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
538
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
552
 	id, _ := this.GetInt64("id")
555
 	id, _ := this.GetInt64("id")
553
 	name := this.GetString("name")
556
 	name := this.GetString("name")
554
 	type_, _ := this.GetInt("type")
557
 	type_, _ := this.GetInt("type")
558
+	sort, _ := this.GetInt64("sort")
555
 	if id <= 0 || len(name) == 0 || type_ <= 0 {
559
 	if id <= 0 || len(name) == 0 || type_ <= 0 {
556
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
560
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
557
 		return
561
 		return
570
 
574
 
571
 	zone.Name = name
575
 	zone.Name = name
572
 	zone.Type = type_
576
 	zone.Type = type_
577
+	zone.Sort = sort
573
 	zone.ModifyTime = time.Now().Unix()
578
 	zone.ModifyTime = time.Now().Unix()
574
 
579
 
575
 	byName, _ := service.GetZoneByNameOne(name, adminInfo.CurrentOrgId)
580
 	byName, _ := service.GetZoneByNameOne(name, adminInfo.CurrentOrgId)

+ 1 - 1
controllers/his_api_controller.go View File

3183
 	var adviceList []models.HisDoctorAdviceInfo
3183
 	var adviceList []models.HisDoctorAdviceInfo
3184
 	var projectList []models.HisPrescriptionProject
3184
 	var projectList []models.HisPrescriptionProject
3185
 
3185
 
3186
-	if adminInfo.CurrentOrgId == 10489 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 10478 || adminInfo.CurrentOrgId == 10318 || adminInfo.CurrentOrgId == 10480 || adminInfo.CurrentOrgId == 10633 || adminInfo.CurrentOrgId == 10610 || adminInfo.CurrentOrgId == 10402 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10537 || adminInfo.CurrentOrgId == 10265 || adminInfo.CurrentOrgId == 10644 || adminInfo.CurrentOrgId == 10164 {
3186
+	if adminInfo.CurrentOrgId == 10489 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 10478 || adminInfo.CurrentOrgId == 10318 || adminInfo.CurrentOrgId == 10480 || adminInfo.CurrentOrgId == 10633 || adminInfo.CurrentOrgId == 10610 || adminInfo.CurrentOrgId == 10402 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10537 || adminInfo.CurrentOrgId == 10265 || adminInfo.CurrentOrgId == 10644 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 10598 || adminInfo.CurrentOrgId == 10028 {
3187
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3187
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3188
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3188
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3189
 
3189
 

+ 6 - 4
controllers/mobile_api_controllers/login_api_controller.go View File

1
 package mobile_api_controllers
1
 package mobile_api_controllers
2
 
2
 
3
 import (
3
 import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"XT_New/utils"
8
 	"encoding/json"
4
 	"encoding/json"
9
 	"fmt"
5
 	"fmt"
10
 	"io/ioutil"
6
 	"io/ioutil"
12
 	"net/url"
8
 	"net/url"
13
 	"strconv"
9
 	"strconv"
14
 
10
 
11
+	"XT_New/enums"
12
+	"XT_New/models"
13
+	"XT_New/service"
14
+	"XT_New/utils"
15
+
15
 	"github.com/astaxie/beego"
16
 	"github.com/astaxie/beego"
16
 )
17
 )
17
 
18
 
23
 // @param mobile:string
24
 // @param mobile:string
24
 // @param password:string
25
 // @param password:string
25
 func (this *LoginAPIController) LoginByPwd() {
26
 func (this *LoginAPIController) LoginByPwd() {
27
+
26
 	mobile := this.GetString("mobile")
28
 	mobile := this.GetString("mobile")
27
 	pwd := this.GetString("password")
29
 	pwd := this.GetString("password")
28
 	//var mobile = "15089497668"
30
 	//var mobile = "15089497668"

+ 2 - 1
controllers/mobile_api_controllers/patient_api_controller.go View File

300
 	advice.UpdatedTime = time.Now().Unix()
300
 	advice.UpdatedTime = time.Now().Unix()
301
 	advice.UserOrgId = adminUserInfo.Org.Id
301
 	advice.UserOrgId = adminUserInfo.Org.Id
302
 	advice.Modifier = adminUserInfo.AdminUser.Id
302
 	advice.Modifier = adminUserInfo.AdminUser.Id
303
-
303
+	advice.AdviceDoctor = adminUserInfo.AdminUser.Id
304
 	//处理修改医嘱开始时间逻辑(不包括子医嘱)
304
 	//处理修改医嘱开始时间逻辑(不包括子医嘱)
305
 	//1.一组医嘱内只有一条医嘱(不包括子医嘱)的情况下,只需要直接修改医嘱开始时间,不需要重新分配组号
305
 	//1.一组医嘱内只有一条医嘱(不包括子医嘱)的情况下,只需要直接修改医嘱开始时间,不需要重新分配组号
306
 	//2.一组医嘱内有多条医嘱(不包括子医嘱)的情况下,需要为修改的那条医嘱重新分配组号,并修改医嘱开始时间
306
 	//2.一组医嘱内有多条医嘱(不包括子医嘱)的情况下,需要为修改的那条医嘱重新分配组号,并修改医嘱开始时间
393
 				gruopNo := service.GetMaxAdviceGroupID(adminUserInfo.Org.Id)
393
 				gruopNo := service.GetMaxAdviceGroupID(adminUserInfo.Org.Id)
394
 				gruopNo = gruopNo + 1
394
 				gruopNo = gruopNo + 1
395
 				advice.GroupNo = gruopNo
395
 				advice.GroupNo = gruopNo
396
+				advice.AdviceDoctor = adminUserInfo.AdminUser.Id
396
 				err = service.UpdateDoctorAdviceAndSubAdvice(&advice)
397
 				err = service.UpdateDoctorAdviceAndSubAdvice(&advice)
397
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(doc_advice_date, 10) + ":doctor_advices"
398
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(doc_advice_date, 10) + ":doctor_advices"
398
 
399
 

+ 8 - 7
controllers/new_mobile_api_controllers/new_login_api_controller.go View File

1
 package new_mobile_api_controllers
1
 package new_mobile_api_controllers
2
 
2
 
3
 import (
3
 import (
4
-	"XT_New/controllers/mobile_api_controllers"
5
-	"XT_New/enums"
6
-	"XT_New/models"
7
-	"XT_New/service"
8
-	"XT_New/utils"
9
 	"encoding/json"
4
 	"encoding/json"
10
 	"fmt"
5
 	"fmt"
11
-	"github.com/astaxie/beego"
12
 	"io/ioutil"
6
 	"io/ioutil"
13
 	"net/http"
7
 	"net/http"
14
 	"net/url"
8
 	"net/url"
15
 	"strconv"
9
 	"strconv"
16
 	"strings"
10
 	"strings"
17
 	"time"
11
 	"time"
12
+
13
+	"XT_New/controllers/mobile_api_controllers"
14
+	"XT_New/enums"
15
+	"XT_New/models"
16
+	"XT_New/service"
17
+	"XT_New/utils"
18
+	"github.com/astaxie/beego"
18
 )
19
 )
19
 
20
 
20
 type NewLoginApiController struct {
21
 type NewLoginApiController struct {
22
 }
23
 }
23
 
24
 
24
 func (this *NewLoginApiController) GetLogin() {
25
 func (this *NewLoginApiController) GetLogin() {
25
-	token_cookie := this.Ctx.GetCookie("token_cookie")
26
 
26
 
27
+	token_cookie := this.Ctx.GetCookie("token_cookie")
27
 	if len(token_cookie) == 0 {
28
 	if len(token_cookie) == 0 {
28
 		this.ServeSuccessJSON(map[string]interface{}{
29
 		this.ServeSuccessJSON(map[string]interface{}{
29
 			"isLogin": false,
30
 			"isLogin": false,

+ 4 - 4
controllers/patient_api_controller.go View File

7674
 	//病人转出
7674
 	//病人转出
7675
 	if lapse_type == 2 {
7675
 	if lapse_type == 2 {
7676
 
7676
 
7677
-		service.UpdatePatientLapsetoByPatientId(patient_id, recordDate)
7677
+		service.UpdatePatientLapsetoByPatientId(patient_id, recordDate, lapse_reason)
7678
 
7678
 
7679
 		service.UpdateScheduleByDeathTime(patient_id, recordDate)
7679
 		service.UpdateScheduleByDeathTime(patient_id, recordDate)
7680
 
7680
 
7684
 	//病人转出
7684
 	//病人转出
7685
 	if lapse_type == 3 {
7685
 	if lapse_type == 3 {
7686
 
7686
 
7687
-		service.UpdatePatientLapsetoByPatientIdOne(patient_id, recordDate)
7687
+		service.UpdatePatientLapsetoByPatientIdOne(patient_id, recordDate, lapse_reason)
7688
 
7688
 
7689
 		service.UpdateScheduleByDeathTime(patient_id, recordDate)
7689
 		service.UpdateScheduleByDeathTime(patient_id, recordDate)
7690
 
7690
 
7857
 
7857
 
7858
 	//病人转出
7858
 	//病人转出
7859
 	if lapse_type == 2 {
7859
 	if lapse_type == 2 {
7860
-		service.UpdatePatientLapsetoByPatientId(patient_id, recordDate)
7860
+		service.UpdatePatientLapsetoByPatientId(patient_id, recordDate, lapse_reason)
7861
 
7861
 
7862
 		service.UpdateScheduleByDeathTime(patient_id, recordDate)
7862
 		service.UpdateScheduleByDeathTime(patient_id, recordDate)
7863
 
7863
 
7865
 	}
7865
 	}
7866
 
7866
 
7867
 	if lapse_type == 3 {
7867
 	if lapse_type == 3 {
7868
-		service.UpdatePatientLapsetoByPatientIdOne(patient_id, recordDate)
7868
+		service.UpdatePatientLapsetoByPatientIdOne(patient_id, recordDate, lapse_reason)
7869
 
7869
 
7870
 		service.UpdateScheduleByDeathTime(patient_id, recordDate)
7870
 		service.UpdateScheduleByDeathTime(patient_id, recordDate)
7871
 
7871
 

+ 5 - 3
service/device_service.go View File

1
 package service
1
 package service
2
 
2
 
3
 import (
3
 import (
4
-	"XT_New/models"
5
 	"encoding/json"
4
 	"encoding/json"
6
 	"fmt"
5
 	"fmt"
7
-	"github.com/jinzhu/gorm"
8
 	"strconv"
6
 	"strconv"
9
 	"strings"
7
 	"strings"
10
 	"time"
8
 	"time"
9
+
10
+	"XT_New/models"
11
+	"github.com/jinzhu/gorm"
11
 )
12
 )
12
 
13
 
13
 //////// 设备基本信息
14
 //////// 设备基本信息
302
 	return zone, err
303
 	return zone, err
303
 }
304
 }
304
 
305
 
305
-func CreateDeviceZone(orgID int64, name string, type_ int) (*models.DeviceZone, error) {
306
+func CreateDeviceZone(orgID int64, name string, type_ int, sort int64) (*models.DeviceZone, error) {
306
 	now := time.Now().Unix()
307
 	now := time.Now().Unix()
307
 	zone := models.DeviceZone{
308
 	zone := models.DeviceZone{
308
 		OrgID:      orgID,
309
 		OrgID:      orgID,
311
 		Status:     1,
312
 		Status:     1,
312
 		CreateTime: now,
313
 		CreateTime: now,
313
 		ModifyTime: now,
314
 		ModifyTime: now,
315
+		Sort:       sort,
314
 	}
316
 	}
315
 	err := writeDb.Model(&models.DeviceZone{}).Create(&zone).Error
317
 	err := writeDb.Model(&models.DeviceZone{}).Create(&zone).Error
316
 	if err != nil {
318
 	if err != nil {

+ 6 - 6
service/patient_service.go View File

2143
 	return err
2143
 	return err
2144
 }
2144
 }
2145
 
2145
 
2146
-func UpdatePatientLapsetoByPatientId(patient_id int64, record_date int64) error {
2146
+func UpdatePatientLapsetoByPatientId(patient_id int64, record_date int64, lapse_reason string) error {
2147
 
2147
 
2148
-	err := XTWriteDB().Model(&models.Patients{}).Where("id = ? and status= 1", patient_id).Updates(map[string]interface{}{"death_time": record_date, "lapseto": 2}).Error
2148
+	err := XTWriteDB().Model(&models.Patients{}).Where("id = ? and status= 1", patient_id).Updates(map[string]interface{}{"death_time": record_date, "lapseto": 2, "out_reason": lapse_reason}).Error
2149
 
2149
 
2150
-	err = XTWriteDB().Model(&models.XtPatientsNew{}).Where("blood_id = ? and status=1", patient_id).Updates(map[string]interface{}{"death_time": record_date, "lapseto": 2}).Error
2150
+	err = XTWriteDB().Model(&models.XtPatientsNew{}).Where("blood_id = ? and status=1", patient_id).Updates(map[string]interface{}{"death_time": record_date, "lapseto": 2, "out_reason": lapse_reason}).Error
2151
 
2151
 
2152
 	return err
2152
 	return err
2153
 }
2153
 }
2154
 
2154
 
2155
-func UpdatePatientLapsetoByPatientIdOne(patient_id int64, record_date int64) error {
2155
+func UpdatePatientLapsetoByPatientIdOne(patient_id int64, record_date int64, lapse_reason string) error {
2156
 
2156
 
2157
-	err := XTWriteDB().Model(&models.Patients{}).Where("id = ? and status= 1", patient_id).Updates(map[string]interface{}{"death_time": record_date, "lapseto": 3}).Error
2157
+	err := XTWriteDB().Model(&models.Patients{}).Where("id = ? and status= 1", patient_id).Updates(map[string]interface{}{"death_time": record_date, "lapseto": 3, "out_reason": lapse_reason}).Error
2158
 
2158
 
2159
-	err = XTWriteDB().Model(&models.XtPatientsNew{}).Where("blood_id = ? and status=1", patient_id).Updates(map[string]interface{}{"death_time": record_date, "lapseto": 3}).Error
2159
+	err = XTWriteDB().Model(&models.XtPatientsNew{}).Where("blood_id = ? and status=1", patient_id).Updates(map[string]interface{}{"death_time": record_date, "lapseto": 3, "out_reason": lapse_reason}).Error
2160
 
2160
 
2161
 	return err
2161
 	return err
2162
 }
2162
 }

+ 1 - 1
service/self_drug_service.go View File

3127
 		db = db.Where("storehouse_id = ?", storehouse_id)
3127
 		db = db.Where("storehouse_id = ?", storehouse_id)
3128
 	}
3128
 	}
3129
 
3129
 
3130
-	err = db.Group("patient_id,good_id,sys_record_time,is_sys").Find(&list).Error
3130
+	err = db.Group("patient_id,good_id,sys_record_time,is_sys,ctime").Find(&list).Error
3131
 
3131
 
3132
 	return list, err
3132
 	return list, err
3133
 }
3133
 }