28169 1 anno fa
parent
commit
ff8894d643

+ 1 - 1
conf/app.conf Vedi File

1
 appname = 血透
1
 appname = 血透
2
 httpport = 9531
2
 httpport = 9531
3
-runmode = dev
3
+runmode = prod
4
 #dev/prod
4
 #dev/prod
5
 
5
 
6
 #
6
 #

+ 4 - 0
controllers/dialysis_record_api_controller.go Vedi File

419
 
419
 
420
 	allDoctor, _ := service.GetAllDoctor(adminInfo.CurrentOrgId, adminInfo.CurrentAppId)
420
 	allDoctor, _ := service.GetAllDoctor(adminInfo.CurrentOrgId, adminInfo.CurrentAppId)
421
 
421
 
422
+	lastAcceptTreatment, _ := service.GetLastAcceptTreatment(adminInfo.CurrentOrgId, patientID)
423
+	fmt.Println("--------------------", lastAcceptTreatment)
422
 	if getDryErr != nil {
424
 	if getDryErr != nil {
423
 		this.ErrorLog("获取最后一条干体重失败:%v", getDryErr)
425
 		this.ErrorLog("获取最后一条干体重失败:%v", getDryErr)
424
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
426
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
475
 			"lastOrder":                   lastOrder,
477
 			"lastOrder":                   lastOrder,
476
 			"dryWeightList":               dryWeightList,
478
 			"dryWeightList":               dryWeightList,
477
 			"docList":                     allDoctor,
479
 			"docList":                     allDoctor,
480
+			"lastAcceptTreatment":         lastAcceptTreatment,
478
 		}
481
 		}
479
 		this.ServeSuccessJSON(returnData)
482
 		this.ServeSuccessJSON(returnData)
480
 
483
 
514
 			"lastOrder":                   lastOrder,
517
 			"lastOrder":                   lastOrder,
515
 			"dryWeightList":               dryWeightList,
518
 			"dryWeightList":               dryWeightList,
516
 			"docList":                     allDoctor,
519
 			"docList":                     allDoctor,
520
+			"lastAcceptTreatment":         lastAcceptTreatment,
517
 		}
521
 		}
518
 		this.ServeSuccessJSON(returnData)
522
 		this.ServeSuccessJSON(returnData)
519
 	}
523
 	}

+ 3 - 3
controllers/mobile_api_controllers/check_weight_api_controller.go Vedi File

1377
 			} else {
1377
 			} else {
1378
 				sc["code"] = 1
1378
 				sc["code"] = 1
1379
 				sc["msg"] = "抱歉,您今天没有排版!"
1379
 				sc["msg"] = "抱歉,您今天没有排版!"
1380
-				sc["mode"] = 0
1380
+				sc["mode"] = "HD"
1381
 				sc["data"] = daySchedule
1381
 				sc["data"] = daySchedule
1382
 			}
1382
 			}
1383
 		}
1383
 		}
1394
 		if len(nextSchedule) <= 0 {
1394
 		if len(nextSchedule) <= 0 {
1395
 			sc["code"] = 1
1395
 			sc["code"] = 1
1396
 			sc["msg"] = "抱歉,您后续没有排版!"
1396
 			sc["msg"] = "抱歉,您后续没有排版!"
1397
-			sc["mode"] = 0
1397
+			sc["mode"] = "HD"
1398
 			sc["data"] = nextSchedule
1398
 			sc["data"] = nextSchedule
1399
 		} else {
1399
 		} else {
1400
 			if nextSchedule[0].Schedule.ID > 0 {
1400
 			if nextSchedule[0].Schedule.ID > 0 {
1523
 			} else {
1523
 			} else {
1524
 				sc["code"] = 1
1524
 				sc["code"] = 1
1525
 				sc["msg"] = "抱歉,您后续没有排版!"
1525
 				sc["msg"] = "抱歉,您后续没有排版!"
1526
-				sc["mode"] = 0
1526
+				sc["mode"] = "HD"
1527
 				sc["data"] = nextSchedule
1527
 				sc["data"] = nextSchedule
1528
 			}
1528
 			}
1529
 		}
1529
 		}

