Pārlūkot izejas kodu

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

陈少旭 2 mēnešus atpakaļ
vecāks
revīzija
e26befa8e4

Binārs
XT_New.exe Parādīt failu


+ 4 - 4
controllers/base_api_controller.go Parādīt failu

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

+ 8 - 3
controllers/device_api_controller.go Parādīt failu

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

+ 1 - 1
controllers/his_api_controller.go Parādīt failu

@@ -3183,7 +3183,7 @@ func (c *HisApiController) CreateHisPrescription() {
3183 3183
 	var adviceList []models.HisDoctorAdviceInfo
3184 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 3187
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3188 3188
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3189 3189
 

+ 6 - 4
controllers/mobile_api_controllers/login_api_controller.go Parādīt failu

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

+ 2 - 1
controllers/mobile_api_controllers/patient_api_controller.go Parādīt failu

@@ -300,7 +300,7 @@ func (c *PatientApiController) EditDoctorAdvice() {
300 300
 	advice.UpdatedTime = time.Now().Unix()
301 301
 	advice.UserOrgId = adminUserInfo.Org.Id
302 302
 	advice.Modifier = adminUserInfo.AdminUser.Id
303
-
303
+	advice.AdviceDoctor = adminUserInfo.AdminUser.Id
304 304
 	//处理修改医嘱开始时间逻辑(不包括子医嘱)
305 305
 	//1.一组医嘱内只有一条医嘱(不包括子医嘱)的情况下,只需要直接修改医嘱开始时间,不需要重新分配组号
306 306
 	//2.一组医嘱内有多条医嘱(不包括子医嘱)的情况下,需要为修改的那条医嘱重新分配组号,并修改医嘱开始时间
@@ -393,6 +393,7 @@ func (c *PatientApiController) EditDoctorAdvice() {
393 393
 				gruopNo := service.GetMaxAdviceGroupID(adminUserInfo.Org.Id)
394 394
 				gruopNo = gruopNo + 1
395 395
 				advice.GroupNo = gruopNo
396
+				advice.AdviceDoctor = adminUserInfo.AdminUser.Id
396 397
 				err = service.UpdateDoctorAdviceAndSubAdvice(&advice)
397 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 Parādīt failu

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

+ 4 - 4
controllers/patient_api_controller.go Parādīt failu

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

+ 5 - 3
service/device_service.go Parādīt failu

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

+ 6 - 6
service/patient_service.go Parādīt failu

@@ -2143,20 +2143,20 @@ func UpdateScheduleByDeathTime(patientid int64, shcheduledate int64) error {
2143 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 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 2161
 	return err
2162 2162
 }

+ 1 - 1
service/self_drug_service.go Parādīt failu

@@ -3127,7 +3127,7 @@ func GetInitOutBanceList(good_id int64, user_org_id int64, start_time int64, end
3127 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 3132
 	return list, err
3133 3133
 }