Bladeren bron

库存调拨修改

28169 2 jaren geleden
bovenliggende
commit
64084861f5

+ 10 - 7
controllers/dialysis_api_controller.go Bestand weergeven

@@ -669,7 +669,7 @@ func (c *DialysisApiController) PostPrescription() {
669 669
 			advicePrescription, _ := service.GetAdvicesByPrescription(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
670 670
 			if advicePrescription.ID > 0 {
671 671
 
672
-				service.UpdateDoctorAdvieById(advicePrescription.ID, prescribing_number)
672
+				service.UpdateDoctorAdvieByIdOne(advicePrescription.ID, prescribing_number, anticoagulant_zongliang)
673 673
 
674 674
 				key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":doctor_advices"
675 675
 				redis := service.RedisClient()
@@ -5801,12 +5801,15 @@ func (this *DialysisApiController) GetMobileScheduleList() {
5801 5801
 
5802 5802
 	if len(schedule) > 0 {
5803 5803
 		for _, its := range schedule {
5804
-			prescription, _ := service.GetPrescriptionList(its.PatientId, its.ScheduleDate, its.UserOrgId)
5805
-			its.DialysisPrescription = prescription
5806
-			monitor, _ := service.GetLastMonitorRecordList(its.PatientId, its.ScheduleDate, its.UserOrgId)
5807
-			its.MonitoringRecord = monitor
5808
-			after, _ := service.GetLastAfter(its.PatientId, its.ScheduleDate, its.UserOrgId)
5809
-			its.XtAssessmentAfterDislysis = after
5804
+			//prescription, _ := service.GetPrescriptionList(its.PatientId, its.ScheduleDate, its.UserOrgId)
5805
+			//its.DialysisPrescription = prescription
5806
+			//monitor, _ := service.GetLastMonitorRecordList(its.PatientId, its.ScheduleDate, its.UserOrgId)
5807
+			//its.MonitoringRecord = monitor
5808
+			//after, _ := service.GetLastAfter(its.PatientId, its.ScheduleDate, its.UserOrgId)
5809
+			//its.XtAssessmentAfterDislysis = after
5810
+
5811
+			order, _ := service.GetLastOrder(its.UserOrgId, its.PatientId, its.ScheduleDate)
5812
+			service.UpdateDoctorSix(order.StartTime, order.PatientId, order.DialysisDate, order.UserOrgId)
5810 5813
 		}
5811 5814
 	}
5812 5815
 

+ 1 - 1
controllers/mobile_api_controllers/dialysis_api_controller.go Bestand weergeven

@@ -1894,7 +1894,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1894 1894
 			advicePrescription, _ := service.GetAdvicesByPrescription(adminUserInfo.Org.Id, id, recordDate.Unix())
1895 1895
 			if advicePrescription.ID > 0 {
1896 1896
 
1897
-				service.UpdateDoctorAdvieById(advicePrescription.ID, prescribing_number)
1897
+				service.UpdateDoctorAdvieByIdOne(advicePrescription.ID, prescribing_number, anticoagulant_zongliang)
1898 1898
 
1899 1899
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":doctor_advices"
1900 1900
 				redis := service.RedisClient()

+ 7 - 6
controllers/mobile_api_controllers/patient_api_controller.go Bestand weergeven

@@ -1265,7 +1265,8 @@ func (c *PatientApiController) ModifyExecDoctorAdvice() {
1265 1265
 	execution_time := c.GetString("execution_time")
1266 1266
 	fmt.Println("execution_time", execution_time)
1267 1267
 	groupno, _ := c.GetInt64("groupno", -1)
1268
-
1268
+	//patient_id, _ := c.GetInt64("patient_id")
1269
+	advice_date, _ := c.GetInt64("advice_date")
1269 1270
 	var ids []string
1270 1271
 	if groupno == 0 {
1271 1272
 		advice_ids := c.GetString("advice_id")
@@ -1339,7 +1340,7 @@ func (c *PatientApiController) ModifyExecDoctorAdvice() {
1339 1340
 		err = service.ModifyExceDoctorAdviceByGroupNo(&advices, groupno, adminUserInfo.Org.Id)
1340 1341
 		redis := service.RedisClient()
1341 1342
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
1342
-		fmt.Println("keyThh322323232323232323223", key)
1343
+
1343 1344
 		redis.Set(key, "", time.Second)
1344 1345
 		keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":advice_list_all"
1345 1346
 		redis.Set(keyOne, "", time.Second)
@@ -1348,12 +1349,13 @@ func (c *PatientApiController) ModifyExecDoctorAdvice() {
1348 1349
 
1349 1350
 	} else {
1350 1351
 		err = service.BatchModifyExceOldDoctorAdvice(&advices, ids)
1351
-		err = service.ModifyExceDoctorAdviceByGroupNo(&advices, groupno, adminUserInfo.Org.Id)
1352
+
1353
+		err = service.ModifyExceDoctorAdviceByGroupNoOne(&advices, ids)
1352 1354
 		redis := service.RedisClient()
1353 1355
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
1354
-		fmt.Println("keyTwohh322323232323232323223", key)
1356
+
1355 1357
 		redis.Set(key, "", time.Second)
1356
-		keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":advice_list_all"
1358
+		keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice_date, 10) + ":advice_list_all"
1357 1359
 		redis.Set(keyOne, "", time.Second)
1358 1360
 
1359 1361
 		defer redis.Close()
@@ -1367,7 +1369,6 @@ func (c *PatientApiController) ModifyExecDoctorAdvice() {
1367 1369
 			ExecutionTime: theTime.Unix(),
1368 1370
 			UpdatedTime:   time.Now().Unix(),
1369 1371
 		}
1370
-		fmt.Println("ids2323232232323", ids)
1371 1372
 		var advicehis models.HisDoctorAdviceInfo
1372 1373
 		service.ModifyExceDoctorAdviceById(&advicesinfo, ids)
1373 1374
 		his_advices, _ := service.FindHisDoctorAdviceByIdOne(adminUserInfo.Org.Id, ids)

+ 21 - 1
service/dialysis_service.go Bestand weergeven

@@ -1137,6 +1137,19 @@ func ModifyExceDoctorAdviceByGroupNo(m *models.DoctorAdvice, groupNo int64, org_
1137 1137
 	return err
1138 1138
 }
1139 1139
 
1140
+func ModifyExceDoctorAdviceByGroupNoOne(m *models.DoctorAdvice, ids []string) (err error) {
1141
+	ut := writeDb.Begin()
1142
+	err = ut.Model(&models.DoctorAdvice{}).Where("id in(?) and status =1", ids).Updates(map[string]interface{}{"execution_time": m.ExecutionTime}).Error
1143
+	if err != nil {
1144
+		ut.Rollback()
1145
+		return
1146
+	}
1147
+	ut.Commit()
1148
+
1149
+	return err
1150
+
1151
+}
1152
+
1140 1153
 func BatchModifyExceOldDoctorAdvice(m *models.DoctorAdvice, ids []string) (err error) {
1141 1154
 
1142 1155
 	ut := writeDb.Begin()
@@ -2039,6 +2052,13 @@ func GetLastOrder(user_org_id int64, patient_id int64, dialysis_date int64) (mod
2039 2052
 	return twenty, err
2040 2053
 }
2041 2054
 
2055
+func UpdateDoctorSix(start_time int64, patient_id int64, dialysis_date int64, user_org_id int64) (models.DoctorAdvice, error) {
2056
+
2057
+	advice := models.DoctorAdvice{}
2058
+	err := XTWriteDB().Model(&advice).Where("patient_id = ? and advice_date=? and user_org_id =? and status=1 and advice_name ='低分子肝素钠注射液'", patient_id, dialysis_date, user_org_id).Updates(map[string]interface{}{"execution_time": start_time}).Error
2059
+	return advice, err
2060
+}
2061
+
2042 2062
 func GetTodayInforMation(orgid int64, record_date int64) (list []*NewDeviceInformation, err error) {
2043 2063
 
2044 2064
 	err = UserReadDB().Where("user_org_id = ? and date = ? and status = 1", orgid, record_date).Find(&list).Error
@@ -2054,7 +2074,7 @@ func GetFiledConfig(orgid int64) (models.FiledConfig, error) {
2054 2074
 
2055 2075
 func GetDoctorAdviceCheckList(patient_id int64, advice_date int64, user_org_id int64) (doctor []*models.DoctorAdvice, err error) {
2056 2076
 
2057
-	err = XTReadDB().Where("patient_id = ? and advice_date = ? and user_org_id =? and status= 1 and check_state= 0", patient_id, advice_date, user_org_id).Find(&doctor).Error
2077
+	err = XTReadDB().Where("patient_id = ? and advice_date = ? and user_org_id =? and status= 1 and checker= 0", patient_id, advice_date, user_org_id).Find(&doctor).Error
2058 2078
 	return doctor, err
2059 2079
 }
2060 2080
 

+ 1 - 1
service/gobal_config_service.go Bestand weergeven

@@ -1012,7 +1012,7 @@ func GetAllBaseDrugListTwenty(orgid int64) (drug []*models.BaseDrugLibTwenty, er
1012 1012
 
1013 1013
 func GetMobileScheduleList(orgid int64) (schedule []*models.MyVmBloodSchedule, err error) {
1014 1014
 
1015
-	err = XTReadDB().Where("user_org_id = ? and status= 1 and schedule_date>=1667232000 and schedule_date<=1669737600", orgid).Preload("SchedualPatient", "user_org_id = ? and status = 1", orgid).Find(&schedule).Error
1015
+	err = XTReadDB().Where("user_org_id = ? and status= 1 and schedule_date=1676563200", orgid).Preload("SchedualPatient", "user_org_id = ? and status = 1", orgid).Find(&schedule).Error
1016 1016
 	return schedule, err
1017 1017
 }
1018 1018
 

+ 7 - 0
service/inspection_service.go Bestand weergeven

@@ -46,6 +46,13 @@ func UpdateDoctorAdvieById(id int64, prescription_number float64) (models.Doctor
46 46
 	return advice, err
47 47
 }
48 48
 
49
+func UpdateDoctorAdvieByIdOne(id int64, prescription_number float64, single_dose float64) (models.DoctorAdvice, error) {
50
+
51
+	advice := models.DoctorAdvice{}
52
+	err := XTWriteDB().Model(&advice).Where("id=? and status= 1 ", id).Updates(map[string]interface{}{"prescribing_number": prescription_number, "single_dose": single_dose}).Error
53
+	return advice, err
54
+}
55
+
49 56
 func CreatePatientInspection(inspectins []models.Inspection) (err error) {
50 57
 	if len(inspectins) == 0 {
51 58
 		err = errors.New("Inspections Cant be nil.")