+ 0 - 3
controllers/mobile_api_controllers/doctor_advice_api_controller.go Vedi File

5
 	"XT_New/models"
5
 	"XT_New/models"
6
 	"XT_New/service"
6
 	"XT_New/service"
7
 	"XT_New/utils"
7
 	"XT_New/utils"
8
-	"fmt"
9
 	"strconv"
8
 	"strconv"
10
 	"time"
9
 	"time"
11
 )
10
 )
45
 	redis.Set(key, "", time.Second)
44
 	redis.Set(key, "", time.Second)
46
 	scheduals, err := service.MobileGetScheduleDoctorAdvicesTwo(orgID, date.Unix(), adviceType, patientType, adminInfo.AdminUser.Id, delivery_way)
45
 	scheduals, err := service.MobileGetScheduleDoctorAdvicesTwo(orgID, date.Unix(), adviceType, patientType, adminInfo.AdminUser.Id, delivery_way)
47
 
46
 
48
-	fmt.Println("scheduals00923923999233223", scheduals)
49
 	//获取所有的患者
47
 	//获取所有的患者
50
 	blood_patients, _ := service.GetAllPatientListByListSeven(orgID)
48
 	blood_patients, _ := service.GetAllPatientListByListSeven(orgID)
51
 	//获取透析处方
49
 	//获取透析处方
81
 	config, _ := service.GetHisDoctorConfig(orgID)
79
 	config, _ := service.GetHisDoctorConfig(orgID)
82
 	project_config, _ := service.GetHisProjectConfig(orgID)
80
 	project_config, _ := service.GetHisProjectConfig(orgID)
83
 
81
 
84
-	fmt.Println("project_config23323232322323", project_config.IsOpen)
85
 	if project_config.IsOpen == 1 || project_config.IsOpen == 2 {
82
 	if project_config.IsOpen == 1 || project_config.IsOpen == 2 {
86
 		//获取his医嘱数据
83
 		//获取his医嘱数据
87
 		project, _ := service.GetMobileHisPrescriptionProject(orgID, date.Unix(), delivery_way, patientType, adminInfo.AdminUser.Id)
84
 		project, _ := service.GetMobileHisPrescriptionProject(orgID, date.Unix(), delivery_way, patientType, adminInfo.AdminUser.Id)

+ 1 - 1
controllers/patient_api_controller.go Vedi File

1122
 	loc, _ := time.LoadLocation("Local")
1122
 	loc, _ := time.LoadLocation("Local")
1123
 	todayTime, err := time.ParseInLocation(timeLayout, today, loc)
1123
 	todayTime, err := time.ParseInLocation(timeLayout, today, loc)
1124
 
1124
 
1125
-	if adminUserInfo.CurrentOrgId == 9538 {
1125
+	if adminUserInfo.CurrentOrgId == 9538 || adminUserInfo.CurrentOrgId == 10375 || adminUserInfo.CurrentOrgId == 10164 {
1126
 		prescription := models.DialysisPrescription{
1126
 		prescription := models.DialysisPrescription{
1127
 			Dialyzer:                   solution.Dialyzer,
1127
 			Dialyzer:                   solution.Dialyzer,
1128
 			Anticoagulant:              solution.Anticoagulant,
1128
 			Anticoagulant:              solution.Anticoagulant,

+ 132 - 0
controllers/patient_dataconfig_api_controller.go Vedi File

65
 
65
 
66
 	beego.Router("/api/patient/updatepatientfallassment", &PatientDataConfigAPIController{}, "Post:UpdatePatientFallassment")
66
 	beego.Router("/api/patient/updatepatientfallassment", &PatientDataConfigAPIController{}, "Post:UpdatePatientFallassment")
67
 
67
 
68
+	beego.Router("/api/patient/savepediatrcfallassesment", &PatientDataConfigAPIController{}, "Post:SavePediatrcFallassment")
69
+
70
+	beego.Router("/api/patient/getbeddiatricfallassessmentlist", &PatientDataConfigAPIController{}, "Get:GetBedDiatricFallassessmentList")
71
+
68
 }
72
 }
69
 
73
 
70
 type PatientDataConfigAPIController struct {
74
 type PatientDataConfigAPIController struct {
2676
 		"patientFallassessment": patientFallassessment,
2680
 		"patientFallassessment": patientFallassessment,
2677
 	})
2681
 	})
2678
 }
2682
 }
2683
+
2684
+func (this *PatientDataConfigAPIController) SavePediatrcFallassment() {
2685
+
2686
+	dataBody := make(map[string]interface{}, 0)
2687
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
2688
+	if err != nil {
2689
+		utils.ErrorLog(err.Error())
2690
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2691
+		return
2692
+	}
2693
+	user_org_id := this.GetAdminUserInfo().CurrentOrgId
2694
+
2695
+	admin_user_id := int64(dataBody["tumble"].(float64))
2696
+
2697
+	patient_id := int64(dataBody["patient_id"].(float64))
2698
+
2699
+	record_date := dataBody["date"].(string)
2700
+
2701
+	total := int64(dataBody["pedia_Totalpoints"].(float64))
2702
+
2703
+	timeLayout := "2006-01-02"
2704
+	loc, _ := time.LoadLocation("Local")
2705
+	var recordDate int64
2706
+	var str string
2707
+	if len(record_date) > 0 {
2708
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
2709
+		if err != nil {
2710
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2711
+			return
2712
+		}
2713
+		recordDate = theTime.Unix()
2714
+	}
2715
+
2716
+	if dataBody["age"] != nil && reflect.TypeOf(dataBody["age"]).String() == "[]interface {}" {
2717
+		ageList, _ := dataBody["age"].([]interface{})
2718
+
2719
+		for _, item := range ageList {
2720
+			//记录日志
2721
+			byterequest, _ := json.Marshal(item)
2722
+			str += string(byterequest) + ","
2723
+		}
2724
+	}
2725
+
2726
+	if dataBody["cognize"] != nil && reflect.TypeOf(dataBody["cognize"]).String() == "[]interface {}" {
2727
+		cognizeList, _ := dataBody["cognize"].([]interface{})
2728
+
2729
+		for _, item := range cognizeList {
2730
+			//记录日志
2731
+			byterequest, _ := json.Marshal(item)
2732
+			str += string(byterequest) + ","
2733
+		}
2734
+	}
2735
+
2736
+	if dataBody["diagnosis"] != nil && reflect.TypeOf(dataBody["diagnosis"]).String() == "[]interface {}" {
2737
+		diagnosisList, _ := dataBody["diagnosis"].([]interface{})
2738
+
2739
+		for _, item := range diagnosisList {
2740
+			//记录日志
2741
+			byterequest, _ := json.Marshal(item)
2742
+			str += string(byterequest) + ","
2743
+		}
2744
+	}
2745
+
2746
+	if dataBody["environment"] != nil && reflect.TypeOf(dataBody["environment"]).String() == "[]interface {}" {
2747
+		environmentList, _ := dataBody["environment"].([]interface{})
2748
+
2749
+		for _, item := range environmentList {
2750
+			//记录日志
2751
+			byterequest, _ := json.Marshal(item)
2752
+			str += string(byterequest) + ","
2753
+		}
2754
+	}
2755
+
2756
+	if dataBody["medicine"] != nil && reflect.TypeOf(dataBody["medicine"]).String() == "[]interface {}" {
2757
+		medicineList, _ := dataBody["medicine"].([]interface{})
2758
+
2759
+		for _, item := range medicineList {
2760
+			//记录日志
2761
+			byterequest, _ := json.Marshal(item)
2762
+			str += string(byterequest) + ","
2763
+		}
2764
+	}
2765
+
2766
+	if dataBody["sex"] != nil && reflect.TypeOf(dataBody["sex"]).String() == "[]interface {}" {
2767
+		sexList, _ := dataBody["medicine"].([]interface{})
2768
+
2769
+		for _, item := range sexList {
2770
+			//记录日志
2771
+			byterequest, _ := json.Marshal(item)
2772
+			str += string(byterequest) + ","
2773
+		}
2774
+	}
2775
+
2776
+	pedFallssessment := models.XtPatientPedFallssessment{
2777
+		PatientId:   patient_id,
2778
+		UserOrgId:   user_org_id,
2779
+		Status:      1,
2780
+		Ctime:       time.Now().Unix(),
2781
+		Mtime:       0,
2782
+		Text:        str,
2783
+		RecordDate:  recordDate,
2784
+		Total:       total,
2785
+		AdminUserId: admin_user_id,
2786
+		Type:        1,
2787
+	}
2788
+
2789
+	service.CreatePadFallssessment(pedFallssessment)
2790
+
2791
+	this.ServeSuccessJSON(map[string]interface{}{
2792
+		"pedFallssessment": pedFallssessment,
2793
+	})
2794
+
2795
+}
2796
+
2797
+func (this *PatientDataConfigAPIController) GetBedDiatricFallassessmentList() {
2798
+
2799
+	patient_id, _ := this.GetInt64("patient_id")
2800
+	is_type, _ := this.GetInt64("is_type")
2801
+	limit, _ := this.GetInt64("limit")
2802
+	page, _ := this.GetInt64("page")
2803
+	orgId := this.GetAdminUserInfo().CurrentOrgId
2804
+	list, total, _ := service.GetBedDiatricFallassessmentList(patient_id, is_type, orgId, limit, page)
2805
+
2806
+	this.ServeSuccessJSON(map[string]interface{}{
2807
+		"list":  list,
2808
+		"total": total,
2809
+	})
2810
+}

+ 26 - 24
controllers/self_drug_api_congtroller.go Vedi File

3987
 			item.WareStartEndStockInventoryLosses = append(item.WareStartEndStockInventoryLosses, it)
3987
 			item.WareStartEndStockInventoryLosses = append(item.WareStartEndStockInventoryLosses, it)
3988
 		}
3988
 		}
3989
 
3989
 
3990
-		//获取入库
3991
-		infoFLow, _ := service.GetNewDrugFlowInWarehouseInfo(item.ID, orgId, startTime)
3990
+		if orgId != 10215 && orgId != 10265 {
3991
+			//获取入库
3992
+			infoFLow, _ := service.GetNewDrugFlowInWarehouseInfo(item.ID, orgId, startTime)
3992
 
3993
 
3993
-		for _, it := range infoFLow {
3994
-			item.NewDrugFlowInWarehouseInfo = append(item.NewDrugFlowInWarehouseInfo, it)
3995
-		}
3996
-		//获取盘盈
3997
-		infoProfitFlow, _ := service.GetNewDrugFlowPofitWarehouseInfo(item.ID, orgId, startTime)
3994
+			for _, it := range infoFLow {
3995
+				item.NewDrugFlowInWarehouseInfo = append(item.NewDrugFlowInWarehouseInfo, it)
3996
+			}
3997
+			//获取盘盈
3998
+			infoProfitFlow, _ := service.GetNewDrugFlowPofitWarehouseInfo(item.ID, orgId, startTime)
3998
 
3999
 
3999
-		for _, it := range infoProfitFlow {
4000
-			item.NewDrugFlowPofitWarehouseInfo = append(item.NewDrugFlowPofitWarehouseInfo, it)
4001
-		}
4002
-		//获取出库
4003
-		infoOutFlow, _ := service.GetNewDrugFlowOutWarehouseInfo(item.ID, orgId, startTime)
4004
-		for _, it := range infoOutFlow {
4005
-			item.NewDrugFlowOutWarehouseInfo = append(item.NewDrugFlowOutWarehouseInfo, it)
4006
-		}
4000
+			for _, it := range infoProfitFlow {
4001
+				item.NewDrugFlowPofitWarehouseInfo = append(item.NewDrugFlowPofitWarehouseInfo, it)
4002
+			}
4003
+			//获取出库
4004
+			infoOutFlow, _ := service.GetNewDrugFlowOutWarehouseInfo(item.ID, orgId, startTime)
4005
+			for _, it := range infoOutFlow {
4006
+				item.NewDrugFlowOutWarehouseInfo = append(item.NewDrugFlowOutWarehouseInfo, it)
4007
+			}
4007
 
4008
 
4008
-		//获取退库
4009
-		infoCacelFlow, _ := service.GetNewDrugFlowCacelWarehouseInfo(item.ID, orgId, startTime)
4010
-		for _, it := range infoCacelFlow {
4011
-			item.NewDrugFlowNoCancelWarehouseInfo = append(item.NewDrugFlowNoCancelWarehouseInfo, it)
4012
-		}
4009
+			//获取退库
4010
+			infoCacelFlow, _ := service.GetNewDrugFlowCacelWarehouseInfo(item.ID, orgId, startTime)
4011
+			for _, it := range infoCacelFlow {
4012
+				item.NewDrugFlowNoCancelWarehouseInfo = append(item.NewDrugFlowNoCancelWarehouseInfo, it)
4013
+			}
4013
 
4014
 
4014
-		//获取盘亏
4015
-		infoNoPofitFlow, _ := service.GetNewDrugFlowNoPofitWarehouseInfo(item.ID, orgId, startTime)
4016
-		for _, it := range infoNoPofitFlow {
4017
-			item.NewDrugFlowNoPofitWarehouseInfo = append(item.NewDrugFlowNoPofitWarehouseInfo, it)
4015
+			//获取盘亏
4016
+			infoNoPofitFlow, _ := service.GetNewDrugFlowNoPofitWarehouseInfo(item.ID, orgId, startTime)
4017
+			for _, it := range infoNoPofitFlow {
4018
+				item.NewDrugFlowNoPofitWarehouseInfo = append(item.NewDrugFlowNoPofitWarehouseInfo, it)
4019
+			}
4018
 		}
4020
 		}
4019
 
4021
 
4020
 	}
4022
 	}

+ 18 - 0
models/patient_models.go Vedi File

2825
 func (XtPatientFallassessmentRealize) TableName() string {
2825
 func (XtPatientFallassessmentRealize) TableName() string {
2826
 	return "xt_patient_fallassessment_realize"
2826
 	return "xt_patient_fallassessment_realize"
2827
 }
2827
 }
2828
+
2829
+type XtPatientPedFallssessment struct {
2830
+	ID          int64  `gorm:"column:id" json:"id" form:"id"`
2831
+	PatientId   int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
2832
+	UserOrgId   int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2833
+	Status      int64  `gorm:"column:status" json:"status" form:"status"`
2834
+	Ctime       int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2835
+	Mtime       int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2836
+	Text        string `gorm:"column:text" json:"text" form:"text"`
2837
+	RecordDate  int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
2838
+	Total       int64  `gorm:"column:total" json:"total" form:"total"`
2839
+	AdminUserId int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
2840
+	Type        int64  `gorm:"column:type" json:"type" form:"type"`
2841
+}
2842
+
2843
+func (XtPatientPedFallssessment) TableName() string {
2844
+	return "xt_patient_ped_fallssessment"
2845
+}

+ 8 - 0
service/mobile_dialysis_service.go Vedi File

129
 	Advices                  []*VMDoctorAdvice                 `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"doctor_advice"`
129
 	Advices                  []*VMDoctorAdvice                 `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"doctor_advice"`
130
 	TreatmentSummary         *VMTreatmentSummary               `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"treatment_summary"`
130
 	TreatmentSummary         *VMTreatmentSummary               `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"treatment_summary"`
131
 	NewDeviceInformation     *NewDeviceInformation             `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"device_information"`
131
 	NewDeviceInformation     *NewDeviceInformation             `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"device_information"`
132
+	LastTreatmentSummary     *VMTreatmentSummary               `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"treatment_summary"`
132
 }
133
 }
133
 
134
 
134
 func (MDialysisScheduleVM) TableName() string {
135
 func (MDialysisScheduleVM) TableName() string {
9278
 	err := db.Find(&vms).Error
9279
 	err := db.Find(&vms).Error
9279
 	return vms, err
9280
 	return vms, err
9280
 }
9281
 }
9282
+
9283
+func GetLastAcceptTreatment(user_org_id int64, patient_id int64) (models.ReceiveTreatmentAsses, error) {
9284
+
9285
+	treatmentAsses := models.ReceiveTreatmentAsses{}
9286
+	err := XTReadDB().Where("user_org_id = ? and patient_id = ? and status=1 and admission_number<>''", user_org_id, patient_id).Last(&treatmentAsses).Error
9287
+	return treatmentAsses, err
9288
+}

+ 1 - 5
service/new_warehouse_service.go Vedi File

97
 		warehouseOutInfo.Count = count
97
 		warehouseOutInfo.Count = count
98
 		if orgID == 9671 || orgID == 10265 {
98
 		if orgID == 9671 || orgID == 10265 {
99
 			goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
99
 			goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
100
-
101
-			fmt.Println("加个我我我哦我我我", goodsInfo.PackingPrice)
102
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
100
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
103
 		}
101
 		}
104
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
102
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
1287
 // 药品自动出库 递归方式
1285
 // 药品自动出库 递归方式
1288
 func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *models.DrugWarehouseOut, drup *models.BaseDrugLib, advice *models.HisDoctorAdviceInfo, hisprescribingNumber float64, unit string) (err error) {
1286
 func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *models.DrugWarehouseOut, drup *models.BaseDrugLib, advice *models.HisDoctorAdviceInfo, hisprescribingNumber float64, unit string) (err error) {
1289
 
1287
 
1290
-	fmt.Println("出库拉22222222222222222222222222222222222222222222222222222222222222222222")
1291
-	fmt.Println("剩余库存2哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦噢噢噢噢", prescribingNumber)
1292
 	//开事务
1288
 	//开事务
1293
 	tx := XTWriteDB().Begin()
1289
 	tx := XTWriteDB().Begin()
1294
 	defer func() {
1290
 	defer func() {
2468
 
2464
 
2469
 	info := models.XtDrugWarehouseOutInfo{}
2465
 	info := models.XtDrugWarehouseOutInfo{}
2470
 	var err error
2466
 	var err error
2471
-	err = XTReadDB().Where("patient_id = ? and sys_record_time = ? and org_id = ? and status = 1 and drug_id = ?", patient_id, advice_date, orgid, drug_id).Find(&info).Error
2467
+	err = XTReadDB().Where("patient_id = ? and sys_record_time = ? and org_id = ? and status = 1 and drug_id = ? and is_sys=1", patient_id, advice_date, orgid, drug_id).Find(&info).Error
2472
 	if err == gorm.ErrRecordNotFound {
2468
 	if err == gorm.ErrRecordNotFound {
2473
 		return nil, err
2469
 		return nil, err
2474
 	}
2470
 	}

+ 28 - 2
service/patient_service.go Vedi File

2838
 
2838
 
2839
 func GetAllPatientListByListSeven(orgID int64) (patients []*MSchedualPatientVM, err error) {
2839
 func GetAllPatientListByListSeven(orgID int64) (patients []*MSchedualPatientVM, err error) {
2840
 
2840
 
2841
-	err = readDb.Model(&MSchedualPatientVM{}).Where("user_org_id=? and status=1 and lapseto = 1", orgID).Find(&patients).Error
2841
+	err = readDb.Model(&MSchedualPatientVM{}).Where("user_org_id=? and status=1", orgID).Find(&patients).Error
2842
 	return patients, nil
2842
 	return patients, nil
2843
 }
2843
 }
2844
 
2844
 
2849
 	patient_info_str, _ := redis.Get(key).Result()
2849
 	patient_info_str, _ := redis.Get(key).Result()
2850
 
2850
 
2851
 	if len(patient_info_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
2851
 	if len(patient_info_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
2852
-		err = readDb.Model(&MSchedualPatientVM{}).Where("user_org_id=? and status=1 and lapseto = 1", orgID).Find(&patients).Error
2852
+		err = readDb.Model(&MSchedualPatientVM{}).Where("user_org_id=? and status=1", orgID).Find(&patients).Error
2853
 		if err != nil {
2853
 		if err != nil {
2854
 			if err == gorm.ErrRecordNotFound {
2854
 			if err == gorm.ErrRecordNotFound {
2855
 				return nil, nil
2855
 				return nil, nil
4067
 	err = XTWriteDB().Model(&models.XtPatientFallassessmentRealize{}).Where("status=1 and user_org_id =? and fassement_id=?", user_org_id, id).Updates(map[string]interface{}{"status": 0}).Error
4067
 	err = XTWriteDB().Model(&models.XtPatientFallassessmentRealize{}).Where("status=1 and user_org_id =? and fassement_id=?", user_org_id, id).Updates(map[string]interface{}{"status": 0}).Error
4068
 	return fallassessment, err
4068
 	return fallassessment, err
4069
 }
4069
 }
4070
+
4071
+func CreatePadFallssessment(fallssessment models.XtPatientPedFallssessment) error {
4072
+
4073
+	err := XTWriteDB().Create(&fallssessment).Error
4074
+
4075
+	return err
4076
+}
4077
+
4078
+func GetBedDiatricFallassessmentList(patient_id int64, is_type int64, user_org_id int64, limit int64, page int64) (list []*models.XtPatientPedFallssessment, total int64, err error) {
4079
+
4080
+	offset := (page - 1) * limit
4081
+
4082
+	db := XTReadDB().Model(&list).Where("status =1")
4083
+	if patient_id > 0 {
4084
+		db = db.Where("patient_id = ?", patient_id)
4085
+	}
4086
+	if user_org_id > 0 {
4087
+		db = db.Where("user_org_id = ?", user_org_id)
4088
+	}
4089
+	if is_type > 0 {
4090
+		db = db.Where("is_type = ?", is_type)
4091
+	}
4092
+	err = db.Count(&total).Offset(offset).Limit(limit).Find(&list).Error
4093
+
4094
+	return list, total, err
4095
+}

+ 2 - 2
service/stock_service.go Vedi File

5210
 
5210
 
5211
 	info := models.WarehouseOutInfo{}
5211
 	info := models.WarehouseOutInfo{}
5212
 	var err error
5212
 	var err error
5213
-	err = XTReadDB().Model(&info).Where("good_id = ? and sys_record_time = ? and status = 1 and patient_id = ?", good_id, record_time, patient_id).Find(&info).Error
5213
+	err = XTReadDB().Model(&info).Where("good_id = ? and sys_record_time = ? and status = 1 and patient_id = ? and is_sys=1", good_id, record_time, patient_id).Find(&info).Error
5214
 	if err == gorm.ErrRecordNotFound {
5214
 	if err == gorm.ErrRecordNotFound {
5215
 		return nil, err
5215
 		return nil, err
5216
 	}
5216
 	}
5222
 
5222
 
5223
 func GetWarehouseOutInfoIsExistTwo(good_id int64, patient_id int64, record_time int64, project_id int64) (models.WarehouseOutInfo, error) {
5223
 func GetWarehouseOutInfoIsExistTwo(good_id int64, patient_id int64, record_time int64, project_id int64) (models.WarehouseOutInfo, error) {
5224
 	info := models.WarehouseOutInfo{}
5224
 	info := models.WarehouseOutInfo{}
5225
-	err := XTReadDB().Where("good_id = ? and sys_record_time = ? and status = 1 and patient_id = ?", good_id, record_time, patient_id).Find(&info).Error
5225
+	err := XTReadDB().Where("good_id = ? and sys_record_time = ? and status = 1 and patient_id = ? and is_sys=1", good_id, record_time, patient_id).Find(&info).Error
5226
 	return info, err
5226
 	return info, err
5227
 }
5227
 }
5228
 
5228